1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //_________________________________________________________________________
17 // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and
18 // Central Barrel Tracking detectors (CTS).
19 // Not all MC particles/tracks/clusters are kept, some kinematical/fiducial restrictions are done.
20 // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS)
21 // : AliCaloTrackMCReader : Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS)
22 // : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS)
23 //-- Author: Gustavo Conesa (LNF-INFN)
24 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
29 #include <TGeoManager.h>
31 // ---- ANALYSIS system ----
32 #include "AliMCEvent.h"
33 #include "AliAODMCHeader.h"
34 #include "AliGenPythiaEventHeader.h"
35 #include "AliESDEvent.h"
36 #include "AliAODEvent.h"
37 #include "AliVTrack.h"
38 #include "AliVParticle.h"
39 #include "AliMixedEvent.h"
40 #include "AliESDtrack.h"
41 #include "AliESDtrackCuts.h"
42 #include "AliTriggerAnalysis.h"
43 #include "AliESDVZERO.h"
44 #include "AliVCaloCells.h"
45 #include "AliAnalysisManager.h"
46 #include "AliInputEventHandler.h"
48 // ---- Detectors ----
49 #include "AliPHOSGeoUtils.h"
50 #include "AliEMCALGeometry.h"
51 #include "AliEMCALRecoUtils.h"
53 // ---- CaloTrackCorr ---
54 #include "AliCalorimeterUtils.h"
55 #include "AliCaloTrackReader.h"
57 ClassImp(AliCaloTrackReader)
60 //________________________________________
61 AliCaloTrackReader::AliCaloTrackReader() :
62 TObject(), fEventNumber(-1), //fCurrentFileName(""),
63 fDataType(0), fDebug(0),
64 fFiducialCut(0x0), fCheckFidCut(kFALSE),
65 fComparePtHardAndJetPt(0), fPtHardAndJetPtFactor(0),
66 fComparePtHardAndClusterPt(0),fPtHardAndClusterPtFactor(0),
67 fCTSPtMin(0), fEMCALPtMin(0), fPHOSPtMin(0),
68 fCTSPtMax(0), fEMCALPtMax(0), fPHOSPtMax(0),
69 fEMCALTimeCutMin(-10000), fEMCALTimeCutMax(10000),
70 fEMCALParamTimeCutMin(), fEMCALParamTimeCutMax(),
71 fUseParamTimeCut(kFALSE),
73 fCTSTracks(0x0), fEMCALClusters(0x0), fPHOSClusters(0x0),
74 fEMCALCells(0x0), fPHOSCells(0x0),
75 fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0),
76 fFillCTS(0), fFillEMCAL(0), fFillPHOS(0),
77 fFillEMCALCells(0), fFillPHOSCells(0),
78 fRecalculateClusters(kFALSE),fSelectEmbeddedClusters(kFALSE),
79 fTrackStatus(0), fTrackFilterMask(0),
80 fESDtrackCuts(0), fConstrainTrack(kFALSE), fSelectHybridTracks(0),
81 fTrackMult(0), fTrackMultEtaCut(0.8),
82 fReadStack(kFALSE), fReadAODMCParticles(kFALSE),
83 fDeltaAODFileName(""), fFiredTriggerClassName(""),
84 fEventTriggerMask(0), fMixEventTriggerMask(0), fEventTriggerAtSE(0),
86 fTaskName(""), fCaloUtils(0x0),
87 fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL),
88 fListMixedTracksEvents(), fListMixedCaloEvents(),
89 fLastMixedTracksEvent(-1), fLastMixedCaloEvent(-1),
90 fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE), fCaloFilterPatch(kFALSE),
91 fEMCALClustersListName(""), fZvtxCut(0.),
92 fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kTRUE),
93 fDoEventSelection(kFALSE), fDoV0ANDEventSelection(kFALSE), fUseEventsWithPrimaryVertex(kFALSE),
94 fTriggerAnalysis (0x0),
95 fCentralityClass(""), fCentralityOpt(0),
96 fEventPlaneMethod(""), fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("")
100 //Initialize parameters
104 //_______________________________________
105 AliCaloTrackReader::~AliCaloTrackReader()
109 delete fFiducialCut ;
113 fAODBranchList->Delete();
114 delete fAODBranchList ;
119 if(fDataType!=kMC)fCTSTracks->Clear() ;
120 else fCTSTracks->Delete() ;
126 if(fDataType!=kMC)fEMCALClusters->Clear("C") ;
127 else fEMCALClusters->Delete() ;
128 delete fEMCALClusters ;
133 if(fDataType!=kMC)fPHOSClusters->Clear("C") ;
134 else fPHOSClusters->Delete() ;
135 delete fPHOSClusters ;
140 for (Int_t i = 0; i < fNMixedEvent; i++)
142 delete [] fVertex[i] ;
148 delete fESDtrackCuts;
149 delete fTriggerAnalysis;
151 // Pointers not owned, done by the analysis frame
152 // if(fInputEvent) delete fInputEvent ;
153 // if(fOutputEvent) delete fOutputEvent ;
154 // if(fMC) delete fMC ;
155 // Pointer not owned, deleted by maker
156 // if (fCaloUtils) delete fCaloUtils ;
160 //________________________________________________
161 Bool_t AliCaloTrackReader::ComparePtHardAndJetPt()
163 // Check the event, if the requested ptHard is much smaller than the jet pT, then there is a problem.
166 //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName());
168 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
171 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
172 Int_t nTriggerJets = pygeh->NTriggerJets();
173 Float_t ptHard = pygeh->GetPtHard();
176 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Njets: %d, pT Hard %f\n",nTriggerJets, ptHard);
178 Float_t tmpjet[]={0,0,0,0};
179 for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
181 pygeh->TriggerJet(ijet, tmpjet);
182 jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
185 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - jet %d; pycell jet pT %f\n",ijet, jet->Pt());
187 //Compare jet pT and pt Hard
188 if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
190 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
191 ptHard, jet->Pt(), fPtHardAndJetPtFactor);
203 //____________________________________________________________________
204 Bool_t AliCaloTrackReader::ComparePtHardAndClusterPt()
206 // Check the event, if the requested ptHard is smaller than the calorimeter cluster E, then there is a problem.
209 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
211 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
212 Float_t ptHard = pygeh->GetPtHard();
214 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
215 for (Int_t iclus = 0; iclus < nclusters; iclus++)
217 AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
218 Float_t ecluster = clus->E();
220 if(ecluster > fPtHardAndClusterPtFactor*ptHard)
222 printf("AliCaloTrackReader::ComparePtHardAndClusterPt() - Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f\n",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard);
234 //____________________________________________
235 AliStack* AliCaloTrackReader::GetStack() const
237 //Return pointer to stack
242 if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n");
247 //__________________________________________________
248 TString AliCaloTrackReader::GetFiredTriggerClasses()
250 // List of triggered classes in a TString
252 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (GetInputEvent());
253 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (GetInputEvent());
255 if (esdevent) return esdevent->GetFiredTriggerClasses();
256 else if(aodevent) return aodevent->GetFiredTriggerClasses();
257 else return ""; // Mixed Event, MC event, does not have this trigger info
261 //______________________________________________
262 AliHeader* AliCaloTrackReader::GetHeader() const
264 //Return pointer to header
267 return fMC->Header();
271 printf("AliCaloTrackReader::Header is not available\n");
276 //______________________________________________________________
277 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const
279 //Return pointer to Generated event header
280 if (ReadStack() && fMC)
282 return fMC->GenEventHeader();
284 else if(ReadAODMCParticles() && GetAODMCHeader())
286 //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",GetAODMCHeader()->GetNCocktailHeaders());
287 if( GetAODMCHeader()->GetNCocktailHeaders() > 0)
288 return GetAODMCHeader()->GetCocktailHeader(0) ;
294 //printf("AliCaloTrackReader::GetGenEventHeader() - MC header not available! \n");
299 //____________________________________________________________________
300 TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const
302 //Return list of particles in AOD. Do it for the corresponding input event.
304 TClonesArray * rv = NULL ;
305 if(fDataType == kAOD)
310 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
312 rv = (TClonesArray*)evt->FindListObject("mcparticles");
314 printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input);
320 printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n");
326 //________________________________________________________
327 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
329 //Return MC header in AOD. Do it for the corresponding input event.
331 AliAODMCHeader *mch = NULL;
333 if(fDataType == kAOD)
335 AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent);
336 if(aod) mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
340 printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n");
346 //_____________________________
347 void AliCaloTrackReader::Init()
349 //Init reader. Method to be called in AliAnaPartCorrMaker
351 //printf(" AliCaloTrackReader::Init() %p \n",gGeoManager);
353 if(fReadStack && fReadAODMCParticles)
355 printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n");
357 fReadAODMCParticles = kFALSE;
360 // Init geometry, I do not like much to do it like this ...
361 if(fImportGeometryFromFile && !gGeoManager)
363 if(fImportGeometryFilePath=="") // If not specified, set a default location
364 fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root"; // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
366 printf("AliCaloTrackReader::Init() - Import %s\n",fImportGeometryFilePath.Data());
367 TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
372 //_______________________________________
373 void AliCaloTrackReader::InitParameters()
375 //Initialize the parameters of the analysis.
381 fEMCALPtMax = 1000. ;
384 //Do not filter the detectors input by default.
388 fFillEMCALCells = kFALSE;
389 fFillPHOSCells = kFALSE;
391 fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
392 fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
393 fDeltaAODFileName = "deltaAODPartCorr.root";
394 fFiredTriggerClassName = "";
395 fEventTriggerMask = AliVEvent::kAny;
396 fMixEventTriggerMask = AliVEvent::kAnyINT;
397 fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
399 fAcceptFastCluster = kTRUE;
402 //We want tracks fitted in the detectors:
403 //fTrackStatus=AliESDtrack::kTPCrefit;
404 //fTrackStatus|=AliESDtrack::kITSrefit;
406 fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
408 fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks
410 fConstrainTrack = kFALSE ; // constrain tracks to vertex
412 fV0ADC[0] = 0; fV0ADC[1] = 0;
413 fV0Mul[0] = 0; fV0Mul[1] = 0;
419 fPtHardAndJetPtFactor = 7.;
420 fPtHardAndClusterPtFactor = 1.;
423 fCentralityClass = "V0M";
425 fCentralityBin[0] = fCentralityBin[1]=-1;
427 fEventPlaneMethod = "V0";
429 // Allocate memory (not sure this is the right place)
430 fCTSTracks = new TObjArray();
431 fEMCALClusters = new TObjArray();
432 fPHOSClusters = new TObjArray();
433 fTriggerAnalysis = new AliTriggerAnalysis;
434 fAODBranchList = new TList ;
436 fImportGeometryFromFile = kFALSE;
438 fPileUpParam[0] = 3 ; fPileUpParam[1] = 0.8 ;
439 fPileUpParam[2] = 3.0 ; fPileUpParam[3] = 2.0 ; fPileUpParam[4] = 5.0;
441 // Parametrized time cut (LHC11d)
442 fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1. ;
443 fEMCALParamTimeCutMax[0] = 5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.45; fEMCALParamTimeCutMax[3] = 1.25;
445 // Parametrized time cut (LHC11c)
446 //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
447 //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
451 //________________________________________________
452 Bool_t AliCaloTrackReader::IsPileUpFromSPD() const
454 // Check if event is from pile-up determined by SPD
455 // Default values: (3, 0.8, 3., 2., 5.)
456 return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParam[0] , fPileUpParam[1] ,
457 fPileUpParam[2] , fPileUpParam[3] , fPileUpParam[4] );
458 //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParam[0], fPileUpParam[1], fPileUpParam[2], fPileUpParam[3], fPileUpParam[4]);
462 //________________________________________________________
463 void AliCaloTrackReader::Print(const Option_t * opt) const
466 //Print some relevant parameters set for the analysis
470 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
471 printf("Task name : %s\n", fTaskName.Data()) ;
472 printf("Data type : %d\n", fDataType) ;
473 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
474 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
475 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
476 printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
477 printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
478 printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
479 printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
480 printf("Use CTS = %d\n", fFillCTS) ;
481 printf("Use EMCAL = %d\n", fFillEMCAL) ;
482 printf("Use PHOS = %d\n", fFillPHOS) ;
483 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
484 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
485 printf("Track status = %d\n", (Int_t) fTrackStatus) ;
486 printf("AODs Track filter mask = %d or hybrid %d\n", (Int_t) fTrackFilterMask,fSelectHybridTracks) ;
487 printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ;
488 printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
489 printf("Recalculate Clusters = %d\n", fRecalculateClusters) ;
491 printf("Use Triggers selected in SE base class %d; If not what trigger Mask? %d; Trigger max for mixed %d \n",
492 fEventTriggerAtSE, fEventTriggerMask,fMixEventTriggerMask);
494 if(fComparePtHardAndClusterPt)
495 printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
497 if(fComparePtHardAndClusterPt)
498 printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
500 printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
501 printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
502 printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
508 //_________________________________________________________________________
509 Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
510 const char * /*currentFileName*/)
512 //Fill the event counter and input lists that are needed, called by the analysis maker.
514 fEventNumber = iEntry;
515 //fCurrentFileName = TString(currentFileName);
518 if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
522 //Select events only fired by a certain trigger configuration if it is provided
524 if(fInputEvent->GetHeader())
525 eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
527 if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
529 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
533 //-------------------------------------------------------------------------------------
534 // Reject event if large clusters with large energy
535 // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
536 // If clusterzer NxN or V2 it does not help
537 //-------------------------------------------------------------------------------------
538 Int_t run = fInputEvent->GetRunNumber();
539 if( fRemoveLEDEvents && run > 146857 && run < 146861 )
541 //printf("Event %d\n",GetEventNumber());
543 // Count number of cells with energy larger than 0.1 in SM3, cut on this number
545 for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
547 Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
548 Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
549 if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
553 if(fFiredTriggerClassName.Contains("EMC")) ncellcut = 35;
555 if(ncellsSM3 >= ncellcut)
557 if(fDebug > 0) printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d\n",ncellsSM3);
560 }// Remove LED events
562 // Reject pure LED events?
563 if( fFiredTriggerClassName !="" && !fAnaLED)
565 //printf("Event type %d\n",eventType);
567 return kFALSE; //Only physics event, do not use for simulated events!!!
570 printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
571 GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
573 if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
574 else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n");
578 // kStartOfRun = 1, // START_OF_RUN
579 // kEndOfRun = 2, // END_OF_RUN
580 // kStartOfRunFiles = 3, // START_OF_RUN_FILES
581 // kEndOfRunFiles = 4, // END_OF_RUN_FILES
582 // kStartOfBurst = 5, // START_OF_BURST
583 // kEndOfBurst = 6, // END_OF_BURST
584 // kPhysicsEvent = 7, // PHYSICS_EVENT
585 // kCalibrationEvent = 8, // CALIBRATION_EVENT
586 // kFormatError = 9, // EVENT_FORMAT_ERROR
587 // kStartOfData = 10, // START_OF_DATA
588 // kEndOfData = 11, // END_OF_DATA
589 // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
590 // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
592 if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType);
593 if(eventType!=8)return kFALSE;
596 //In case of analysis of events with jets, skip those with jet pt > 5 pt hard
597 if(fComparePtHardAndJetPt)
599 if(!ComparePtHardAndJetPt()) return kFALSE ;
602 if(fComparePtHardAndClusterPt)
604 if(!ComparePtHardAndClusterPt()) return kFALSE ;
609 //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
610 if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
612 //------------------------------------------------------
613 //Event rejection depending on vertex, pileup, v0and
614 //------------------------------------------------------
616 if(fUseEventsWithPrimaryVertex)
618 if( !CheckForPrimaryVertex() ) return kFALSE;
619 if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
620 TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
621 TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
624 //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
626 if(fDoEventSelection)
628 if(!fCaloFilterPatch)
630 // Do not analyze events with pileup
631 Bool_t bPileup = IsPileUpFromSPD();
632 //IsPileupFromSPDInMultBins() // method to try
633 //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParam[0], fPileUpParam[1], fPileUpParam[2], fPileUpParam[3], fPileUpParam[4]);
634 if(bPileup) return kFALSE;
636 if(fDoV0ANDEventSelection)
638 Bool_t bV0AND = kTRUE;
639 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
641 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
642 //else bV0AND = //FIXME FOR AODs
643 if(!bV0AND) return kFALSE;
648 if(fInputEvent->GetNumberOfCaloClusters() > 0)
650 AliVCluster * calo = fInputEvent->GetCaloCluster(0);
651 if(calo->GetNLabels() == 4)
653 Int_t * selection = calo->GetLabels();
654 Bool_t bPileup = selection[0];
655 if(bPileup) return kFALSE;
657 Bool_t bGoodV = selection[1];
658 if(fUseEventsWithPrimaryVertex && !bGoodV) return kFALSE;
660 if(fDoV0ANDEventSelection)
662 Bool_t bV0AND = selection[2];
663 if(!bV0AND) return kFALSE;
666 fTrackMult = selection[3];
667 if(fTrackMult == 0) return kFALSE;
671 //First filtered AODs, track multiplicity stored there.
672 fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
673 if(fTrackMult == 0) return kFALSE;
675 }//at least one cluster
678 //printf("AliCaloTrackReader::FillInputEvent() - No clusters in event\n");
679 //Remove events with vertex (0,0,0), bad vertex reconstruction
680 if(fUseEventsWithPrimaryVertex && TMath::Abs(fVertex[0][0]) < 1.e-6 && TMath::Abs(fVertex[0][1]) < 1.e-6 && TMath::Abs(fVertex[0][2]) < 1.e-6) return kFALSE;
682 //First filtered AODs, track multiplicity stored there.
683 fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
684 if(fTrackMult == 0) return kFALSE;
686 }// CaloFileter patch
688 //------------------------------------------------------
690 //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
691 //If we need a centrality bin, we select only those events in the corresponding bin.
692 if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100)
694 Int_t cen = GetEventCentrality();
695 if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
698 //Fill the arrays with cluster/tracks/cells data
701 FillInputEMCALCells();
704 FillInputPHOSCells();
708 if(fEventTriggerAtSE)
713 //Accept events with at least one track
714 if(fTrackMult == 0 && fDoEventSelection) return kFALSE;
723 // In case of mixing analysis, all triggers accepted, but trigger particles selected
724 // only for the specific trigered events selected here. Mixing done only for MB events,
725 // tracks array filled also for those events and not the others.
727 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
728 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
730 if(!inputHandler) return kFALSE ; // to content coverity
732 UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
733 UInt_t isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
735 if(fFillCTS && (isMB || isTrigger))
738 //Accept events with at least one track
739 if(fTrackMult == 0 && fDoEventSelection) return kFALSE;
754 //___________________________________
755 void AliCaloTrackReader::ResetLists()
757 // Reset lists, called by the analysis maker
759 if(fCTSTracks) fCTSTracks -> Clear();
760 if(fEMCALClusters) fEMCALClusters -> Clear("C");
761 if(fPHOSClusters) fPHOSClusters -> Clear("C");
763 fV0ADC[0] = 0; fV0ADC[1] = 0;
764 fV0Mul[0] = 0; fV0Mul[1] = 0;
768 //____________________________________________________________
769 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
772 fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
774 fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
776 //Delete previous vertex
779 for (Int_t i = 0; i < fNMixedEvent; i++)
781 delete [] fVertex[i] ;
786 fVertex = new Double_t*[fNMixedEvent] ;
787 for (Int_t i = 0; i < fNMixedEvent; i++)
789 fVertex[i] = new Double_t[3] ;
790 fVertex[i][0] = 0.0 ;
791 fVertex[i][1] = 0.0 ;
792 fVertex[i][2] = 0.0 ;
796 //__________________________________________________
797 Int_t AliCaloTrackReader::GetEventCentrality() const
799 //Return current event centrality
803 if (fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
804 else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
805 else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
808 printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
816 //_____________________________________________________
817 Double_t AliCaloTrackReader::GetEventPlaneAngle() const
819 //Return current event centrality
823 Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
825 if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
827 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <Q> method : %f\n",ep);
830 else if(GetEventPlaneMethod().Contains("V0") )
832 if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
834 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep);
838 ep+=TMath::Pi()/2; // put same range as for <Q> method
842 //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep);
845 if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
846 else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
853 if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() - No EP pointer\n");
859 //__________________________________________________________
860 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const
862 //Return vertex position to be used for single event analysis
863 vertex[0]=fVertex[0][0];
864 vertex[1]=fVertex[0][1];
865 vertex[2]=fVertex[0][2];
868 //____________________________________________________________
869 void AliCaloTrackReader::GetVertex(Double_t vertex[3],
870 const Int_t evtIndex) const
872 //Return vertex position for mixed event, recover the vertex in a particular event.
874 vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2];
878 //________________________________________
879 void AliCaloTrackReader::FillVertexArray()
882 //Fill data member with vertex
883 //In case of Mixed event, multiple vertices
885 //Delete previous vertex
888 for (Int_t i = 0; i < fNMixedEvent; i++)
890 delete [] fVertex[i] ;
895 fVertex = new Double_t*[fNMixedEvent] ;
896 for (Int_t i = 0; i < fNMixedEvent; i++)
898 fVertex[i] = new Double_t[3] ;
899 fVertex[i][0] = 0.0 ;
900 fVertex[i][1] = 0.0 ;
901 fVertex[i][2] = 0.0 ;
905 { //Single event analysis
909 if(fInputEvent->GetPrimaryVertex())
911 fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
915 printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
916 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
917 }//Primary vertex pointer do not exist
921 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
925 printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
928 { // MultiEvent analysis
929 for (Int_t iev = 0; iev < fNMixedEvent; iev++)
931 if (fMixedEvent->GetVertexOfEvent(iev))
932 fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
934 { // no vertex found !!!!
935 AliWarning("No vertex found");
939 printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
946 //_____________________________________
947 void AliCaloTrackReader::FillInputCTS()
949 //Return array with Central Tracking System (CTS) tracks
951 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
953 Double_t pTrack[3] = {0,0,0};
955 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
959 for (Int_t itrack = 0; itrack < nTracks; itrack++)
960 {////////////// track loop
961 AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
963 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
964 if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus))
971 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track);
973 if(esdTrack && fESDtrackCuts->AcceptTrack(esdTrack))
975 track->GetPxPyPz(pTrack) ;
979 if(esdTrack->GetConstrainedParam())
981 const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam();
982 esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
983 esdTrack->GetConstrainedPxPyPz(pTrack);
987 } // use constrained tracks
993 else if(fDataType==kAOD)
995 AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track);
999 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n",
1000 aodtrack->GetType(),AliAODTrack::kPrimary,
1001 aodtrack->IsHybridGlobalConstrainedGlobal());
1004 if (fSelectHybridTracks)
1006 if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
1010 if ( aodtrack->TestFilterBit(fTrackFilterMask)==kFALSE) continue ;
1013 if (aodtrack->GetType()!= AliAODTrack::kPrimary) continue ;
1015 if (fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS(): \t accepted track! \n");
1017 track->GetPxPyPz(pTrack) ;
1019 } // aod track exists
1024 //Count the tracks in eta < 0.9
1025 //printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
1026 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1028 TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
1030 if(fCTSPtMin < momentum.Pt() && fCTSPtMax > momentum.Pt())
1032 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS"))
1035 if(fDebug > 2 && momentum.Pt() > 0.1)
1036 printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1037 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1041 track->SetID(itrack);
1044 fCTSTracks->Add(track);
1046 }//Pt and Fiducial cut passed.
1050 printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
1054 //__________________________________________________________________
1055 void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus,
1058 //Fill the EMCAL data in the array, do it
1062 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1064 //Reject clusters with bad channels, close to borders and exotic;
1065 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return;
1067 //Mask all cells in collumns facing ALICE thick material if requested
1068 if(GetCaloUtils()->GetNMaskCellColumns())
1074 Bool_t shared = kFALSE;
1075 GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1076 if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1079 if(fSelectEmbeddedClusters)
1081 if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1082 //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1086 //clus->GetPosition(pos);
1087 //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1089 if(fRecalculateClusters)
1091 //Recalibrate the cluster energy
1092 if(GetCaloUtils()->IsRecalibrationOn())
1094 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
1097 //printf("Recalibrated Energy %f\n",clus->E());
1099 GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus);
1100 GetCaloUtils()->RecalculateClusterPID(clus);
1104 //Recalculate distance to bad channels, if new list of bad channels provided
1105 GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus);
1107 //Recalculate cluster position
1108 if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1110 GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus);
1111 //clus->GetPosition(pos);
1112 //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1116 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1118 Double_t tof = clus->GetTOF();
1120 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1122 if(fDataType==AliCaloTrackReader::kESD)
1124 tof = fEMCALCells->GetCellTime(absIdMax);
1127 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1131 }// Time recalibration
1134 //Correct non linearity
1135 if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn())
1137 GetCaloUtils()->CorrectClusterEnergy(clus) ;
1138 //printf("Linearity Corrected Energy %f\n",clus->E());
1140 //In case of MC analysis, to match resolution/calibration in real data
1141 Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1142 // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy);
1143 clus->SetE(rdmEnergy);
1146 TLorentzVector momentum ;
1148 clus->GetMomentum(momentum, fVertex[vindex]);
1150 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1152 if(fEMCALPtMin > momentum.E() || fEMCALPtMax < momentum.E()) return ;
1154 Double_t tof = clus->GetTOF()*1e9;
1156 if(!fUseParamTimeCut)
1158 if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return ;
1162 Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(momentum.E()-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
1163 Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(momentum.E()-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
1164 //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
1165 if( tof < minCut || tof > maxCut ) return ;
1168 if(fDebug > 2 && momentum.E() > 0.1)
1169 printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1170 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1173 clus->SetID(iclus) ;
1175 fEMCALClusters->Add(clus);
1179 //_______________________________________
1180 void AliCaloTrackReader::FillInputEMCAL()
1182 //Return array with EMCAL clusters in aod format
1184 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
1186 // First recalibrate cells, time or energy
1187 // if(GetCaloUtils()->IsRecalibrationOn())
1188 // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1190 // fInputEvent->GetBunchCrossNumber());
1192 //Loop to select clusters in fiducial cut and fill container with aodClusters
1193 if(fEMCALClustersListName=="")
1195 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1196 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1198 AliVCluster * clus = 0;
1199 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1201 if (IsEMCALCluster(clus))
1203 FillInputEMCALAlgorithm(clus, iclus);
1208 //Recalculate track matching
1209 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
1211 }//Get the clusters from the input event
1214 TClonesArray * clusterList = 0x0;
1216 if (fInputEvent->FindListObject(fEMCALClustersListName))
1218 clusterList = dynamic_cast<TClonesArray*> (fInputEvent ->FindListObject(fEMCALClustersListName));
1220 else if(fOutputEvent)
1222 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
1227 //printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? Try input event <%s>\n",fEMCALClustersListName.Data());
1228 //List not in output event, try input event
1229 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
1232 printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data());
1237 Int_t nclusters = clusterList->GetEntriesFast();
1238 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1240 AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
1241 //printf("E %f\n",clus->E());
1242 if (clus) FillInputEMCALAlgorithm(clus, iclus);
1243 else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
1246 // Recalculate track matching, not necessary if already done in the reclusterization task.
1247 // in case it was not done ...
1248 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
1252 if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d\n", fEMCALClusters->GetEntriesFast());
1256 //______________________________________
1257 void AliCaloTrackReader::FillInputPHOS()
1259 //Return array with PHOS clusters in aod format
1261 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
1263 //Loop to select clusters in fiducial cut and fill container with aodClusters
1264 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1265 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1267 AliVCluster * clus = 0;
1268 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1270 if (IsPHOSCluster(clus))
1272 //Check if the cluster contains any bad channel and if close to calorimeter borders
1275 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1276 if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells()))
1278 if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex))
1281 if(fRecalculateClusters)
1283 //Recalibrate the cluster energy
1284 if(GetCaloUtils()->IsRecalibrationOn())
1286 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
1291 TLorentzVector momentum ;
1293 clus->GetMomentum(momentum, fVertex[vindex]);
1295 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
1297 if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue;
1299 if(fDebug > 2 && momentum.E() > 0.1)
1300 printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1301 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1306 clus->SetID(iclus) ;
1309 fPHOSClusters->Add(clus);
1315 if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast());
1319 //____________________________________________
1320 void AliCaloTrackReader::FillInputEMCALCells()
1322 //Return array with EMCAL cells in aod format
1324 fEMCALCells = fInputEvent->GetEMCALCells();
1328 //___________________________________________
1329 void AliCaloTrackReader::FillInputPHOSCells()
1331 //Return array with PHOS cells in aod format
1333 fPHOSCells = fInputEvent->GetPHOSCells();
1337 //_______________________________________
1338 void AliCaloTrackReader::FillInputVZERO()
1340 //Fill VZERO information in data member, add all the channels information.
1341 AliVVZERO* v0 = fInputEvent->GetVZEROData();
1342 //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1346 AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
1347 for (Int_t i = 0; i < 32; i++)
1350 {//Only available in ESDs
1351 fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
1352 fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
1355 fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
1356 fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
1359 printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1364 printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
1369 //___________________________________________________________________
1370 Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const
1372 // Check if it is a cluster from EMCAL. For old AODs cluster type has
1373 // different number and need to patch here
1375 if(fDataType==kAOD && fOldAOD)
1377 if (cluster->GetType() == 2) return kTRUE;
1382 return cluster->IsEMCAL();
1387 //___________________________________________________________________
1388 Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const
1390 //Check if it is a cluster from PHOS.For old AODs cluster type has
1391 // different number and need to patch here
1393 if(fDataType==kAOD && fOldAOD)
1395 Int_t type = cluster->GetType();
1396 if (type == 0 || type == 1) return kTRUE;
1401 return cluster->IsPHOS();
1406 //________________________________________________
1407 Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
1409 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
1412 AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent);
1413 if(!event) return kTRUE;
1415 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0)
1420 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1)
1423 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0)
1425 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
1429 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1)
1431 // cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl;
1440 //____________________________________________________________
1441 void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts)
1445 if(fESDtrackCuts) delete fESDtrackCuts ;
1447 fESDtrackCuts = cuts ;