]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.cxx
Static cast needed by C++11
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliAnaCaloTrackCorrMaker.cxx
CommitLineData
f15155ed 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//_____________________________________________________________________________
85c4406e 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
f15155ed 21// the analysis classes that derive from AliAnaCaloTrackCorrBaseClass
22//
23// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
24
25#include <cstdlib>
26
27// --- ROOT system ---
5b96be07 28#include <TClonesArray.h>
29#include <TList.h>
30#include <TH1F.h>
f15155ed 31//#include <TObjectTable.h>
5b96be07 32#include <TGeoGlobalMagField.h>
f15155ed 33
4b7f6e01 34//---- AliRoot system ----
f15155ed 35#include "AliAnalysisManager.h"
f52538d5 36#include "AliInputEventHandler.h"
4b7f6e01 37#include "AliESDEvent.h"
38#include "AliAODEvent.h"
39#include "AliAnaCaloTrackCorrBaseClass.h"
40#include "AliAnaCaloTrackCorrMaker.h"
f15155ed 41
42ClassImp(AliAnaCaloTrackCorrMaker)
43
44
45//__________________________________________________
85c4406e 46AliAnaCaloTrackCorrMaker::AliAnaCaloTrackCorrMaker() :
f15155ed 47TObject(),
4c795f31 48fReader(0), fCaloUtils(0),
f15155ed 49fOutputContainer(new TList ), fAnalysisContainer(new TList ),
85c4406e 50fMakeHisto(kFALSE), fMakeAOD(kFALSE),
51fAnaDebug(0), fCuts(new TList),
accd903d 52fScaleFactor(-1),
914b9fe7 53fFillDataControlHisto(kTRUE),
54// Control histograms
74dc00d2 55fhNEventsIn(0), fhNEvents(0),
56fhNExoticEvents(0), fhNEventsNoTriggerFound(0),
c2a62a94 57fhNPileUpEvents(0), fhNPileUpEventsTriggerBC0(0),
e3f791f6 58fhXVertex(0), fhYVertex(0), fhZVertex(0),
59fhXVertexExotic(0), fhYVertexExotic(0), fhZVertexExotic(0),
d41e07ee 60fhPileUpClusterMult(0), fhPileUpClusterMultAndSPDPileUp(0),
3c1a2e95 61fhTrackMult(0),
62fhCentrality(0), fhEventPlaneAngle(0),
975b29fa 63fhNMergedFiles(0), fhScaleFactor(0),
64fhEMCalBCEvent(0), fhEMCalBCEventCut(0),
da3558c3 65fhTrackBCEvent(0), fhTrackBCEventCut(0),
cc944149 66fhPrimaryVertexBC(0), fhTimeStampFraction(0),
c2a62a94 67fhNPileUpVertSPD(0), fhNPileUpVertTracks(0),
1035a8d9 68
69fhClusterTriggerBC(0), fhClusterTriggerBCExotic(0),
70fhClusterTriggerBCBadCell(0), fhClusterTriggerBCBadCellExotic(0),
71fhClusterTriggerBCBadCluster(0), fhClusterTriggerBCBadClusterExotic(0),
72fhClusterTriggerBCUnMatch(0), fhClusterTriggerBCExoticUnMatch(0),
73fhClusterTriggerBCBadCellUnMatch(0), fhClusterTriggerBCBadCellExoticUnMatch(0),
74fhClusterTriggerBCBadClusterUnMatch(0), fhClusterTriggerBCBadClusterExoticUnMatch(0),
75fhClusterTriggerBCEventBC(0), fhClusterTriggerBCEventBCUnMatch(0),
76fhClusterTriggerBCExoticEventBC(0), fhClusterTriggerBCExoticEventBCUnMatch(0)
f15155ed 77{
78 //Default Ctor
79 if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n");
80
85c4406e 81 for(Int_t i = 0; i < 3; i++)
82 {
83 fhClusterTriggerBCUnMatchReMatch [0] = 0;
84 fhClusterTriggerBCExoticUnMatchReMatch[0] = 0;
85 }
86
f15155ed 87 //Initialize parameters, pointers and histograms
88 InitParameters();
89}
90
91//________________________________________________________________________________________
85c4406e 92AliAnaCaloTrackCorrMaker::AliAnaCaloTrackCorrMaker(const AliAnaCaloTrackCorrMaker & maker) :
f15155ed 93TObject(),
4c795f31 94fReader(), //(new AliCaloTrackReader(*maker.fReader)),
95fCaloUtils(),//(new AliCalorimeterUtils(*maker.fCaloUtils)),
85c4406e 96fOutputContainer(new TList()), fAnalysisContainer(new TList()),
f15155ed 97fMakeHisto(maker.fMakeHisto), fMakeAOD(maker.fMakeAOD),
4c795f31 98fAnaDebug(maker.fAnaDebug), fCuts(new TList()),
accd903d 99fScaleFactor(maker.fScaleFactor),
914b9fe7 100fFillDataControlHisto(maker.fFillDataControlHisto),
74dc00d2 101fhNEventsIn(maker.fhNEventsIn),
a529ae05 102fhNEvents(maker.fhNEvents),
103fhNExoticEvents(maker.fhNExoticEvents),
afb3af8a 104fhNEventsNoTriggerFound(maker.fhNEventsNoTriggerFound),
099de61e 105fhNPileUpEvents(maker.fhNPileUpEvents),
c2a62a94 106fhNPileUpEventsTriggerBC0(maker.fhNPileUpEventsTriggerBC0),
e3f791f6 107fhXVertex(maker.fhXVertex),
108fhYVertex(maker.fhYVertex),
c2a62a94 109fhZVertex(maker.fhZVertex),
e3f791f6 110fhXVertexExotic(maker.fhXVertexExotic),
111fhYVertexExotic(maker.fhYVertexExotic),
112fhZVertexExotic(maker.fhZVertexExotic),
3c1a2e95 113fhPileUpClusterMult(maker.fhPileUpClusterMult),
d41e07ee 114fhPileUpClusterMultAndSPDPileUp(maker.fhPileUpClusterMultAndSPDPileUp),
099de61e 115fhTrackMult(maker.fhTrackMult),
116fhCentrality(maker.fhCentrality),
f7eac3ca 117fhEventPlaneAngle(maker.fhEventPlaneAngle),
85c4406e 118fhNMergedFiles(maker.fhNMergedFiles),
975b29fa 119fhScaleFactor(maker.fhScaleFactor),
120fhEMCalBCEvent(maker.fhEMCalBCEvent),
121fhEMCalBCEventCut(maker.fhEMCalBCEventCut),
122fhTrackBCEvent(maker.fhTrackBCEvent),
da3558c3 123fhTrackBCEventCut(maker.fhTrackBCEventCut),
c5f9edfd 124fhPrimaryVertexBC(maker.fhPrimaryVertexBC),
cc944149 125fhTimeStampFraction(maker.fhTimeStampFraction),
126fhNPileUpVertSPD(maker.fhNPileUpVertSPD),
c2a62a94 127fhNPileUpVertTracks(maker.fhNPileUpVertTracks),
afb3af8a 128fhClusterTriggerBC(maker.fhClusterTriggerBC),
129fhClusterTriggerBCExotic(maker.fhClusterTriggerBCExotic),
1035a8d9 130fhClusterTriggerBCBadCell(maker.fhClusterTriggerBCBadCell),
131fhClusterTriggerBCBadCellExotic(maker.fhClusterTriggerBCBadCellExotic),
132fhClusterTriggerBCBadCluster(maker.fhClusterTriggerBCBadCluster),
133fhClusterTriggerBCBadClusterExotic(maker.fhClusterTriggerBCBadClusterExotic),
afb3af8a 134fhClusterTriggerBCUnMatch(maker.fhClusterTriggerBCUnMatch),
135fhClusterTriggerBCExoticUnMatch(maker.fhClusterTriggerBCExoticUnMatch),
1035a8d9 136fhClusterTriggerBCBadCellUnMatch(maker.fhClusterTriggerBCBadCellUnMatch),
137fhClusterTriggerBCBadCellExoticUnMatch(maker.fhClusterTriggerBCBadCellExoticUnMatch),
138fhClusterTriggerBCBadClusterUnMatch(maker.fhClusterTriggerBCBadClusterUnMatch),
139fhClusterTriggerBCBadClusterExoticUnMatch(maker.fhClusterTriggerBCBadClusterExoticUnMatch),
140fhClusterTriggerBCEventBC(maker.fhClusterTriggerBCEventBC),
141fhClusterTriggerBCEventBCUnMatch(maker.fhClusterTriggerBCEventBCUnMatch),
142fhClusterTriggerBCExoticEventBC(maker.fhClusterTriggerBCExoticEventBC),
143fhClusterTriggerBCExoticEventBCUnMatch(maker.fhClusterTriggerBCExoticEventBCUnMatch)
144
f15155ed 145{
85c4406e 146 for(Int_t i = 0; i < 3; i++)
147 {
148 fhClusterTriggerBCUnMatchReMatch [i] = maker.fhClusterTriggerBCUnMatchReMatch [i];
149 fhClusterTriggerBCExoticUnMatchReMatch[i] = maker.fhClusterTriggerBCExoticUnMatchReMatch[i];
150 }
f15155ed 151 // cpy ctor
152}
153
154//___________________________________________________
85c4406e 155AliAnaCaloTrackCorrMaker::~AliAnaCaloTrackCorrMaker()
f15155ed 156{
157 // Remove all owned pointers.
158
85c4406e 159 // Do not delete it here, already done somewhere else, need to understand where.
f15155ed 160 // if (fOutputContainer) {
161 // fOutputContainer->Clear();
162 // delete fOutputContainer ;
85c4406e 163 // }
f15155ed 164
4c795f31 165 if (fAnalysisContainer)
166 {
f15155ed 167 fAnalysisContainer->Delete();
168 delete fAnalysisContainer ;
85c4406e 169 }
f15155ed 170
171 if (fReader) delete fReader ;
172 if (fCaloUtils) delete fCaloUtils ;
173
4c795f31 174 if(fCuts)
175 {
f15155ed 176 fCuts->Delete();
177 delete fCuts;
178 }
179
180}
181
accd903d 182//__________________________________________________________________
85c4406e 183void AliAnaCaloTrackCorrMaker::AddAnalysis(TObject* ana, Int_t n)
f15155ed 184{
185 // Add analysis depending on AliAnaCaloTrackCorrBaseClass to list
186
187 if ( fAnalysisContainer)
85c4406e 188 {
189 fAnalysisContainer->AddAt(ana,n);
f15155ed 190 }
191 else
85c4406e 192 {
f15155ed 193 printf("AliAnaCaloTrackCorrMaker::AddAnalysis() - AnalysisContainer not initialized\n");
194 abort();
195 }
85c4406e 196}
f15155ed 197
198//_________________________________________________________
199TList * AliAnaCaloTrackCorrMaker::FillAndGetAODBranchList()
85c4406e 200{
f15155ed 201
f6b8da1f 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
f15155ed 205
f6b8da1f 206 TList *aodBranchList = fReader->GetAODBranchList() ;
207
208 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
85c4406e 209 {
210 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
211 if(ana->NewOutputAOD()) aodBranchList->Add(ana->GetCreateOutputAODBranch());
212 }
f6b8da1f 213
214 return aodBranchList ;
f15155ed 215
f15155ed 216}
217
914b9fe7 218//____________________________________________________
b8d661af 219void AliAnaCaloTrackCorrMaker::FillControlHistograms()
220{
221 // Event control histograms
222
cc944149 223 AliVEvent* event = fReader->GetInputEvent();
224 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
225 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
226
b8d661af 227 fhNEvents ->Fill(0); // Number of events analyzed
c2a62a94 228
914b9fe7 229 Double_t v[3];
230 event->GetPrimaryVertex()->GetXYZ(v) ;
231 fhXVertex->Fill(v[0]);
232 fhYVertex->Fill(v[1]);
233 fhZVertex->Fill(v[2]);
234
235 fhTrackMult ->Fill(fReader->GetTrackMultiplicity());
236 fhCentrality ->Fill(fReader->GetEventCentrality ());
237 fhEventPlaneAngle ->Fill(fReader->GetEventPlaneAngle ());
238
239 if(fFillDataControlHisto)
c2a62a94 240 {
241 if( fReader->IsPileUpFromSPD())
914b9fe7 242 fhNPileUpEvents->Fill(0.5);
c2a62a94 243 //if( event->IsPileupFromSPDInMultBins())
914b9fe7 244 // fhNPileUpEvents->Fill(1.5);
c2a62a94 245 if( fReader->IsPileUpFromEMCal())
914b9fe7 246 fhNPileUpEvents->Fill(2.5);
c2a62a94 247 if( fReader->IsPileUpFromSPDOrEMCal() )
914b9fe7 248 fhNPileUpEvents->Fill(3.5);
c2a62a94 249 if( fReader->IsPileUpFromSPDAndEMCal() )
914b9fe7 250 fhNPileUpEvents->Fill(4.5);
c2a62a94 251 if( fReader->IsPileUpFromSPDAndNotEMCal() )
914b9fe7 252 fhNPileUpEvents->Fill(5.5);
c2a62a94 253 if( fReader->IsPileUpFromEMCalAndNotSPD() )
914b9fe7 254 fhNPileUpEvents->Fill(6.5);
c2a62a94 255 if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
914b9fe7 256 fhNPileUpEvents->Fill(7.5);
257
258 Int_t triggerBC = fReader->GetTriggerClusterBC() ;
259 if( triggerBC == 0 &&
260 !fReader->IsExoticEvent() &&
261 !fReader->IsBadCellTriggerEvent())
262 {
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);
279 }
280
281 if(fReader->IsPileUpFromSPD())
282 fhPileUpClusterMultAndSPDPileUp ->Fill(fReader->GetNPileUpClusters());
283
284 fhPileUpClusterMult ->Fill(fReader->GetNPileUpClusters ());
285
286 for(Int_t i = 0; i < 19; i++)
287 {
74dc00d2 288 if(fReader->IsAccessToTrackTimeOn())
289 {
290 if(fReader->GetTrackEventBC(i)) fhTrackBCEvent ->Fill(i);
291 if(fReader->GetTrackEventBCcut(i))fhTrackBCEventCut->Fill(i);
292 }
914b9fe7 293 if(fReader->GetEMCalEventBC(i)) fhEMCalBCEvent ->Fill(i);
294 if(fReader->GetEMCalEventBCcut(i))fhEMCalBCEventCut->Fill(i);
295 }
296
297 Int_t bc = fReader->GetVertexBC();
74dc00d2 298 if(bc!=AliVTrack::kTOFBCNA) fhPrimaryVertexBC->Fill(bc);
914b9fe7 299
300 // N pile up vertices
301 Int_t nVerticesSPD = -1;
302 Int_t nVerticesTracks = -1;
303
304 if (esdevent)
305 {
306 nVerticesSPD = esdevent->GetNumberOfPileupVerticesSPD();
307 nVerticesTracks = esdevent->GetNumberOfPileupVerticesTracks();
308
309 }//ESD
310 else if (aodevent)
311 {
312 nVerticesSPD = aodevent->GetNumberOfPileupVerticesSPD();
313 nVerticesTracks = aodevent->GetNumberOfPileupVerticesTracks();
314 }//AOD
315
316 fhNPileUpVertSPD ->Fill(nVerticesSPD);
317 fhNPileUpVertTracks->Fill(nVerticesTracks);
318
319 // Time stamp
320 if(fReader->IsSelectEventTimeStampOn() && esdevent)
321 {
322 Int_t timeStamp = esdevent->GetTimeStamp();
323 Float_t timeStampFrac = 1.*(timeStamp-fReader->GetRunTimeStampMin()) /
324 (fReader->GetRunTimeStampMax()-fReader->GetRunTimeStampMin());
325
326 //printf("stamp %d, min %d, max %d, frac %f\n", timeStamp, fReader->GetRunTimeStampMin(), fReader->GetRunTimeStampMax(), timeStampFrac);
327
328 fhTimeStampFraction->Fill(timeStampFrac);
329 }
c2a62a94 330 }
914b9fe7 331}
332
333//___________________________________________________________
334void AliAnaCaloTrackCorrMaker::FillTriggerControlHistograms()
335{
336 if(!fFillDataControlHisto) return;
c2a62a94 337
914b9fe7 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() ;
73aeefb9 345
914b9fe7 346 Bool_t reMatchOpenTime = fReader->IsTriggerMatchedOpenCuts(0);
347 Bool_t reMatchNeigbour = fReader->IsTriggerMatchedOpenCuts(1);
348 Bool_t reMatchBoth = fReader->IsTriggerMatchedOpenCuts(2);
b8d661af 349
914b9fe7 350 if(triggerId < 0)
b8d661af 351 {
914b9fe7 352 //printf("Trigger id %d\n",triggerId);
74dc00d2 353 if(triggerId == -2) fhNEventsNoTriggerFound->Fill(0);
914b9fe7 354 triggerBCOK = kFALSE;
b8d661af 355 }
356
914b9fe7 357 if(exotic)
358 {
359 fhNExoticEvents->Fill(0) ;
360 Double_t v[3];
361 fReader->GetInputEvent()->GetPrimaryVertex()->GetXYZ(v) ;
362 fhXVertexExotic->Fill(v[0]);
363 fhYVertexExotic->Fill(v[1]);
364 fhZVertexExotic->Fill(v[2]);
365 }
366 //if(fReader->IsExoticEvent()) printf("Maker: EXOTIC Cluster trigger\n");
b8d661af 367
914b9fe7 368 if(!triggerBCOK) return;
b8d661af 369
914b9fe7 370 Int_t eventBC = fReader->GetInputEvent()->GetBunchCrossNumber();
371 if(eventBC%4 < 0 || eventBC%4 > 3 )
372 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - STRANGE: Trigger BC %d - Event BC %d, modulo4 %d \n",triggerBC,eventBC,eventBC%4);
b8d661af 373
914b9fe7 374 if(triggerMatch)
cc944149 375 {
914b9fe7 376 if (!exotic && !badCluster) fhClusterTriggerBC->Fill(triggerBC);
377 else if( exotic && badCluster)
378 {
379 fhClusterTriggerBCBadClusterExotic->Fill(triggerBC);
380 if(badCell) fhClusterTriggerBCBadCellExotic->Fill(triggerBC);
381 }
382 else if( exotic && !badCluster) fhClusterTriggerBCExotic->Fill(triggerBC);
383 else if( badCluster && !exotic )
384 {
385 fhClusterTriggerBCBadCluster ->Fill(triggerBC);
386 if(badCell) fhClusterTriggerBCBadCell->Fill(triggerBC);
387 }
cc944149 388
914b9fe7 389 if(!exotic) fhClusterTriggerBCEventBC ->Fill(triggerBC,eventBC%4);
390 else fhClusterTriggerBCExoticEventBC->Fill(triggerBC,eventBC%4);
391 }
392 else
b8d661af 393 {
914b9fe7 394 if (!exotic && !badCluster)
395 {
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);
400 }
401 else if( exotic && badCluster)
402 {
403 fhClusterTriggerBCBadClusterExoticUnMatch->Fill(triggerBC);
404 if(badCell) fhClusterTriggerBCBadCellExoticUnMatch ->Fill(triggerBC);
405 }
406 else if( exotic && !badCluster)
407 {
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);
412 }
413 else if( badCluster && !exotic )
414 {
415 fhClusterTriggerBCBadClusterUnMatch->Fill(triggerBC);
416 if(badCell)fhClusterTriggerBCBadCellUnMatch->Fill(triggerBC);
417 }
85c4406e 418
914b9fe7 419 if(!exotic) fhClusterTriggerBCEventBCUnMatch ->Fill(triggerBC,eventBC%4);
420 else fhClusterTriggerBCExoticEventBCUnMatch->Fill(triggerBC,eventBC%4);
b8d661af 421 }
914b9fe7 422
b8d661af 423}
424
914b9fe7 425
f15155ed 426//_______________________________________________________
427TList * AliAnaCaloTrackCorrMaker::GetListOfAnalysisCuts()
85c4406e 428{
f15155ed 429
f6b8da1f 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
f15155ed 432
f6b8da1f 433 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
85c4406e 434 {
435 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
436 TObjString * objstring = ana->GetAnalysisCuts();
437
438 if(objstring)fCuts->Add(objstring);
439 }
4c795f31 440
f6b8da1f 441 return fCuts ;
f15155ed 442
443}
444
445//___________________________________________________
446TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
447{
448 // Fill the output list of histograms during the CreateOutputObjects stage.
449
450 //Initialize calorimeters geometry pointers
55d66f31 451 //GetCaloUtils()->InitPHOSGeometry();
452 //GetCaloUtils()->InitEMCALGeometry();
f15155ed 453
f15155ed 454 //General event histograms
74dc00d2 455
456 fhNEventsIn = new TH1F("hNEventsIn", "Number of input events" , 1 , 0 , 1 ) ;
457 fhNEventsIn->SetYTitle("# events");
458 fOutputContainer->Add(fhNEventsIn);
f15155ed 459
4b7f6e01 460 fhNEvents = new TH1F("hNEvents", "Number of analyzed events" , 1 , 0 , 1 ) ;
4c795f31 461 fhNEvents->SetYTitle("# events");
f15155ed 462 fOutputContainer->Add(fhNEvents);
4c795f31 463
e3f791f6 464 fhXVertex = new TH1F("hXVertex", " X vertex distribution" , 200 , -4 , 4 ) ;
465 fhXVertex->SetXTitle("v_{x} (cm)");
466 fOutputContainer->Add(fhXVertex);
467
468 fhYVertex = new TH1F("hYVertex", " Y vertex distribution" , 200 , -4 , 4 ) ;
469 fhYVertex->SetXTitle("v_{y} (cm)");
470 fOutputContainer->Add(fhYVertex);
471
accd903d 472 fhZVertex = new TH1F("hZVertex", " Z vertex distribution" , 200 , -50 , 50 ) ;
d2655d46 473 fhZVertex->SetXTitle("v_{z} (cm)");
474 fOutputContainer->Add(fhZVertex);
914b9fe7 475
accd903d 476 fhCentrality = new TH1F("hCentrality","Number of events in centrality bin",100,0.,100) ;
4c795f31 477 fhCentrality->SetXTitle("Centrality bin");
85c4406e 478 fOutputContainer->Add(fhCentrality) ;
4c795f31 479
f7eac3ca 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) ;
914b9fe7 483
484 fhTrackMult = new TH1F("hTrackMult", "Number of tracks per events" , 2000 , 0 , 2000 ) ;
485 fhTrackMult->SetXTitle("# tracks");
486 fOutputContainer->Add(fhTrackMult);
487
488 if(fFillDataControlHisto)
b8d661af 489 {
914b9fe7 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);
493
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);
497
498
499 Int_t nbin = 11;
500 Float_t minbin =-5.5;
501 Float_t maxbin = 5.5;
502 Int_t labelshift = 6;
503
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);
514
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);
524
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);
534
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);
544
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);
552
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);
560
561
562 fhClusterTriggerBCBadCell = new TH1F("hClusterTriggerBCBadCell",
563 "Number of analyzed events triggered by a bad cell in a given BC",
564 nbin , minbin ,maxbin) ;
565
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);
570
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);
578
579 fhClusterTriggerBCBadCluster = new TH1F("hClusterTriggerBCBadCluster",
580 "Number of analyzed events triggered by a bad cluster in a given BC",
581 nbin , minbin ,maxbin) ;
582
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);
587
588
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) ;
592
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);
597
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);
605
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);
613
614
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);
622
623
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);
631
632
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);
640
641
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);
649
650 TString rematch[] = {"OpenTime","CheckNeighbours","Both"};
651 for(Int_t j = 0; j < 3; j++)
652 {
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]);
660
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]);
668 }
669
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);
681
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);
693
74dc00d2 694 if(fReader->IsAccessToTrackTimeOn())
695 {
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);
702
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);
709 }
914b9fe7 710
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);
715
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);
722
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);
729
730 fhXVertexExotic = new TH1F("hXVertexExotic", " X vertex distribution in exotic events" , 200 , -4 , 4 ) ;
731 fhXVertexExotic->SetXTitle("v_{x} (cm)");
732 fOutputContainer->Add(fhXVertexExotic);
733
734 fhYVertexExotic = new TH1F("hYVertexExotic", " Y vertex distribution in exotic events" , 200 , -4 , 4 ) ;
735 fhYVertexExotic->SetXTitle("v_{y} (cm)");
736 fOutputContainer->Add(fhYVertexExotic);
737
738 fhZVertexExotic = new TH1F("hZVertexExotic", " Z vertex distribution in exotic events" , 200 , -50 , 50 ) ;
739 fhZVertexExotic->SetXTitle("v_{z} (cm)");
740 fOutputContainer->Add(fhZVertexExotic);
741
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);
745
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);
749
750 fhNPileUpVertSPD = new TH1F ("hNPileUpVertSPD","N pile-up SPD vertex", 50,0,50);
751 fhNPileUpVertSPD->SetYTitle("# vertex ");
752 fOutputContainer->Add(fhNPileUpVertSPD);
753
754 fhNPileUpVertTracks = new TH1F ("hNPileUpVertTracks","N pile-up Tracks vertex", 50,0,50);
755 fhNPileUpVertTracks->SetYTitle("# vertex ");
756 fOutputContainer->Add(fhNPileUpVertTracks);
757
758 if(fReader->IsSelectEventTimeStampOn())
759 {
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) ;
763 }
b8d661af 764 }
765
accd903d 766 if(fScaleFactor > 0)
767 {
4b7f6e01 768 fhNMergedFiles = new TH1F("hNMergedFiles", "Number of merged output files" , 1 , 0 , 1 ) ;
accd903d 769 fhNMergedFiles->SetYTitle("# files");
770 fhNMergedFiles->Fill(1); // Fill here with one entry, while merging it will count the rest
771 fOutputContainer->Add(fhNMergedFiles);
772
773 fhScaleFactor = new TH1F("hScaleFactor", "Number of merged output files" , 1 , 0 , 1 ) ;
774 fhScaleFactor->SetYTitle("scale factor");
85c4406e 775 fhScaleFactor->SetBinContent(1,fScaleFactor); // Fill here
776 fOutputContainer->Add(fhScaleFactor);
accd903d 777 }
778
4c795f31 779 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
780 {
781 printf("AliAnaCaloTrackCorrMaker::GetOutputContainer() - Analysis job list not initialized!!!\n");
782 return fOutputContainer;
783 }
784
785 const Int_t buffersize = 255;
786 char newname[buffersize];
787 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
788 {
789
790 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
791
792 if(fMakeHisto) // Analysis with histograms as output on
793 {
794
85c4406e 795 //Fill container with appropriate histograms
796 TList * templist = ana ->GetCreateOutputObjects();
4c795f31 797 templist->SetOwner(kFALSE); //Owner is fOutputContainer.
798
799 for(Int_t i = 0; i < templist->GetEntries(); i++)
800 {
801
802 //Add only to the histogram name the name of the task
85c4406e 803 if( strcmp((templist->At(i))->ClassName(),"TObjString") )
4c795f31 804 {
4b7f6e01 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);
4c795f31 807 ((TH1*) templist->At(i))->SetName(newname);
808 }
809
810 //Add histogram to general container
811 fOutputContainer->Add(templist->At(i)) ;
812
813 }
814
815 delete templist;
816
817 }// Analysis with histograms as output on
818
819 }//Loop on analysis defined
820
f15155ed 821 return fOutputContainer;
822
823}
824
825//___________________________________
826void AliAnaCaloTrackCorrMaker::Init()
85c4406e 827{
f15155ed 828 //Init container histograms and other common variables
829 // Fill the output list of histograms during the CreateOutputObjects stage.
830
831 //Initialize reader
832 GetReader()->Init();
833 GetReader()->SetCaloUtils(GetCaloUtils()); // pass the calo utils pointer to the reader
834
835
4c795f31 836 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
837 {
f15155ed 838 printf("AliAnaCaloTrackCorrMaker::GetOutputInit() - Analysis job list not initialized!!!\n");
4c795f31 839 return;
f15155ed 840 }
4c795f31 841
842 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
843 {
f15155ed 844
4c795f31 845 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
846
847 ana->SetReader(fReader); // Set Reader for each analysis
848 ana->SetCaloUtils(fCaloUtils); // Set CaloUtils for each analysis
849
850 ana->Init();
851
852 }//Loop on analysis defined
853
f15155ed 854}
855
856//_____________________________________________
857void AliAnaCaloTrackCorrMaker::InitParameters()
85c4406e 858{
f15155ed 859 //Init data members
860
861 fMakeHisto = kTRUE;
85c4406e 862 fMakeAOD = kTRUE;
f15155ed 863 fAnaDebug = 0; // No debugging info displayed by default
864
865}
866
867//______________________________________________________________
868void AliAnaCaloTrackCorrMaker::Print(const Option_t * opt) const
85c4406e 869{
f15155ed 870 //Print some relevant parameters set for the analysis
871
872 if(! opt)
873 return;
874
875 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
4c795f31 876 printf("Debug level = %d\n", fAnaDebug ) ;
877 printf("Produce Histo = %d\n", fMakeHisto ) ;
878 printf("Produce AOD = %d\n", fMakeAOD ) ;
f15155ed 879 printf("Number of analysis tasks = %d\n", fAnalysisContainer->GetEntries()) ;
880
4c795f31 881 if(!strcmp("all",opt))
85c4406e 882 {
883 printf("Print analysis Tasks settings :\n") ;
884 for(Int_t iana = 0; iana<fAnalysisContainer->GetEntries(); iana++)
4c795f31 885 {
85c4406e 886 ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana))->Print("");
887 }
888
889 printf("Print analysis Reader settings :\n") ;
890 fReader->Print("");
891 printf("Print analysis Calorimeter Utils settings :\n") ;
892 fCaloUtils->Print("");
893
f15155ed 894 }
4c795f31 895
85c4406e 896}
f15155ed 897
8a2dbbff 898//_____________________________________________________________________________________
899void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFileName)
f15155ed 900{
901 //Process analysis for this event
902
4c795f31 903 if(fMakeHisto && !fOutputContainer)
85c4406e 904 {
905 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Histograms not initialized\n");
906 abort();
907 }
f6b8da1f 908
4c795f31 909 if(fAnaDebug >= 0 )
85c4406e 910 {
911 printf("*** AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d *** \n",iEntry);
912 if(fAnaDebug > 1 )
4c795f31 913 {
85c4406e 914 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Current File Name : %s\n", currentFileName);
915 //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
f6b8da1f 916 }
85c4406e 917 }
f15155ed 918
919 //Each event needs an empty branch
920 TList * aodList = fReader->GetAODBranchList();
921 Int_t nAODBranches = aodList->GetEntries();
4c795f31 922 for(Int_t iaod = 0; iaod < nAODBranches; iaod++)
923 {
f15155ed 924 TClonesArray *tca = dynamic_cast<TClonesArray*> (aodList->At(iaod));
925 if(tca) tca->Clear("C");
926 }
927
928 //Set geometry matrices before filling arrays, in case recalibration/position calculation etc is needed
85c4406e 929 fCaloUtils->AccessGeometry(fReader->GetInputEvent());
55d66f31 930
931 //Set the AODB calibration, bad channels etc. parameters at least once
85c4406e 932 fCaloUtils->AccessOADB(fReader->GetInputEvent());
f15155ed 933
934 //Tell the reader to fill the data in the 3 detector lists
935 Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
c2a62a94 936
73aeefb9 937 //Access pointers, and trigger mask check needed in mixing case
938 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
939 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
940
941 UInt_t isMBTrigger = kFALSE;
942 UInt_t isTrigger = kFALSE;
943 if(inputHandler)
944 {
945 isMBTrigger = inputHandler->IsEventSelected() & fReader->GetMixEventTriggerMask();
946 isTrigger = inputHandler->IsEventSelected() & fReader->GetEventTriggerMask();
947 }
948
949 //Fill trigger control histograms, make sure it is only for triggered events and
950 // not the MB events used for mixing
74dc00d2 951 if(fReader->IsEventTriggerAtSEOn() || isTrigger)
952 {
953 fhNEventsIn->Fill(0);
954 FillTriggerControlHistograms();
955 }
afb3af8a 956
4c795f31 957 if(!ok)
85c4406e 958 {
f6b8da1f 959 if(fAnaDebug >= 1 )printf("*** Skip event *** %d \n",iEntry);
a0c23d83 960 fReader->ResetLists();
f6b8da1f 961 return ;
f15155ed 962 }
c2a62a94 963
f15155ed 964 //Magic line to write events to file
965 if(fReader->WriteDeltaAODToFile())AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
966
967 //printf(">>>>>>>>>> BEFORE >>>>>>>>>>>\n");
968 //gObjectTable->Print();
4c795f31 969
5b96be07 970 // Init mag field for tracks in case of ESDs, not really necessary
971 if (!TGeoGlobalMagField::Instance()->GetField() && ((AliESDEvent*) fReader->GetInputEvent()))
972 ((AliESDEvent*)fReader->GetInputEvent())->InitMagneticField();
973
f15155ed 974 //Loop on analysis algorithms
4c795f31 975
f15155ed 976 if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
4c795f31 977
f15155ed 978 Int_t nana = fAnalysisContainer->GetEntries() ;
4c795f31 979 for(Int_t iana = 0; iana < nana; iana++)
980 {
85c4406e 981 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
f15155ed 982
983 ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
31864468 984
985 //Fill pool for mixed event for the analysis that need it
bcd08add 986 if(!fReader->IsEventTriggerAtSEOn() && isMBTrigger)
31864468 987 {
bcd08add 988 ana->FillEventMixPool();
ce3054c8 989 if(!isTrigger) continue; // pool filled do not try to fill AODs or histograms if trigger is not MB
31864468 990 }
991
992 //Make analysis, create aods in aod branch and in some cases fill histograms
f15155ed 993 if(fMakeAOD ) ana->MakeAnalysisFillAOD() ;
31864468 994
f15155ed 995 //Make further analysis with aod branch and fill histograms
996 if(fMakeHisto) ana->MakeAnalysisFillHistograms() ;
997
998 }
999
f52538d5 1000 fReader->ResetLists();
85c4406e 1001
f52538d5 1002 // In case of mixing analysis, non triggered events are used,
1003 // do not fill control histograms for a non requested triggered event
bcd08add 1004 if(!fReader->IsEventTriggerAtSEOn() && !isTrigger)
85c4406e 1005 {
bcd08add 1006 if(fAnaDebug > 0 ) printf("AliAnaCaloTrackMaker::ProcessEvent() - *** End analysis, MB for mixing *** \n");
1007 return;
f52538d5 1008 }
1009
b8d661af 1010 FillControlHistograms();
975b29fa 1011
f15155ed 1012 //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
1013 //gObjectTable->Print();
1014
f52538d5 1015 if(fAnaDebug > 0 ) printf("AliAnaCaloTrackMaker::ProcessEvent() - *** End analysis *** \n");
f15155ed 1016
1017}
1018
1019//__________________________________________________________
1020void AliAnaCaloTrackCorrMaker::Terminate(TList * outputList)
85c4406e 1021{
f15155ed 1022 //Execute Terminate of analysis
1023 //Do some final plots.
1024
85c4406e 1025 if (!outputList)
4c795f31 1026 {
f6b8da1f 1027 Error("Terminate", "No output list");
1028 return;
f15155ed 1029 }
f6b8da1f 1030
4c795f31 1031 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
85c4406e 1032 {
1033
1034 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
1035 if(ana->MakePlotsOn())ana->Terminate(outputList);
1036
1037 }//Loop on analysis defined
4c795f31 1038
f15155ed 1039}
1040