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