AliPhysics  v5-06-40-01 (42bb456)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEMCalTriggerPatchAnalysisComponent.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <map>
16 #include <memory>
17 #include <string>
18 #include <sstream>
19 #include <vector>
20 #include <TClonesArray.h>
21 
26 
30 
31 namespace EMCalTriggerPtAnalysis {
32 
37 AliEMCalTriggerPatchAnalysisComponent::AliEMCalTriggerPatchAnalysisComponent() :
39  fSwapOnlineThresholds(kFALSE),
40  fSwapOfflineThresholds(kFALSE),
41  fWithEventSelection(kFALSE)
42 {
43 }
44 
54  fSwapOnlineThresholds(kFALSE),
55  fSwapOfflineThresholds(kFALSE),
56  fWithEventSelection(withEventSelection)
57 {
58 }
59 
81 
83  *phibinning = fBinning->GetBinning("phi");
84  const TAxis *patchaxes[6] = {
85  DefineAxis("energy", 100, 0., 100),
86  DefineAxis("energyRough", 100, 0., 100),
87  DefineAxis("amplitude", 2100, 0., 2100.), // limit for the moment
88  DefineAxis("eta", etabinning),
89  DefineAxis("phi", phibinning),
90  DefineAxis("isMain", 2, -0.5, 1.5)
91  };
92 
93  const TAxis *ampaxes[5] = {
94  DefineAxis("amplitudeOnline", 2000, 0., 2100.),
95  DefineAxis("amplitudeOffline", 2000, 0., 2100.),
96  DefineAxis("eta", etabinning),
97  DefineAxis("phi", phibinning),
98  DefineAxis("isMain", 2, -0.5, 1.5)
99  };
100 
101  // Create trigger definitions
102  std::map<std::string, std::string> triggerCombinations;
103  GetAllTriggerNamesAndTitles(triggerCombinations);
104 
105  std::string patchnames[] = {"Level0", "JetHigh", "JetLow", "GammaHigh", "GammaLow"};
106  std::string triggermodes[] = {"Online", "Offline"};
107  for(std::string * triggerpatch = patchnames; triggerpatch < patchnames + sizeof(patchnames)/sizeof(std::string); ++triggerpatch){
108  for(std::string *triggermode = triggermodes; triggermode < triggermodes + sizeof(triggermodes)/sizeof(std::string); ++triggermode){
110  for(std::map<std::string, std::string>::iterator trgiter = triggerCombinations.begin(); trgiter != triggerCombinations.end(); ++trgiter){
111  printf("Adding patch for trigger %s in case of %s for event selection %s\n", triggerpatch->c_str(), triggermode->c_str(), trgiter->second.c_str());
112  fHistos->CreateTHnSparse(Form("PatchInfo%s%s%s", triggerpatch->c_str(), triggermode->c_str(), trgiter->first.c_str()), Form("Patch energy for %s %s trigger patches", triggerpatch->c_str(), triggermode->c_str()), 6, patchaxes, "s");
113  }
114  } else {
115  if((!strcmp(triggermode->c_str(), "Offline")) && (!strcmp(triggerpatch->c_str(), "Level0"))) continue; // Don't process L0 in case of offline
116  printf("Adding patch for trigger %s in case of %s\n", triggerpatch->c_str(), triggermode->c_str());
117  fHistos->CreateTHnSparse(Form("PatchInfo%s%s", triggerpatch->c_str(), triggermode->c_str()), Form("Patch energy for %s %s trigger patches", triggerpatch->c_str(), triggermode->c_str()), 6, patchaxes, "s");
118  if(strcmp(triggerpatch->c_str(), "Level0")){
119  // Add histogram for online-offline of amplitudes
120  fHistos->CreateTHnSparse(Form("PatchAmplitude%s%s", triggerpatch->c_str(), triggermode->c_str()), Form("Patch amplitudes for %s %s trigger patches", triggerpatch->c_str(), triggermode->c_str()), 5, ampaxes, "s");
121  }
122  }
123  }
124  }
125 }
126 
138  AliEmcalTriggerPatchInfo *triggerpatch(NULL);
139  TIter patchIter(data->GetTriggerPatchContainer());
140  while((triggerpatch = dynamic_cast<AliEmcalTriggerPatchInfo *>(patchIter()))){
142  std::vector<std::string> triggernames;
143  GetMachingTriggerNames(triggernames);
144  for(std::vector<std::string>::iterator trgclassit = triggernames.begin(); trgclassit != triggernames.end(); ++trgclassit){
145  FillStandardMonitoring(triggerpatch, trgclassit->c_str());
146  }
147  } else {
148  FillStandardMonitoring(triggerpatch);
149  }
150  }
151 }
152 
160  std::vector<TString> triggerclasses;
161  triggerclasses.push_back("JetHigh");
162  triggerclasses.push_back("JetLow");
163  triggerclasses.push_back("GammaHigh");
164  triggerclasses.push_back("GammaLow");
165  triggerclasses.push_back("Level0");
167  for(std::vector<TString>::iterator trgclassit = triggerclasses.begin(); trgclassit != triggerclasses.end(); ++trgclassit){
168  if(mypatchhandler.IsPatchOfType(patch, *trgclassit)){
169  std::stringstream infohistname;
170  infohistname << "PatchInfo" << trgclassit->Data() << (patch->IsOfflineSimple() ? "Offline" : "Online");
171  if(eventType.Length()) infohistname << eventType.Data();
172  FillTriggerInfoHistogram(infohistname.str().c_str(), patch);
173  if((!eventType.Length()) &&(*trgclassit != "Level0")){
174  std::stringstream amphistname;
175  amphistname << "PatchAmplitude" << trgclassit->Data() << (patch->IsOfflineSimple() ? "Offline" : "Online");
176  FillAmplitudeHistogram(amphistname.str().c_str(), patch);
177  }
178  }
179  }
180 }
181 
188  bool isMain = patch->IsOfflineSimple() ? patch->IsMainTriggerSimple() : patch->IsMainTrigger();
189  double triggerpatchinfo[6] = {patch->GetPatchE(),patch->GetADCAmpGeVRough(),
190  static_cast<double>(patch->IsOfflineSimple() ? patch->GetADCOfflineAmp() : patch->GetADCAmp()), patch->GetEtaGeo(),
191  patch->GetPhiGeo(), isMain ? 1. : 0.};
192  fHistos->FillTHnSparse(histo.Data(), triggerpatchinfo);
193 }
194 
195 
202  bool isMain = patch->IsOfflineSimple() ? patch->IsMainTriggerSimple() : patch->IsMainTrigger();
203  double amplitudeinfo[5] = {(double)patch->GetADCAmp(), (double)patch->GetADCOfflineAmp(), (double)patch->GetEtaGeo(), (double)patch->GetPhiGeo(), isMain ? 1. : 0.};
204  fHistos->FillTHnSparse(histo.Data(), amplitudeinfo);
205 }
206 
207 //
208 // Implementation of patch handlers and patch handler factory
209 //
210 
218  Bool_t result = false;
219  if(patch->IsOfflineSimple()){
221  } else {
222  result = ((!fPatchSwapThresholdsOnline && patch->IsJetLow()) || (fPatchSwapThresholdsOnline && patch->IsJetHigh()));
223  }
224  return result;
225 }
226 
234  Bool_t result = false;
235  if(patch->IsOfflineSimple()){
236  result = ((!fPatchSwapThresholdsOffline && patch->IsJetHighSimple()) || (fPatchSwapThresholdsOffline && patch->IsJetLowSimple()));
237  } else {
238  result = ((!fPatchSwapThresholdsOnline && patch->IsJetHigh()) || (fPatchSwapThresholdsOnline && patch->IsJetLow()));
239  }
240  return result;
241 }
242 
250  Bool_t result = false;
251  if(patch->IsOfflineSimple()){
252  result = ((!fPatchSwapThresholdsOffline && patch->IsGammaLowSimple()) || (fPatchSwapThresholdsOffline && patch->IsGammaHighSimple()));
253  } else {
254  result = ((!fPatchSwapThresholdsOnline && patch->IsGammaLow()) || (fPatchSwapThresholdsOnline && patch->IsGammaHigh()));
255  }
256  return result;
257 }
258 
266  Bool_t result = false;
267  if(patch->IsOfflineSimple()){
268  result = ((!fPatchSwapThresholdsOffline && patch->IsGammaHighSimple()) || (fPatchSwapThresholdsOffline && patch->IsGammaLowSimple()));
269  } else {
270  result = ((!fPatchSwapThresholdsOnline && patch->IsGammaHigh()) || (fPatchSwapThresholdsOnline && patch->IsGammaLow()));
271  }
272  return result;
273 }
274 
282  if(patch->IsLevel0()) return true;
283  return false;
284 }
285 
293  const AliEmcalTriggerPatchInfo* const patch, TString patchtype) const {
294  Bool_t result = false;
295  std::auto_ptr<AliEmcalTriggerPatchHandler> myhandler(NULL);
296  if (patchtype == "JetHigh") myhandler = std::auto_ptr<AliEmcalTriggerPatchHandler>(new AliEmcalTriggerPatchHandlerGammaHigh(fSwapThresholdsOnline, fSwapThresholdsOffline));
297  else if (patchtype == "JetLow") myhandler = std::auto_ptr<AliEmcalTriggerPatchHandler>(new AliEmcalTriggerPatchHandlerGammaLow(fSwapThresholdsOnline, fSwapThresholdsOffline));
298  else if (patchtype == "GammaHigh") myhandler = std::auto_ptr<AliEmcalTriggerPatchHandler>(new AliEmcalTriggerPatchHandlerJetHigh(fSwapThresholdsOnline, fSwapThresholdsOffline));
299  else if (patchtype == "GammaLow") myhandler = std::auto_ptr<AliEmcalTriggerPatchHandler>(new AliEmcalTriggerPatchHandlerJetLow(fSwapThresholdsOnline, fSwapThresholdsOffline));
300  else if (patchtype == "Level0") myhandler = std::auto_ptr<AliEmcalTriggerPatchHandler>(new AliEmcalTriggerPatchHandlerLevel0(fSwapThresholdsOnline, fSwapThresholdsOffline));
301  if(!myhandler.get()) return false;
302  return myhandler->IsOfType(patch);
303 }
304 
305 } /* namespace EMCalTriggerPtAnalysis */
306 
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
void GetMachingTriggerNames(std::vector< std::string > &triggernames) const
void FillAmplitudeHistogram(TString histo, const AliEmcalTriggerPatchInfo *const patch)
Bool_t fWithEventSelection
Define whether patches are analysed with event selection.
TAxis * DefineAxis(const char *name, const AliEMCalTriggerBinningDimension *binning)
void FillTHnSparse(const char *name, const double *x, double weight=1.)
void CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
void GetAllTriggerNamesAndTitles(std::map< std::string, std::string > &triggers) const
Main data structure storing all relevant information of EMCAL/DCAL trigger patches.
AliEMCalHistoContainer * fHistos
Histogram container of the analysis component.
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
void FillTriggerInfoHistogram(TString histo, const AliEmcalTriggerPatchInfo *const patch)
Base class for analysis components in the analysis of EMCAL-triggered events.
Declaration of the classes AliEMCalTriggerBinningComponent and AliEMCalTriggerBinningDimension.
void FillStandardMonitoring(const AliEmcalTriggerPatchInfo *const patch, TString eventclass="")
Bool_t fSwapOfflineThresholds
Swap trigger thresholds for offline patches.
Class to make array of trigger patch objects in AOD/ESD events.
Analysis component for EMCAL trigger patches.
Simple event container within the high- track analysis.
const AliEMCalTriggerBinningComponent * fBinning
Global binning handler.
Event Data used in exchange to the different analysis components.