AliPhysics  ec7afe5 (ec7afe5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaCaloTrackCorrMaker.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 
16 #include <cstdlib>
17 
18 // --- ROOT system ---
19 #include <TClonesArray.h>
20 #include <TList.h>
21 #include <TH1F.h>
22 //#include <TObjectTable.h>
23 #include <TGeoGlobalMagField.h>
24 
25 //---- AliRoot system ----
26 #include "AliAnalysisManager.h"
27 #include "AliInputEventHandler.h"
28 #include "AliESDEvent.h"
29 #include "AliAODEvent.h"
32 #include "AliLog.h"
33 #include "AliGenPythiaEventHeader.h"
34 
38 
39 //__________________________________________________
42 //__________________________________________________
44 TObject(),
45 fReader(0), fCaloUtils(0),
46 fOutputContainer(new TList ), fAnalysisContainer(new TList ),
47 fMakeHisto(kFALSE), fMakeAOD(kFALSE),
48 fAnaDebug(0), fCuts(new TList),
49 fScaleFactor(-1),
50 fFillDataControlHisto(1), fSumw2(0),
51 fCheckPtHard(0),
52 // Control histograms
53 fhNEventsIn(0), fhNEvents(0),
54 fhNExoticEvents(0), fhNEventsNoTriggerFound(0),
55 fhNPileUpEvents(0), fhNPileUpEventsTriggerBC0(0),
56 fhXVertex(0), fhYVertex(0), fhZVertex(0),
57 fhXVertexExotic(0), fhYVertexExotic(0), fhZVertexExotic(0),
58 fhPtHard(0), fhPtHardWeighted(0),
59 fhPileUpClusterMult(0), fhPileUpClusterMultAndSPDPileUp(0),
60 fhTrackMult(0),
61 fhCentrality(0), fhEventPlaneAngle(0),
62 fhNEventsWeighted(0), fhTrackMultWeighted(0),
63 fhCentralityWeighted(0), fhEventPlaneAngleWeighted(0),
64 fhNMergedFiles(0), fhScaleFactor(0),
65 fhEMCalBCEvent(0), fhEMCalBCEventCut(0),
66 fhTrackBCEvent(0), fhTrackBCEventCut(0),
67 fhPrimaryVertexBC(0), fhTimeStampFraction(0),
68 fhNPileUpVertSPD(0), fhNPileUpVertTracks(0),
69 // EMCal trigger control histograms
70 fhClusterTriggerBC(0), fhClusterTriggerBCExotic(0),
71 fhClusterTriggerBCBadCell(0), fhClusterTriggerBCBadCellExotic(0),
72 fhClusterTriggerBCBadCluster(0), fhClusterTriggerBCBadClusterExotic(0),
73 fhClusterTriggerBCUnMatch(0), fhClusterTriggerBCExoticUnMatch(0),
74 fhClusterTriggerBCBadCellUnMatch(0), fhClusterTriggerBCBadCellExoticUnMatch(0),
75 fhClusterTriggerBCBadClusterUnMatch(0), fhClusterTriggerBCBadClusterExoticUnMatch(0),
76 fhClusterTriggerBCEventBC(0), fhClusterTriggerBCEventBCUnMatch(0),
77 fhClusterTriggerBCExoticEventBC(0), fhClusterTriggerBCExoticEventBCUnMatch(0)
78 {
79  AliDebug(1,"*** Analysis Maker Constructor ***");
80 
81  for(Int_t i = 0; i < 3; i++)
82  {
85  }
86 
88 }
89 
90 //________________________________________________________________________________________
92 //________________________________________________________________________________________
94 TObject(),
95 fReader(), //(new AliCaloTrackReader(*maker.fReader)),
96 fCaloUtils(),//(new AliCalorimeterUtils(*maker.fCaloUtils)),
97 fOutputContainer(new TList()), fAnalysisContainer(new TList()),
98 fMakeHisto(maker.fMakeHisto), fMakeAOD(maker.fMakeAOD),
99 fAnaDebug(maker.fAnaDebug), fCuts(new TList()),
100 fScaleFactor(maker.fScaleFactor),
101 fFillDataControlHisto(maker.fFillDataControlHisto),
102 fSumw2(maker.fSumw2),
103 fCheckPtHard(maker.fCheckPtHard),
104 fhNEventsIn(maker.fhNEventsIn),
105 fhNEvents(maker.fhNEvents),
106 fhNExoticEvents(maker.fhNExoticEvents),
107 fhNEventsNoTriggerFound(maker.fhNEventsNoTriggerFound),
108 fhNPileUpEvents(maker.fhNPileUpEvents),
109 fhNPileUpEventsTriggerBC0(maker.fhNPileUpEventsTriggerBC0),
110 fhXVertex(maker.fhXVertex),
111 fhYVertex(maker.fhYVertex),
112 fhZVertex(maker.fhZVertex),
113 fhXVertexExotic(maker.fhXVertexExotic),
114 fhYVertexExotic(maker.fhYVertexExotic),
115 fhZVertexExotic(maker.fhZVertexExotic),
116 fhPtHard(maker.fhPtHard),
117 fhPtHardWeighted(maker.fhPtHardWeighted),
118 fhPileUpClusterMult(maker.fhPileUpClusterMult),
119 fhPileUpClusterMultAndSPDPileUp(maker.fhPileUpClusterMultAndSPDPileUp),
120 fhTrackMult(maker.fhTrackMult),
121 fhCentrality(maker.fhCentrality),
122 fhEventPlaneAngle(maker.fhEventPlaneAngle),
123 fhNEventsWeighted(maker.fhNEventsWeighted),
124 fhTrackMultWeighted(maker.fhTrackMultWeighted),
125 fhCentralityWeighted(maker.fhCentralityWeighted),
126 fhEventPlaneAngleWeighted(maker.fhEventPlaneAngleWeighted),
127 fhNMergedFiles(maker.fhNMergedFiles),
128 fhScaleFactor(maker.fhScaleFactor),
129 fhEMCalBCEvent(maker.fhEMCalBCEvent),
130 fhEMCalBCEventCut(maker.fhEMCalBCEventCut),
131 fhTrackBCEvent(maker.fhTrackBCEvent),
132 fhTrackBCEventCut(maker.fhTrackBCEventCut),
133 fhPrimaryVertexBC(maker.fhPrimaryVertexBC),
134 fhTimeStampFraction(maker.fhTimeStampFraction),
135 fhNPileUpVertSPD(maker.fhNPileUpVertSPD),
136 fhNPileUpVertTracks(maker.fhNPileUpVertTracks),
137 fhClusterTriggerBC(maker.fhClusterTriggerBC),
138 fhClusterTriggerBCExotic(maker.fhClusterTriggerBCExotic),
139 fhClusterTriggerBCBadCell(maker.fhClusterTriggerBCBadCell),
140 fhClusterTriggerBCBadCellExotic(maker.fhClusterTriggerBCBadCellExotic),
141 fhClusterTriggerBCBadCluster(maker.fhClusterTriggerBCBadCluster),
142 fhClusterTriggerBCBadClusterExotic(maker.fhClusterTriggerBCBadClusterExotic),
143 fhClusterTriggerBCUnMatch(maker.fhClusterTriggerBCUnMatch),
144 fhClusterTriggerBCExoticUnMatch(maker.fhClusterTriggerBCExoticUnMatch),
145 fhClusterTriggerBCBadCellUnMatch(maker.fhClusterTriggerBCBadCellUnMatch),
146 fhClusterTriggerBCBadCellExoticUnMatch(maker.fhClusterTriggerBCBadCellExoticUnMatch),
147 fhClusterTriggerBCBadClusterUnMatch(maker.fhClusterTriggerBCBadClusterUnMatch),
148 fhClusterTriggerBCBadClusterExoticUnMatch(maker.fhClusterTriggerBCBadClusterExoticUnMatch),
149 fhClusterTriggerBCEventBC(maker.fhClusterTriggerBCEventBC),
150 fhClusterTriggerBCEventBCUnMatch(maker.fhClusterTriggerBCEventBCUnMatch),
151 fhClusterTriggerBCExoticEventBC(maker.fhClusterTriggerBCExoticEventBC),
152 fhClusterTriggerBCExoticEventBCUnMatch(maker.fhClusterTriggerBCExoticEventBCUnMatch)
153 {
154  for(Int_t i = 0; i < 3; i++)
155  {
158  }
159 }
160 
161 //___________________________________________________
163 //___________________________________________________
165 {
166  // Do not delete it here, already done somewhere else, need to understand where.
167  // if (fOutputContainer) {
168  // fOutputContainer->Clear();
169  // delete fOutputContainer ;
170  // }
171 
172  if (fAnalysisContainer)
173  {
174  fAnalysisContainer->Delete();
175  delete fAnalysisContainer ;
176  }
177 
178  if (fReader) delete fReader ;
179  if (fCaloUtils) delete fCaloUtils ;
180 
181  if(fCuts)
182  {
183  fCuts->Delete();
184  delete fCuts;
185  }
186 }
187 
188 //__________________________________________________________________
190 //__________________________________________________________________
192 {
193  if ( fAnalysisContainer)
194  {
195  fAnalysisContainer->AddAt(ana,n);
196  }
197  else
198  {
199  AliFatal("AnalysisContainer not initialized");
200  }
201 }
202 
203 //_________________________________________________________
207 //_________________________________________________________
209 {
210  TList *aodBranchList = fReader->GetAODBranchList() ;
211 
212  for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
213  {
215  if(ana->NewOutputAOD()) aodBranchList->Add(ana->GetCreateOutputAODBranch());
216  }
217 
218  return aodBranchList ;
219 }
220 
221 //____________________________________________________
223 //____________________________________________________
225 {
226  AliVEvent* event = fReader->GetInputEvent();
227  AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
228  AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
229 
230  fhNEvents ->Fill(0); // Number of events analyzed
231 
232  Double_t v[3];
233  event->GetPrimaryVertex()->GetXYZ(v) ;
234  fhXVertex->Fill(v[0]);
235  fhYVertex->Fill(v[1]);
236  fhZVertex->Fill(v[2]);
237 
241 
243  {
244  Float_t eventWeight = fReader->GetEventWeight();
245 
246  fhNEventsWeighted ->Fill(0., eventWeight);
247  fhTrackMultWeighted ->Fill(fReader->GetTrackMultiplicity(),eventWeight);
248  fhCentralityWeighted ->Fill(fReader->GetEventCentrality (),eventWeight);
250  }
251 
252  // Check the pT hard in MC
254  {
255  if(!strcmp(fReader->GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
256  {
257  AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) fReader->GetGenEventHeader();
258 
259  Float_t pTHard = pygeh->GetPtHard();
260 
261  //printf("pT hard %f, event weight %e\n",pTHard,fReader->GetEventWeight());
262 
263  fhPtHard->Fill(pTHard);
264 
267  fhPtHardWeighted->Fill(pTHard,fReader->GetEventWeight());
268  }
269  }
270 
272  {
273  if( fReader->IsPileUpFromSPD())
274  fhNPileUpEvents->Fill(0.5);
275  //if( event->IsPileupFromSPDInMultBins())
276  // fhNPileUpEvents->Fill(1.5);
277  if( fReader->IsPileUpFromEMCal())
278  fhNPileUpEvents->Fill(2.5);
280  fhNPileUpEvents->Fill(3.5);
282  fhNPileUpEvents->Fill(4.5);
284  fhNPileUpEvents->Fill(5.5);
286  fhNPileUpEvents->Fill(6.5);
288  fhNPileUpEvents->Fill(7.5);
289 
290  Int_t triggerBC = fReader->GetTriggerClusterBC() ;
291  if( triggerBC == 0 &&
292  !fReader->IsExoticEvent() &&
294  {
295  if( fReader->IsPileUpFromSPD())
296  fhNPileUpEventsTriggerBC0->Fill(0.5);
297  //if( event->IsPileupFromSPDInMultBins())
298  // fhNPileUpEventsTriggerBC0->Fill(1.5);
299  if( fReader->IsPileUpFromEMCal())
300  fhNPileUpEventsTriggerBC0->Fill(2.5);
302  fhNPileUpEventsTriggerBC0->Fill(3.5);
304  fhNPileUpEventsTriggerBC0->Fill(4.5);
306  fhNPileUpEventsTriggerBC0->Fill(5.5);
308  fhNPileUpEventsTriggerBC0->Fill(6.5);
310  fhNPileUpEventsTriggerBC0->Fill(7.5);
311  }
312 
313  if(fReader->IsPileUpFromSPD())
315 
317 
318  for(Int_t i = 0; i < 19; i++)
319  {
321  {
322  if(fReader->GetTrackEventBC(i)) fhTrackBCEvent ->Fill(i);
324  }
325  if(fReader->GetEMCalEventBC(i)) fhEMCalBCEvent ->Fill(i);
327  }
328 
329  Int_t bc = fReader->GetVertexBC();
330  if(bc!=AliVTrack::kTOFBCNA) fhPrimaryVertexBC->Fill(bc);
331 
332  // N pile up vertices
333  Int_t nVerticesSPD = -1;
334  Int_t nVerticesTracks = -1;
335 
336  if (esdevent)
337  {
338  nVerticesSPD = esdevent->GetNumberOfPileupVerticesSPD();
339  nVerticesTracks = esdevent->GetNumberOfPileupVerticesTracks();
340 
341  }//ESD
342  else if (aodevent)
343  {
344  nVerticesSPD = aodevent->GetNumberOfPileupVerticesSPD();
345  nVerticesTracks = aodevent->GetNumberOfPileupVerticesTracks();
346  }//AOD
347 
348  fhNPileUpVertSPD ->Fill(nVerticesSPD);
349  fhNPileUpVertTracks->Fill(nVerticesTracks);
350 
351  // Time stamp
352  if(fReader->IsSelectEventTimeStampOn() && esdevent)
353  {
354  Int_t timeStamp = esdevent->GetTimeStamp();
355  Float_t timeStampFrac = 1.*(timeStamp-fReader->GetRunTimeStampMin()) /
357 
358  //printf("stamp %d, min %d, max %d, frac %f\n", timeStamp, fReader->GetRunTimeStampMin(), fReader->GetRunTimeStampMax(), timeStampFrac);
359 
360  fhTimeStampFraction->Fill(timeStampFrac);
361  }
362  }
363 }
364 
365 //___________________________________________________________
367 //___________________________________________________________
369 {
370  if ( fFillDataControlHisto < 2 ) return;
371 
372  Int_t triggerBC = fReader->GetTriggerClusterBC() ;
373  Bool_t exotic = fReader->IsExoticEvent();
374  Bool_t badCluster = fReader->IsBadCellTriggerEvent();
376  Bool_t triggerMatch= fReader->IsTriggerMatched();
377  Bool_t triggerBCOK = kTRUE;
378  Int_t triggerId = fReader->GetTriggerClusterId() ;
379 
380  Bool_t reMatchOpenTime = fReader->IsTriggerMatchedOpenCuts(0);
381  Bool_t reMatchNeigbour = fReader->IsTriggerMatchedOpenCuts(1);
382  Bool_t reMatchBoth = fReader->IsTriggerMatchedOpenCuts(2);
383 
384  if(triggerId < 0)
385  {
386  //printf("Trigger id %d\n",triggerId);
387  if(triggerId == -2) fhNEventsNoTriggerFound->Fill(0);
388  triggerBCOK = kFALSE;
389  }
390 
391  if(exotic)
392  {
393  fhNExoticEvents->Fill(0) ;
394  Double_t v[3];
395  fReader->GetInputEvent()->GetPrimaryVertex()->GetXYZ(v) ;
396  fhXVertexExotic->Fill(v[0]);
397  fhYVertexExotic->Fill(v[1]);
398  fhZVertexExotic->Fill(v[2]);
399  }
400  //if(fReader->IsExoticEvent()) printf("Maker: EXOTIC Cluster trigger\n");
401 
402  if(!triggerBCOK) return;
403 
404  Int_t eventBC = fReader->GetInputEvent()->GetBunchCrossNumber();
405  if(eventBC%4 < 0 || eventBC%4 > 3 )
406  AliWarning(Form("STRANGE: Trigger BC %d - Event BC %d, modulo4 %d",triggerBC,eventBC,eventBC%4));
407 
408  if(triggerMatch)
409  {
410  if (!exotic && !badCluster) fhClusterTriggerBC->Fill(triggerBC);
411  else if( exotic && badCluster)
412  {
413  fhClusterTriggerBCBadClusterExotic->Fill(triggerBC);
414  if(badCell) fhClusterTriggerBCBadCellExotic->Fill(triggerBC);
415  }
416  else if( exotic && !badCluster) fhClusterTriggerBCExotic->Fill(triggerBC);
417  else if( badCluster && !exotic )
418  {
419  fhClusterTriggerBCBadCluster ->Fill(triggerBC);
420  if(badCell) fhClusterTriggerBCBadCell->Fill(triggerBC);
421  }
422 
423  if(!exotic) fhClusterTriggerBCEventBC ->Fill(triggerBC,eventBC%4);
424  else fhClusterTriggerBCExoticEventBC->Fill(triggerBC,eventBC%4);
425  }
426  else
427  {
428  if (!exotic && !badCluster)
429  {
430  fhClusterTriggerBCUnMatch->Fill(triggerBC);
431  if(reMatchOpenTime) fhClusterTriggerBCUnMatchReMatch[0]->Fill(triggerBC);
432  if(reMatchNeigbour) fhClusterTriggerBCUnMatchReMatch[1]->Fill(triggerBC);
433  if(reMatchBoth) fhClusterTriggerBCUnMatchReMatch[2]->Fill(triggerBC);
434  }
435  else if( exotic && badCluster)
436  {
438  if(badCell) fhClusterTriggerBCBadCellExoticUnMatch ->Fill(triggerBC);
439  }
440  else if( exotic && !badCluster)
441  {
442  fhClusterTriggerBCExoticUnMatch->Fill(triggerBC);
443  if(reMatchOpenTime) fhClusterTriggerBCExoticUnMatchReMatch[0]->Fill(triggerBC);
444  if(reMatchNeigbour) fhClusterTriggerBCExoticUnMatchReMatch[1]->Fill(triggerBC);
445  if(reMatchBoth) fhClusterTriggerBCExoticUnMatchReMatch[2]->Fill(triggerBC);
446  }
447  else if( badCluster && !exotic )
448  {
449  fhClusterTriggerBCBadClusterUnMatch->Fill(triggerBC);
450  if(badCell)fhClusterTriggerBCBadCellUnMatch->Fill(triggerBC);
451  }
452 
453  if(!exotic) fhClusterTriggerBCEventBCUnMatch ->Fill(triggerBC,eventBC%4);
454  else fhClusterTriggerBCExoticEventBCUnMatch->Fill(triggerBC,eventBC%4);
455  }
456 }
457 
458 //_______________________________________________________
461 //_______________________________________________________
463 {
464  // Reader cuts
465  TObjString * objstring = fReader->GetListOfParameters();
466  fCuts->Add(objstring);
467 
468  // Analysis wagons cuts
469  for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
470  {
472  objstring = ana->GetAnalysisCuts();
473 
474  if ( objstring ) fCuts->Add(objstring);
475  }
476 
477  return fCuts ;
478 }
479 
480 //___________________________________________________
484 //___________________________________________________
486 {
487  // General event histograms
488 
489  fhNEventsIn = new TH1F("hNEventsIn", "Number of input events" , 1 , 0 , 1 ) ;
490  fhNEventsIn->SetYTitle("# events");
492 
493  fhNEvents = new TH1F("hNEvents", "Number of analyzed events" , 1 , 0 , 1 ) ;
494  fhNEvents->SetYTitle("# events");
496 
497  fhXVertex = new TH1F("hXVertex", " X vertex distribution" , 200 , -1 , 1 ) ;
498  fhXVertex->SetXTitle("v_{x} (cm)");
500 
501  fhYVertex = new TH1F("hYVertex", " Y vertex distribution" , 200 , -1 , 1 ) ;
502  fhYVertex->SetXTitle("v_{y} (cm)");
504 
505  fhZVertex = new TH1F("hZVertex", " Z vertex distribution" , 200 , -50 , 50 ) ;
506  fhZVertex->SetXTitle("v_{z} (cm)");
508 
509  fhCentrality = new TH1F("hCentrality","Number of events in centrality bin", 100, 0., 100) ;
510  fhCentrality->SetXTitle("Centrality bin");
512 
513  fhEventPlaneAngle = new TH1F("hEventPlaneAngle","Number of events in event plane", 100, 0., TMath::Pi()) ;
514  fhEventPlaneAngle->SetXTitle("EP angle (rad)");
516 
517  fhTrackMult = new TH1F
518  ("hTrackMult",
519  Form("Number of tracks per event with #it{p}_{T} > %2.2f GeV/#it{c} and |#eta|<%2.2f",
520  GetReader()->GetTrackMultiplicityPtCut(),GetReader()->GetTrackMultiplicityEtaCut()),
521  2000 , 0 , 2000) ;
522  fhTrackMult->SetXTitle("# tracks");
524 
525  if(fCheckPtHard)
526  {
527  fhPtHard = new TH1F("hPtHard"," #it{p}_{T}-hard for selected triggers",300,0,300);
528  fhPtHard->SetXTitle("#it{p}_{T}^{hard} (GeV/#it{c})");
530 
533  {
534  fhPtHardWeighted = new TH1F("hPtHardWeighted"," #it{p}_{T}-hard for selected triggers, weighted by cross section",300,0,300);
535  fhPtHardWeighted->SetXTitle("#it{p}_{T}^{hard} (GeV/#it{c})");
537  }
538  }
539 
540  if ( GetReader()->GetWeightUtils()->IsCentralityWeightOn() )
541  {
542  fhNEventsWeighted = new TH1F("hNEventsWeighted", "Number of analyzed events weighted by centrality", 1 , 0 , 1 ) ;
543  fhNEventsWeighted->SetYTitle("# events");
545 
546  fhCentralityWeighted = new TH1F("hCentralityWeighted","Number of events in centrality bin weighted by centrality", 100, 0.,100) ;
547  fhCentralityWeighted->SetXTitle("Centrality bin");
549 
550  fhEventPlaneAngleWeighted = new TH1F("hEventPlaneAngleWeighted","Number of events in event plane weighted by centrality",100, 0., TMath::Pi()) ;
551  fhEventPlaneAngleWeighted->SetXTitle("EP angle (rad)");
553 
554  fhTrackMultWeighted = new TH1F
555  ("hTrackMultWeighted",
556  Form("Number of tracks per weighted event with #it{p}_{T} > %2.2f GeV/#it{c} and |#eta|<%2.2f",
557  GetReader()->GetTrackMultiplicityPtCut(),GetReader()->GetTrackMultiplicityEtaCut()),
558  2000 , 0 , 2000) ;
559  fhTrackMultWeighted->SetXTitle("# tracks");
561  }
562 
564  {
565  // Trigger and exoticity related histograms
566  if(fFillDataControlHisto > 1)
567  {
568  fhNExoticEvents = new TH1F("hNExoticEvents", "Number of analyzed events triggered by exotic cluster" , 1 , 0 , 1 ) ;
569  fhNExoticEvents->SetYTitle("# exotic events");
571 
572  fhNEventsNoTriggerFound = new TH1F("hNEventsNoTriggerFound", "Number of analyzed events triggered but no trigger found" , 1 , 0 , 1 ) ;
573  fhNEventsNoTriggerFound->SetYTitle("# exotic events");
575 
576  Int_t nbin = 11;
577  Float_t minbin =-5.5;
578  Float_t maxbin = 5.5;
579  Int_t labelshift = 6;
580 
581  fhClusterTriggerBCEventBC = new TH2F("hClusterTriggerBCEventBC", "Found trigger BC and Event BC",
582  nbin , minbin ,maxbin,4,0, 4) ;
583  fhClusterTriggerBCEventBC->SetXTitle("cluster trigger BC");
584  for(Int_t i = 0; i < 4; i++)
585  fhClusterTriggerBCEventBC->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
586  fhClusterTriggerBCEventBC->SetXTitle("cluster trigger BC");
587  for(Int_t i = 1; i < 12; i++)
588  fhClusterTriggerBCEventBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
589  fhClusterTriggerBCEventBC->SetYTitle("Event BC%4");
591 
592  fhClusterTriggerBCExoticEventBC = new TH2F("hClusterTriggerBCExoticEventBC", "Found exotic trigger BC and Event BC",
593  nbin , minbin ,maxbin,4,1, 4) ;
594  for(Int_t i = 0; i < 4; i++)
595  fhClusterTriggerBCExoticEventBC->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
596  fhClusterTriggerBCExoticEventBC->SetXTitle("cluster trigger BC");
597  for(Int_t i = 1; i < 12; i++)
598  fhClusterTriggerBCExoticEventBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
599  fhClusterTriggerBCExoticEventBC->SetYTitle("Event BC%4");
601 
602  fhClusterTriggerBCEventBCUnMatch = new TH2F("hClusterTriggerBCEventBCUnMatch", "Found unmatched trigger BC and Event BC",
603  nbin , minbin ,maxbin,4,1, 4) ;
604  for(Int_t i = 0; i < 4; i++)
605  fhClusterTriggerBCEventBCUnMatch->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
606  fhClusterTriggerBCEventBCUnMatch->SetXTitle("cluster trigger BC");
607  for(Int_t i = 1; i < 12; i++)
608  fhClusterTriggerBCEventBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
609  fhClusterTriggerBCEventBCUnMatch->SetYTitle("Event BC%4");
611 
612  fhClusterTriggerBCExoticEventBCUnMatch = new TH2F("hClusterTriggerExoticBCEventBCUnMatch", "Found unmatched trigger BC and Event BC",
613  nbin , minbin ,maxbin,4,1, 4) ;
614  for(Int_t i = 0; i < 4; i++)
615  fhClusterTriggerBCExoticEventBCUnMatch->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
616  fhClusterTriggerBCExoticEventBCUnMatch->SetXTitle("cluster trigger BC");
617  for(Int_t i = 1; i < 12; i++)
618  fhClusterTriggerBCExoticEventBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
619  fhClusterTriggerBCExoticEventBCUnMatch->SetYTitle("Event BC%4");
621 
622  fhClusterTriggerBC = new TH1F("hClusterTriggerBC",
623  "Number of analyzed events triggered by a cluster in a given BC",
624  nbin , minbin ,maxbin) ;
625  fhClusterTriggerBC->SetYTitle("# events");
626  for(Int_t i = 1; i < 12; i++)
627  fhClusterTriggerBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
629 
630  fhClusterTriggerBCExotic = new TH1F("hClusterTriggerBCExotic",
631  "Number of analyzed events triggered by a exotic cluster in a given BC",
632  nbin , minbin ,maxbin) ;
633  fhClusterTriggerBCExotic->SetYTitle("# events");
634  for(Int_t i = 1; i < 12; i++)
635  fhClusterTriggerBCExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
637 
638 
639  fhClusterTriggerBCBadCell = new TH1F("hClusterTriggerBCBadCell",
640  "Number of analyzed events triggered by a bad cell in a given BC",
641  nbin , minbin ,maxbin) ;
642 
643  fhClusterTriggerBCBadCell->SetYTitle("# events");
644  for(Int_t i = 1; i < 12; i++)
645  fhClusterTriggerBCBadCell->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
647 
648  fhClusterTriggerBCBadCellExotic = new TH1F("hClusterTriggerBCBadCellExotic",
649  "Number of analyzed events triggered by a bad cell & exotic cluster in a given BC",
650  nbin , minbin ,maxbin) ;
651  fhClusterTriggerBCBadCellExotic->SetYTitle("# events");
652  for(Int_t i = 1; i < 12; i++)
653  fhClusterTriggerBCBadCellExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
655 
656  fhClusterTriggerBCBadCluster = new TH1F("hClusterTriggerBCBadCluster",
657  "Number of analyzed events triggered by a bad cluster in a given BC",
658  nbin , minbin ,maxbin) ;
659 
660  fhClusterTriggerBCBadCluster->SetYTitle("# events");
661  for(Int_t i = 1; i < 12; i++)
662  fhClusterTriggerBCBadCluster->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
664 
665 
666  fhClusterTriggerBCBadClusterExotic = new TH1F("hClusterTriggerBCBadClusterExotic",
667  "Number of analyzed events triggered by a bad cluster & exotic cluster in a given BC",
668  nbin , minbin ,maxbin) ;
669 
670  fhClusterTriggerBCBadClusterExotic->SetYTitle("# events");
671  for(Int_t i = 1; i < 12; i++)
672  fhClusterTriggerBCBadClusterExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
674 
675  fhClusterTriggerBCUnMatch = new TH1F("hClusterTriggerBCUnMatch",
676  "Number of analyzed events triggered by a cluster (no trigger patch match) in a given BC",
677  nbin , minbin ,maxbin) ;
678  fhClusterTriggerBCUnMatch->SetYTitle("# events");
679  for(Int_t i = 1; i < 12; i++)
680  fhClusterTriggerBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
682 
683  fhClusterTriggerBCExoticUnMatch = new TH1F("hClusterTriggerBCExoticUnMatch",
684  "Number of analyzed events triggered by a exotic cluster (no trigger patch match) in a given BC",
685  nbin , minbin ,maxbin) ;
686  fhClusterTriggerBCExoticUnMatch->SetYTitle("# events");
687  for(Int_t i = 1; i < 12; i++)
688  fhClusterTriggerBCExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
690 
691 
692  fhClusterTriggerBCBadCellUnMatch = new TH1F("hClusterTriggerBCBadCellUnMatch",
693  "Number of analyzed events triggered by a bad cluster (no trigger patch match) in a given BC",
694  nbin , minbin ,maxbin) ;
695  fhClusterTriggerBCBadCellUnMatch->SetYTitle("# events");
696  for(Int_t i = 1; i < 12; i++)
697  fhClusterTriggerBCBadCellUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
699 
700 
701  fhClusterTriggerBCBadCellExoticUnMatch = new TH1F("hClusterTriggerBCBadCellExoticUnMatch",
702  "Number of analyzed events triggered by a bad&exotic cluster (no trigger patch match) in a given BC",
703  nbin , minbin ,maxbin) ;
704  fhClusterTriggerBCBadCellExoticUnMatch->SetYTitle("# events");
705  for(Int_t i = 1; i < 12; i++)
706  fhClusterTriggerBCBadCellExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
708 
709 
710  fhClusterTriggerBCBadClusterUnMatch = new TH1F("hClusterTriggerBCBadClusterUnMatch",
711  "Number of analyzed events triggered by a bad cluster (no trigger patch match) in a given BC",
712  nbin , minbin ,maxbin) ;
713  fhClusterTriggerBCBadClusterUnMatch->SetYTitle("# events");
714  for(Int_t i = 1; i < 12; i++)
715  fhClusterTriggerBCBadClusterUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
717 
718 
719  fhClusterTriggerBCBadClusterExoticUnMatch = new TH1F("hClusterTriggerBCBadClusterExoticUnMatch",
720  "Number of analyzed events triggered by a bad&exotic cluster (no trigger patch match) in a given BC",
721  nbin , minbin ,maxbin) ;
722  fhClusterTriggerBCBadClusterExoticUnMatch->SetYTitle("# events");
723  for(Int_t i = 1; i < 12; i++)
724  fhClusterTriggerBCBadClusterExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
726 
727  TString rematch[] = {"OpenTime","CheckNeighbours","Both"};
728  for(Int_t j = 0; j < 3; j++)
729  {
730  fhClusterTriggerBCUnMatchReMatch[j] = new TH1F(Form("hClusterTriggerBCUnMatch_ReMatch_%s",rematch[j].Data()),
731  Form("Number of analyzed events triggered by a cluster (no trigger patch match) in a given BC, re-match %s",rematch[j].Data()),
732  nbin , minbin ,maxbin) ;
733  fhClusterTriggerBCUnMatchReMatch[j]->SetYTitle("# events");
734  for(Int_t i = 1; i < 12; i++)
735  fhClusterTriggerBCUnMatchReMatch[j]->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
737 
738  fhClusterTriggerBCExoticUnMatchReMatch[j] = new TH1F(Form("hClusterTriggerBCExoticUnMatch_ReMatch_%s",rematch[j].Data()),
739  Form("Number of analyzed events triggered by a exotic cluster (no trigger patch match) in a given BC, re-match %s",rematch[j].Data()),
740  nbin , minbin ,maxbin) ;
741  fhClusterTriggerBCExoticUnMatchReMatch[j]->SetYTitle("# events");
742  for(Int_t i = 1; i < 12; i++)
743  fhClusterTriggerBCExoticUnMatchReMatch[j]->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
745  }
746 
747  fhXVertexExotic = new TH1F("hXVertexExotic", " X vertex distribution in exotic events" , 200 , -1 , 1 ) ;
748  fhXVertexExotic->SetXTitle("v_{x} (cm)");
750 
751  fhYVertexExotic = new TH1F("hYVertexExotic", " Y vertex distribution in exotic events" , 200 , -1 , 1 ) ;
752  fhYVertexExotic->SetXTitle("v_{y} (cm)");
754 
755  fhZVertexExotic = new TH1F("hZVertexExotic", " Z vertex distribution in exotic events" , 200 , -50 , 50 ) ;
756  fhZVertexExotic->SetXTitle("v_{z} (cm)");
758  }
759 
760  fhNPileUpEvents = new TH1F("hNPileUpEvents", "Number of events considered as pile-up", 8 , 0 , 8 ) ;
761  fhNPileUpEvents->SetYTitle("# events");
762  fhNPileUpEvents->GetXaxis()->SetBinLabel(1 ,"SPD");
763  fhNPileUpEvents->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
764  fhNPileUpEvents->GetXaxis()->SetBinLabel(3 ,"EMCal");
765  fhNPileUpEvents->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
766  fhNPileUpEvents->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
767  fhNPileUpEvents->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
768  fhNPileUpEvents->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
769  fhNPileUpEvents->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
771 
772  fhNPileUpEventsTriggerBC0 = new TH1F("hNPileUpEventsTriggerBC0","Number of events considered as pile-up, trigger cluster in BC=0", 8 , 0 , 8 ) ;
773  fhNPileUpEventsTriggerBC0->SetYTitle("# events");
774  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(1 ,"SPD");
775  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
776  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(3 ,"EMCal");
777  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
778  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
779  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
780  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
781  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
783 
785  {
786  fhTrackBCEvent = new TH1F("hTrackBCEvent", "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
787  fhTrackBCEvent->SetYTitle("# events");
788  fhTrackBCEvent->SetXTitle("Bunch crossing");
789  for(Int_t i = 1; i < 20; i++)
790  fhTrackBCEvent->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
792 
793  fhTrackBCEventCut = new TH1F("hTrackBCEventCut", "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
794  fhTrackBCEventCut->SetYTitle("# events");
795  fhTrackBCEventCut->SetXTitle("Bunch crossing");
796  for(Int_t i = 1; i < 20; i++)
797  fhTrackBCEventCut->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
799  }
800 
801  fhPrimaryVertexBC = new TH1F("hPrimaryVertexBC", "Number of primary vertex per bunch crossing ", 41 , -20 , 20 ) ;
802  fhPrimaryVertexBC->SetYTitle("# events");
803  fhPrimaryVertexBC->SetXTitle("Bunch crossing");
805 
806  fhEMCalBCEvent = new TH1F("hEMCalBCEvent", "Number of events with at least 1 cluster in a bunch crossing ", 19 , 0 , 19 ) ;
807  fhEMCalBCEvent->SetYTitle("# events");
808  fhEMCalBCEvent->SetXTitle("Bunch crossing");
809  for(Int_t i = 1; i < 20; i++)
810  fhEMCalBCEvent->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
812 
813  fhEMCalBCEventCut = new TH1F("hEMCalBCEventCut", "Number of events with at least 1 cluster in a bunch crossing", 19 , 0 , 19 ) ;
814  fhEMCalBCEventCut->SetYTitle("# events");
815  fhEMCalBCEventCut->SetXTitle("Bunch crossing");
816  for(Int_t i = 1; i < 20; i++)
817  fhEMCalBCEventCut->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
819 
820  fhPileUpClusterMult = new TH1F("hPileUpClusterMult", "Number of clusters per event with large time (|t| > 20 ns)" , 100 , 0 , 100 ) ;
821  fhPileUpClusterMult->SetXTitle("# clusters");
823 
824  fhPileUpClusterMultAndSPDPileUp = new TH1F("hPileUpClusterMultAndSPDPileUp", "Number of clusters per event with large time (|t| > 20 ns, events tagged as pile-up by SPD)" , 100 , 0 , 100 ) ;
825  fhPileUpClusterMultAndSPDPileUp->SetXTitle("# clusters");
827 
828  fhNPileUpVertSPD = new TH1F ("hNPileUpVertSPD","N pile-up SPD vertex", 50,0,50);
829  fhNPileUpVertSPD->SetYTitle("# vertex ");
831 
832  fhNPileUpVertTracks = new TH1F ("hNPileUpVertTracks","N pile-up Tracks vertex", 50,0,50);
833  fhNPileUpVertTracks->SetYTitle("# vertex ");
835 
837  {
838  fhTimeStampFraction = new TH1F("hTimeStampFraction","Fraction of events within a given time stamp range",150, -1, 2) ;
839  fhTimeStampFraction->SetXTitle("fraction");
841  }
842  }
843 
844  fhNMergedFiles = new TH1F("hNMergedFiles", "Number of merged output files" , 1 , 0 , 1 ) ;
845  fhNMergedFiles->SetYTitle("# files");
846  fhNMergedFiles->Fill(1); // Fill here with one entry, while merging it will count the rest
848 
849  if(fScaleFactor > 0)
850  {
851  fhScaleFactor = new TH1F("hScaleFactor", "Number of merged output files" , 1 , 0 , 1 ) ;
852  fhScaleFactor->SetYTitle("scale factor");
853  fhScaleFactor->SetBinContent(1,fScaleFactor); // Fill here
855  }
856 
857  // Histograms defined and filled in this class, just get the pointers
858  // and add them to the list.
859  if(GetReader()->GetWeightUtils()->IsMCCrossSectionCalculationOn())
860  {
862 
863  if ( templist && templist->GetEntries() == 2 )
864  {
865  templist->SetOwner(kFALSE); //Owner is fOutputContainer.
866 
867  fOutputContainer->Add(templist->At(0));
868  fOutputContainer->Add(templist->At(1));
869  }
870  }
871 
872  // --------------------------------
873  // Add control histograms in Reader
874  // --------------------------------
875 
876  TList * templist = fReader->GetCreateControlHistograms();
877  templist->SetOwner(kFALSE); //Owner is fOutputContainer.
878 
879  for(Int_t ih = 0; ih < templist->GetEntries() ; ih++)
880  {
881  //if ( fSumw2 ) ((TH1*) templist->At(ih))->Sumw2();
882 
883  //printf("histo %d %p %s\n",ih,templist->At(ih), templist->At(ih)->GetName());
884 
885  //Add histogram to general container
886  fOutputContainer->Add(templist->At(ih)) ;
887  }
888 
889  delete templist;
890 
891  // ------------------------
892  // Add analysis histograms
893  // ------------------------
894 
895  if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
896  {
897  AliWarning("Analysis job list not initialized!!!");
898  return fOutputContainer;
899  }
900 
901  const Int_t buffersize = 255;
902  char newname[buffersize];
903 
904  for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
905  {
907 
908  if(fMakeHisto) // Analysis with histograms as output on
909  {
910  //Fill container with appropriate histograms
911  templist = ana->GetCreateOutputObjects();
912  templist->SetOwner(kFALSE); //Owner is fOutputContainer.
913 
914  for(Int_t i = 0; i < templist->GetEntries(); i++)
915  {
916  //Add only to the histogram name the name of the task
917  if( strcmp((templist->At(i))->ClassName(),"TObjString") )
918  {
919  snprintf(newname,buffersize, "%s%s", (ana->GetAddedHistogramsStringToName()).Data(), (templist->At(i))->GetName());
920  //printf("name %s, new name %s\n",(templist->At(i))->GetName(),newname);
921 
922  ((TH1*) templist->At(i))->SetName(newname);
923 
924  if ( fSumw2 ) ((TH1*) templist->At(i))->Sumw2();
925  }
926 
927  //Add histogram to general container
928  fOutputContainer->Add(templist->At(i)) ;
929  }
930 
931  delete templist;
932 
933  }// Analysis with histograms as output on
934 
935  }//Loop on analysis defined
936 
937  // Initialize calorimeters geometry pointers
938  //GetCaloUtils()->InitPHOSGeometry();
939  //GetCaloUtils()->InitEMCALGeometry();
940 
941  return fOutputContainer;
942 }
943 
944 //___________________________________
949 //___________________________________
951 {
952  // Activate debug level in maker
953  if( fAnaDebug >= 0 )
954  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fAnaDebug);
955 
956  //Initialize reader
957  GetReader()->Init();
958  GetReader()->SetCaloUtils(GetCaloUtils()); // pass the calo utils pointer to the reader
959 
960  // Activate debug level in reader
961  if( fReader->GetDebug() >= 0 )
962  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fReader->ClassName(), fReader->GetDebug());
963 
964  // Activate debug level in calo utils
965  if( fCaloUtils->GetDebug() >= 0 )
966  (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fCaloUtils->ClassName(), fCaloUtils->GetDebug());
967 
968  if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
969  {
970  AliWarning("Analysis job list not initialized");
971  return;
972  }
973 
974  for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
975  {
977 
978  ana->SetReader(fReader); // Set Reader for each analysis
979  ana->SetCaloUtils(fCaloUtils); // Set CaloUtils for each analysis
980 
981  ana->Init();
982  ana->InitDebug();
983  }//Loop on analysis defined
984 }
985 
986 //_____________________________________________
988 //_____________________________________________
990 {
991  fMakeHisto = kTRUE;
992  fMakeAOD = kTRUE;
993  fAnaDebug = 0; // No debugging info displayed by default
994 }
995 
996 //______________________________________________________________
998 //______________________________________________________________
1000 {
1001  if(! opt)
1002  return;
1003 
1004  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
1005  printf("Debug level = %d\n", fAnaDebug ) ;
1006  printf("Produce Histo = %d\n", fMakeHisto ) ;
1007  printf("Produce AOD = %d\n", fMakeAOD ) ;
1008  printf("Number of analysis tasks = %d\n", fAnalysisContainer->GetEntries()) ;
1009 
1010  if(!strcmp("all",opt))
1011  {
1012  printf("Print analysis Tasks settings :\n") ;
1013  for(Int_t iana = 0; iana<fAnalysisContainer->GetEntries(); iana++)
1014  {
1016  }
1017 
1018  printf("Print analysis Reader settings :\n") ;
1019  fReader->Print("");
1020  printf("Print analysis Calorimeter Utils settings :\n") ;
1021  fCaloUtils->Print("");
1022  }
1023 }
1024 
1025 //_____________________________________________________________________________________
1035 //_____________________________________________________________________________________
1036 void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFileName)
1037 {
1039  AliFatal("Histograms not initialized");
1040 
1041  AliDebug(1,Form("*** AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d ***",iEntry));
1042  AliDebug(2,Form("Current File Name : %s", currentFileName));
1043  //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
1044 
1045  // Each event needs an empty branch
1046  TList * aodList = fReader->GetAODBranchList();
1047  Int_t nAODBranches = aodList->GetEntries();
1048  for(Int_t iaod = 0; iaod < nAODBranches; iaod++)
1049  {
1050  TClonesArray *tca = dynamic_cast<TClonesArray*> (aodList->At(iaod));
1051  if(tca) tca->Clear("C");
1052  }
1053 
1054  // Set geometry matrices before filling arrays, in case recalibration/position calculation etc is needed
1056 
1057  // Set the AODB calibration, bad channels etc. parameters at least once
1059 
1060  // Tell the reader to fill the data in the 3 detector lists
1061  Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
1062 
1063  // Access pointers, and trigger mask check needed in mixing case
1064  AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
1065  AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
1066 
1067  UInt_t isMBTrigger = kFALSE;
1068  UInt_t isTrigger = kFALSE;
1069  if(inputHandler)
1070  {
1071  isMBTrigger = inputHandler->IsEventSelected() & fReader->GetMixEventTriggerMask();
1072  isTrigger = inputHandler->IsEventSelected() & fReader->GetEventTriggerMask();
1073  }
1074 
1075  //Fill trigger control histograms, make sure it is only for triggered events and
1076  // not the MB events used for mixing
1077  if(fReader->IsEventTriggerAtSEOn() || isTrigger)
1078  {
1079  fhNEventsIn->Fill(0);
1081  }
1082 
1083  if(!ok)
1084  {
1085  AliDebug(1,Form("*** Skip event *** %d",iEntry));
1086  fReader->ResetLists();
1087  return ;
1088  }
1089 
1090  // Magic line to write events to file
1091  if(fReader->WriteDeltaAODToFile())AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
1092 
1093  //printf(">>>>>>>>>> BEFORE >>>>>>>>>>>\n");
1094  //gObjectTable->Print();
1095 
1096  // Init mag field for tracks in case of ESDs, not really necessary
1097  if ( !TGeoGlobalMagField::Instance()->GetField() && fReader->GetInputEvent() )
1098  (fReader->GetInputEvent())->InitMagneticField();
1099 
1100  // Loop on analysis algorithms
1101 
1102  AliDebug(1,"*** Begin analysis ***");
1103 
1104  Int_t nana = fAnalysisContainer->GetEntries() ;
1105  for(Int_t iana = 0; iana < nana; iana++)
1106  {
1108 
1109  ana->ConnectInputOutputAODBranches(); // Sets branches for each analysis
1110 
1111  //Fill pool for mixed event for the analysis that need it
1112  if(!fReader->IsEventTriggerAtSEOn() && isMBTrigger)
1113  {
1114  ana->FillEventMixPool();
1115  if(!isTrigger) continue; // pool filled do not try to fill AODs or histograms if trigger is not MB
1116  }
1117 
1118  //Make analysis, create aods in aod branch and in some cases fill histograms
1119  if(fMakeAOD ) ana->MakeAnalysisFillAOD() ;
1120 
1121  //Make further analysis with aod branch and fill histograms
1123 
1124  }
1125 
1126  fReader->ResetLists();
1127 
1128  // In case of mixing analysis, non triggered events are used,
1129  // do not fill control histograms for a non requested triggered event
1130  if(!fReader->IsEventTriggerAtSEOn() && !isTrigger)
1131  {
1132  AliDebug(1,"*** End analysis, MB for mixing ***");
1133  return;
1134  }
1135 
1137 
1138  //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
1139  //gObjectTable->Print();
1140 
1141  AliDebug(1,"*** End analysis ***");
1142 }
1143 
1144 //__________________________________________________________
1147 //__________________________________________________________
1149 {
1150  if (!outputList)
1151  {
1152  AliError("No output list");
1153  return;
1154  }
1155 
1156  for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
1157  {
1159  if(ana->MakePlotsOn())ana->Terminate(outputList);
1160  } // Loop on analysis defined
1161 }
1162 
1163 
1164 
TH2F * fhClusterTriggerBCExoticEventBCUnMatch
! Correlate the found BC in the exotic trigger and the event BC, when there was no match with the tri...
Bool_t IsPileUpFromSPD() const
TH1F * fhTimeStampFraction
! event fraction depending on Time Stamp, only if activated on reader.
TH1F * fhNEvents
! Number of acepted events counter histogram.
virtual void SetCaloUtils(AliCalorimeterUtils *caloutils)
virtual Int_t GetDebug() const
Bool_t IsBadMaxCellTriggerEvent() const
TH2F * fhClusterTriggerBCEventBC
! Correlate the found BC in the trigger and the event BC.
TH1F * fhEMCalBCEventCut
! N events depending on the existence of a cluster above acceptance and E cut in a given bunch crossi...
void ana(Int_t mode=mGRID)
Definition: ana.C:87
TH1F * fhClusterTriggerBCUnMatchReMatch[3]
! Number of events triggered, depending on BC of the cluster, not matched, open cuts and rematch...
TList * GetCreateOutputHistograms()
double Double_t
Definition: External.C:58
TH2F * fhClusterTriggerBCExoticEventBC
! Correlate the found BC in the exotic trigger and the event BC.
TList * fCuts
! List with analysis cuts.
TH1F * fhClusterTriggerBCBadClusterUnMatch
! Number of events triggered, depending on BC of the cluster.
Definition: External.C:236
TH1F * fhPtHardWeighted
! pt of parton, only for MC generation (pythia jet-jet/gamma-jet), weighted by cross section ...
TH1F * fhZVertexExotic
! Z Vertex distribution of exotic event.
TH1F * fhNPileUpVertTracks
! Number of pile-up vertices from tracks.
TH1F * fhClusterTriggerBCBadCell
! Number of events triggered, depending on BC of the cluster.
TH1F * fhNEventsIn
! Number of input events counter histogram.
void InitParameters()
Init data members.
TH1F * fhClusterTriggerBCBadCluster
! Number of events triggered, depending on BC of the cluster.
AliCalorimeterUtils * fCaloUtils
Pointer to AliCalorimeterUtils.
Bool_t WriteDeltaAODToFile() const
Int_t GetVertexBC(const AliVVertex *vtx)
TH1F * fhScaleFactor
! Factor to scale histograms.
virtual AliVEvent * GetInputEvent() const
TH1F * fhTrackBCEventCut
! N events depending on the existence of a track above acceptance and pt cut in a given bunch crossin...
Bool_t IsPileUpFromSPDAndNotEMCal() const
Check if event is from pile-up determined by SPD and not by EMCal.
Int_t fFillDataControlHisto
Fill histograms only interesting with data. 0 not filled; 1 basic control; 2+ trigger related...
void AddAnalysis(TObject *ana, Int_t n)
Add analysis depending on AliAnaCaloTrackCorrBaseClass to list.
TH1F * fhClusterTriggerBCBadCellExoticUnMatch
! Number of events triggered, depending on BC of the cluster.
TH1F * fhNEventsWeighted
! Number of acepted events counter histogram. After centrality weight.
TH1F * fhEMCalBCEvent
! N events depending on the existence of a cluster in a given bunch crossing.
Double_t GetRunTimeStampMin() const
Double_t fScaleFactor
Scaling factor needed for normalization.
TH1F * fhXVertexExotic
! X Vertex distribution of exotic event.
TH2F * fhClusterTriggerBCEventBCUnMatch
! Correlate the found BC in the trigger and the event BC, when there was no match with the trigger BC...
virtual Int_t GetEventCentrality() const
virtual AliGenEventHeader * GetGenEventHeader() const
Bool_t IsCentralityWeightOn() const
Definition: AliAnaWeights.h:63
Bool_t IsTriggerMatchedOpenCuts(Int_t i) const
Bool_t IsPileUpFromNotSPDAndNotEMCal() const
Check if event not from pile-up determined neither by SPD nor by EMCal.
void FillTriggerControlHistograms()
Fill here EMCal triggered events control histograms.
TH1F * fhTrackBCEvent
! N events depending on the existence of a track in a given bunch crossing.
TH1F * fhNPileUpEventsTriggerBC0
! N events pasing pile up cut.
TH1F * fhNMergedFiles
! Number of files merged.
virtual Bool_t FillInputEvent(Int_t iEntry, const char *currentFileName)
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
TH1F * fhXVertex
! X Vertex distribution of accepted event.
Bool_t IsPileUpFromSPDOrEMCal() const
Check if event is from pile-up determined by SPD or EMCal.
Bool_t IsPileUpFromEMCalAndNotSPD() const
Check if event is from pile-up determined by EMCal, not by SPD.
Double_t GetRunTimeStampMax() const
TH1F * fhClusterTriggerBC
! Number of events triggered, depending on BC of the cluster.
Base class for CaloTrackCorr analysis algorithms.
TH1F * fhClusterTriggerBCBadClusterExoticUnMatch
! Number of events triggered, depending on BC of the cluster.
int Int_t
Definition: External.C:63
Int_t GetTrackMultiplicity(Int_t cut=0) const
unsigned int UInt_t
Definition: External.C:33
virtual TList * GetAODBranchList() const
float Float_t
Definition: External.C:68
Bool_t IsTriggerMatched() const
virtual Int_t GetDebug() const
Bool_t IsMCCrossSectionJustHistoFillOn() const
Definition: AliAnaWeights.h:81
TH1F * fhTrackMultWeighted
! Number of tracks per event histogram. After centrality weight.
virtual TObjString * GetListOfParameters()
Save parameters used for analysis in a string.
Bool_t fMakeHisto
If true makes final analysis with histograms as output.
Bool_t fSumw2
Call the histograms method Sumw2() after initialization, off by default, too large memory booking...
TH1F * fhNExoticEvents
! Number of events triggered by exotic, counter histogram.
TH1F * fhClusterTriggerBCExoticUnMatch
! Number of events triggered, depending on BC of the cluster.
Int_t GetTriggerClusterBC() const
Double_t GetEventWeight() const
UInt_t GetEventTriggerMask() const
TH1F * fhYVertex
! Y Vertex distribution of accepted event.
virtual void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
virtual TString GetAddedHistogramsStringToName() const
Bool_t IsMCCrossSectionCalculationOn() const
Definition: AliAnaWeights.h:80
TH1F * fhPileUpClusterMult
! N clusters with high time.
TH1F * fhTrackMult
! Number of tracks per event histogram.
Int_t GetEMCalEventBC(Int_t bc) const
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)
void ProcessEvent(Int_t iEntry, const char *currentFileName)
TH1F * fhClusterTriggerBCBadCellExotic
! Number of events triggered, depending on BC of the cluster.
TH1F * fhNPileUpEvents
! N events pasing pile up cut.
void SetCaloUtils(AliCalorimeterUtils *caloutils)
Bool_t fCheckPtHard
For MC done in pT-Hard bins, plot specific histogram.
Bool_t IsAccessToTrackTimeOn() const
TH1F * fhClusterTriggerBCBadCellUnMatch
! Number of events triggered, depending on BC of the cluster.
TH1F * fhNEventsNoTriggerFound
! Number of events where whatever was done, no trigger is found.
virtual ~AliAnaCaloTrackCorrMaker()
Destructor. Remove only owned pointers.
TH1F * fhEventPlaneAngle
! Histogram with Event plane angle.
virtual void SetReader(AliCaloTrackReader *reader)
UInt_t GetMixEventTriggerMask() const
virtual void ResetLists()
Reset lists, called in AliAnaCaloTrackCorrMaker.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t IsExoticEvent() const
TH1F * fhClusterTriggerBCExotic
! Number of events triggered, depending on BC of the cluster.
virtual TClonesArray * GetCreateOutputAODBranch()
Create AOD branch filled in the analysis.
Bool_t IsEventTriggerAtSEOn() const
TH1F * fhCentrality
! Histogram with centrality bins.
TH1F * fhZVertex
! Z Vertex distribution of accepted event.
virtual Double_t GetEventPlaneAngle() const
const char Option_t
Definition: External.C:48
TH1F * fhClusterTriggerBCExoticUnMatchReMatch[3]
! Number of events triggered by exotic, depending on BC of the clusterm not matched, open cuts and rematch.
Int_t GetTrackEventBC(Int_t bc) const
Bool_t IsPileUpFromEMCal() const
Check if event is from pile-up determined by EMCal.
TH1F * fhClusterTriggerBCBadClusterExotic
! Number of events triggered, depending on BC of the cluster.
void FillControlHistograms()
Fill here event control histograms.
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
bool Bool_t
Definition: External.C:53
TH1F * fhYVertexExotic
! Y Vertex distribution of exotic event.
TH1F * fhPtHard
! pt of parton, only for MC generation (pythia jet-jet/gamma-jet)
AliCaloTrackReader * GetReader()
void AccessGeometry(AliVEvent *inputEvent)
virtual TList * GetCreateControlHistograms()
AliCalorimeterUtils * GetCaloUtils()
AliAnaWeights * GetWeightUtils()
TH1F * fhCentralityWeighted
! Histogram with centrality bins. After centrality weight.
Bool_t fMakeAOD
If true makes analysis generating AODs.
void AccessOADB(AliVEvent *event)
TH1F * fhPrimaryVertexBC
! Primary vertex BC.
TList * fOutputContainer
! Output histograms container.
Int_t GetEMCalEventBCcut(Int_t bc) const
TH1F * fhPileUpClusterMultAndSPDPileUp
! N clusters with high time in events tagged as pile-up by SPD.
Bool_t IsBadCellTriggerEvent() const
AliCaloTrackReader * fReader
Pointer to AliCaloTrackReader.
TList * fAnalysisContainer
List with analysis pointers.
Definition: External.C:196
TH1F * fhNPileUpVertSPD
! Number of pile-up vertices from SPD.
Int_t GetTrackEventBCcut(Int_t bc) const
Bool_t IsPileUpFromSPDAndEMCal() const
Check if event is from pile-up determined by SPD and EMCal.
TH1F * fhClusterTriggerBCUnMatch
! Number of events triggered, depending on BC of the cluster.
Int_t GetTriggerClusterId() const
TH1F * fhEventPlaneAngleWeighted
! Histogram with Event plane angle. After centrality weight.
Steering class of package CaloTrackCorrelartions.