1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_____________________________________________________________________________
17 // Steering class for particle (gamma, hadron) identification and correlation
18 // analysis. It is called by the task class AliAnalysisTaskCaloTrackCorrelation
19 // and it connects the input (ESD/AOD/MonteCarlo) got with AliCaloTrackReader
20 // (produces TClonesArrays of AODs (TParticles in MC case if requested)), with
21 // the analysis classes that derive from AliAnaCaloTrackCorrBaseClass
23 // -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
27 // --- ROOT system ---
28 #include <TClonesArray.h>
31 //#include <TObjectTable.h>
32 #include <TGeoGlobalMagField.h>
34 //---- AliRoot system ----
35 #include "AliAnalysisManager.h"
36 #include "AliInputEventHandler.h"
37 #include "AliESDEvent.h"
38 #include "AliAODEvent.h"
39 #include "AliAnaCaloTrackCorrBaseClass.h"
40 #include "AliAnaCaloTrackCorrMaker.h"
43 ClassImp(AliAnaCaloTrackCorrMaker)
46 //__________________________________________________
47 AliAnaCaloTrackCorrMaker::AliAnaCaloTrackCorrMaker() :
49 fReader(0), fCaloUtils(0),
50 fOutputContainer(new TList ), fAnalysisContainer(new TList ),
51 fMakeHisto(kFALSE), fMakeAOD(kFALSE),
52 fAnaDebug(0), fCuts(new TList),
54 fFillDataControlHisto(kTRUE),
56 fhNEventsIn(0), fhNEvents(0),
57 fhNExoticEvents(0), fhNEventsNoTriggerFound(0),
58 fhNPileUpEvents(0), fhNPileUpEventsTriggerBC0(0),
59 fhXVertex(0), fhYVertex(0), fhZVertex(0),
60 fhXVertexExotic(0), fhYVertexExotic(0), fhZVertexExotic(0),
61 fhPileUpClusterMult(0), fhPileUpClusterMultAndSPDPileUp(0),
63 fhCentrality(0), fhEventPlaneAngle(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),
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)
80 AliDebug(1,"*** Analysis Maker Constructor ***");
82 for(Int_t i = 0; i < 3; i++)
84 fhClusterTriggerBCUnMatchReMatch [0] = 0;
85 fhClusterTriggerBCExoticUnMatchReMatch[0] = 0;
88 //Initialize parameters, pointers and histograms
92 //________________________________________________________________________________________
93 AliAnaCaloTrackCorrMaker::AliAnaCaloTrackCorrMaker(const AliAnaCaloTrackCorrMaker & maker) :
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 fhNEventsIn(maker.fhNEventsIn),
103 fhNEvents(maker.fhNEvents),
104 fhNExoticEvents(maker.fhNExoticEvents),
105 fhNEventsNoTriggerFound(maker.fhNEventsNoTriggerFound),
106 fhNPileUpEvents(maker.fhNPileUpEvents),
107 fhNPileUpEventsTriggerBC0(maker.fhNPileUpEventsTriggerBC0),
108 fhXVertex(maker.fhXVertex),
109 fhYVertex(maker.fhYVertex),
110 fhZVertex(maker.fhZVertex),
111 fhXVertexExotic(maker.fhXVertexExotic),
112 fhYVertexExotic(maker.fhYVertexExotic),
113 fhZVertexExotic(maker.fhZVertexExotic),
114 fhPileUpClusterMult(maker.fhPileUpClusterMult),
115 fhPileUpClusterMultAndSPDPileUp(maker.fhPileUpClusterMultAndSPDPileUp),
116 fhTrackMult(maker.fhTrackMult),
117 fhCentrality(maker.fhCentrality),
118 fhEventPlaneAngle(maker.fhEventPlaneAngle),
119 fhNMergedFiles(maker.fhNMergedFiles),
120 fhScaleFactor(maker.fhScaleFactor),
121 fhEMCalBCEvent(maker.fhEMCalBCEvent),
122 fhEMCalBCEventCut(maker.fhEMCalBCEventCut),
123 fhTrackBCEvent(maker.fhTrackBCEvent),
124 fhTrackBCEventCut(maker.fhTrackBCEventCut),
125 fhPrimaryVertexBC(maker.fhPrimaryVertexBC),
126 fhTimeStampFraction(maker.fhTimeStampFraction),
127 fhNPileUpVertSPD(maker.fhNPileUpVertSPD),
128 fhNPileUpVertTracks(maker.fhNPileUpVertTracks),
129 fhClusterTriggerBC(maker.fhClusterTriggerBC),
130 fhClusterTriggerBCExotic(maker.fhClusterTriggerBCExotic),
131 fhClusterTriggerBCBadCell(maker.fhClusterTriggerBCBadCell),
132 fhClusterTriggerBCBadCellExotic(maker.fhClusterTriggerBCBadCellExotic),
133 fhClusterTriggerBCBadCluster(maker.fhClusterTriggerBCBadCluster),
134 fhClusterTriggerBCBadClusterExotic(maker.fhClusterTriggerBCBadClusterExotic),
135 fhClusterTriggerBCUnMatch(maker.fhClusterTriggerBCUnMatch),
136 fhClusterTriggerBCExoticUnMatch(maker.fhClusterTriggerBCExoticUnMatch),
137 fhClusterTriggerBCBadCellUnMatch(maker.fhClusterTriggerBCBadCellUnMatch),
138 fhClusterTriggerBCBadCellExoticUnMatch(maker.fhClusterTriggerBCBadCellExoticUnMatch),
139 fhClusterTriggerBCBadClusterUnMatch(maker.fhClusterTriggerBCBadClusterUnMatch),
140 fhClusterTriggerBCBadClusterExoticUnMatch(maker.fhClusterTriggerBCBadClusterExoticUnMatch),
141 fhClusterTriggerBCEventBC(maker.fhClusterTriggerBCEventBC),
142 fhClusterTriggerBCEventBCUnMatch(maker.fhClusterTriggerBCEventBCUnMatch),
143 fhClusterTriggerBCExoticEventBC(maker.fhClusterTriggerBCExoticEventBC),
144 fhClusterTriggerBCExoticEventBCUnMatch(maker.fhClusterTriggerBCExoticEventBCUnMatch)
147 for(Int_t i = 0; i < 3; i++)
149 fhClusterTriggerBCUnMatchReMatch [i] = maker.fhClusterTriggerBCUnMatchReMatch [i];
150 fhClusterTriggerBCExoticUnMatchReMatch[i] = maker.fhClusterTriggerBCExoticUnMatchReMatch[i];
155 //___________________________________________________
156 AliAnaCaloTrackCorrMaker::~AliAnaCaloTrackCorrMaker()
158 // Remove all owned pointers.
160 // Do not delete it here, already done somewhere else, need to understand where.
161 // if (fOutputContainer) {
162 // fOutputContainer->Clear();
163 // delete fOutputContainer ;
166 if (fAnalysisContainer)
168 fAnalysisContainer->Delete();
169 delete fAnalysisContainer ;
172 if (fReader) delete fReader ;
173 if (fCaloUtils) delete fCaloUtils ;
183 //__________________________________________________________________
184 void AliAnaCaloTrackCorrMaker::AddAnalysis(TObject* ana, Int_t n)
186 // Add analysis depending on AliAnaCaloTrackCorrBaseClass to list
188 if ( fAnalysisContainer)
190 fAnalysisContainer->AddAt(ana,n);
194 AliFatal("AnalysisContainer not initialized");
198 //_________________________________________________________
199 TList * AliAnaCaloTrackCorrMaker::FillAndGetAODBranchList()
202 // Get any new output AOD branches from analysis and put them in a list
203 // The list is filled in the maker, and new branch passed to the analysis frame
204 // AliAnalysisTaskCaloTrackCorrelation
206 TList *aodBranchList = fReader->GetAODBranchList() ;
208 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
210 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
211 if(ana->NewOutputAOD()) aodBranchList->Add(ana->GetCreateOutputAODBranch());
214 return aodBranchList ;
218 //____________________________________________________
219 void AliAnaCaloTrackCorrMaker::FillControlHistograms()
221 // Event control histograms
223 AliVEvent* event = fReader->GetInputEvent();
224 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
225 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
227 fhNEvents ->Fill(0); // Number of events analyzed
230 event->GetPrimaryVertex()->GetXYZ(v) ;
231 fhXVertex->Fill(v[0]);
232 fhYVertex->Fill(v[1]);
233 fhZVertex->Fill(v[2]);
235 fhTrackMult ->Fill(fReader->GetTrackMultiplicity());
236 fhCentrality ->Fill(fReader->GetEventCentrality ());
237 fhEventPlaneAngle ->Fill(fReader->GetEventPlaneAngle ());
239 if(fFillDataControlHisto)
241 if( fReader->IsPileUpFromSPD())
242 fhNPileUpEvents->Fill(0.5);
243 //if( event->IsPileupFromSPDInMultBins())
244 // fhNPileUpEvents->Fill(1.5);
245 if( fReader->IsPileUpFromEMCal())
246 fhNPileUpEvents->Fill(2.5);
247 if( fReader->IsPileUpFromSPDOrEMCal() )
248 fhNPileUpEvents->Fill(3.5);
249 if( fReader->IsPileUpFromSPDAndEMCal() )
250 fhNPileUpEvents->Fill(4.5);
251 if( fReader->IsPileUpFromSPDAndNotEMCal() )
252 fhNPileUpEvents->Fill(5.5);
253 if( fReader->IsPileUpFromEMCalAndNotSPD() )
254 fhNPileUpEvents->Fill(6.5);
255 if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
256 fhNPileUpEvents->Fill(7.5);
258 Int_t triggerBC = fReader->GetTriggerClusterBC() ;
259 if( triggerBC == 0 &&
260 !fReader->IsExoticEvent() &&
261 !fReader->IsBadCellTriggerEvent())
263 if( fReader->IsPileUpFromSPD())
264 fhNPileUpEventsTriggerBC0->Fill(0.5);
265 //if( event->IsPileupFromSPDInMultBins())
266 // fhNPileUpEventsTriggerBC0->Fill(1.5);
267 if( fReader->IsPileUpFromEMCal())
268 fhNPileUpEventsTriggerBC0->Fill(2.5);
269 if( fReader->IsPileUpFromSPDOrEMCal() )
270 fhNPileUpEventsTriggerBC0->Fill(3.5);
271 if( fReader->IsPileUpFromSPDAndEMCal() )
272 fhNPileUpEventsTriggerBC0->Fill(4.5);
273 if( fReader->IsPileUpFromSPDAndNotEMCal() )
274 fhNPileUpEventsTriggerBC0->Fill(5.5);
275 if( fReader->IsPileUpFromEMCalAndNotSPD() )
276 fhNPileUpEventsTriggerBC0->Fill(6.5);
277 if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
278 fhNPileUpEventsTriggerBC0->Fill(7.5);
281 if(fReader->IsPileUpFromSPD())
282 fhPileUpClusterMultAndSPDPileUp ->Fill(fReader->GetNPileUpClusters());
284 fhPileUpClusterMult ->Fill(fReader->GetNPileUpClusters ());
286 for(Int_t i = 0; i < 19; i++)
288 if(fReader->IsAccessToTrackTimeOn())
290 if(fReader->GetTrackEventBC(i)) fhTrackBCEvent ->Fill(i);
291 if(fReader->GetTrackEventBCcut(i))fhTrackBCEventCut->Fill(i);
293 if(fReader->GetEMCalEventBC(i)) fhEMCalBCEvent ->Fill(i);
294 if(fReader->GetEMCalEventBCcut(i))fhEMCalBCEventCut->Fill(i);
297 Int_t bc = fReader->GetVertexBC();
298 if(bc!=AliVTrack::kTOFBCNA) fhPrimaryVertexBC->Fill(bc);
300 // N pile up vertices
301 Int_t nVerticesSPD = -1;
302 Int_t nVerticesTracks = -1;
306 nVerticesSPD = esdevent->GetNumberOfPileupVerticesSPD();
307 nVerticesTracks = esdevent->GetNumberOfPileupVerticesTracks();
312 nVerticesSPD = aodevent->GetNumberOfPileupVerticesSPD();
313 nVerticesTracks = aodevent->GetNumberOfPileupVerticesTracks();
316 fhNPileUpVertSPD ->Fill(nVerticesSPD);
317 fhNPileUpVertTracks->Fill(nVerticesTracks);
320 if(fReader->IsSelectEventTimeStampOn() && esdevent)
322 Int_t timeStamp = esdevent->GetTimeStamp();
323 Float_t timeStampFrac = 1.*(timeStamp-fReader->GetRunTimeStampMin()) /
324 (fReader->GetRunTimeStampMax()-fReader->GetRunTimeStampMin());
326 //printf("stamp %d, min %d, max %d, frac %f\n", timeStamp, fReader->GetRunTimeStampMin(), fReader->GetRunTimeStampMax(), timeStampFrac);
328 fhTimeStampFraction->Fill(timeStampFrac);
333 //___________________________________________________________
334 void AliAnaCaloTrackCorrMaker::FillTriggerControlHistograms()
336 if(!fFillDataControlHisto) return;
338 Int_t triggerBC = fReader->GetTriggerClusterBC() ;
339 Bool_t exotic = fReader->IsExoticEvent();
340 Bool_t badCluster = fReader->IsBadCellTriggerEvent();
341 Bool_t badCell = fReader->IsBadMaxCellTriggerEvent();
342 Bool_t triggerMatch= fReader->IsTriggerMatched();
343 Bool_t triggerBCOK = kTRUE;
344 Int_t triggerId = fReader->GetTriggerClusterId() ;
346 Bool_t reMatchOpenTime = fReader->IsTriggerMatchedOpenCuts(0);
347 Bool_t reMatchNeigbour = fReader->IsTriggerMatchedOpenCuts(1);
348 Bool_t reMatchBoth = fReader->IsTriggerMatchedOpenCuts(2);
352 //printf("Trigger id %d\n",triggerId);
353 if(triggerId == -2) fhNEventsNoTriggerFound->Fill(0);
354 triggerBCOK = kFALSE;
359 fhNExoticEvents->Fill(0) ;
361 fReader->GetInputEvent()->GetPrimaryVertex()->GetXYZ(v) ;
362 fhXVertexExotic->Fill(v[0]);
363 fhYVertexExotic->Fill(v[1]);
364 fhZVertexExotic->Fill(v[2]);
366 //if(fReader->IsExoticEvent()) printf("Maker: EXOTIC Cluster trigger\n");
368 if(!triggerBCOK) return;
370 Int_t eventBC = fReader->GetInputEvent()->GetBunchCrossNumber();
371 if(eventBC%4 < 0 || eventBC%4 > 3 )
372 AliWarning(Form("STRANGE: Trigger BC %d - Event BC %d, modulo4 %d",triggerBC,eventBC,eventBC%4));
376 if (!exotic && !badCluster) fhClusterTriggerBC->Fill(triggerBC);
377 else if( exotic && badCluster)
379 fhClusterTriggerBCBadClusterExotic->Fill(triggerBC);
380 if(badCell) fhClusterTriggerBCBadCellExotic->Fill(triggerBC);
382 else if( exotic && !badCluster) fhClusterTriggerBCExotic->Fill(triggerBC);
383 else if( badCluster && !exotic )
385 fhClusterTriggerBCBadCluster ->Fill(triggerBC);
386 if(badCell) fhClusterTriggerBCBadCell->Fill(triggerBC);
389 if(!exotic) fhClusterTriggerBCEventBC ->Fill(triggerBC,eventBC%4);
390 else fhClusterTriggerBCExoticEventBC->Fill(triggerBC,eventBC%4);
394 if (!exotic && !badCluster)
396 fhClusterTriggerBCUnMatch->Fill(triggerBC);
397 if(reMatchOpenTime) fhClusterTriggerBCUnMatchReMatch[0]->Fill(triggerBC);
398 if(reMatchNeigbour) fhClusterTriggerBCUnMatchReMatch[1]->Fill(triggerBC);
399 if(reMatchBoth) fhClusterTriggerBCUnMatchReMatch[2]->Fill(triggerBC);
401 else if( exotic && badCluster)
403 fhClusterTriggerBCBadClusterExoticUnMatch->Fill(triggerBC);
404 if(badCell) fhClusterTriggerBCBadCellExoticUnMatch ->Fill(triggerBC);
406 else if( exotic && !badCluster)
408 fhClusterTriggerBCExoticUnMatch->Fill(triggerBC);
409 if(reMatchOpenTime) fhClusterTriggerBCExoticUnMatchReMatch[0]->Fill(triggerBC);
410 if(reMatchNeigbour) fhClusterTriggerBCExoticUnMatchReMatch[1]->Fill(triggerBC);
411 if(reMatchBoth) fhClusterTriggerBCExoticUnMatchReMatch[2]->Fill(triggerBC);
413 else if( badCluster && !exotic )
415 fhClusterTriggerBCBadClusterUnMatch->Fill(triggerBC);
416 if(badCell)fhClusterTriggerBCBadCellUnMatch->Fill(triggerBC);
419 if(!exotic) fhClusterTriggerBCEventBCUnMatch ->Fill(triggerBC,eventBC%4);
420 else fhClusterTriggerBCExoticEventBCUnMatch->Fill(triggerBC,eventBC%4);
426 //_______________________________________________________
427 TList * AliAnaCaloTrackCorrMaker::GetListOfAnalysisCuts()
430 // Get the list of the cuts used for the analysis
431 // The list is filled in the maker, called by the task in LocalInit() and posted there
433 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
435 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
436 TObjString * objstring = ana->GetAnalysisCuts();
438 if(objstring)fCuts->Add(objstring);
445 //___________________________________________________
446 TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
448 // Fill the output list of histograms during the CreateOutputObjects stage.
450 //Initialize calorimeters geometry pointers
451 //GetCaloUtils()->InitPHOSGeometry();
452 //GetCaloUtils()->InitEMCALGeometry();
454 //General event histograms
456 fhNEventsIn = new TH1F("hNEventsIn", "Number of input events" , 1 , 0 , 1 ) ;
457 fhNEventsIn->SetYTitle("# events");
458 fOutputContainer->Add(fhNEventsIn);
460 fhNEvents = new TH1F("hNEvents", "Number of analyzed events" , 1 , 0 , 1 ) ;
461 fhNEvents->SetYTitle("# events");
462 fOutputContainer->Add(fhNEvents);
464 fhXVertex = new TH1F("hXVertex", " X vertex distribution" , 200 , -4 , 4 ) ;
465 fhXVertex->SetXTitle("v_{x} (cm)");
466 fOutputContainer->Add(fhXVertex);
468 fhYVertex = new TH1F("hYVertex", " Y vertex distribution" , 200 , -4 , 4 ) ;
469 fhYVertex->SetXTitle("v_{y} (cm)");
470 fOutputContainer->Add(fhYVertex);
472 fhZVertex = new TH1F("hZVertex", " Z vertex distribution" , 200 , -50 , 50 ) ;
473 fhZVertex->SetXTitle("v_{z} (cm)");
474 fOutputContainer->Add(fhZVertex);
476 fhCentrality = new TH1F("hCentrality","Number of events in centrality bin",100,0.,100) ;
477 fhCentrality->SetXTitle("Centrality bin");
478 fOutputContainer->Add(fhCentrality) ;
480 fhEventPlaneAngle=new TH1F("hEventPlaneAngle","Number of events in event plane",100,0.,TMath::Pi()) ;
481 fhEventPlaneAngle->SetXTitle("EP angle (rad)");
482 fOutputContainer->Add(fhEventPlaneAngle) ;
484 fhTrackMult = new TH1F("hTrackMult", "Number of tracks per events" , 2000 , 0 , 2000 ) ;
485 fhTrackMult->SetXTitle("# tracks");
486 fOutputContainer->Add(fhTrackMult);
488 if(fFillDataControlHisto)
490 fhNExoticEvents = new TH1F("hNExoticEvents", "Number of analyzed events triggered by exotic cluster" , 1 , 0 , 1 ) ;
491 fhNExoticEvents->SetYTitle("# exotic events");
492 fOutputContainer->Add(fhNExoticEvents);
494 fhNEventsNoTriggerFound = new TH1F("hNEventsNoTriggerFound", "Number of analyzed events triggered but no trigger found" , 1 , 0 , 1 ) ;
495 fhNEventsNoTriggerFound->SetYTitle("# exotic events");
496 fOutputContainer->Add(fhNEventsNoTriggerFound);
500 Float_t minbin =-5.5;
501 Float_t maxbin = 5.5;
502 Int_t labelshift = 6;
504 fhClusterTriggerBCEventBC = new TH2F("hClusterTriggerBCEventBC", "Found trigger BC and Event BC",
505 nbin , minbin ,maxbin,4,0, 4) ;
506 fhClusterTriggerBCEventBC->SetXTitle("cluster trigger BC");
507 for(Int_t i = 0; i < 4; i++)
508 fhClusterTriggerBCEventBC->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
509 fhClusterTriggerBCEventBC->SetXTitle("cluster trigger BC");
510 for(Int_t i = 1; i < 12; i++)
511 fhClusterTriggerBCEventBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
512 fhClusterTriggerBCEventBC->SetYTitle("Event BC%4");
513 fOutputContainer->Add(fhClusterTriggerBCEventBC);
515 fhClusterTriggerBCExoticEventBC = new TH2F("hClusterTriggerBCExoticEventBC", "Found exotic trigger BC and Event BC",
516 nbin , minbin ,maxbin,4,1, 4) ;
517 for(Int_t i = 0; i < 4; i++)
518 fhClusterTriggerBCExoticEventBC->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
519 fhClusterTriggerBCExoticEventBC->SetXTitle("cluster trigger BC");
520 for(Int_t i = 1; i < 12; i++)
521 fhClusterTriggerBCExoticEventBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
522 fhClusterTriggerBCExoticEventBC->SetYTitle("Event BC%4");
523 fOutputContainer->Add(fhClusterTriggerBCExoticEventBC);
525 fhClusterTriggerBCEventBCUnMatch = new TH2F("hClusterTriggerBCEventBCUnMatch", "Found unmatched trigger BC and Event BC",
526 nbin , minbin ,maxbin,4,1, 4) ;
527 for(Int_t i = 0; i < 4; i++)
528 fhClusterTriggerBCEventBCUnMatch->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
529 fhClusterTriggerBCEventBCUnMatch->SetXTitle("cluster trigger BC");
530 for(Int_t i = 1; i < 12; i++)
531 fhClusterTriggerBCEventBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
532 fhClusterTriggerBCEventBCUnMatch->SetYTitle("Event BC%4");
533 fOutputContainer->Add(fhClusterTriggerBCEventBCUnMatch);
535 fhClusterTriggerBCExoticEventBCUnMatch = new TH2F("hClusterTriggerExoticBCEventBCUnMatch", "Found unmatched trigger BC and Event BC",
536 nbin , minbin ,maxbin,4,1, 4) ;
537 for(Int_t i = 0; i < 4; i++)
538 fhClusterTriggerBCExoticEventBCUnMatch->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
539 fhClusterTriggerBCExoticEventBCUnMatch->SetXTitle("cluster trigger BC");
540 for(Int_t i = 1; i < 12; i++)
541 fhClusterTriggerBCExoticEventBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
542 fhClusterTriggerBCExoticEventBCUnMatch->SetYTitle("Event BC%4");
543 fOutputContainer->Add(fhClusterTriggerBCExoticEventBCUnMatch);
545 fhClusterTriggerBC = new TH1F("hClusterTriggerBC",
546 "Number of analyzed events triggered by a cluster in a given BC",
547 nbin , minbin ,maxbin) ;
548 fhClusterTriggerBC->SetYTitle("# events");
549 for(Int_t i = 1; i < 12; i++)
550 fhClusterTriggerBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
551 fOutputContainer->Add(fhClusterTriggerBC);
553 fhClusterTriggerBCExotic = new TH1F("hClusterTriggerBCExotic",
554 "Number of analyzed events triggered by a exotic cluster in a given BC",
555 nbin , minbin ,maxbin) ;
556 fhClusterTriggerBCExotic->SetYTitle("# events");
557 for(Int_t i = 1; i < 12; i++)
558 fhClusterTriggerBCExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
559 fOutputContainer->Add(fhClusterTriggerBCExotic);
562 fhClusterTriggerBCBadCell = new TH1F("hClusterTriggerBCBadCell",
563 "Number of analyzed events triggered by a bad cell in a given BC",
564 nbin , minbin ,maxbin) ;
566 fhClusterTriggerBCBadCell->SetYTitle("# events");
567 for(Int_t i = 1; i < 12; i++)
568 fhClusterTriggerBCBadCell->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
569 fOutputContainer->Add(fhClusterTriggerBCBadCell);
571 fhClusterTriggerBCBadCellExotic = new TH1F("hClusterTriggerBCBadCellExotic",
572 "Number of analyzed events triggered by a bad cell & exotic cluster in a given BC",
573 nbin , minbin ,maxbin) ;
574 fhClusterTriggerBCBadCellExotic->SetYTitle("# events");
575 for(Int_t i = 1; i < 12; i++)
576 fhClusterTriggerBCBadCellExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
577 fOutputContainer->Add(fhClusterTriggerBCBadCellExotic);
579 fhClusterTriggerBCBadCluster = new TH1F("hClusterTriggerBCBadCluster",
580 "Number of analyzed events triggered by a bad cluster in a given BC",
581 nbin , minbin ,maxbin) ;
583 fhClusterTriggerBCBadCluster->SetYTitle("# events");
584 for(Int_t i = 1; i < 12; i++)
585 fhClusterTriggerBCBadCluster->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
586 fOutputContainer->Add(fhClusterTriggerBCBadCluster);
589 fhClusterTriggerBCBadClusterExotic = new TH1F("hClusterTriggerBCBadClusterExotic",
590 "Number of analyzed events triggered by a bad cluster & exotic cluster in a given BC",
591 nbin , minbin ,maxbin) ;
593 fhClusterTriggerBCBadClusterExotic->SetYTitle("# events");
594 for(Int_t i = 1; i < 12; i++)
595 fhClusterTriggerBCBadClusterExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
596 fOutputContainer->Add(fhClusterTriggerBCBadClusterExotic);
598 fhClusterTriggerBCUnMatch = new TH1F("hClusterTriggerBCUnMatch",
599 "Number of analyzed events triggered by a cluster (no trigger patch match) in a given BC",
600 nbin , minbin ,maxbin) ;
601 fhClusterTriggerBCUnMatch->SetYTitle("# events");
602 for(Int_t i = 1; i < 12; i++)
603 fhClusterTriggerBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
604 fOutputContainer->Add(fhClusterTriggerBCUnMatch);
606 fhClusterTriggerBCExoticUnMatch = new TH1F("hClusterTriggerBCExoticUnMatch",
607 "Number of analyzed events triggered by a exotic cluster (no trigger patch match) in a given BC",
608 nbin , minbin ,maxbin) ;
609 fhClusterTriggerBCExoticUnMatch->SetYTitle("# events");
610 for(Int_t i = 1; i < 12; i++)
611 fhClusterTriggerBCExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
612 fOutputContainer->Add(fhClusterTriggerBCExoticUnMatch);
615 fhClusterTriggerBCBadCellUnMatch = new TH1F("hClusterTriggerBCBadCellUnMatch",
616 "Number of analyzed events triggered by a bad cluster (no trigger patch match) in a given BC",
617 nbin , minbin ,maxbin) ;
618 fhClusterTriggerBCBadCellUnMatch->SetYTitle("# events");
619 for(Int_t i = 1; i < 12; i++)
620 fhClusterTriggerBCBadCellUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
621 fOutputContainer->Add(fhClusterTriggerBCBadCellUnMatch);
624 fhClusterTriggerBCBadCellExoticUnMatch = new TH1F("hClusterTriggerBCBadCellExoticUnMatch",
625 "Number of analyzed events triggered by a bad&exotic cluster (no trigger patch match) in a given BC",
626 nbin , minbin ,maxbin) ;
627 fhClusterTriggerBCBadCellExoticUnMatch->SetYTitle("# events");
628 for(Int_t i = 1; i < 12; i++)
629 fhClusterTriggerBCBadCellExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
630 fOutputContainer->Add(fhClusterTriggerBCBadCellExoticUnMatch);
633 fhClusterTriggerBCBadClusterUnMatch = new TH1F("hClusterTriggerBCBadClusterUnMatch",
634 "Number of analyzed events triggered by a bad cluster (no trigger patch match) in a given BC",
635 nbin , minbin ,maxbin) ;
636 fhClusterTriggerBCBadClusterUnMatch->SetYTitle("# events");
637 for(Int_t i = 1; i < 12; i++)
638 fhClusterTriggerBCBadClusterUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
639 fOutputContainer->Add(fhClusterTriggerBCBadClusterUnMatch);
642 fhClusterTriggerBCBadClusterExoticUnMatch = new TH1F("hClusterTriggerBCBadClusterExoticUnMatch",
643 "Number of analyzed events triggered by a bad&exotic cluster (no trigger patch match) in a given BC",
644 nbin , minbin ,maxbin) ;
645 fhClusterTriggerBCBadClusterExoticUnMatch->SetYTitle("# events");
646 for(Int_t i = 1; i < 12; i++)
647 fhClusterTriggerBCBadClusterExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
648 fOutputContainer->Add(fhClusterTriggerBCBadClusterExoticUnMatch);
650 TString rematch[] = {"OpenTime","CheckNeighbours","Both"};
651 for(Int_t j = 0; j < 3; j++)
653 fhClusterTriggerBCUnMatchReMatch[j] = new TH1F(Form("hClusterTriggerBCUnMatch_ReMatch_%s",rematch[j].Data()),
654 Form("Number of analyzed events triggered by a cluster (no trigger patch match) in a given BC, re-match %s",rematch[j].Data()),
655 nbin , minbin ,maxbin) ;
656 fhClusterTriggerBCUnMatchReMatch[j]->SetYTitle("# events");
657 for(Int_t i = 1; i < 12; i++)
658 fhClusterTriggerBCUnMatchReMatch[j]->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
659 fOutputContainer->Add(fhClusterTriggerBCUnMatchReMatch[j]);
661 fhClusterTriggerBCExoticUnMatchReMatch[j] = new TH1F(Form("hClusterTriggerBCExoticUnMatch_ReMatch_%s",rematch[j].Data()),
662 Form("Number of analyzed events triggered by a exotic cluster (no trigger patch match) in a given BC, re-match %s",rematch[j].Data()),
663 nbin , minbin ,maxbin) ;
664 fhClusterTriggerBCExoticUnMatchReMatch[j]->SetYTitle("# events");
665 for(Int_t i = 1; i < 12; i++)
666 fhClusterTriggerBCExoticUnMatchReMatch[j]->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
667 fOutputContainer->Add(fhClusterTriggerBCExoticUnMatchReMatch[j]);
670 fhNPileUpEvents = new TH1F("hNPileUpEvents", "Number of events considered as pile-up", 8 , 0 , 8 ) ;
671 fhNPileUpEvents->SetYTitle("# events");
672 fhNPileUpEvents->GetXaxis()->SetBinLabel(1 ,"SPD");
673 fhNPileUpEvents->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
674 fhNPileUpEvents->GetXaxis()->SetBinLabel(3 ,"EMCal");
675 fhNPileUpEvents->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
676 fhNPileUpEvents->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
677 fhNPileUpEvents->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
678 fhNPileUpEvents->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
679 fhNPileUpEvents->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
680 fOutputContainer->Add(fhNPileUpEvents);
682 fhNPileUpEventsTriggerBC0 = new TH1F("hNPileUpEventsTriggerBC0","Number of events considered as pile-up, trigger cluster in BC=0", 8 , 0 , 8 ) ;
683 fhNPileUpEventsTriggerBC0->SetYTitle("# events");
684 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(1 ,"SPD");
685 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
686 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(3 ,"EMCal");
687 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
688 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
689 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
690 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
691 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
692 fOutputContainer->Add(fhNPileUpEventsTriggerBC0);
694 if(fReader->IsAccessToTrackTimeOn())
696 fhTrackBCEvent = new TH1F("hTrackBCEvent", "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
697 fhTrackBCEvent->SetYTitle("# events");
698 fhTrackBCEvent->SetXTitle("Bunch crossing");
699 for(Int_t i = 1; i < 20; i++)
700 fhTrackBCEvent->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
701 fOutputContainer->Add(fhTrackBCEvent);
703 fhTrackBCEventCut = new TH1F("hTrackBCEventCut", "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
704 fhTrackBCEventCut->SetYTitle("# events");
705 fhTrackBCEventCut->SetXTitle("Bunch crossing");
706 for(Int_t i = 1; i < 20; i++)
707 fhTrackBCEventCut->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
708 fOutputContainer->Add(fhTrackBCEventCut);
711 fhPrimaryVertexBC = new TH1F("hPrimaryVertexBC", "Number of primary vertex per bunch crossing ", 41 , -20 , 20 ) ;
712 fhPrimaryVertexBC->SetYTitle("# events");
713 fhPrimaryVertexBC->SetXTitle("Bunch crossing");
714 fOutputContainer->Add(fhPrimaryVertexBC);
716 fhEMCalBCEvent = new TH1F("hEMCalBCEvent", "Number of events with at least 1 cluster in a bunch crossing ", 19 , 0 , 19 ) ;
717 fhEMCalBCEvent->SetYTitle("# events");
718 fhEMCalBCEvent->SetXTitle("Bunch crossing");
719 for(Int_t i = 1; i < 20; i++)
720 fhEMCalBCEvent->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
721 fOutputContainer->Add(fhEMCalBCEvent);
723 fhEMCalBCEventCut = new TH1F("hEMCalBCEventCut", "Number of events with at least 1 cluster in a bunch crossing", 19 , 0 , 19 ) ;
724 fhEMCalBCEventCut->SetYTitle("# events");
725 fhEMCalBCEventCut->SetXTitle("Bunch crossing");
726 for(Int_t i = 1; i < 20; i++)
727 fhEMCalBCEventCut->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
728 fOutputContainer->Add(fhEMCalBCEventCut);
730 fhXVertexExotic = new TH1F("hXVertexExotic", " X vertex distribution in exotic events" , 200 , -4 , 4 ) ;
731 fhXVertexExotic->SetXTitle("v_{x} (cm)");
732 fOutputContainer->Add(fhXVertexExotic);
734 fhYVertexExotic = new TH1F("hYVertexExotic", " Y vertex distribution in exotic events" , 200 , -4 , 4 ) ;
735 fhYVertexExotic->SetXTitle("v_{y} (cm)");
736 fOutputContainer->Add(fhYVertexExotic);
738 fhZVertexExotic = new TH1F("hZVertexExotic", " Z vertex distribution in exotic events" , 200 , -50 , 50 ) ;
739 fhZVertexExotic->SetXTitle("v_{z} (cm)");
740 fOutputContainer->Add(fhZVertexExotic);
742 fhPileUpClusterMult = new TH1F("hPileUpClusterMult", "Number of clusters per event with large time (|t| > 20 ns)" , 100 , 0 , 100 ) ;
743 fhPileUpClusterMult->SetXTitle("# clusters");
744 fOutputContainer->Add(fhPileUpClusterMult);
746 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 ) ;
747 fhPileUpClusterMultAndSPDPileUp->SetXTitle("# clusters");
748 fOutputContainer->Add(fhPileUpClusterMultAndSPDPileUp);
750 fhNPileUpVertSPD = new TH1F ("hNPileUpVertSPD","N pile-up SPD vertex", 50,0,50);
751 fhNPileUpVertSPD->SetYTitle("# vertex ");
752 fOutputContainer->Add(fhNPileUpVertSPD);
754 fhNPileUpVertTracks = new TH1F ("hNPileUpVertTracks","N pile-up Tracks vertex", 50,0,50);
755 fhNPileUpVertTracks->SetYTitle("# vertex ");
756 fOutputContainer->Add(fhNPileUpVertTracks);
758 if(fReader->IsSelectEventTimeStampOn())
760 fhTimeStampFraction = new TH1F("hTimeStampFraction","Fraction of events within a given time stamp range",150, -1, 2) ;
761 fhTimeStampFraction->SetXTitle("fraction");
762 fOutputContainer->Add(fhTimeStampFraction) ;
768 fhNMergedFiles = new TH1F("hNMergedFiles", "Number of merged output files" , 1 , 0 , 1 ) ;
769 fhNMergedFiles->SetYTitle("# files");
770 fhNMergedFiles->Fill(1); // Fill here with one entry, while merging it will count the rest
771 fOutputContainer->Add(fhNMergedFiles);
773 fhScaleFactor = new TH1F("hScaleFactor", "Number of merged output files" , 1 , 0 , 1 ) ;
774 fhScaleFactor->SetYTitle("scale factor");
775 fhScaleFactor->SetBinContent(1,fScaleFactor); // Fill here
776 fOutputContainer->Add(fhScaleFactor);
779 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
781 AliWarning("Analysis job list not initialized!!!");
782 return fOutputContainer;
785 const Int_t buffersize = 255;
786 char newname[buffersize];
787 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
790 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
792 if(fMakeHisto) // Analysis with histograms as output on
795 //Fill container with appropriate histograms
796 TList * templist = ana ->GetCreateOutputObjects();
797 templist->SetOwner(kFALSE); //Owner is fOutputContainer.
799 for(Int_t i = 0; i < templist->GetEntries(); i++)
802 //Add only to the histogram name the name of the task
803 if( strcmp((templist->At(i))->ClassName(),"TObjString") )
805 snprintf(newname,buffersize, "%s%s", (ana->GetAddedHistogramsStringToName()).Data(), (templist->At(i))->GetName());
806 //printf("name %s, new name %s\n",(templist->At(i))->GetName(),newname);
807 ((TH1*) templist->At(i))->SetName(newname);
810 //Add histogram to general container
811 fOutputContainer->Add(templist->At(i)) ;
817 }// Analysis with histograms as output on
819 }//Loop on analysis defined
821 return fOutputContainer;
825 //___________________________________
826 void AliAnaCaloTrackCorrMaker::Init()
828 //Init container histograms and other common variables
829 // Fill the output list of histograms during the CreateOutputObjects stage.
831 // Activate debug level in maker
833 (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(this->ClassName(),fAnaDebug);
837 GetReader()->SetCaloUtils(GetCaloUtils()); // pass the calo utils pointer to the reader
839 // Activate debug level in reader
840 if( fReader->GetDebug() >= 0 )
841 (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fReader->ClassName(), fReader->GetDebug());
843 // Activate debug level in calo utils
844 if( fCaloUtils->GetDebug() >= 0 )
845 (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(fCaloUtils->ClassName(), fCaloUtils->GetDebug());
847 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
849 AliWarning("Analysis job list not initialized");
853 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
855 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
857 ana->SetReader(fReader); // Set Reader for each analysis
858 ana->SetCaloUtils(fCaloUtils); // Set CaloUtils for each analysis
863 // // Activate debug level in analysis
864 // if( ana->GetDebug() >= 0 )
865 // (AliAnalysisManager::GetAnalysisManager())->AddClassDebug(ana->ClassName(),ana->GetDebug());
867 }//Loop on analysis defined
871 //_____________________________________________
872 void AliAnaCaloTrackCorrMaker::InitParameters()
878 fAnaDebug = 0; // No debugging info displayed by default
882 //______________________________________________________________
883 void AliAnaCaloTrackCorrMaker::Print(const Option_t * opt) const
885 //Print some relevant parameters set for the analysis
890 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
891 printf("Debug level = %d\n", fAnaDebug ) ;
892 printf("Produce Histo = %d\n", fMakeHisto ) ;
893 printf("Produce AOD = %d\n", fMakeAOD ) ;
894 printf("Number of analysis tasks = %d\n", fAnalysisContainer->GetEntries()) ;
896 if(!strcmp("all",opt))
898 printf("Print analysis Tasks settings :\n") ;
899 for(Int_t iana = 0; iana<fAnalysisContainer->GetEntries(); iana++)
901 ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana))->Print("");
904 printf("Print analysis Reader settings :\n") ;
906 printf("Print analysis Calorimeter Utils settings :\n") ;
907 fCaloUtils->Print("");
913 //_____________________________________________________________________________________
914 void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFileName)
916 //Process analysis for this event
918 if(fMakeHisto && !fOutputContainer)
919 AliFatal("Histograms not initialized");
921 AliDebug(1,Form("*** AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d ***",iEntry));
922 AliDebug(2,Form("Current File Name : %s", currentFileName));
923 //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
925 //Each event needs an empty branch
926 TList * aodList = fReader->GetAODBranchList();
927 Int_t nAODBranches = aodList->GetEntries();
928 for(Int_t iaod = 0; iaod < nAODBranches; iaod++)
930 TClonesArray *tca = dynamic_cast<TClonesArray*> (aodList->At(iaod));
931 if(tca) tca->Clear("C");
934 //Set geometry matrices before filling arrays, in case recalibration/position calculation etc is needed
935 fCaloUtils->AccessGeometry(fReader->GetInputEvent());
937 //Set the AODB calibration, bad channels etc. parameters at least once
938 fCaloUtils->AccessOADB(fReader->GetInputEvent());
940 //Tell the reader to fill the data in the 3 detector lists
941 Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
943 //Access pointers, and trigger mask check needed in mixing case
944 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
945 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
947 UInt_t isMBTrigger = kFALSE;
948 UInt_t isTrigger = kFALSE;
951 isMBTrigger = inputHandler->IsEventSelected() & fReader->GetMixEventTriggerMask();
952 isTrigger = inputHandler->IsEventSelected() & fReader->GetEventTriggerMask();
955 //Fill trigger control histograms, make sure it is only for triggered events and
956 // not the MB events used for mixing
957 if(fReader->IsEventTriggerAtSEOn() || isTrigger)
959 fhNEventsIn->Fill(0);
960 FillTriggerControlHistograms();
965 AliDebug(1,Form("*** Skip event *** %d",iEntry));
966 fReader->ResetLists();
970 //Magic line to write events to file
971 if(fReader->WriteDeltaAODToFile())AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
973 //printf(">>>>>>>>>> BEFORE >>>>>>>>>>>\n");
974 //gObjectTable->Print();
976 // Init mag field for tracks in case of ESDs, not really necessary
977 if (!TGeoGlobalMagField::Instance()->GetField() && ((AliESDEvent*) fReader->GetInputEvent()))
978 ((AliESDEvent*)fReader->GetInputEvent())->InitMagneticField();
980 //Loop on analysis algorithms
982 AliDebug(1,"*** Begin analysis ***");
984 Int_t nana = fAnalysisContainer->GetEntries() ;
985 for(Int_t iana = 0; iana < nana; iana++)
987 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
989 ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
991 //Fill pool for mixed event for the analysis that need it
992 if(!fReader->IsEventTriggerAtSEOn() && isMBTrigger)
994 ana->FillEventMixPool();
995 if(!isTrigger) continue; // pool filled do not try to fill AODs or histograms if trigger is not MB
998 //Make analysis, create aods in aod branch and in some cases fill histograms
999 if(fMakeAOD ) ana->MakeAnalysisFillAOD() ;
1001 //Make further analysis with aod branch and fill histograms
1002 if(fMakeHisto) ana->MakeAnalysisFillHistograms() ;
1006 fReader->ResetLists();
1008 // In case of mixing analysis, non triggered events are used,
1009 // do not fill control histograms for a non requested triggered event
1010 if(!fReader->IsEventTriggerAtSEOn() && !isTrigger)
1012 AliDebug(1,"*** End analysis, MB for mixing ***");
1016 FillControlHistograms();
1018 //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
1019 //gObjectTable->Print();
1021 AliDebug(1,"*** End analysis ***");
1025 //__________________________________________________________
1026 void AliAnaCaloTrackCorrMaker::Terminate(TList * outputList)
1028 //Execute Terminate of analysis
1029 //Do some final plots.
1033 AliError("No output list");
1037 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
1040 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
1041 if(ana->MakePlotsOn())ana->Terminate(outputList);
1043 }//Loop on analysis defined