]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[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
c2a62a94 55fhNEvents(0), fhNExoticEvents(0),
afb3af8a 56fhNEventsNoTriggerFound(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),
a529ae05 101fhNEvents(maker.fhNEvents),
102fhNExoticEvents(maker.fhNExoticEvents),
afb3af8a 103fhNEventsNoTriggerFound(maker.fhNEventsNoTriggerFound),
099de61e 104fhNPileUpEvents(maker.fhNPileUpEvents),
c2a62a94 105fhNPileUpEventsTriggerBC0(maker.fhNPileUpEventsTriggerBC0),
e3f791f6 106fhXVertex(maker.fhXVertex),
107fhYVertex(maker.fhYVertex),
c2a62a94 108fhZVertex(maker.fhZVertex),
e3f791f6 109fhXVertexExotic(maker.fhXVertexExotic),
110fhYVertexExotic(maker.fhYVertexExotic),
111fhZVertexExotic(maker.fhZVertexExotic),
3c1a2e95 112fhPileUpClusterMult(maker.fhPileUpClusterMult),
d41e07ee 113fhPileUpClusterMultAndSPDPileUp(maker.fhPileUpClusterMultAndSPDPileUp),
099de61e 114fhTrackMult(maker.fhTrackMult),
115fhCentrality(maker.fhCentrality),
f7eac3ca 116fhEventPlaneAngle(maker.fhEventPlaneAngle),
85c4406e 117fhNMergedFiles(maker.fhNMergedFiles),
975b29fa 118fhScaleFactor(maker.fhScaleFactor),
119fhEMCalBCEvent(maker.fhEMCalBCEvent),
120fhEMCalBCEventCut(maker.fhEMCalBCEventCut),
121fhTrackBCEvent(maker.fhTrackBCEvent),
da3558c3 122fhTrackBCEventCut(maker.fhTrackBCEventCut),
c5f9edfd 123fhPrimaryVertexBC(maker.fhPrimaryVertexBC),
cc944149 124fhTimeStampFraction(maker.fhTimeStampFraction),
125fhNPileUpVertSPD(maker.fhNPileUpVertSPD),
c2a62a94 126fhNPileUpVertTracks(maker.fhNPileUpVertTracks),
afb3af8a 127fhClusterTriggerBC(maker.fhClusterTriggerBC),
128fhClusterTriggerBCExotic(maker.fhClusterTriggerBCExotic),
1035a8d9 129fhClusterTriggerBCBadCell(maker.fhClusterTriggerBCBadCell),
130fhClusterTriggerBCBadCellExotic(maker.fhClusterTriggerBCBadCellExotic),
131fhClusterTriggerBCBadCluster(maker.fhClusterTriggerBCBadCluster),
132fhClusterTriggerBCBadClusterExotic(maker.fhClusterTriggerBCBadClusterExotic),
afb3af8a 133fhClusterTriggerBCUnMatch(maker.fhClusterTriggerBCUnMatch),
134fhClusterTriggerBCExoticUnMatch(maker.fhClusterTriggerBCExoticUnMatch),
1035a8d9 135fhClusterTriggerBCBadCellUnMatch(maker.fhClusterTriggerBCBadCellUnMatch),
136fhClusterTriggerBCBadCellExoticUnMatch(maker.fhClusterTriggerBCBadCellExoticUnMatch),
137fhClusterTriggerBCBadClusterUnMatch(maker.fhClusterTriggerBCBadClusterUnMatch),
138fhClusterTriggerBCBadClusterExoticUnMatch(maker.fhClusterTriggerBCBadClusterExoticUnMatch),
139fhClusterTriggerBCEventBC(maker.fhClusterTriggerBCEventBC),
140fhClusterTriggerBCEventBCUnMatch(maker.fhClusterTriggerBCEventBCUnMatch),
141fhClusterTriggerBCExoticEventBC(maker.fhClusterTriggerBCExoticEventBC),
142fhClusterTriggerBCExoticEventBCUnMatch(maker.fhClusterTriggerBCExoticEventBCUnMatch)
143
f15155ed 144{
85c4406e 145 for(Int_t i = 0; i < 3; i++)
146 {
147 fhClusterTriggerBCUnMatchReMatch [i] = maker.fhClusterTriggerBCUnMatchReMatch [i];
148 fhClusterTriggerBCExoticUnMatchReMatch[i] = maker.fhClusterTriggerBCExoticUnMatchReMatch[i];
149 }
f15155ed 150 // cpy ctor
151}
152
153//___________________________________________________
85c4406e 154AliAnaCaloTrackCorrMaker::~AliAnaCaloTrackCorrMaker()
f15155ed 155{
156 // Remove all owned pointers.
157
85c4406e 158 // Do not delete it here, already done somewhere else, need to understand where.
f15155ed 159 // if (fOutputContainer) {
160 // fOutputContainer->Clear();
161 // delete fOutputContainer ;
85c4406e 162 // }
f15155ed 163
4c795f31 164 if (fAnalysisContainer)
165 {
f15155ed 166 fAnalysisContainer->Delete();
167 delete fAnalysisContainer ;
85c4406e 168 }
f15155ed 169
170 if (fReader) delete fReader ;
171 if (fCaloUtils) delete fCaloUtils ;
172
4c795f31 173 if(fCuts)
174 {
f15155ed 175 fCuts->Delete();
176 delete fCuts;
177 }
178
179}
180
accd903d 181//__________________________________________________________________
85c4406e 182void AliAnaCaloTrackCorrMaker::AddAnalysis(TObject* ana, Int_t n)
f15155ed 183{
184 // Add analysis depending on AliAnaCaloTrackCorrBaseClass to list
185
186 if ( fAnalysisContainer)
85c4406e 187 {
188 fAnalysisContainer->AddAt(ana,n);
f15155ed 189 }
190 else
85c4406e 191 {
f15155ed 192 printf("AliAnaCaloTrackCorrMaker::AddAnalysis() - AnalysisContainer not initialized\n");
193 abort();
194 }
85c4406e 195}
f15155ed 196
197//_________________________________________________________
198TList * AliAnaCaloTrackCorrMaker::FillAndGetAODBranchList()
85c4406e 199{
f15155ed 200
f6b8da1f 201 // Get any new output AOD branches from analysis and put them in a list
202 // The list is filled in the maker, and new branch passed to the analysis frame
203 // AliAnalysisTaskCaloTrackCorrelation
f15155ed 204
f6b8da1f 205 TList *aodBranchList = fReader->GetAODBranchList() ;
206
207 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
85c4406e 208 {
209 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
210 if(ana->NewOutputAOD()) aodBranchList->Add(ana->GetCreateOutputAODBranch());
211 }
f6b8da1f 212
213 return aodBranchList ;
f15155ed 214
f15155ed 215}
216
914b9fe7 217//____________________________________________________
b8d661af 218void AliAnaCaloTrackCorrMaker::FillControlHistograms()
219{
220 // Event control histograms
221
cc944149 222 AliVEvent* event = fReader->GetInputEvent();
223 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (event);
224 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
225
b8d661af 226 fhNEvents ->Fill(0); // Number of events analyzed
c2a62a94 227
914b9fe7 228 Double_t v[3];
229 event->GetPrimaryVertex()->GetXYZ(v) ;
230 fhXVertex->Fill(v[0]);
231 fhYVertex->Fill(v[1]);
232 fhZVertex->Fill(v[2]);
233
234 fhTrackMult ->Fill(fReader->GetTrackMultiplicity());
235 fhCentrality ->Fill(fReader->GetEventCentrality ());
236 fhEventPlaneAngle ->Fill(fReader->GetEventPlaneAngle ());
237
238 if(fFillDataControlHisto)
c2a62a94 239 {
240 if( fReader->IsPileUpFromSPD())
914b9fe7 241 fhNPileUpEvents->Fill(0.5);
c2a62a94 242 //if( event->IsPileupFromSPDInMultBins())
914b9fe7 243 // fhNPileUpEvents->Fill(1.5);
c2a62a94 244 if( fReader->IsPileUpFromEMCal())
914b9fe7 245 fhNPileUpEvents->Fill(2.5);
c2a62a94 246 if( fReader->IsPileUpFromSPDOrEMCal() )
914b9fe7 247 fhNPileUpEvents->Fill(3.5);
c2a62a94 248 if( fReader->IsPileUpFromSPDAndEMCal() )
914b9fe7 249 fhNPileUpEvents->Fill(4.5);
c2a62a94 250 if( fReader->IsPileUpFromSPDAndNotEMCal() )
914b9fe7 251 fhNPileUpEvents->Fill(5.5);
c2a62a94 252 if( fReader->IsPileUpFromEMCalAndNotSPD() )
914b9fe7 253 fhNPileUpEvents->Fill(6.5);
c2a62a94 254 if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
914b9fe7 255 fhNPileUpEvents->Fill(7.5);
256
257 Int_t triggerBC = fReader->GetTriggerClusterBC() ;
258 if( triggerBC == 0 &&
259 !fReader->IsExoticEvent() &&
260 !fReader->IsBadCellTriggerEvent())
261 {
262 if( fReader->IsPileUpFromSPD())
263 fhNPileUpEventsTriggerBC0->Fill(0.5);
264 //if( event->IsPileupFromSPDInMultBins())
265 // fhNPileUpEventsTriggerBC0->Fill(1.5);
266 if( fReader->IsPileUpFromEMCal())
267 fhNPileUpEventsTriggerBC0->Fill(2.5);
268 if( fReader->IsPileUpFromSPDOrEMCal() )
269 fhNPileUpEventsTriggerBC0->Fill(3.5);
270 if( fReader->IsPileUpFromSPDAndEMCal() )
271 fhNPileUpEventsTriggerBC0->Fill(4.5);
272 if( fReader->IsPileUpFromSPDAndNotEMCal() )
273 fhNPileUpEventsTriggerBC0->Fill(5.5);
274 if( fReader->IsPileUpFromEMCalAndNotSPD() )
275 fhNPileUpEventsTriggerBC0->Fill(6.5);
276 if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
277 fhNPileUpEventsTriggerBC0->Fill(7.5);
278 }
279
280 if(fReader->IsPileUpFromSPD())
281 fhPileUpClusterMultAndSPDPileUp ->Fill(fReader->GetNPileUpClusters());
282
283 fhPileUpClusterMult ->Fill(fReader->GetNPileUpClusters ());
284
285 for(Int_t i = 0; i < 19; i++)
286 {
287 if(fReader->GetTrackEventBC(i)) fhTrackBCEvent ->Fill(i);
288 if(fReader->GetTrackEventBCcut(i))fhTrackBCEventCut->Fill(i);
289 if(fReader->GetEMCalEventBC(i)) fhEMCalBCEvent ->Fill(i);
290 if(fReader->GetEMCalEventBCcut(i))fhEMCalBCEventCut->Fill(i);
291 }
292
293 Int_t bc = fReader->GetVertexBC();
294 if(bc!=AliVTrack::kTOFBCNA)fhPrimaryVertexBC->Fill(bc);
295
296
297 // N pile up vertices
298 Int_t nVerticesSPD = -1;
299 Int_t nVerticesTracks = -1;
300
301 if (esdevent)
302 {
303 nVerticesSPD = esdevent->GetNumberOfPileupVerticesSPD();
304 nVerticesTracks = esdevent->GetNumberOfPileupVerticesTracks();
305
306 }//ESD
307 else if (aodevent)
308 {
309 nVerticesSPD = aodevent->GetNumberOfPileupVerticesSPD();
310 nVerticesTracks = aodevent->GetNumberOfPileupVerticesTracks();
311 }//AOD
312
313 fhNPileUpVertSPD ->Fill(nVerticesSPD);
314 fhNPileUpVertTracks->Fill(nVerticesTracks);
315
316 // Time stamp
317 if(fReader->IsSelectEventTimeStampOn() && esdevent)
318 {
319 Int_t timeStamp = esdevent->GetTimeStamp();
320 Float_t timeStampFrac = 1.*(timeStamp-fReader->GetRunTimeStampMin()) /
321 (fReader->GetRunTimeStampMax()-fReader->GetRunTimeStampMin());
322
323 //printf("stamp %d, min %d, max %d, frac %f\n", timeStamp, fReader->GetRunTimeStampMin(), fReader->GetRunTimeStampMax(), timeStampFrac);
324
325 fhTimeStampFraction->Fill(timeStampFrac);
326 }
c2a62a94 327 }
914b9fe7 328}
329
330//___________________________________________________________
331void AliAnaCaloTrackCorrMaker::FillTriggerControlHistograms()
332{
333 if(!fFillDataControlHisto) return;
c2a62a94 334
914b9fe7 335 Int_t triggerBC = fReader->GetTriggerClusterBC() ;
336 Bool_t exotic = fReader->IsExoticEvent();
337 Bool_t badCluster = fReader->IsBadCellTriggerEvent();
338 Bool_t badCell = fReader->IsBadMaxCellTriggerEvent();
339 Bool_t triggerMatch= fReader->IsTriggerMatched();
340 Bool_t triggerBCOK = kTRUE;
341 Int_t triggerId = fReader->GetTriggerClusterId() ;
342 Bool_t reMatchOpenTime = fReader->IsTriggerMatchedOpenCuts(0);
343 Bool_t reMatchNeigbour = fReader->IsTriggerMatchedOpenCuts(1);
344 Bool_t reMatchBoth = fReader->IsTriggerMatchedOpenCuts(2);
b8d661af 345
914b9fe7 346 if(triggerId < 0)
b8d661af 347 {
914b9fe7 348 //printf("Trigger id %d\n",triggerId);
349 if(triggerId == -2)fhNEventsNoTriggerFound->Fill(0);
350 triggerBCOK = kFALSE;
b8d661af 351 }
352
914b9fe7 353 if(exotic)
354 {
355 fhNExoticEvents->Fill(0) ;
356 Double_t v[3];
357 fReader->GetInputEvent()->GetPrimaryVertex()->GetXYZ(v) ;
358 fhXVertexExotic->Fill(v[0]);
359 fhYVertexExotic->Fill(v[1]);
360 fhZVertexExotic->Fill(v[2]);
361 }
362 //if(fReader->IsExoticEvent()) printf("Maker: EXOTIC Cluster trigger\n");
b8d661af 363
914b9fe7 364 if(!triggerBCOK) return;
b8d661af 365
914b9fe7 366 Int_t eventBC = fReader->GetInputEvent()->GetBunchCrossNumber();
367 if(eventBC%4 < 0 || eventBC%4 > 3 )
368 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - STRANGE: Trigger BC %d - Event BC %d, modulo4 %d \n",triggerBC,eventBC,eventBC%4);
b8d661af 369
914b9fe7 370 if(triggerMatch)
cc944149 371 {
914b9fe7 372 if (!exotic && !badCluster) fhClusterTriggerBC->Fill(triggerBC);
373 else if( exotic && badCluster)
374 {
375 fhClusterTriggerBCBadClusterExotic->Fill(triggerBC);
376 if(badCell) fhClusterTriggerBCBadCellExotic->Fill(triggerBC);
377 }
378 else if( exotic && !badCluster) fhClusterTriggerBCExotic->Fill(triggerBC);
379 else if( badCluster && !exotic )
380 {
381 fhClusterTriggerBCBadCluster ->Fill(triggerBC);
382 if(badCell) fhClusterTriggerBCBadCell->Fill(triggerBC);
383 }
cc944149 384
914b9fe7 385 if(!exotic) fhClusterTriggerBCEventBC ->Fill(triggerBC,eventBC%4);
386 else fhClusterTriggerBCExoticEventBC->Fill(triggerBC,eventBC%4);
387 }
388 else
b8d661af 389 {
914b9fe7 390 if (!exotic && !badCluster)
391 {
392 fhClusterTriggerBCUnMatch->Fill(triggerBC);
393 if(reMatchOpenTime) fhClusterTriggerBCUnMatchReMatch[0]->Fill(triggerBC);
394 if(reMatchNeigbour) fhClusterTriggerBCUnMatchReMatch[1]->Fill(triggerBC);
395 if(reMatchBoth) fhClusterTriggerBCUnMatchReMatch[2]->Fill(triggerBC);
396 }
397 else if( exotic && badCluster)
398 {
399 fhClusterTriggerBCBadClusterExoticUnMatch->Fill(triggerBC);
400 if(badCell) fhClusterTriggerBCBadCellExoticUnMatch ->Fill(triggerBC);
401 }
402 else if( exotic && !badCluster)
403 {
404 fhClusterTriggerBCExoticUnMatch->Fill(triggerBC);
405 if(reMatchOpenTime) fhClusterTriggerBCExoticUnMatchReMatch[0]->Fill(triggerBC);
406 if(reMatchNeigbour) fhClusterTriggerBCExoticUnMatchReMatch[1]->Fill(triggerBC);
407 if(reMatchBoth) fhClusterTriggerBCExoticUnMatchReMatch[2]->Fill(triggerBC);
408 }
409 else if( badCluster && !exotic )
410 {
411 fhClusterTriggerBCBadClusterUnMatch->Fill(triggerBC);
412 if(badCell)fhClusterTriggerBCBadCellUnMatch->Fill(triggerBC);
413 }
85c4406e 414
914b9fe7 415 if(!exotic) fhClusterTriggerBCEventBCUnMatch ->Fill(triggerBC,eventBC%4);
416 else fhClusterTriggerBCExoticEventBCUnMatch->Fill(triggerBC,eventBC%4);
b8d661af 417 }
914b9fe7 418
b8d661af 419}
420
914b9fe7 421
f15155ed 422//_______________________________________________________
423TList * AliAnaCaloTrackCorrMaker::GetListOfAnalysisCuts()
85c4406e 424{
f15155ed 425
f6b8da1f 426 // Get the list of the cuts used for the analysis
427 // The list is filled in the maker, called by the task in LocalInit() and posted there
f15155ed 428
f6b8da1f 429 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
85c4406e 430 {
431 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
432 TObjString * objstring = ana->GetAnalysisCuts();
433
434 if(objstring)fCuts->Add(objstring);
435 }
4c795f31 436
f6b8da1f 437 return fCuts ;
f15155ed 438
439}
440
441//___________________________________________________
442TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
443{
444 // Fill the output list of histograms during the CreateOutputObjects stage.
445
446 //Initialize calorimeters geometry pointers
55d66f31 447 //GetCaloUtils()->InitPHOSGeometry();
448 //GetCaloUtils()->InitEMCALGeometry();
f15155ed 449
f15155ed 450 //General event histograms
451
4b7f6e01 452 fhNEvents = new TH1F("hNEvents", "Number of analyzed events" , 1 , 0 , 1 ) ;
4c795f31 453 fhNEvents->SetYTitle("# events");
f15155ed 454 fOutputContainer->Add(fhNEvents);
4c795f31 455
e3f791f6 456 fhXVertex = new TH1F("hXVertex", " X vertex distribution" , 200 , -4 , 4 ) ;
457 fhXVertex->SetXTitle("v_{x} (cm)");
458 fOutputContainer->Add(fhXVertex);
459
460 fhYVertex = new TH1F("hYVertex", " Y vertex distribution" , 200 , -4 , 4 ) ;
461 fhYVertex->SetXTitle("v_{y} (cm)");
462 fOutputContainer->Add(fhYVertex);
463
accd903d 464 fhZVertex = new TH1F("hZVertex", " Z vertex distribution" , 200 , -50 , 50 ) ;
d2655d46 465 fhZVertex->SetXTitle("v_{z} (cm)");
466 fOutputContainer->Add(fhZVertex);
914b9fe7 467
accd903d 468 fhCentrality = new TH1F("hCentrality","Number of events in centrality bin",100,0.,100) ;
4c795f31 469 fhCentrality->SetXTitle("Centrality bin");
85c4406e 470 fOutputContainer->Add(fhCentrality) ;
4c795f31 471
f7eac3ca 472 fhEventPlaneAngle=new TH1F("hEventPlaneAngle","Number of events in event plane",100,0.,TMath::Pi()) ;
473 fhEventPlaneAngle->SetXTitle("EP angle (rad)");
474 fOutputContainer->Add(fhEventPlaneAngle) ;
914b9fe7 475
476 fhTrackMult = new TH1F("hTrackMult", "Number of tracks per events" , 2000 , 0 , 2000 ) ;
477 fhTrackMult->SetXTitle("# tracks");
478 fOutputContainer->Add(fhTrackMult);
479
480 if(fFillDataControlHisto)
b8d661af 481 {
914b9fe7 482 fhNExoticEvents = new TH1F("hNExoticEvents", "Number of analyzed events triggered by exotic cluster" , 1 , 0 , 1 ) ;
483 fhNExoticEvents->SetYTitle("# exotic events");
484 fOutputContainer->Add(fhNExoticEvents);
485
486 fhNEventsNoTriggerFound = new TH1F("hNEventsNoTriggerFound", "Number of analyzed events triggered but no trigger found" , 1 , 0 , 1 ) ;
487 fhNEventsNoTriggerFound->SetYTitle("# exotic events");
488 fOutputContainer->Add(fhNEventsNoTriggerFound);
489
490
491 Int_t nbin = 11;
492 Float_t minbin =-5.5;
493 Float_t maxbin = 5.5;
494 Int_t labelshift = 6;
495
496 fhClusterTriggerBCEventBC = new TH2F("hClusterTriggerBCEventBC", "Found trigger BC and Event BC",
497 nbin , minbin ,maxbin,4,0, 4) ;
498 fhClusterTriggerBCEventBC->SetXTitle("cluster trigger BC");
499 for(Int_t i = 0; i < 4; i++)
500 fhClusterTriggerBCEventBC->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
501 fhClusterTriggerBCEventBC->SetXTitle("cluster trigger BC");
502 for(Int_t i = 1; i < 12; i++)
503 fhClusterTriggerBCEventBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
504 fhClusterTriggerBCEventBC->SetYTitle("Event BC%4");
505 fOutputContainer->Add(fhClusterTriggerBCEventBC);
506
507 fhClusterTriggerBCExoticEventBC = new TH2F("hClusterTriggerBCExoticEventBC", "Found exotic trigger BC and Event BC",
508 nbin , minbin ,maxbin,4,1, 4) ;
509 for(Int_t i = 0; i < 4; i++)
510 fhClusterTriggerBCExoticEventBC->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
511 fhClusterTriggerBCExoticEventBC->SetXTitle("cluster trigger BC");
512 for(Int_t i = 1; i < 12; i++)
513 fhClusterTriggerBCExoticEventBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
514 fhClusterTriggerBCExoticEventBC->SetYTitle("Event BC%4");
515 fOutputContainer->Add(fhClusterTriggerBCExoticEventBC);
516
517 fhClusterTriggerBCEventBCUnMatch = new TH2F("hClusterTriggerBCEventBCUnMatch", "Found unmatched trigger BC and Event BC",
518 nbin , minbin ,maxbin,4,1, 4) ;
519 for(Int_t i = 0; i < 4; i++)
520 fhClusterTriggerBCEventBCUnMatch->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
521 fhClusterTriggerBCEventBCUnMatch->SetXTitle("cluster trigger BC");
522 for(Int_t i = 1; i < 12; i++)
523 fhClusterTriggerBCEventBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
524 fhClusterTriggerBCEventBCUnMatch->SetYTitle("Event BC%4");
525 fOutputContainer->Add(fhClusterTriggerBCEventBCUnMatch);
526
527 fhClusterTriggerBCExoticEventBCUnMatch = new TH2F("hClusterTriggerExoticBCEventBCUnMatch", "Found unmatched trigger BC and Event BC",
528 nbin , minbin ,maxbin,4,1, 4) ;
529 for(Int_t i = 0; i < 4; i++)
530 fhClusterTriggerBCExoticEventBCUnMatch->GetYaxis()->SetBinLabel(i+1 ,Form("BC/4=%d",i));
531 fhClusterTriggerBCExoticEventBCUnMatch->SetXTitle("cluster trigger BC");
532 for(Int_t i = 1; i < 12; i++)
533 fhClusterTriggerBCExoticEventBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
534 fhClusterTriggerBCExoticEventBCUnMatch->SetYTitle("Event BC%4");
535 fOutputContainer->Add(fhClusterTriggerBCExoticEventBCUnMatch);
536
537 fhClusterTriggerBC = new TH1F("hClusterTriggerBC",
538 "Number of analyzed events triggered by a cluster in a given BC",
539 nbin , minbin ,maxbin) ;
540 fhClusterTriggerBC->SetYTitle("# events");
541 for(Int_t i = 1; i < 12; i++)
542 fhClusterTriggerBC->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
543 fOutputContainer->Add(fhClusterTriggerBC);
544
545 fhClusterTriggerBCExotic = new TH1F("hClusterTriggerBCExotic",
546 "Number of analyzed events triggered by a exotic cluster in a given BC",
547 nbin , minbin ,maxbin) ;
548 fhClusterTriggerBCExotic->SetYTitle("# events");
549 for(Int_t i = 1; i < 12; i++)
550 fhClusterTriggerBCExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
551 fOutputContainer->Add(fhClusterTriggerBCExotic);
552
553
554 fhClusterTriggerBCBadCell = new TH1F("hClusterTriggerBCBadCell",
555 "Number of analyzed events triggered by a bad cell in a given BC",
556 nbin , minbin ,maxbin) ;
557
558 fhClusterTriggerBCBadCell->SetYTitle("# events");
559 for(Int_t i = 1; i < 12; i++)
560 fhClusterTriggerBCBadCell->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
561 fOutputContainer->Add(fhClusterTriggerBCBadCell);
562
563 fhClusterTriggerBCBadCellExotic = new TH1F("hClusterTriggerBCBadCellExotic",
564 "Number of analyzed events triggered by a bad cell & exotic cluster in a given BC",
565 nbin , minbin ,maxbin) ;
566 fhClusterTriggerBCBadCellExotic->SetYTitle("# events");
567 for(Int_t i = 1; i < 12; i++)
568 fhClusterTriggerBCBadCellExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
569 fOutputContainer->Add(fhClusterTriggerBCBadCellExotic);
570
571 fhClusterTriggerBCBadCluster = new TH1F("hClusterTriggerBCBadCluster",
572 "Number of analyzed events triggered by a bad cluster in a given BC",
573 nbin , minbin ,maxbin) ;
574
575 fhClusterTriggerBCBadCluster->SetYTitle("# events");
576 for(Int_t i = 1; i < 12; i++)
577 fhClusterTriggerBCBadCluster->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
578 fOutputContainer->Add(fhClusterTriggerBCBadCluster);
579
580
581 fhClusterTriggerBCBadClusterExotic = new TH1F("hClusterTriggerBCBadClusterExotic",
582 "Number of analyzed events triggered by a bad cluster & exotic cluster in a given BC",
583 nbin , minbin ,maxbin) ;
584
585 fhClusterTriggerBCBadClusterExotic->SetYTitle("# events");
586 for(Int_t i = 1; i < 12; i++)
587 fhClusterTriggerBCBadClusterExotic->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
588 fOutputContainer->Add(fhClusterTriggerBCBadClusterExotic);
589
590 fhClusterTriggerBCUnMatch = new TH1F("hClusterTriggerBCUnMatch",
591 "Number of analyzed events triggered by a cluster (no trigger patch match) in a given BC",
592 nbin , minbin ,maxbin) ;
593 fhClusterTriggerBCUnMatch->SetYTitle("# events");
594 for(Int_t i = 1; i < 12; i++)
595 fhClusterTriggerBCUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
596 fOutputContainer->Add(fhClusterTriggerBCUnMatch);
597
598 fhClusterTriggerBCExoticUnMatch = new TH1F("hClusterTriggerBCExoticUnMatch",
599 "Number of analyzed events triggered by a exotic cluster (no trigger patch match) in a given BC",
600 nbin , minbin ,maxbin) ;
601 fhClusterTriggerBCExoticUnMatch->SetYTitle("# events");
602 for(Int_t i = 1; i < 12; i++)
603 fhClusterTriggerBCExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
604 fOutputContainer->Add(fhClusterTriggerBCExoticUnMatch);
605
606
607 fhClusterTriggerBCBadCellUnMatch = new TH1F("hClusterTriggerBCBadCellUnMatch",
608 "Number of analyzed events triggered by a bad cluster (no trigger patch match) in a given BC",
609 nbin , minbin ,maxbin) ;
610 fhClusterTriggerBCBadCellUnMatch->SetYTitle("# events");
611 for(Int_t i = 1; i < 12; i++)
612 fhClusterTriggerBCBadCellUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
613 fOutputContainer->Add(fhClusterTriggerBCBadCellUnMatch);
614
615
616 fhClusterTriggerBCBadCellExoticUnMatch = new TH1F("hClusterTriggerBCBadCellExoticUnMatch",
617 "Number of analyzed events triggered by a bad&exotic cluster (no trigger patch match) in a given BC",
618 nbin , minbin ,maxbin) ;
619 fhClusterTriggerBCBadCellExoticUnMatch->SetYTitle("# events");
620 for(Int_t i = 1; i < 12; i++)
621 fhClusterTriggerBCBadCellExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
622 fOutputContainer->Add(fhClusterTriggerBCBadCellExoticUnMatch);
623
624
625 fhClusterTriggerBCBadClusterUnMatch = new TH1F("hClusterTriggerBCBadClusterUnMatch",
626 "Number of analyzed events triggered by a bad cluster (no trigger patch match) in a given BC",
627 nbin , minbin ,maxbin) ;
628 fhClusterTriggerBCBadClusterUnMatch->SetYTitle("# events");
629 for(Int_t i = 1; i < 12; i++)
630 fhClusterTriggerBCBadClusterUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
631 fOutputContainer->Add(fhClusterTriggerBCBadClusterUnMatch);
632
633
634 fhClusterTriggerBCBadClusterExoticUnMatch = new TH1F("hClusterTriggerBCBadClusterExoticUnMatch",
635 "Number of analyzed events triggered by a bad&exotic cluster (no trigger patch match) in a given BC",
636 nbin , minbin ,maxbin) ;
637 fhClusterTriggerBCBadClusterExoticUnMatch->SetYTitle("# events");
638 for(Int_t i = 1; i < 12; i++)
639 fhClusterTriggerBCBadClusterExoticUnMatch->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
640 fOutputContainer->Add(fhClusterTriggerBCBadClusterExoticUnMatch);
641
642 TString rematch[] = {"OpenTime","CheckNeighbours","Both"};
643 for(Int_t j = 0; j < 3; j++)
644 {
645 fhClusterTriggerBCUnMatchReMatch[j] = new TH1F(Form("hClusterTriggerBCUnMatch_ReMatch_%s",rematch[j].Data()),
646 Form("Number of analyzed events triggered by a cluster (no trigger patch match) in a given BC, re-match %s",rematch[j].Data()),
647 nbin , minbin ,maxbin) ;
648 fhClusterTriggerBCUnMatchReMatch[j]->SetYTitle("# events");
649 for(Int_t i = 1; i < 12; i++)
650 fhClusterTriggerBCUnMatchReMatch[j]->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
651 fOutputContainer->Add(fhClusterTriggerBCUnMatchReMatch[j]);
652
653 fhClusterTriggerBCExoticUnMatchReMatch[j] = new TH1F(Form("hClusterTriggerBCExoticUnMatch_ReMatch_%s",rematch[j].Data()),
654 Form("Number of analyzed events triggered by a exotic cluster (no trigger patch match) in a given BC, re-match %s",rematch[j].Data()),
655 nbin , minbin ,maxbin) ;
656 fhClusterTriggerBCExoticUnMatchReMatch[j]->SetYTitle("# events");
657 for(Int_t i = 1; i < 12; i++)
658 fhClusterTriggerBCExoticUnMatchReMatch[j]->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-labelshift));
659 fOutputContainer->Add(fhClusterTriggerBCExoticUnMatchReMatch[j]);
660 }
661
662 fhNPileUpEvents = new TH1F("hNPileUpEvents", "Number of events considered as pile-up", 8 , 0 , 8 ) ;
663 fhNPileUpEvents->SetYTitle("# events");
664 fhNPileUpEvents->GetXaxis()->SetBinLabel(1 ,"SPD");
665 fhNPileUpEvents->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
666 fhNPileUpEvents->GetXaxis()->SetBinLabel(3 ,"EMCal");
667 fhNPileUpEvents->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
668 fhNPileUpEvents->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
669 fhNPileUpEvents->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
670 fhNPileUpEvents->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
671 fhNPileUpEvents->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
672 fOutputContainer->Add(fhNPileUpEvents);
673
674 fhNPileUpEventsTriggerBC0 = new TH1F("hNPileUpEventsTriggerBC0","Number of events considered as pile-up, trigger cluster in BC=0", 8 , 0 , 8 ) ;
675 fhNPileUpEventsTriggerBC0->SetYTitle("# events");
676 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(1 ,"SPD");
677 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
678 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(3 ,"EMCal");
679 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
680 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
681 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
682 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
683 fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
684 fOutputContainer->Add(fhNPileUpEventsTriggerBC0);
685
686
687 fhTrackBCEvent = new TH1F("hTrackBCEvent", "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
688 fhTrackBCEvent->SetYTitle("# events");
689 fhTrackBCEvent->SetXTitle("Bunch crossing");
690 for(Int_t i = 1; i < 20; i++)
691 fhTrackBCEvent->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
692 fOutputContainer->Add(fhTrackBCEvent);
693
694 fhTrackBCEventCut = new TH1F("hTrackBCEventCut", "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
695 fhTrackBCEventCut->SetYTitle("# events");
696 fhTrackBCEventCut->SetXTitle("Bunch crossing");
697 for(Int_t i = 1; i < 20; i++)
698 fhTrackBCEventCut->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
699 fOutputContainer->Add(fhTrackBCEventCut);
700
701 fhPrimaryVertexBC = new TH1F("hPrimaryVertexBC", "Number of primary vertex per bunch crossing ", 41 , -20 , 20 ) ;
702 fhPrimaryVertexBC->SetYTitle("# events");
703 fhPrimaryVertexBC->SetXTitle("Bunch crossing");
704 fOutputContainer->Add(fhPrimaryVertexBC);
705
706 fhEMCalBCEvent = new TH1F("hEMCalBCEvent", "Number of events with at least 1 cluster in a bunch crossing ", 19 , 0 , 19 ) ;
707 fhEMCalBCEvent->SetYTitle("# events");
708 fhEMCalBCEvent->SetXTitle("Bunch crossing");
709 for(Int_t i = 1; i < 20; i++)
710 fhEMCalBCEvent->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
711 fOutputContainer->Add(fhEMCalBCEvent);
712
713 fhEMCalBCEventCut = new TH1F("hEMCalBCEventCut", "Number of events with at least 1 cluster in a bunch crossing", 19 , 0 , 19 ) ;
714 fhEMCalBCEventCut->SetYTitle("# events");
715 fhEMCalBCEventCut->SetXTitle("Bunch crossing");
716 for(Int_t i = 1; i < 20; i++)
717 fhEMCalBCEventCut->GetXaxis()->SetBinLabel(i ,Form("%d",i-10));
718 fOutputContainer->Add(fhEMCalBCEventCut);
719
720 fhXVertexExotic = new TH1F("hXVertexExotic", " X vertex distribution in exotic events" , 200 , -4 , 4 ) ;
721 fhXVertexExotic->SetXTitle("v_{x} (cm)");
722 fOutputContainer->Add(fhXVertexExotic);
723
724 fhYVertexExotic = new TH1F("hYVertexExotic", " Y vertex distribution in exotic events" , 200 , -4 , 4 ) ;
725 fhYVertexExotic->SetXTitle("v_{y} (cm)");
726 fOutputContainer->Add(fhYVertexExotic);
727
728 fhZVertexExotic = new TH1F("hZVertexExotic", " Z vertex distribution in exotic events" , 200 , -50 , 50 ) ;
729 fhZVertexExotic->SetXTitle("v_{z} (cm)");
730 fOutputContainer->Add(fhZVertexExotic);
731
732 fhPileUpClusterMult = new TH1F("hPileUpClusterMult", "Number of clusters per event with large time (|t| > 20 ns)" , 100 , 0 , 100 ) ;
733 fhPileUpClusterMult->SetXTitle("# clusters");
734 fOutputContainer->Add(fhPileUpClusterMult);
735
736 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 ) ;
737 fhPileUpClusterMultAndSPDPileUp->SetXTitle("# clusters");
738 fOutputContainer->Add(fhPileUpClusterMultAndSPDPileUp);
739
740 fhNPileUpVertSPD = new TH1F ("hNPileUpVertSPD","N pile-up SPD vertex", 50,0,50);
741 fhNPileUpVertSPD->SetYTitle("# vertex ");
742 fOutputContainer->Add(fhNPileUpVertSPD);
743
744 fhNPileUpVertTracks = new TH1F ("hNPileUpVertTracks","N pile-up Tracks vertex", 50,0,50);
745 fhNPileUpVertTracks->SetYTitle("# vertex ");
746 fOutputContainer->Add(fhNPileUpVertTracks);
747
748 if(fReader->IsSelectEventTimeStampOn())
749 {
750 fhTimeStampFraction = new TH1F("hTimeStampFraction","Fraction of events within a given time stamp range",150, -1, 2) ;
751 fhTimeStampFraction->SetXTitle("fraction");
752 fOutputContainer->Add(fhTimeStampFraction) ;
753 }
b8d661af 754 }
755
accd903d 756 if(fScaleFactor > 0)
757 {
4b7f6e01 758 fhNMergedFiles = new TH1F("hNMergedFiles", "Number of merged output files" , 1 , 0 , 1 ) ;
accd903d 759 fhNMergedFiles->SetYTitle("# files");
760 fhNMergedFiles->Fill(1); // Fill here with one entry, while merging it will count the rest
761 fOutputContainer->Add(fhNMergedFiles);
762
763 fhScaleFactor = new TH1F("hScaleFactor", "Number of merged output files" , 1 , 0 , 1 ) ;
764 fhScaleFactor->SetYTitle("scale factor");
85c4406e 765 fhScaleFactor->SetBinContent(1,fScaleFactor); // Fill here
766 fOutputContainer->Add(fhScaleFactor);
accd903d 767 }
768
4c795f31 769 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
770 {
771 printf("AliAnaCaloTrackCorrMaker::GetOutputContainer() - Analysis job list not initialized!!!\n");
772 return fOutputContainer;
773 }
774
775 const Int_t buffersize = 255;
776 char newname[buffersize];
777 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
778 {
779
780 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
781
782 if(fMakeHisto) // Analysis with histograms as output on
783 {
784
85c4406e 785 //Fill container with appropriate histograms
786 TList * templist = ana ->GetCreateOutputObjects();
4c795f31 787 templist->SetOwner(kFALSE); //Owner is fOutputContainer.
788
789 for(Int_t i = 0; i < templist->GetEntries(); i++)
790 {
791
792 //Add only to the histogram name the name of the task
85c4406e 793 if( strcmp((templist->At(i))->ClassName(),"TObjString") )
4c795f31 794 {
4b7f6e01 795 snprintf(newname,buffersize, "%s%s", (ana->GetAddedHistogramsStringToName()).Data(), (templist->At(i))->GetName());
796 //printf("name %s, new name %s\n",(templist->At(i))->GetName(),newname);
4c795f31 797 ((TH1*) templist->At(i))->SetName(newname);
798 }
799
800 //Add histogram to general container
801 fOutputContainer->Add(templist->At(i)) ;
802
803 }
804
805 delete templist;
806
807 }// Analysis with histograms as output on
808
809 }//Loop on analysis defined
810
f15155ed 811 return fOutputContainer;
812
813}
814
815//___________________________________
816void AliAnaCaloTrackCorrMaker::Init()
85c4406e 817{
f15155ed 818 //Init container histograms and other common variables
819 // Fill the output list of histograms during the CreateOutputObjects stage.
820
821 //Initialize reader
822 GetReader()->Init();
823 GetReader()->SetCaloUtils(GetCaloUtils()); // pass the calo utils pointer to the reader
824
825
4c795f31 826 if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0)
827 {
f15155ed 828 printf("AliAnaCaloTrackCorrMaker::GetOutputInit() - Analysis job list not initialized!!!\n");
4c795f31 829 return;
f15155ed 830 }
4c795f31 831
832 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
833 {
f15155ed 834
4c795f31 835 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
836
837 ana->SetReader(fReader); // Set Reader for each analysis
838 ana->SetCaloUtils(fCaloUtils); // Set CaloUtils for each analysis
839
840 ana->Init();
841
842 }//Loop on analysis defined
843
f15155ed 844}
845
846//_____________________________________________
847void AliAnaCaloTrackCorrMaker::InitParameters()
85c4406e 848{
f15155ed 849 //Init data members
850
851 fMakeHisto = kTRUE;
85c4406e 852 fMakeAOD = kTRUE;
f15155ed 853 fAnaDebug = 0; // No debugging info displayed by default
854
855}
856
857//______________________________________________________________
858void AliAnaCaloTrackCorrMaker::Print(const Option_t * opt) const
85c4406e 859{
f15155ed 860 //Print some relevant parameters set for the analysis
861
862 if(! opt)
863 return;
864
865 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
4c795f31 866 printf("Debug level = %d\n", fAnaDebug ) ;
867 printf("Produce Histo = %d\n", fMakeHisto ) ;
868 printf("Produce AOD = %d\n", fMakeAOD ) ;
f15155ed 869 printf("Number of analysis tasks = %d\n", fAnalysisContainer->GetEntries()) ;
870
4c795f31 871 if(!strcmp("all",opt))
85c4406e 872 {
873 printf("Print analysis Tasks settings :\n") ;
874 for(Int_t iana = 0; iana<fAnalysisContainer->GetEntries(); iana++)
4c795f31 875 {
85c4406e 876 ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana))->Print("");
877 }
878
879 printf("Print analysis Reader settings :\n") ;
880 fReader->Print("");
881 printf("Print analysis Calorimeter Utils settings :\n") ;
882 fCaloUtils->Print("");
883
f15155ed 884 }
4c795f31 885
85c4406e 886}
f15155ed 887
8a2dbbff 888//_____________________________________________________________________________________
889void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFileName)
f15155ed 890{
891 //Process analysis for this event
892
4c795f31 893 if(fMakeHisto && !fOutputContainer)
85c4406e 894 {
895 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Histograms not initialized\n");
896 abort();
897 }
f6b8da1f 898
4c795f31 899 if(fAnaDebug >= 0 )
85c4406e 900 {
901 printf("*** AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d *** \n",iEntry);
902 if(fAnaDebug > 1 )
4c795f31 903 {
85c4406e 904 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Current File Name : %s\n", currentFileName);
905 //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
f6b8da1f 906 }
85c4406e 907 }
f15155ed 908
909 //Each event needs an empty branch
910 TList * aodList = fReader->GetAODBranchList();
911 Int_t nAODBranches = aodList->GetEntries();
4c795f31 912 for(Int_t iaod = 0; iaod < nAODBranches; iaod++)
913 {
f15155ed 914 TClonesArray *tca = dynamic_cast<TClonesArray*> (aodList->At(iaod));
915 if(tca) tca->Clear("C");
916 }
917
918 //Set geometry matrices before filling arrays, in case recalibration/position calculation etc is needed
85c4406e 919 fCaloUtils->AccessGeometry(fReader->GetInputEvent());
55d66f31 920
921 //Set the AODB calibration, bad channels etc. parameters at least once
85c4406e 922 fCaloUtils->AccessOADB(fReader->GetInputEvent());
f15155ed 923
924 //Tell the reader to fill the data in the 3 detector lists
925 Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
c2a62a94 926
914b9fe7 927 FillTriggerControlHistograms();
afb3af8a 928
4c795f31 929 if(!ok)
85c4406e 930 {
f6b8da1f 931 if(fAnaDebug >= 1 )printf("*** Skip event *** %d \n",iEntry);
a0c23d83 932 fReader->ResetLists();
f6b8da1f 933 return ;
f15155ed 934 }
c2a62a94 935
f15155ed 936 //Magic line to write events to file
937 if(fReader->WriteDeltaAODToFile())AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
938
939 //printf(">>>>>>>>>> BEFORE >>>>>>>>>>>\n");
940 //gObjectTable->Print();
4c795f31 941
bcd08add 942 //Access pointers, and trigger mask check needed in mixing case
943 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
944 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
945
946 UInt_t isMBTrigger = kFALSE;
947 UInt_t isTrigger = kFALSE;
948 if(inputHandler)
949 {
950 isMBTrigger = inputHandler->IsEventSelected() & fReader->GetMixEventTriggerMask();
951 isTrigger = inputHandler->IsEventSelected() & fReader->GetEventTriggerMask();
952 }
953
5b96be07 954 // Init mag field for tracks in case of ESDs, not really necessary
955 if (!TGeoGlobalMagField::Instance()->GetField() && ((AliESDEvent*) fReader->GetInputEvent()))
956 ((AliESDEvent*)fReader->GetInputEvent())->InitMagneticField();
957
f15155ed 958 //Loop on analysis algorithms
4c795f31 959
f15155ed 960 if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
4c795f31 961
f15155ed 962 Int_t nana = fAnalysisContainer->GetEntries() ;
4c795f31 963 for(Int_t iana = 0; iana < nana; iana++)
964 {
85c4406e 965 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
f15155ed 966
967 ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
31864468 968
969 //Fill pool for mixed event for the analysis that need it
bcd08add 970 if(!fReader->IsEventTriggerAtSEOn() && isMBTrigger)
31864468 971 {
bcd08add 972 ana->FillEventMixPool();
973 continue; // pool filled do not try to fill AODs or histograms
31864468 974 }
975
976 //Make analysis, create aods in aod branch and in some cases fill histograms
f15155ed 977 if(fMakeAOD ) ana->MakeAnalysisFillAOD() ;
31864468 978
f15155ed 979 //Make further analysis with aod branch and fill histograms
980 if(fMakeHisto) ana->MakeAnalysisFillHistograms() ;
981
982 }
983
f52538d5 984 fReader->ResetLists();
85c4406e 985
f52538d5 986 // In case of mixing analysis, non triggered events are used,
987 // do not fill control histograms for a non requested triggered event
bcd08add 988 if(!fReader->IsEventTriggerAtSEOn() && !isTrigger)
85c4406e 989 {
bcd08add 990 if(fAnaDebug > 0 ) printf("AliAnaCaloTrackMaker::ProcessEvent() - *** End analysis, MB for mixing *** \n");
991 return;
f52538d5 992 }
993
b8d661af 994 FillControlHistograms();
975b29fa 995
f15155ed 996 //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
997 //gObjectTable->Print();
998
f52538d5 999 if(fAnaDebug > 0 ) printf("AliAnaCaloTrackMaker::ProcessEvent() - *** End analysis *** \n");
f15155ed 1000
1001}
1002
1003//__________________________________________________________
1004void AliAnaCaloTrackCorrMaker::Terminate(TList * outputList)
85c4406e 1005{
f15155ed 1006 //Execute Terminate of analysis
1007 //Do some final plots.
1008
85c4406e 1009 if (!outputList)
4c795f31 1010 {
f6b8da1f 1011 Error("Terminate", "No output list");
1012 return;
f15155ed 1013 }
f6b8da1f 1014
4c795f31 1015 for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++)
85c4406e 1016 {
1017
1018 AliAnaCaloTrackCorrBaseClass * ana = ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
1019 if(ana->MakePlotsOn())ana->Terminate(outputList);
1020
1021 }//Loop on analysis defined
4c795f31 1022
f15155ed 1023}
1024