AliPhysics  b76e98e (b76e98e)
AliAnalysisTaskGammaTriggerQA.cxx
Go to the documentation of this file.
1  /*************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Friederike Bock *
5  * Version 1.0 *
6  * *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
18 //----------------------------------------------------------------
19 // Class used to do analysis on conversion photons + calo photons
20 //----------------------------------------------------------------
22 #include "TChain.h"
23 #include "TTree.h"
24 #include "TBranch.h"
25 #include "TFile.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TH3F.h"
29 #include "THnSparse.h"
30 #include "TCanvas.h"
31 #include "TNtuple.h"
32 #include "AliAnalysisTask.h"
33 #include "AliAnalysisManager.h"
34 #include "AliESDEvent.h"
35 #include "AliESDInputHandler.h"
36 #include "AliMCEventHandler.h"
37 #include "AliMCEvent.h"
38 #include "AliMCParticle.h"
39 #include "AliCentrality.h"
40 #include "AliESDVZERO.h"
41 #include "AliESDpid.h"
43 #include "AliVParticle.h"
44 #include "AliESDtrack.h"
45 #include "AliESDtrackCuts.h"
46 #include "AliKFVertex.h"
47 #include "AliV0ReaderV1.h"
48 #include "AliGenCocktailEventHeader.h"
49 #include "AliAODMCParticle.h"
50 #include "AliAODMCHeader.h"
51 #include "AliEventplane.h"
53 #include "AliAODEvent.h"
54 #include "AliAODInputHandler.h"
55 #include "AliESDEvent.h"
56 #include "AliESDInputHandler.h"
57 #include "AliInputEventHandler.h"
58 #include "AliCaloTrackMatcher.h"
59 #include <vector>
60 #include <map>
61 #include <fstream>
62 
64 
65 //________________________________________________________________________
67  fV0Reader(NULL),
68  fV0ReaderName("V0ReaderV1"),
69  fCorrTaskSetting(""),
70  fInputEvent(NULL),
71  fMCEvent(NULL),
72  fCutFolder(NULL),
73  fESDList(NULL),
74  fOutputContainer(NULL),
75  fClusterCandidates(NULL),
76  fEventCutArray(NULL),
77  fEventCuts(NULL),
78  fClusterCutArray(NULL),
79  fCaloPhotonCuts(NULL),
80  fHistoClusGammaPt(NULL),
81  fHistoClusGammaE(NULL),
82  fHistoNEvents(NULL),
83  fHistoNEventsWOWeight(NULL),
84  fHistoNGoodESDTracks(NULL),
85  fHistoCent(NULL),
86  fHistoVertexZ(NULL),
87  fHistoNGammaCandidates(NULL),
88  fHistoNGammaCandidatesBasic(NULL),
89  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
90  fHistoSPDClusterTrackletBackground(NULL),
91  fHistoNV0Tracks(NULL),
92  fHistoNV0Trigger(NULL),
93  fHistoNV0TriggerTracks(NULL),
94  fProfileEtaShift(NULL),
95  fProfileJetJetXSection(NULL),
96  fHistoJetJetNTrials(NULL),
97  fTreeList(NULL),
98  fTreeTriggInfo(NULL),
99  fCent(0),
100  fT0Trigg(0),
101  fV0Mult(0),
102  fV0Trigg(0),
103  fTPCMult(0),
104  fSPDHit(0),
105  fSPDTracklet(0),
106  fZVertex(0),
107  fEventPlaneAngle(-100),
108  fRandom(0),
109  fnCuts(0),
110  fiCut(0),
111  fIsHeavyIon(0),
112  fDoLightOutput(kFALSE),
113  fQADetailed(0),
114  fIsMC(0),
115  fWeightJetJetMC(1),
116  fNCurrentClusterBasic(0)
117 {
118 
119 }
120 
121 //________________________________________________________________________
123  AliAnalysisTaskSE(name),
124  fV0Reader(NULL),
125  fV0ReaderName("V0ReaderV1"),
126  fCorrTaskSetting(""),
127  fInputEvent(NULL),
128  fMCEvent(NULL),
129  fCutFolder(NULL),
130  fESDList(NULL),
131  fOutputContainer(0),
132  fClusterCandidates(NULL),
133  fEventCutArray(NULL),
134  fEventCuts(NULL),
135  fClusterCutArray(NULL),
136  fCaloPhotonCuts(NULL),
137  fHistoClusGammaPt(NULL),
138  fHistoClusGammaE(NULL),
139  fHistoNEvents(NULL),
140  fHistoNEventsWOWeight(NULL),
141  fHistoNGoodESDTracks(NULL),
142  fHistoCent(NULL),
143  fHistoVertexZ(NULL),
144  fHistoNGammaCandidates(NULL),
145  fHistoNGammaCandidatesBasic(NULL),
146  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
147  fHistoSPDClusterTrackletBackground(NULL),
148  fHistoNV0Tracks(NULL),
149  fHistoNV0Trigger(NULL),
150  fHistoNV0TriggerTracks(NULL),
151  fProfileEtaShift(NULL),
152  fProfileJetJetXSection(NULL),
153  fHistoJetJetNTrials(NULL),
154  fTreeList(NULL),
155  fTreeTriggInfo(NULL),
156  fCent(0),
157  fT0Trigg(0),
158  fV0Mult(0),
159  fV0Trigg(0),
160  fTPCMult(0),
161  fSPDHit(0),
162  fSPDTracklet(0),
163  fZVertex(0),
164  fEventPlaneAngle(-100),
165  fRandom(0),
166  fnCuts(0),
167  fiCut(0),
168  fIsHeavyIon(0),
169  fDoLightOutput(kFALSE),
170  fQADetailed(0),
171  fIsMC(0),
172  fWeightJetJetMC(1),
173  fNCurrentClusterBasic(0)
174 {
175  // Define output slots here
176  DefineOutput(1, TList::Class());
177 }
178 
180 {
181  if(fClusterCandidates){
182  delete fClusterCandidates;
183  fClusterCandidates = 0x0;
184  }
185 }
186 
187 //________________________________________________________________________
189 
190  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
191  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
192 
193  // set common binning in pT for mesons and photons
194  Int_t nBinsPt = 250;
195  Float_t minPt = 0;
196  Float_t maxPt = 25;
197  Int_t nBinsQAPt = 175;
198  Float_t maxQAPt = 25;
199  Int_t nBinsClusterPt = 500;
200  Float_t minClusterPt = 0;
201  Float_t maxClusterPt = 50;
202  Double_t *arrPtBinning = new Double_t[1200];
203  Double_t *arrQAPtBinning = new Double_t[1200];
204  Double_t *arrClusPtBinning = new Double_t[1200];
205  for(Int_t i=0; i<nBinsPt+1;i++){
206  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
207  }
208  for(Int_t i=0; i<nBinsClusterPt+1;i++){
209  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
210  }
211  for(Int_t i=0; i<nBinsQAPt+1;i++){
212  if(i<60) arrQAPtBinning[i] = 0.05*i;
213  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
214  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
215  else if(i<175) arrQAPtBinning[i] = 20.+1.0*(i-170);
216  else arrQAPtBinning[i] = maxQAPt;
217  }
218 
219  // Create histograms
220  if(fOutputContainer != NULL){
221  delete fOutputContainer;
222  fOutputContainer = NULL;
223  }
224  if(fOutputContainer == NULL){
225  fOutputContainer = new TList();
226  fOutputContainer->SetOwner(kTRUE);
227  }
228 
229  // Array of current cut's gammas
230  fClusterCandidates = new TList();
231  fClusterCandidates->SetOwner(kTRUE);
232 
233  fCutFolder = new TList*[fnCuts];
234  fESDList = new TList*[fnCuts];
235  fHistoNEvents = new TH1F*[fnCuts];
236  if(fIsMC > 1){
237  fHistoNEventsWOWeight = new TH1F*[fnCuts];
238  }
239  if(fIsMC == 2){
240  fProfileJetJetXSection = new TProfile*[fnCuts];
241  fHistoJetJetNTrials = new TH1F*[fnCuts];
242  }
243 
244  if (fQADetailed > 0){
245  fTreeList = new TList*[fnCuts];
246  fTreeTriggInfo = new TTree*[fnCuts];
247  }
248 
249  fHistoNGoodESDTracks = new TH1F*[fnCuts];
250  fHistoCent = new TH1F*[fnCuts];
251  fHistoVertexZ = new TH1F*[fnCuts];
252  fHistoNGammaCandidates = new TH1F*[fnCuts];
253  fHistoNGammaCandidatesBasic = new TH1F*[fnCuts];
254  if(!fDoLightOutput){
257  fHistoNV0Tracks = new TH1F*[fnCuts];
258  fHistoNV0Trigger = new TH1F*[fnCuts];
260  }
261  if(fIsHeavyIon==2) fProfileEtaShift = new TProfile*[fnCuts];
262 
263  fHistoClusGammaPt = new TH1F*[fnCuts];
264  fHistoClusGammaE = new TH1F*[fnCuts];
265 
266  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
267  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
268  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
269 
270  fCutFolder[iCut] = new TList();
271  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s", cutstringEvent.Data(), cutstringCalo.Data()));
272  fCutFolder[iCut]->SetOwner(kTRUE);
273  fOutputContainer->Add(fCutFolder[iCut]);
274  fESDList[iCut] = new TList();
275  fESDList[iCut]->SetName(Form("%s_%s ESD histograms", cutstringEvent.Data(), cutstringCalo.Data()));
276  fESDList[iCut]->SetOwner(kTRUE);
277  fCutFolder[iCut]->Add(fESDList[iCut]);
278 
279  fHistoNEvents[iCut] = new TH1F("NEvents", "NEvents", 14, -0.5, 13.5);
280  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
281  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
282  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
283  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
284  TString TriggerNames = "Not Trigger: ";
285  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
286  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
287  } else {
288  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
289  }
290  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
291  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
292  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"SPD Pile-Up");
293  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
294  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
295  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
296  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
297  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
298  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
299  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
300  fESDList[iCut]->Add(fHistoNEvents[iCut]);
301 
302  if (fIsMC > 1){
303  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight", "NEventsWOWeight", 14, -0.5, 13.5);
304  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
305  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
306  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
307  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
308  TString TriggerNames = "Not Trigger: ";
309  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
310  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
311  } else {
312  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
313  }
314  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
315  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
316  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
317  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
318  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
319  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
320  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
321  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
322  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
323  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
324  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
325  }
326  if (fIsMC == 2){
327  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
328  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
329  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
330  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
331  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
332  }
333 
334  if(fIsHeavyIon == 1)
335  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 4000, 0, 4000);
336  else if(fIsHeavyIon == 2)
337  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 400, 0, 400);
338  else
339  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 200, 0, 200);
340  fHistoNGoodESDTracks[iCut]->GetXaxis()->SetTitle("#primary tracks");
341  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
342 
343  fHistoCent[iCut] = new TH1F("Centrality", "Centrality; Centrality [%]", 100, 0, 100);
344  fESDList[iCut]->Add(fHistoCent[iCut]);
345 
346  fHistoVertexZ[iCut] = new TH1F("VertexZ", "VertexZ", 200, -10, 10);
347  fHistoVertexZ[iCut]->GetXaxis()->SetTitle("Z_{vtx} (cm)");
348  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
349 
350  if(fIsHeavyIon == 1)
351  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 600, 0, 600);
352  else if(fIsHeavyIon == 2)
353  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 400, 0, 400);
354  else
355  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 100, 0, 100);
356  fHistoNGammaCandidatesBasic[iCut]->GetXaxis()->SetTitle("#cluster candidates basic");
357  fESDList[iCut]->Add(fHistoNGammaCandidatesBasic[iCut]);
358 
359 
360  if(fIsHeavyIon == 1)
361  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 200, 0, 200);
362  else if(fIsHeavyIon == 2)
363  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 100, 0, 100);
364  else
365  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
366  fHistoNGammaCandidates[iCut]->GetXaxis()->SetTitle("#cluster candidates with current cut");
367  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
368 
369  if(!fDoLightOutput){
370  if(fIsHeavyIon == 1)
371  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 4000, 0, 4000, 200, 0, 200);
372  else if(fIsHeavyIon == 2)
373  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 400, 0, 400, 100, 0, 100);
374  else
375  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 200, 0, 200, 50, 0, 50);
376  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("#good tracks");
377  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("#cluster candidates");
379 
380  if(fIsHeavyIon == 1)
381  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 500, 0, 1000, 1000, 0, 4000);
382  else if(fIsHeavyIon == 2)
383  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 200, 0, 400, 500, 0, 2000);
384  else
385  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 100, 0, 200, 250, 0, 1000);
387 
388  if(fIsHeavyIon == 1)
389  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 40000, 0, 40000);
390  else if(fIsHeavyIon == 2)
391  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 2500, 0, 2500);
392  else
393  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 1500, 0, 1500);
394  fHistoNV0Tracks[iCut]->SetXTitle("V0 amplitude");
395  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
396 
397  if(fIsHeavyIon == 1)
398  fHistoNV0Trigger[iCut] = new TH1F("V0 Trigger", "V0 Trigger", 40000, 0, 40000);
399  else if(fIsHeavyIon == 2)
400  fHistoNV0Trigger[iCut] = new TH1F("V0 Trigger", "V0 Trigger", 2500, 0, 2500);
401  else
402  fHistoNV0Trigger[iCut] = new TH1F("V0 Trigger", "V0 Trigger", 1500, 0, 1500);
403  fHistoNV0Trigger[iCut]->SetXTitle("V0 trigger amplitude");
404  fESDList[iCut]->Add(fHistoNV0Trigger[iCut]);
405 
406  if(fIsHeavyIon == 1)
407  fHistoNV0TriggerTracks[iCut] = new TH2F("V0 Trigger vs Mult", "V0 Trigger vs Mult", 1000, 0, 40000, 1000, 0, 40000);
408  else if(fIsHeavyIon == 2)
409  fHistoNV0TriggerTracks[iCut] = new TH2F("V0 Trigger vs Mult", "V0 Trigger vs Mult", 250, 0, 2500, 250, 0, 2500);
410  else
411  fHistoNV0TriggerTracks[iCut] = new TH2F("V0 Trigger vs Mult", "V0 Trigger vs Mult", 150, 0, 1500, 150, 0, 1500);
412  fESDList[iCut]->Add(fHistoNV0TriggerTracks[iCut]);
413 
414 
415  }
416 
417  if(fIsHeavyIon==2) {
418  fProfileEtaShift[iCut] = new TProfile("Eta Shift", "Eta Shift", 1, -0.5, 0.5);
419  fProfileEtaShift[iCut]->SetXTitle("#eta shift");
420  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
421  }
422 
423  if (fIsMC > 1){
424  fHistoNEvents[iCut]->Sumw2();
425  fHistoNGoodESDTracks[iCut]->Sumw2();
426  fHistoVertexZ[iCut]->Sumw2();
427  fHistoNGammaCandidates[iCut]->Sumw2();
428  fHistoNGammaCandidatesBasic[iCut]->Sumw2();
429  fHistoCent[iCut]->Sumw2();
430  if(!fDoLightOutput){
432  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
433  fHistoNV0Tracks[iCut]->Sumw2();
434  }
435  if(fIsHeavyIon==2) fProfileEtaShift[iCut]->Sumw2();
436  }
437 
438  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt", "ClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
439  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
440  fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
441  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E", "ClusGamma_E", nBinsClusterPt, arrClusPtBinning);
442  fHistoClusGammaPt[iCut]->SetXTitle("E_{clus} (GeV/c)");
443  fESDList[iCut]->Add(fHistoClusGammaE[iCut]);
444 
445  if (fIsMC > 1){
446  fHistoClusGammaPt[iCut]->Sumw2();
447  fHistoClusGammaE[iCut]->Sumw2();
448  }
449 
450  if (fQADetailed > 0){
451  fTreeList[iCut] = new TList();
452  fTreeList[iCut]->SetName(Form("%s_%s TriggerQA tree", cutstringEvent.Data(), cutstringCalo.Data()));
453  fTreeList[iCut]->SetOwner(kTRUE);
454  fCutFolder[iCut]->Add(fTreeList[iCut]);
455 
456  fTreeTriggInfo[iCut]= new TTree("TriggerInfoTree", "TriggerInfoTree");
457  fTreeTriggInfo[iCut]->Branch("Cent",&fCent,"fCent/F");
458  fTreeTriggInfo[iCut]->Branch("T0Trigg",&fT0Trigg,"fT0Trigg/s");
459  fTreeTriggInfo[iCut]->Branch("V0Mult",&fV0Mult,"fV0Mult/i");
460  fTreeTriggInfo[iCut]->Branch("V0Trigg",&fV0Trigg,"fV0Trigg/i");
461  fTreeTriggInfo[iCut]->Branch("TPCMult",&fTPCMult,"fTPCMult/i");
462  fTreeTriggInfo[iCut]->Branch("SPDTrack",&fSPDHit,"fSPDHit/i");
463  fTreeTriggInfo[iCut]->Branch("SPDTracklet",&fSPDTracklet,"fSPDTracklet/i");
464  fTreeTriggInfo[iCut]->Branch("ZVertex",&fZVertex,"fZVertex/F");
465  fTreeList[iCut]->Add(fTreeTriggInfo[iCut]);
466  }
467  }
468 
469 
470  if(fV0Reader)
472  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
473  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
474  if(fV0Reader)
476  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
477  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
478 
479  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
480  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
481  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
482  }
483 
484  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
485  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
486  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
487  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
488  }
489  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
490  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
491  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
492  }
493  }
494 
495  PostData(1, fOutputContainer);
496 }
497 //_____________________________________________________________________________
499 {
500  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
501  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
502  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
503  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
504  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
505  }
506  if(fIsHeavyIon==2) {
507  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
508  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
509  continue; // No Eta Shift requested, continue
510  }
511  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
512  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
513  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
514  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
515  continue;
516  }
517  else{
518  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
519  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
520  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
521  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
522  }
523  }
524  }
525 
526  return kTRUE;
527 }
528 //_____________________________________________________________________________
530 {
531  //
532  // Called for each event
533  //
534  fInputEvent = InputEvent();
535  if(fIsMC> 0) fMCEvent = MCEvent();
536 
537  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
538  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
539  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete
540  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
541  fHistoNEvents[iCut]->Fill(eventQuality);
542  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
543  }
544  return;
545  }
546 
547  // ------------------- BeginEvent ----------------------------
548 
549  AliEventplane *EventPlane = fInputEvent->GetEventplane();
550  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
551  else fEventPlaneAngle=0.0;
552 
553  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
554 
555  fiCut = iCut;
556 
558  Bool_t isRunningEMCALrelAna = kFALSE;
559  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
560 
561  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
562 
563  if(fIsMC==2){
564  Float_t xsection = -1.;
565  Float_t ntrials = -1.;
566  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials, fInputEvent );
567  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
568  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
569  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}", ntrials);
570  }
571 
572  if (fIsMC > 0){
573  fWeightJetJetMC = 1;
574  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC , fInputEvent);
575  if (fIsMC == 3){
576  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
577  fWeightJetJetMC = fWeightJetJetMC*weightMult;
578  }
579 
580  if (!isMCJet){
581  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
582  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
583  continue;
584  }
585  }
586 
587  Bool_t triggered = kTRUE;
588  if(eventNotAccepted){
589  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
590  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
591  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
592  if (eventNotAccepted==3 && fIsMC>0){
593  triggered = kFALSE;
594  } else {
595  continue;
596  }
597  }
598 
599  if(eventQuality != 0){// Event Not Accepted
600  //cout << "event rejected due to: " <<eventQuality << endl;
601  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
602  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
603  continue;
604  }
605  if (triggered == kTRUE) {
606  // set variables
607  fCent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCentrality(fInputEvent);
608  if(fInputEvent->IsA()==AliESDEvent::Class()){
609  fT0Trigg = ((AliESDEvent*)fInputEvent)->GetT0Trig();
610  } else {
611  fT0Trigg = 0;
612  }
613 
614  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2){
615  fV0Mult = fInputEvent->GetVZEROData()->GetMTotV0A();
616  fV0Trigg = fInputEvent->GetVZEROData()->GetTriggerChargeA();
617  } else{
618  fV0Mult = fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C();
619  fV0Trigg = fInputEvent->GetVZEROData()->GetTriggerChargeA()+fInputEvent->GetVZEROData()->GetTriggerChargeC();
620  }
622  fSPDTracklet = fInputEvent->GetMultiplicity()->GetNumberOfTracklets();
623  fSPDHit = fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1);
624  fZVertex = fInputEvent->GetPrimaryVertex()->GetZ();
625 
626  // fill histograms
627  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
628  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
629  fHistoCent[iCut]->Fill(fCent, fWeightJetJetMC);
631  fHistoVertexZ[iCut]->Fill(fZVertex, fWeightJetJetMC);
632  if(!fDoLightOutput){
637  }
638  // fill tree
639  if (fQADetailed > 0){
640  fTreeTriggInfo[iCut]->Fill();
641  }
642  }
643 
644  if(fIsMC> 0){
645  // Process MC Particle
646  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
647  if(fInputEvent->IsA()==AliESDEvent::Class()){
648  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
649  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
650  fMCEvent);
651  }
652  else if(fInputEvent->IsA()==AliAODEvent::Class()){
653  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
654  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
655  fInputEvent);
656  }
657  }
658  }
659 
660 
661  if (triggered==kFALSE) continue;
662 
663  // it is in the loop to have the same conversion cut string (used also for MC stuff that should be same for V0 and Cluster)
664  ProcessClusters(); // process calo clusters
666  fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries(), fWeightJetJetMC);
668 
669  fClusterCandidates->Clear(); // delete cluster candidates
670  }
671  PostData(1, fOutputContainer);
672 }
673 
674 //________________________________________________________________________
676 {
677 
678  Int_t nclus = 0;
679  TClonesArray * arrClustersProcess = NULL;
681  if(!fCorrTaskSetting.CompareTo("")){
682  nclus = fInputEvent->GetNumberOfCaloClusters();
683  } else {
684  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
685  if(!arrClustersProcess)
686  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaTriggerQA! Check the correction framework settings!",fCorrTaskSetting.Data()));
687  nclus = arrClustersProcess->GetEntries();
688  }
689 
690  if(nclus == 0) return;
691  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
692  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
693 
694  // match tracks to clusters
695  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC);
696 
697  // vertex
698  Double_t vertex[3] = {0};
699  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
700 
701  // Loop over EMCal clusters
702  for(Long_t i = 0; i < nclus; i++){
703  AliVCluster* clus = NULL;
704  if(fInputEvent->IsA()==AliESDEvent::Class()){
705  if(arrClustersProcess)
706  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
707  else
708  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
709  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
710  if(arrClustersProcess)
711  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
712  else
713  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
714  }
715 
716  if(!clus) continue;
717  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
718  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetIsAcceptedForBasicCounting())fNCurrentClusterBasic++;
719  delete clus;
720  continue;
721  }
723 
724  // TLorentzvector with cluster
725  TLorentzVector clusterVector;
726  clus->GetMomentum(clusterVector,vertex);
727 
728  TLorentzVector* tmpvec = new TLorentzVector();
729  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
730 
731  // convert to AODConversionPhoton
732  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
733  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
734 
735  // Flag Photon as CaloPhoton
736  PhotonCandidate->SetIsCaloPhoton();
737  PhotonCandidate->SetCaloClusterRef(i);
738  PhotonCandidate->SetLeadingCellID(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent));
739  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
740  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(), fWeightJetJetMC);
741 
742  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
743 
744  delete clus;
745  delete tmpvec;
746  }
747 
748  return;
749 }
750 
751 //________________________________________________________________________
753 {
754 
755  //fOutputContainer->Print(); // Will crash on GRID
756 }
TH1F ** fHistoNEventsWOWeight
array of histos with event information
TList ** fTreeList
array of histos with ntrials for jetjet
void SetCaloClusterRef(Long_t ref)
double Double_t
Definition: External.C:58
TH1F ** fHistoNV0Trigger
array of histos with V0 counts
Definition: External.C:236
TH1F ** fHistoJetJetNTrials
array of profiles with xsection for jetjet
Int_t GetNumberOfPrimaryTracks()
TH1F ** fHistoVertexZ
array of histos with centrality slices
TString GetPeriodName()
TH1F ** fHistoCent
array of histos with number of good tracks (2010 Standard track cuts)
int Int_t
Definition: External.C:63
Class handling all kinds of selection cuts for Gamma Calo analysis.
TH1F ** fHistoNGoodESDTracks
array of histos with event information without event weights
TH1F ** fHistoNEvents
array of histos with cluster, E
float Float_t
Definition: External.C:68
TH2F ** fHistoNV0TriggerTracks
array of histos with V0 trigger
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
TH1F ** fHistoClusGammaE
array of histos with cluster, pt
TH2F ** fHistoSPDClusterTrackletBackground
array of histos with number of good tracks vs gamma candidates
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TProfile ** fProfileJetJetXSection
array of profiles with eta shift
void SetLeadingCellID(Int_t index)
TProfile ** fProfileEtaShift
array of histos with V0 trigger vs tracks
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TList * GetCaloTrackMatcherHistograms()
Float_t fCent
Array of lists with tree.
TH1F ** fHistoNGammaCandidatesBasic
array of histos with number of gamma candidates per event
TH2F ** fHistoNGoodESDTracksVsNGammaCandidates
array of histos with number of gamma candidates per event for basic cluster cut
virtual void Terminate(const Option_t *)
Class handling all kinds of selection cuts for Gamma Conversion analysis.
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:90
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
TH1F ** fHistoNV0Tracks
array of histos with SPD tracklets vs SPD clusters for background rejection
TList * fEventCutArray
current list of cluster candidates
TH1F ** fHistoNGammaCandidates
array of histos with vertex z distribution for selected events