2 // Jet trigger QA analysis task.
6 #include <TClonesArray.h>
10 #include <THnSparse.h>
12 #include <TLorentzVector.h>
14 #include "AliVCluster.h"
15 #include "AliVTrack.h"
16 #include "AliEmcalJet.h"
17 #include "AliRhoParameter.h"
19 #include "AliEmcalParticle.h"
20 #include "AliAODCaloTrigger.h"
21 #include "AliEMCALGeometry.h"
22 #include "AliVCaloCells.h"
23 #include "AliJetContainer.h"
24 #include "AliClusterContainer.h"
25 #include "AliParticleContainer.h"
26 #include "AliEmcalTriggerPatchInfo.h"
27 #include "AliAODHeader.h"
28 #include "AliPicoTrack.h"
30 #include "AliAnalysisTaskEmcalJetTriggerQA.h"
32 ClassImp(AliAnalysisTaskEmcalJetTriggerQA)
34 //________________________________________________________________________
35 AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA() :
36 AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetTriggerQA", kTRUE),
48 fh3PtEtaPhiTracksOnEmcal(0),
49 fh3PtEtaPhiTracksProp(0),
50 fh3PtEtaPhiJetFull(0),
51 fh3PtEtaPhiJetCharged(0),
54 fh3PtEtaAreaJetFull(0),
55 fh3PtEtaAreaJetCharged(0),
56 fh2PtNConstituentsCharged(0),
57 fh2PtNConstituents(0),
58 fh2PtMeanPtConstituentsCharged(0),
59 fh2PtMeanPtConstituentsNeutral(0),
62 fh2NEFNConstituentsCharged(0),
63 fh2NEFNConstituentsNeutral(0),
66 fh2PtLeadJet1VsLeadJet2(0),
68 fh3PtLeadJet1VsPatchEnergy(0),
69 fh3PtLeadJet2VsPatchEnergy(0),
70 fh3PatchEnergyEtaPhiCenterJ1(0),
71 fh3PatchEnergyEtaPhiCenterJ2(0),
72 fh3PatchEnergyEtaPhiCenterJ1J2(0),
73 fh3PatchADCEnergyEtaPhiCenterJ1(0),
74 fh3PatchADCEnergyEtaPhiCenterJ2(0),
75 fh3PatchADCEnergyEtaPhiCenterJ1J2(0),
76 fh2CellEnergyVsTime(0),
77 fh3EClusELeadingCellVsTime(0)
79 // Default constructor.
81 SetMakeGeneralHistograms(kTRUE);
84 //________________________________________________________________________
85 AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA(const char *name) :
86 AliAnalysisTaskEmcalJet(name, kTRUE),
98 fh3PtEtaPhiTracksOnEmcal(0),
99 fh3PtEtaPhiTracksProp(0),
100 fh3PtEtaPhiJetFull(0),
101 fh3PtEtaPhiJetCharged(0),
103 fh2NJetsPtCharged(0),
104 fh3PtEtaAreaJetFull(0),
105 fh3PtEtaAreaJetCharged(0),
106 fh2PtNConstituentsCharged(0),
107 fh2PtNConstituents(0),
108 fh2PtMeanPtConstituentsCharged(0),
109 fh2PtMeanPtConstituentsNeutral(0),
112 fh2NEFNConstituentsCharged(0),
113 fh2NEFNConstituentsNeutral(0),
116 fh2PtLeadJet1VsLeadJet2(0),
117 fh3EEtaPhiCluster(0),
118 fh3PtLeadJet1VsPatchEnergy(0),
119 fh3PtLeadJet2VsPatchEnergy(0),
120 fh3PatchEnergyEtaPhiCenterJ1(0),
121 fh3PatchEnergyEtaPhiCenterJ2(0),
122 fh3PatchEnergyEtaPhiCenterJ1J2(0),
123 fh3PatchADCEnergyEtaPhiCenterJ1(0),
124 fh3PatchADCEnergyEtaPhiCenterJ2(0),
125 fh3PatchADCEnergyEtaPhiCenterJ1J2(0),
126 fh2CellEnergyVsTime(0),
127 fh3EClusELeadingCellVsTime(0)
129 // Standard constructor.
131 SetMakeGeneralHistograms(kTRUE);
134 //________________________________________________________________________
135 AliAnalysisTaskEmcalJetTriggerQA::~AliAnalysisTaskEmcalJetTriggerQA()
140 //________________________________________________________________________
141 Bool_t AliAnalysisTaskEmcalJetTriggerQA::SelectEvent() {
143 // Decide if event should be selected for analysis
146 fhNEvents->Fill(3.5);
148 if(!fTriggerClass.IsNull()) {
149 //Check if requested trigger was fired
150 TString firedTrigClass = InputEvent()->GetFiredTriggerClasses();
152 if(!firedTrigClass.Contains(fTriggerClass))
154 else if(fTriggerClass.Contains("J1") && fTriggerClass.Contains("J2")) { //if events with J1&&J2 are requested
155 if(!firedTrigClass.Contains("J1") || !firedTrigClass.Contains("J2") ) //check if both are fired
158 else if(fTriggerClass.Contains("J1") && firedTrigClass.Contains("J2")) //if J2 is requested also add triggers which have J1&&J2. Reject if J1 is requested and J2 is fired
162 fhNEvents->Fill(1.5);
168 //________________________________________________________________________
169 void AliAnalysisTaskEmcalJetTriggerQA::FindTriggerPatch() {
171 //Code to get position of trigger
173 AliEmcalTriggerPatchInfo *patch = GetMainTriggerPatch();
175 fMaxPatchEnergy = patch->GetPatchE();
176 Double_t patchADCGeV = patch->GetADCAmpGeVRough();
177 if(patch->IsJetLow() && !patch->IsJetHigh()) {
178 fh3PatchEnergyEtaPhiCenterJ2->Fill(patch->GetPatchE(),patch->GetEtaGeo(),patch->GetPhiGeo());
179 fh3PatchADCEnergyEtaPhiCenterJ2->Fill(patchADCGeV,patch->GetEtaGeo(),patch->GetPhiGeo());
181 else if(patch->IsJetHigh() && !patch->IsJetLow()) {
182 fh3PatchEnergyEtaPhiCenterJ1->Fill(patch->GetPatchE(),patch->GetEtaGeo(),patch->GetPhiGeo());
183 fh3PatchADCEnergyEtaPhiCenterJ1->Fill(patchADCGeV,patch->GetEtaGeo(),patch->GetPhiGeo());
185 else if(patch->IsJetHigh() && patch->IsJetLow()) {
186 fh3PatchEnergyEtaPhiCenterJ1J2->Fill(patch->GetPatchE(),patch->GetEtaGeo(),patch->GetPhiGeo());
187 fh3PatchADCEnergyEtaPhiCenterJ1J2->Fill(patchADCGeV,patch->GetEtaGeo(),patch->GetPhiGeo());
193 //________________________________________________________________________
194 void AliAnalysisTaskEmcalJetTriggerQA::UserCreateOutputObjects()
196 // Create user output.
198 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
200 Bool_t oldStatus = TH1::AddDirectoryStatus();
201 TH1::AddDirectory(kFALSE);
203 fhNEvents = new TH1F("fhNEvents","fhNEvents;selection;N_{evt}",5,0,5);
204 fOutput->Add(fhNEvents);
206 Int_t fgkNPtBins = 200;
207 Float_t kMinPt = -50.;
208 Float_t kMaxPt = 150.;
209 Double_t *binsPt = new Double_t[fgkNPtBins+1];
210 for(Int_t i=0; i<=fgkNPtBins; i++) binsPt[i]=(Double_t)kMinPt + (kMaxPt-kMinPt)/fgkNPtBins*(Double_t)i ;
212 Int_t fgkNPhiBins = 18*6;
213 Float_t kMinPhi = 0.;
214 Float_t kMaxPhi = 2.*TMath::Pi();
215 Double_t *binsPhi = new Double_t[fgkNPhiBins+1];
216 for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ;
218 Int_t fgkNEtaBins = 100;
219 Float_t fgkEtaMin = -1.;
220 Float_t fgkEtaMax = 1.;
221 Double_t *binsEta=new Double_t[fgkNEtaBins+1];
222 for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ;
224 Int_t fgkNAreaBins = 100;
225 Float_t kMinArea = 0.;
226 Float_t kMaxArea = 1.;
227 Double_t *binsArea = new Double_t[fgkNAreaBins+1];
228 for(Int_t i=0; i<=fgkNAreaBins; i++) binsArea[i]=(Double_t)kMinArea + (kMaxArea-kMinArea)/fgkNAreaBins*(Double_t)i ;
230 Int_t fgkNConstBins = 100;
231 Float_t kMinConst = 0.;
232 Float_t kMaxConst = 100.;
233 Double_t *binsConst = new Double_t[fgkNConstBins+1];
234 for(Int_t i=0; i<=fgkNConstBins; i++) binsConst[i]=(Double_t)kMinConst + (kMaxConst-kMinConst)/fgkNConstBins*(Double_t)i ;
236 Int_t fgkNMeanPtBins = 100;
237 Float_t kMinMeanPt = 0.;
238 Float_t kMaxMeanPt = 20.;
239 Double_t *binsMeanPt = new Double_t[fgkNMeanPtBins+1];
240 for(Int_t i=0; i<=fgkNMeanPtBins; i++) binsMeanPt[i]=(Double_t)kMinMeanPt + (kMaxMeanPt-kMinMeanPt)/fgkNMeanPtBins*(Double_t)i ;
242 Int_t fgkNNEFBins = 101;
243 Float_t kMinNEF = 0.;
244 Float_t kMaxNEF = 1.01;
245 Double_t *binsNEF = new Double_t[fgkNNEFBins+1];
246 for(Int_t i=0; i<=fgkNNEFBins; i++) binsNEF[i]=(Double_t)kMinNEF + (kMaxNEF-kMinNEF)/fgkNNEFBins*(Double_t)i ;
248 Int_t fgkNzBins = 101;
250 Float_t kMaxz = 1.01;
251 Double_t *binsz = new Double_t[fgkNzBins+1];
252 for(Int_t i=0; i<=fgkNzBins; i++) binsz[i]=(Double_t)kMinz + (kMaxz-kMinz)/fgkNzBins*(Double_t)i ;
254 Int_t fgkNJetTypeBins = 2;
255 Float_t kMinJetType = -0.5;
256 Float_t kMaxJetType = 1.5;
257 Double_t *binsJetType = new Double_t[fgkNJetTypeBins+1];
258 for(Int_t i=0; i<=fgkNJetTypeBins; i++) binsJetType[i]=(Double_t)kMinJetType + (kMaxJetType-kMinJetType)/fgkNJetTypeBins*(Double_t)i ;
260 Int_t fgkNTimeBins = 100;
261 Float_t kMinTime = -200.;
262 Float_t kMaxTime = 200;
263 Double_t *binsTime = new Double_t[fgkNTimeBins+1];
264 for(Int_t i=0; i<=fgkNTimeBins; i++) binsTime[i]=(Double_t)kMinTime + (kMaxTime-kMinTime)/fgkNTimeBins*(Double_t)i ;
266 Double_t enBinEdges[3][2];
267 enBinEdges[0][0] = 1.; //10 bins
268 enBinEdges[0][1] = 0.1;
269 enBinEdges[1][0] = 5.; //8 bins
270 enBinEdges[1][1] = 0.5;
271 enBinEdges[2][0] = 100.;//95 bins
272 enBinEdges[2][1] = 1.;
274 const Float_t enmin1 = 0;
275 const Float_t enmax1 = enBinEdges[0][0];
276 const Float_t enmin2 = enmax1 ;
277 const Float_t enmax2 = enBinEdges[1][0];
278 const Float_t enmin3 = enmax2 ;
279 const Float_t enmax3 = enBinEdges[2][0];//fgkEnMax;
280 const Int_t nbin11 = (int)((enmax1-enmin1)/enBinEdges[0][1]);
281 const Int_t nbin12 = (int)((enmax2-enmin2)/enBinEdges[1][1])+nbin11;
282 const Int_t nbin13 = (int)((enmax3-enmin3)/enBinEdges[2][1])+nbin12;
284 Int_t fgkNEnBins=nbin13;
285 Double_t *binsEn=new Double_t[fgkNEnBins+1];
286 for(Int_t i=0; i<=fgkNEnBins; i++) {
287 if(i<=nbin11) binsEn[i]=(Double_t)enmin1 + (enmax1-enmin1)/nbin11*(Double_t)i ;
288 if(i<=nbin12 && i>nbin11) binsEn[i]=(Double_t)enmin2 + (enmax2-enmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ;
289 if(i<=nbin13 && i>nbin12) binsEn[i]=(Double_t)enmin3 + (enmax3-enmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ;
292 fh3PtEtaPhiTracks = new TH3F("fh3PtEtaPhiTracks","fh3PtEtaPhiTracks;#it{p}_{T}^{track};#eta;#varphi",fgkNEnBins,binsEn,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
293 fOutput->Add(fh3PtEtaPhiTracks);
295 fh3PtEtaPhiTracksOnEmcal = new TH3F("fh3PtEtaPhiTracksOnEmcal","fh3PtEtaPhiTracksOnEmcal;#it{p}_{T}^{track};#eta;#varphi",fgkNEnBins,binsEn,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
296 fOutput->Add(fh3PtEtaPhiTracksOnEmcal);
298 fh3PtEtaPhiTracksProp = new TH3F("fh3PtEtaPhiTracksProp","fh3PtEtaPhiTracksProp;#it{p}_{T}^{track};#eta;#varphi",fgkNEnBins,binsEn,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
299 fOutput->Add(fh3PtEtaPhiTracksProp);
301 fh3PtEtaPhiJetFull = new TH3F("fh3PtEtaPhiJetFull","fh3PtEtaPhiJetFull;#it{p}_{T}^{jet};#eta;#varphi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
302 fOutput->Add(fh3PtEtaPhiJetFull);
304 fh3PtEtaPhiJetCharged = new TH3F("fh3PtEtaPhiJetCharged","fh3PtEtaPhiJetCharged;#it{p}_{T}^{jet};#eta;#varphi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
305 fOutput->Add(fh3PtEtaPhiJetCharged);
307 fh2NJetsPtFull = new TH2F("fh2NJetsPtFull","fh2NJetsPtFull;N_{jets};#it{p}_{T}^{jet}",20,-0.5,19.5,fgkNPtBins,binsPt);
308 fOutput->Add(fh2NJetsPtFull);
310 fh2NJetsPtCharged = new TH2F("fh2NJetsPtCharged","fh2NJetsPtCharged;N_{jets};#it{p}_{T}^{jet}",20,-0.5,19.5,fgkNPtBins,binsPt);
311 fOutput->Add(fh2NJetsPtCharged);
313 fh3PtEtaAreaJetFull = new TH3F("fh3PtEtaAreaJetFull","fh3PtEtaAreaJetFull;#it{p}_{T}^{jet};#eta;A",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNAreaBins,binsArea);
314 fOutput->Add(fh3PtEtaAreaJetFull);
316 fh3PtEtaAreaJetCharged = new TH3F("fh3PtEtaAreaJetCharged","fh3PtEtaAreaJetCharged;#it{p}_{T}^{jet};#eta;A",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNAreaBins,binsArea);
317 fOutput->Add(fh3PtEtaAreaJetCharged);
319 fh2PtNConstituentsCharged = new TH2F("fh2PtNConstituentsCharged","fh2PtNConstituentsCharged;#it{p}_{T}^{jet};N_{charged constituents}",fgkNPtBins,binsPt,fgkNConstBins,binsConst);
320 fOutput->Add(fh2PtNConstituentsCharged);
322 fh2PtNConstituents = new TH2F("fh2PtNConstituents","fh2PtNConstituents;#it{p}_{T}^{jet};N_{constituents}",fgkNPtBins,binsPt,fgkNConstBins,binsConst);
323 fOutput->Add(fh2PtNConstituents);
325 fh2PtMeanPtConstituentsCharged = new TH2F("fh2PtMeanPtConstituentsCharged","fh2PtMeanPtConstituentsCharged;#it{p}_{T}^{jet};charged #langle #it{p}_{T} #rangle",fgkNPtBins,binsPt,fgkNMeanPtBins,binsMeanPt);
326 fOutput->Add(fh2PtMeanPtConstituentsCharged);
328 fh2PtMeanPtConstituentsNeutral = new TH2F("fh2PtMeanPtConstituentsNeutral","fh2PtMeanPtConstituentsNeutral;#it{p}_{T}^{jet};neutral langle #it{p}_{T} #rangle",fgkNPtBins,binsPt,fgkNMeanPtBins,binsMeanPt);
329 fOutput->Add(fh2PtMeanPtConstituentsNeutral);
331 fh2PtNEF = new TH2F("fh2PtNEF","fh2PtNEF;#it{p}_{T}^{jet};NEF",fgkNPtBins,binsPt,fgkNNEFBins,binsNEF);
332 fOutput->Add(fh2PtNEF);
334 fh3NEFEtaPhi = new TH3F("fh3NEFEtaPhi","fh3NEFEtaPhi;NEF;#eta;#varphi",fgkNNEFBins,binsNEF,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
335 fOutput->Add(fh3NEFEtaPhi);
337 fh2NEFNConstituentsCharged = new TH2F("fh2NEFNConstituentsCharged","fh2NEFNConstituentsCharged;NEF;N_{charged constituents}",fgkNNEFBins,binsNEF,fgkNConstBins,binsConst);
338 fOutput->Add(fh2NEFNConstituentsCharged);
340 fh2NEFNConstituentsNeutral = new TH2F("fh2NEFNConstituentsNeutral","fh2NEFNConstituentsNeutral;NEF;N_{clusters}",fgkNNEFBins,binsNEF,fgkNConstBins,binsConst);
341 fOutput->Add(fh2NEFNConstituentsNeutral);
343 fh2Ptz = new TH2F("fh2Ptz","fh2Ptz;#it{p}_{T}^{jet};z=p_{t,trk}^{proj}/p_{jet}",fgkNPtBins,binsPt,fgkNzBins,binsz);
344 fOutput->Add(fh2Ptz);
346 fh2PtzCharged = new TH2F("fh2PtzCharged","fh2Ptz;#it{p}_{T}^{ch jet};z=p_{t,trk}^{proj}/p_{ch jet}",fgkNPtBins,binsPt,fgkNzBins,binsz);
347 fOutput->Add(fh2PtzCharged);
349 fh2PtLeadJet1VsLeadJet2 = new TH2F("fh2PtLeadJet1VsLeadJet2","fh2PtLeadJet1VsLeadJet2;#it{p}_{T}^{jet 1};#it{p}_{T}^{jet 2}",fgkNPtBins,binsPt,fgkNPtBins,binsPt);
350 fOutput->Add(fh2PtLeadJet1VsLeadJet2);
352 fh3EEtaPhiCluster = new TH3F("fh3EEtaPhiCluster","fh3EEtaPhiCluster;E_{clus};#eta;#phi",fgkNEnBins,binsEn,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
353 fOutput->Add(fh3EEtaPhiCluster);
355 fh3PtLeadJet1VsPatchEnergy = new TH3F("fh3PtLeadJet1VsPatchEnergy","fh3PtLeadJet1VsPatchEnergy;#it{p}_{T}^{jet 1};Amplitude_{patch};trig type",fgkNPtBins,binsPt,fgkNPtBins,binsPt,fgkNJetTypeBins,binsJetType);
356 fOutput->Add(fh3PtLeadJet1VsPatchEnergy);
357 fh3PtLeadJet2VsPatchEnergy = new TH3F("fh3PtLeadJet2VsPatchEnergy","fh3PtLeadJet2VsPatchEnergy;#it{p}_{T}^{jet 1};Amplitude_{patch};trig type",fgkNPtBins,binsPt,fgkNPtBins,binsPt,fgkNJetTypeBins,binsJetType);
358 fOutput->Add(fh3PtLeadJet2VsPatchEnergy);
360 fh3PatchEnergyEtaPhiCenterJ1 = new TH3F("fh3PatchEnergyEtaPhiCenterJ1","fh3PatchEnergyEtaPhiCenterJ1;E_{patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
361 fOutput->Add(fh3PatchEnergyEtaPhiCenterJ1);
363 fh3PatchEnergyEtaPhiCenterJ2 = new TH3F("fh3PatchEnergyEtaPhiCenterJ2","fh3PatchEnergyEtaPhiCenterJ2;E_{patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
364 fOutput->Add(fh3PatchEnergyEtaPhiCenterJ2);
366 fh3PatchEnergyEtaPhiCenterJ1J2 = new TH3F("fh3PatchEnergyEtaPhiCenterJ1J2","fh3PatchEnergyEtaPhiCenterJ1J2;E_{patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
367 fOutput->Add(fh3PatchEnergyEtaPhiCenterJ1J2);
369 fh3PatchADCEnergyEtaPhiCenterJ1 = new TH3F("fh3PatchADCEnergyEtaPhiCenterJ1","fh3PatchADCEnergyEtaPhiCenterJ1;E_{ADC,patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
370 fOutput->Add(fh3PatchADCEnergyEtaPhiCenterJ1);
372 fh3PatchADCEnergyEtaPhiCenterJ2 = new TH3F("fh3PatchADCEnergyEtaPhiCenterJ2","fh3PatchADCEnergyEtaPhiCenterJ2;E_{ADC,patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
373 fOutput->Add(fh3PatchADCEnergyEtaPhiCenterJ2);
375 fh3PatchADCEnergyEtaPhiCenterJ1J2 = new TH3F("fh3PatchADCEnergyEtaPhiCenterJ1J2","fh3PatchADCEnergyEtaPhiCenterJ1J2;E_{ADC,patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi);
376 fOutput->Add(fh3PatchADCEnergyEtaPhiCenterJ1J2);
378 fh2CellEnergyVsTime = new TH2F("fh2CellEnergyVsTime","fh2CellEnergyVsTime;E_{cell};time",fgkNEnBins,binsEn,fgkNTimeBins,binsTime);
379 fOutput->Add(fh2CellEnergyVsTime);
381 fh3EClusELeadingCellVsTime = new TH3F("fh3EClusELeadingCellVsTime","fh3EClusELeadingCellVsTime;E_{cluster};E_{leading cell};time_{leading cell}",fgkNEnBins,binsEn,fgkNEnBins,binsEn,fgkNTimeBins,binsTime);
382 fOutput->Add(fh3EClusELeadingCellVsTime);
385 // =========== Switch on Sumw2 for all histos ===========
386 for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
387 TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
392 TH2 *h2 = dynamic_cast<TH2*>(fOutput->At(i));
397 TH3 *h3 = dynamic_cast<TH3*>(fOutput->At(i));
402 THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
406 TH1::AddDirectory(oldStatus);
408 PostData(1, fOutput); // Post data for ALL output slots > 0 here.
410 if(binsEn) delete [] binsEn;
411 if(binsPt) delete [] binsPt;
412 if(binsPhi) delete [] binsPhi;
413 if(binsEta) delete [] binsEta;
414 if(binsArea) delete [] binsArea;
415 if(binsConst) delete [] binsConst;
416 if(binsMeanPt) delete [] binsMeanPt;
417 if(binsNEF) delete [] binsNEF;
418 if(binsz) delete [] binsz;
419 if(binsJetType) delete [] binsJetType;
420 if(binsTime) delete [] binsTime;
424 //________________________________________________________________________
425 Bool_t AliAnalysisTaskEmcalJetTriggerQA::FillHistograms()
429 AliParticleContainer *partCont = GetParticleContainer(0);
432 AliPicoTrack *track = dynamic_cast<AliPicoTrack*>(partCont->GetNextAcceptParticle(0));
434 Double_t trkphi = track->Phi()*TMath::RadToDeg();
435 fh3PtEtaPhiTracks->Fill(track->Pt(),track->Eta(),track->Phi());
436 if(track->IsEMCAL()) {
438 fh3PtEtaPhiTracksOnEmcal->Fill(track->GetTrackPtOnEMCal(),track->GetTrackEtaOnEMCal(),track->GetTrackPhiOnEMCal());
439 if(TMath::Abs(track->Eta())<0.9 && trkphi > 10 && trkphi < 250 )
440 fh3PtEtaPhiTracksProp->Fill(track->Pt(),track->Eta(),track->Phi());
442 track = dynamic_cast<AliPicoTrack*>(partCont->GetNextAcceptParticle());
448 AliClusterContainer *clusCont = GetClusterContainer(0);
450 Int_t nclusters = clusCont->GetNClusters();
451 TString arrName = clusCont->GetArrayName();
452 for (Int_t ic = 0; ic < nclusters; ic++) {
453 AliVCluster *cluster = static_cast<AliVCluster*>(clusCont->GetCluster(ic));
455 AliDebug(2,Form("Could not receive cluster %d", ic));
458 if (!cluster->IsEMCAL()) {
459 AliDebug(2,Form("%s: Cluster is not emcal",GetName()));
464 cluster->GetMomentum(lp, const_cast<Double_t*>(fVertex));
466 //Fill eta,phi,E of clusters here
467 fh3EEtaPhiCluster->Fill(lp.E(),lp.Eta(),lp.Phi());
470 Double_t leadCellE = GetEnergyLeadingCell(cluster);
471 Double_t leadCellT = cluster->GetTOF();
472 fh3EClusELeadingCellVsTime->Fill(lp.E(),leadCellE,leadCellT*1e9);
478 const Short_t nCells = fCaloCells->GetNumberOfCells();
480 for(Int_t iCell=0; iCell<nCells; ++iCell) {
481 Short_t cellId = fCaloCells->GetCellNumber(iCell);
482 Double_t cellE = fCaloCells->GetCellAmplitude(cellId);
483 Double_t cellT = fCaloCells->GetCellTime(cellId);
485 AliDebug(2,Form("cell energy = %f time = %f",cellE,cellT*1e9));
486 fh2CellEnergyVsTime->Fill(cellE,cellT*1e9);
490 Double_t ptLeadJet1 = 0.;
491 Double_t ptLeadJet2 = 0.;
493 TArrayI *nJetsArr = new TArrayI(fh2NJetsPtFull->GetNbinsY()+1);
495 nJetsArr->Set(fh2NJetsPtFull->GetNbinsY()+1);
497 if (GetJetContainer(fContainerFull)) {
498 const Int_t njets = GetNJets(fContainerFull);
499 for (Int_t ij = 0; ij < njets; ij++) {
501 AliEmcalJet* jet = GetAcceptJetFromArray(ij,fContainerFull);
503 continue; //jet not selected
505 Double_t jetPt = jet->Pt() - GetRhoVal(fContainerFull)*jet->Area();
506 if(jetPt>ptLeadJet1) ptLeadJet1=jetPt;
507 fh3PtEtaPhiJetFull->Fill(jetPt,jet->Eta(),jet->Phi());
508 fh3PtEtaAreaJetFull->Fill(jetPt,jet->Eta(),jet->Area());
510 //count jets above certain pT threshold
511 Int_t ptbin = fh2NJetsPtFull->GetYaxis()->FindBin(jetPt);
512 for(Int_t iptbin = ptbin; iptbin<=fh2NJetsPtFull->GetNbinsY(); iptbin++)
513 nJetsArr->AddAt(nJetsArr->At(iptbin)+1,iptbin);
515 fh2PtNConstituentsCharged->Fill(jetPt,jet->GetNumberOfTracks());
516 fh2PtNConstituents->Fill(jetPt,jet->GetNumberOfConstituents());
518 fh2PtNEF->Fill(jetPt,jet->NEF());
519 fh3NEFEtaPhi->Fill(jet->NEF(),jet->Eta(),jet->Phi());
520 fh2NEFNConstituentsCharged->Fill(jet->NEF(),jet->GetNumberOfTracks());
521 fh2NEFNConstituentsNeutral->Fill(jet->NEF(),jet->GetNumberOfClusters());
524 Double_t sumPtCh = 0.;
525 for(Int_t icc=0; icc<jet->GetNumberOfTracks(); icc++) {
526 vp = static_cast<AliVParticle*>(jet->TrackAt(icc, fTracks));
528 fh2Ptz->Fill(jetPt,GetZ(vp,jet));
532 if(jet->GetNumberOfTracks()>0)
533 fh2PtMeanPtConstituentsCharged->Fill(jetPt,sumPtCh/(double)(jet->GetNumberOfTracks()) );
536 AliVCluster *vc = 0x0;
537 Double_t sumPtNe = 0.;
539 for(Int_t icc=0; icc<jet->GetNumberOfClusters(); icc++) {
540 vc = static_cast<AliVCluster*>(clusCont->GetCluster(icc));
544 vc->GetMomentum(lp, const_cast<Double_t*>(fVertex));
549 if(jet->GetNumberOfClusters()>0)
550 fh2PtMeanPtConstituentsNeutral->Fill(jetPt,sumPtNe/(double)(jet->GetNumberOfClusters()) );
554 for(Int_t i=1; i<=fh2NJetsPtFull->GetNbinsY(); i++) {
555 Int_t nJetsInEvent = nJetsArr->At(i);
556 fh2NJetsPtFull->Fill(nJetsInEvent,fh2NJetsPtFull->GetYaxis()->GetBinCenter(i));
561 //Reset array to zero to also count charged jets
564 //Loop over charged jets
565 if (GetJetContainer(fContainerCharged)) {
566 const Int_t njets = GetNJets(fContainerCharged);
567 for (Int_t ij = 0; ij < njets; ij++) {
569 AliEmcalJet* jet = GetAcceptJetFromArray(ij,fContainerCharged);
571 continue; //jet not selected
573 Double_t jetPt = jet->Pt() - GetRhoVal(fContainerCharged)*jet->Area();
574 if(jetPt>ptLeadJet2) ptLeadJet2=jetPt;
575 fh3PtEtaPhiJetCharged->Fill(jetPt,jet->Eta(),jet->Phi());
576 fh3PtEtaAreaJetCharged->Fill(jetPt,jet->Eta(),jet->Area());
579 for(Int_t icc=0; icc<jet->GetNumberOfTracks(); icc++) {
580 vp = static_cast<AliVParticle*>(jet->TrackAt(icc, fTracks));
582 fh2PtzCharged->Fill(jetPt,GetZ(vp,jet));
585 //count jets above certain pT threshold
586 Int_t ptbin = fh2NJetsPtCharged->GetYaxis()->FindBin(jetPt);
587 for(Int_t iptbin = ptbin; iptbin<=fh2NJetsPtCharged->GetNbinsY(); iptbin++)
588 nJetsArr->AddAt(nJetsArr->At(iptbin)+1,iptbin);
591 for(Int_t i=1; i<=fh2NJetsPtCharged->GetNbinsY(); i++) {
592 Int_t nJetsInEvent = nJetsArr->At(i);
593 fh2NJetsPtCharged->Fill(nJetsInEvent,fh2NJetsPtCharged->GetYaxis()->GetBinCenter(i));
597 if(GetJetContainer(fContainerFull) && GetJetContainer(fContainerCharged)) {
598 fh2PtLeadJet1VsLeadJet2->Fill(ptLeadJet1,ptLeadJet2);
601 fh3PtLeadJet1VsPatchEnergy->Fill(ptLeadJet1,fMaxPatchEnergy,fTriggerType);
602 fh3PtLeadJet2VsPatchEnergy->Fill(ptLeadJet2,fMaxPatchEnergy,fTriggerType);
604 if(nJetsArr) delete nJetsArr;
609 //________________________________________________________________________
610 Bool_t AliAnalysisTaskEmcalJetTriggerQA::Run()
612 // Run analysis code here, if needed. It will be executed before FillHistograms().
614 //Check if event is selected (vertex & pile-up)
618 if(fTriggerPatchInfo)
621 return kTRUE; // If return kFALSE FillHistogram() will NOT be executed.
624 //_______________________________________________________________________
625 void AliAnalysisTaskEmcalJetTriggerQA::Terminate(Option_t *)
627 // Called once at the end of the analysis.
629 //________________________________________________________________________
630 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetZ(const AliVParticle *trk, const AliEmcalJet *jet) const
632 // Get Z of constituent trk
634 return GetZ(trk->Px(),trk->Py(),trk->Pz(),jet->Px(),jet->Py(),jet->Pz());
637 //________________________________________________________________________
638 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const
641 // Get the z of a constituent inside of a jet
644 Double_t pJetSq = jetPx*jetPx+jetPy*jetPy+jetPz*jetPz;
647 return (trkPx*jetPx+trkPy*jetPy+trkPz*jetPz)/pJetSq;
649 AliWarning(Form("%s: strange, pjet*pjet seems to be zero pJetSq: %f",GetName(), pJetSq));
654 //________________________________________________________________________
655 Int_t AliAnalysisTaskEmcalJetTriggerQA::GetLeadingCellId(const AliVCluster *clus) const
657 //Get energy of leading cell in cluster
663 Int_t iCellAbsIdMax = -1;
664 Int_t nCells = clus->GetNCells();
665 for(Int_t i = 0; i<nCells; i++) {
666 Int_t absId = clus->GetCellAbsId(i);
667 Double_t cellE = fCaloCells->GetCellAmplitude(absId);
670 iCellAbsIdMax = absId;
674 return iCellAbsIdMax;
677 //________________________________________________________________________
678 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetEnergyLeadingCell(const AliVCluster *clus) const
680 //Get energy of leading cell in cluster
684 Int_t absID = GetLeadingCellId(clus);
686 return fCaloCells->GetCellAmplitude(absID);
692 //________________________________________________________________________
693 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetECross(Int_t absID) const {
695 //Get Ecross = sum of energy of neighbouring cells (using uncalibrated energy)
700 Double_t ecross = -1.;
707 Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
708 fGeom->GetCellIndex(absID,imod,iTower,iIphi,iIeta);
709 fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta);
711 if( iphi < AliEMCALGeoParams::fgkEMCALRows-1)
712 absID1 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
714 absID2 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
716 if( ieta == AliEMCALGeoParams::fgkEMCALCols-1 && !(imod%2) ) {
717 absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod+1, iphi, 0);
718 absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
720 else if( ieta == 0 && imod%2 ) {
721 absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
722 absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod-1, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
725 if( ieta < AliEMCALGeoParams::fgkEMCALCols-1 )
726 absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
728 absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
731 Double_t ecell1 = fCaloCells->GetCellAmplitude(absID1);
732 Double_t ecell2 = fCaloCells->GetCellAmplitude(absID2);
733 Double_t ecell3 = fCaloCells->GetCellAmplitude(absID3);
734 Double_t ecell4 = fCaloCells->GetCellAmplitude(absID4);
736 ecross = ecell1+ecell2+ecell3+ecell4;