AliPhysics  vAN-20150328 (7755d27)
 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 <TClonesArray.h>
16 
17 #include "AliEmcalTriggerPatchInfo.h"
21 
25 
26 namespace EMCalTriggerPtAnalysis {
27 
32 AliEMCalTriggerPatchAnalysisComponent::AliEMCalTriggerPatchAnalysisComponent() :
34  fSwapOnlineThresholds(kFALSE),
35  fSwapOfflineThresholds(kFALSE)
36 {
37 }
38 
47  fSwapOnlineThresholds(kFALSE),
48  fSwapOfflineThresholds(kFALSE)
49 {
50 }
51 
73 
75  *phibinning = fBinning->GetBinning("phi");
76  const TAxis *patchaxes[6] = {
77  DefineAxis("energy", 100, 0., 100),
78  DefineAxis("energyRough", 100, 0., 100),
79  DefineAxis("amplitude", 5000, 0., 5000.), // limit for the moment
80  DefineAxis("eta", etabinning),
81  DefineAxis("phi", phibinning),
82  DefineAxis("isMain", 2, -0.5, 1.5)
83  };
84 
85  const TAxis *ampaxes[5] = {
86  DefineAxis("amplitudeOnline", 5000, 0., 5000.),
87  DefineAxis("amplitudeOffline", 5000, 0., 5000.),
88  DefineAxis("eta", etabinning),
89  DefineAxis("phi", phibinning),
90  DefineAxis("isMain", 2, -0.5, 1.5)
91  };
92 
93  std::string patchnames[] = {"Level0", "JetHigh", "JetLow", "GammaHigh", "GammaLow"};
94  std::string triggermodes[] = {"Online", "Offline"};
95  for(std::string * triggerpatch = patchnames; triggerpatch < patchnames + sizeof(patchnames)/sizeof(std::string); ++triggerpatch){
96  for(std::string *triggermode = triggermodes; triggermode < triggermodes + sizeof(triggermodes)/sizeof(std::string); ++triggermode){
97  if((!strcmp(triggermode->c_str(), "Offline")) && (!strcmp(triggerpatch->c_str(), "Level0"))) continue; // Don't process L0 in case of offline
98  printf("Adding patch for trigger %s in case of %s\n", triggerpatch->c_str(), triggermode->c_str());
99  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");
100  if(strcmp(triggerpatch->c_str(), "Level0")){
101  // Add histogram for online-offline of amplitudes
102  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");
103  }
104  }
105  }
106 }
107 
119  AliEmcalTriggerPatchInfo *triggerpatch(NULL);
120  TIter patchIter(data->GetTriggerPatchContainer());
121  while((triggerpatch = dynamic_cast<AliEmcalTriggerPatchInfo *>(patchIter()))){
122  bool isMain = triggerpatch->IsOfflineSimple() ? triggerpatch->IsMainTriggerSimple() : triggerpatch->IsMainTrigger();
123  double triggerpatchinfo[6] = {triggerpatch->GetPatchE(),triggerpatch->GetADCAmpGeVRough(),
124  static_cast<double>(triggerpatch->IsOfflineSimple() ? triggerpatch->GetADCOfflineAmp() : triggerpatch->GetADCAmp()), triggerpatch->GetEtaGeo(),
125  triggerpatch->GetPhiGeo(), isMain ? 1. : 0.};
126  double amplitudeinfo[5] = {triggerpatch->GetADCAmp(), triggerpatch->GetADCOfflineAmp(), triggerpatch->GetEtaGeo(), triggerpatch->GetPhiGeo(), isMain ? 1. : 0.};
127  if(triggerpatch->IsOfflineSimple()){
128  if((!fSwapOfflineThresholds && triggerpatch->IsJetHighSimple()) || (fSwapOfflineThresholds && triggerpatch->IsJetLowSimple())){
129  fHistos->FillTHnSparse("PatchInfoJetHighOffline", triggerpatchinfo);
130  fHistos->FillTHnSparse("PatchAmplitudeJetHighOffline", amplitudeinfo);
131  }
132  if((!fSwapOfflineThresholds && triggerpatch->IsJetLowSimple()) || (fSwapOfflineThresholds && triggerpatch->IsJetHighSimple())){
133  fHistos->FillTHnSparse("PatchInfoJetLowOffline", triggerpatchinfo);
134  fHistos->FillTHnSparse("PatchAmplitudeJetLowOffline", amplitudeinfo);
135  }
136  if((!fSwapOfflineThresholds && triggerpatch->IsGammaHighSimple()) || (fSwapOfflineThresholds && triggerpatch->IsGammaLowSimple())){
137  fHistos->FillTHnSparse("PatchInfoGammaHighOffline", triggerpatchinfo);
138  fHistos->FillTHnSparse("PatchAmplitudeGammaHighOffline", amplitudeinfo);
139  }
140  if((!fSwapOfflineThresholds && triggerpatch->IsGammaLowSimple()) || (fSwapOfflineThresholds && triggerpatch->IsGammaHighSimple())){
141  fHistos->FillTHnSparse("PatchInfoGammaLowOffline", triggerpatchinfo);
142  fHistos->FillTHnSparse("PatchAmplitudeGammaLowOffline", amplitudeinfo);
143  }
144  } else{
145  if((!fSwapOnlineThresholds && triggerpatch->IsJetHigh()) || (fSwapOnlineThresholds && triggerpatch->IsJetLow())){
146  fHistos->FillTHnSparse("PatchInfoJetHighOnline", triggerpatchinfo);
147  fHistos->FillTHnSparse("PatchAmplitudeJetHighOnline", amplitudeinfo);
148  }
149  if((!fSwapOnlineThresholds && triggerpatch->IsJetLow()) || (fSwapOnlineThresholds && triggerpatch->IsJetHigh())){
150  fHistos->FillTHnSparse("PatchInfoJetLowOnline", triggerpatchinfo);
151  fHistos->FillTHnSparse("PatchAmplitudeJetLowOnline", amplitudeinfo);
152  }
153  if((!fSwapOnlineThresholds && triggerpatch->IsGammaHigh()) || (fSwapOnlineThresholds && triggerpatch->IsGammaLow())){
154  fHistos->FillTHnSparse("PatchInfoGammaHighOnline", triggerpatchinfo);
155  fHistos->FillTHnSparse("PatchAmplitudeGammaHighOnline", amplitudeinfo);
156  }
157  if((!fSwapOnlineThresholds && triggerpatch->IsGammaLow()) || (fSwapOnlineThresholds && triggerpatch->IsGammaHigh())){
158  fHistos->FillTHnSparse("PatchInfoGammaLowOnline", triggerpatchinfo);
159  fHistos->FillTHnSparse("PatchAmplitudeGammaLowOnline", amplitudeinfo);
160  }
161  if(triggerpatch->IsLevel0()){
162  fHistos->FillTHnSparse("PatchInfoLevel0Online", triggerpatchinfo);
163  }
164  }
165  }
166 }
167 
168 } /* namespace EMCalTriggerPtAnalysis */
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
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="")
Bool_t fSwapOnlineThresholds
Swap trigger thresholds for online patches.
AliEMCalHistoContainer * fHistos
Histogram container of the analysis component.
Base class for analysis components in the analysis of EMCAL-triggered events.
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
Bool_t fSwapOfflineThresholds
Swap trigger thresholds for offline patches.
Analysis component for EMCAL trigger patches.
const AliEMCalTriggerBinningComponent * fBinning
Global binning handler.