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>
30 #include <TStreamerInfo.h>
32 // ---- ANALYSIS system ----
33 #include "AliMCEvent.h"
34 #include "AliAODMCHeader.h"
35 #include "AliGenPythiaEventHeader.h"
36 #include "AliGenCocktailEventHeader.h"
37 #include "AliGenHijingEventHeader.h"
38 #include "AliESDEvent.h"
39 #include "AliAODEvent.h"
40 #include "AliVTrack.h"
41 #include "AliVParticle.h"
42 #include "AliMixedEvent.h"
43 #include "AliESDtrack.h"
44 #include "AliESDtrackCuts.h"
45 #include "AliTriggerAnalysis.h"
46 #include "AliESDVZERO.h"
47 #include "AliVCaloCells.h"
48 #include "AliAnalysisManager.h"
49 #include "AliInputEventHandler.h"
50 #include "AliAODMCParticle.h"
53 // ---- Detectors ----
54 #include "AliPHOSGeoUtils.h"
55 #include "AliEMCALGeometry.h"
56 #include "AliEMCALRecoUtils.h"
58 // ---- CaloTrackCorr ---
59 #include "AliCalorimeterUtils.h"
60 #include "AliCaloTrackReader.h"
62 #include "AliAODJet.h"
64 ClassImp(AliCaloTrackReader)
67 //________________________________________
68 AliCaloTrackReader::AliCaloTrackReader() :
69 TObject(), fEventNumber(-1), //fCurrentFileName(""),
70 fDataType(0), fDebug(0),
71 fFiducialCut(0x0), fCheckFidCut(kFALSE),
72 fComparePtHardAndJetPt(0), fPtHardAndJetPtFactor(0),
73 fComparePtHardAndClusterPt(0),fPtHardAndClusterPtFactor(0),
74 fCTSPtMin(0), fEMCALPtMin(0), fPHOSPtMin(0),
75 fCTSPtMax(0), fEMCALPtMax(0), fPHOSPtMax(0),
76 fUseEMCALTimeCut(1), fUseParamTimeCut(0), fUseTrackTimeCut(0),
77 fEMCALTimeCutMin(-10000), fEMCALTimeCutMax(10000),
78 fEMCALParamTimeCutMin(), fEMCALParamTimeCutMax(),
79 fTrackTimeCutMin(-10000), fTrackTimeCutMax(10000),
82 fCTSTracks(0x0), fEMCALClusters(0x0), fPHOSClusters(0x0),
83 fEMCALCells(0x0), fPHOSCells(0x0),
84 fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0),
85 fFillCTS(0), fFillEMCAL(0), fFillPHOS(0),
86 fFillEMCALCells(0), fFillPHOSCells(0),
87 fRecalculateClusters(kFALSE),fSelectEmbeddedClusters(kFALSE),
88 fTrackStatus(0), fTrackFilterMask(0),
89 fESDtrackCuts(0), fESDtrackComplementaryCuts(0), fConstrainTrack(kFALSE),
90 fSelectHybridTracks(0), fSelectSPDHitTracks(kFALSE),
91 fTrackMult(0), fTrackMultEtaCut(0.9),
92 fReadStack(kFALSE), fReadAODMCParticles(kFALSE),
93 fDeltaAODFileName(""), fFiredTriggerClassName(""),
95 fEventTriggerMask(0), fMixEventTriggerMask(0), fEventTriggerAtSE(0),
96 fEventTrigMinBias(0), fEventTrigCentral(0),
97 fEventTrigSemiCentral(0), fEventTrigEMCALL0(0),
98 fEventTrigEMCALL1Gamma1(0), fEventTrigEMCALL1Gamma2(0),
99 fEventTrigEMCALL1Jet1(0), fEventTrigEMCALL1Jet2(0),
100 fBitEGA(0), fBitEJE(0),
103 fTaskName(""), fCaloUtils(0x0),
104 fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL),
105 fListMixedTracksEvents(), fListMixedCaloEvents(),
106 fLastMixedTracksEvent(-1), fLastMixedCaloEvent(-1),
107 fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE), fCaloFilterPatch(kFALSE),
108 fEMCALClustersListName(""), fZvtxCut(0.),
109 fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kTRUE),
111 fRemoveBadTriggerEvents(0), fTriggerPatchClusterMatch(0),
112 fTriggerPatchTimeWindow(), fTriggerEventThreshold(0),
113 fTriggerClusterBC(0), fTriggerClusterIndex(0), fTriggerClusterId(0),
114 fIsExoticEvent(0), fIsBadCellEvent(0), fIsBadMaxCellEvent(0),
115 fIsTriggerMatch(0), fIsTriggerMatchOpenCut(),
117 fDoEventSelection(kFALSE), fDoV0ANDEventSelection(kFALSE),
118 fDoVertexBCEventSelection(kFALSE),
119 fDoRejectNoTrackEvents(kFALSE),
120 fUseEventsWithPrimaryVertex(kFALSE),
121 fTriggerAnalysis (0x0), fTimeStampEventSelect(0),
122 fTimeStampEventFracMin(0), fTimeStampEventFracMax(0),
123 fTimeStampRunMin(0), fTimeStampRunMax(0),
124 fNPileUpClusters(-1), fNNonPileUpClusters(-1), fNPileUpClustersCut(3),
125 fVertexBC(-200), fRecalculateVertexBC(0),
126 fCentralityClass(""), fCentralityOpt(0),
127 fEventPlaneMethod(""), fImportGeometryFromFile(kFALSE), fImportGeometryFilePath(""),
128 fAcceptOnlyHIJINGLabels(0), fNMCProducedMin(0), fNMCProducedMax(0),
129 fFillInputNonStandardJetBranch(kFALSE),
130 fNonStandardJets(new TClonesArray("AliAODJet",100)),fInputNonStandardJetBranchName("jets")
134 //Initialize parameters
138 //_______________________________________
139 AliCaloTrackReader::~AliCaloTrackReader()
143 delete fFiducialCut ;
147 fAODBranchList->Delete();
148 delete fAODBranchList ;
153 if(fDataType!=kMC)fCTSTracks->Clear() ;
154 else fCTSTracks->Delete() ;
160 if(fDataType!=kMC)fEMCALClusters->Clear("C") ;
161 else fEMCALClusters->Delete() ;
162 delete fEMCALClusters ;
167 if(fDataType!=kMC)fPHOSClusters->Clear("C") ;
168 else fPHOSClusters->Delete() ;
169 delete fPHOSClusters ;
174 for (Int_t i = 0; i < fNMixedEvent; i++)
176 delete [] fVertex[i] ;
182 delete fESDtrackCuts;
183 delete fESDtrackComplementaryCuts;
184 delete fTriggerAnalysis;
188 if(fDataType!=kMC) fNonStandardJets->Clear("C") ;
189 else fNonStandardJets->Delete() ;
190 delete fNonStandardJets ;
193 // Pointers not owned, done by the analysis frame
194 // if(fInputEvent) delete fInputEvent ;
195 // if(fOutputEvent) delete fOutputEvent ;
196 // if(fMC) delete fMC ;
197 // Pointer not owned, deleted by maker
198 // if (fCaloUtils) delete fCaloUtils ;
202 //________________________________________________________________________
203 Bool_t AliCaloTrackReader::AcceptDCA(const Float_t pt, const Float_t dca)
205 // Accept track if DCA is smaller than function
207 Float_t cut = fTrackDCACut[0]+fTrackDCACut[1]/TMath::Power(pt,fTrackDCACut[2]);
209 if(TMath::Abs(dca) < cut)
216 //________________________________________________
217 Bool_t AliCaloTrackReader::ComparePtHardAndJetPt()
219 // Check the event, if the requested ptHard is much smaller than the jet pT, then there is a problem.
222 //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName());
224 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
227 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
228 Int_t nTriggerJets = pygeh->NTriggerJets();
229 Float_t ptHard = pygeh->GetPtHard();
232 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Njets: %d, pT Hard %f\n",nTriggerJets, ptHard);
234 Float_t tmpjet[]={0,0,0,0};
235 for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
237 pygeh->TriggerJet(ijet, tmpjet);
238 jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
241 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - jet %d; pycell jet pT %f\n",ijet, jet->Pt());
243 //Compare jet pT and pt Hard
244 if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
246 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
247 ptHard, jet->Pt(), fPtHardAndJetPtFactor);
259 //____________________________________________________________________
260 Bool_t AliCaloTrackReader::ComparePtHardAndClusterPt()
262 // Check the event, if the requested ptHard is smaller than the calorimeter cluster E, then there is a problem.
265 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
267 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
268 Float_t ptHard = pygeh->GetPtHard();
270 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
271 for (Int_t iclus = 0; iclus < nclusters; iclus++)
273 AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
274 Float_t ecluster = clus->E();
276 if(ecluster > fPtHardAndClusterPtFactor*ptHard)
278 printf("AliCaloTrackReader::ComparePtHardAndClusterPt() - Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f\n",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard);
290 //____________________________________________
291 AliStack* AliCaloTrackReader::GetStack() const
293 //Return pointer to stack
298 if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n");
303 ////__________________________________________________
304 //TString AliCaloTrackReader::GetFiredTriggerClasses()
306 // // List of triggered classes in a TString
308 // AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (GetInputEvent());
309 // AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (GetInputEvent());
311 // if (esdevent) return esdevent->GetFiredTriggerClasses();
312 // else if(aodevent) return aodevent->GetFiredTriggerClasses();
313 // else return ""; // Mixed Event, MC event, does not have this trigger info
317 //______________________________________________
318 AliHeader* AliCaloTrackReader::GetHeader() const
320 //Return pointer to header
323 return fMC->Header();
327 printf("AliCaloTrackReader::Header is not available\n");
332 //____________________________________________________
333 void AliCaloTrackReader::SetGeneratorMinMaxParticles()
335 // In case of access only to hijing particles in cocktail
336 // get the min and max labels
337 // TODO: Check when generator is not the first one ...
342 if (ReadStack() && fMC)
344 AliGenEventHeader * eventHeader = fMC->GenEventHeader();
346 if(!fAcceptOnlyHIJINGLabels) return ;
348 // TODO Check if it works from here ...
350 AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
352 if(!cocktail) return ;
354 TList *genHeaders = cocktail->GetHeaders();
356 Int_t nGenerators = genHeaders->GetEntries();
357 //printf("N generators %d \n", nGenerators);
359 for(Int_t igen = 0; igen < nGenerators; igen++)
361 AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
362 TString name = eventHeader2->GetName();
364 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
366 fNMCProducedMin = fNMCProducedMax;
367 fNMCProducedMax+= eventHeader2->NProduced();
369 if(name == "Hijing") return ;
373 else if(ReadAODMCParticles() && GetAODMCHeader())
375 Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
376 //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",nGenerators);
378 if( nGenerators <= 0) return ;
380 if(!fAcceptOnlyHIJINGLabels) return ;
382 for(Int_t igen = 0; igen < nGenerators; igen++)
384 AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
385 TString name = eventHeader->GetName();
387 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader->ClassName(), name.Data(), eventHeader->GetTitle());
389 fNMCProducedMin = fNMCProducedMax;
390 fNMCProducedMax+= eventHeader->NProduced();
392 if(name == "Hijing") return ;
399 //______________________________________________________________
400 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const
402 // Return pointer to Generated event header
403 // If requested and cocktail, search for the hijing generator
405 if (ReadStack() && fMC)
407 AliGenEventHeader * eventHeader = fMC->GenEventHeader();
409 if(!fAcceptOnlyHIJINGLabels) return eventHeader ;
411 // TODO Check if it works from here ...
413 AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
415 if(!cocktail) return 0x0 ;
417 TList *genHeaders = cocktail->GetHeaders();
419 Int_t nGenerators = genHeaders->GetEntries();
420 //printf("N generators %d \n", nGenerators);
422 for(Int_t igen = 0; igen < nGenerators; igen++)
424 AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
425 TString name = eventHeader2->GetName();
427 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
429 if(name == "Hijing") return eventHeader2 ;
435 else if(ReadAODMCParticles() && GetAODMCHeader())
437 Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
438 //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",nGenerators);
440 if( nGenerators <= 0) return 0x0;
442 if(!fAcceptOnlyHIJINGLabels) return GetAODMCHeader()->GetCocktailHeader(0);
444 for(Int_t igen = 0; igen < nGenerators; igen++)
446 AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
447 TString name = eventHeader->GetName();
449 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader->ClassName(), name.Data(), eventHeader->GetTitle());
451 if(name == "Hijing") return eventHeader ;
459 //printf("AliCaloTrackReader::GetGenEventHeader() - MC header not available! \n");
464 //____________________________________________________________________
465 TClonesArray* AliCaloTrackReader::GetAODMCParticles() const
467 //Return list of particles in AOD. Do it for the corresponding input event.
469 TClonesArray * rv = NULL ;
470 if(fDataType == kAOD)
473 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
475 rv = (TClonesArray*)evt->FindListObject("mcparticles");
477 printf("AliCaloTrackReader::GetAODMCParticles() - Null AOD event \n");
481 printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n");
487 //________________________________________________________
488 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
490 //Return MC header in AOD. Do it for the corresponding input event.
492 AliAODMCHeader *mch = NULL;
494 if(fDataType == kAOD)
496 AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent);
497 if(aod) mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
501 printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n");
507 //___________________________________________________________
508 Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
512 Int_t vertexBC=vtx->GetBC();
513 if(!fRecalculateVertexBC) return vertexBC;
515 // In old AODs BC not stored, recalculate it
516 // loop over the global track and select those which have small DCA to primary vertex (e.g. primary).
517 // If at least one of these primaries has valid BC != 0, then this vertex is a pile-up candidate.
519 Double_t bz = fInputEvent->GetMagneticField();
521 Int_t ntr = GetCTSTracks()->GetEntriesFast();
522 //printf("N Tracks %d\n",ntr);
524 for(Int_t i = 0 ; i < ntr ; i++)
526 AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
528 //Check if has TOF info, if not skip
529 ULong_t status = track->GetStatus();
530 Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
531 vertexBC = track->GetTOFBunchCrossing(bz);
532 Float_t pt = track->Pt();
537 Double_t dca[2] = {1e6,1e6};
538 Double_t covar[3] = {1e6,1e6,1e6};
539 track->PropagateToDCA(vtx,bz,100.,dca,covar);
541 if(AcceptDCA(pt,dca[0]))
543 if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC;
544 else if(vertexBC == 0) bc0 = kTRUE;
548 if( bc0 ) vertexBC = 0 ;
549 else vertexBC = AliVTrack::kTOFBCNA ;
555 //_____________________________
556 void AliCaloTrackReader::Init()
558 //Init reader. Method to be called in AliAnaPartCorrMaker
560 //printf(" AliCaloTrackReader::Init() %p \n",gGeoManager);
562 if(fReadStack && fReadAODMCParticles)
564 printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n");
566 fReadAODMCParticles = kFALSE;
569 // Init geometry, I do not like much to do it like this ...
570 if(fImportGeometryFromFile && !gGeoManager)
572 if(fImportGeometryFilePath=="") // If not specified, set a default location
573 fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root"; // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
575 printf("AliCaloTrackReader::Init() - Import %s\n",fImportGeometryFilePath.Data());
576 TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
580 fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks
584 //_______________________________________
585 void AliCaloTrackReader::InitParameters()
587 //Initialize the parameters of the analysis.
593 fEMCALPtMax = 1000. ;
597 // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
598 fTrackDCACut[0] = 0.0105;
599 fTrackDCACut[1] = 0.0350;
600 fTrackDCACut[2] = 1.1;
602 //Do not filter the detectors input by default.
606 fFillEMCALCells = kFALSE;
607 fFillPHOSCells = kFALSE;
609 fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
610 fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
611 fDeltaAODFileName = "deltaAODPartCorr.root";
612 fFiredTriggerClassName = "";
613 fEventTriggerMask = AliVEvent::kAny;
614 fMixEventTriggerMask = AliVEvent::kAnyINT;
615 fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
617 fAcceptFastCluster = kTRUE;
620 //We want tracks fitted in the detectors:
621 //fTrackStatus=AliESDtrack::kTPCrefit;
622 //fTrackStatus|=AliESDtrack::kITSrefit;
624 fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
627 fESDtrackComplementaryCuts = 0;
629 fConstrainTrack = kFALSE ; // constrain tracks to vertex
631 fV0ADC[0] = 0; fV0ADC[1] = 0;
632 fV0Mul[0] = 0; fV0Mul[1] = 0;
638 fPtHardAndJetPtFactor = 7.;
639 fPtHardAndClusterPtFactor = 1.;
642 fCentralityClass = "V0M";
644 fCentralityBin[0] = fCentralityBin[1]=-1;
646 fEventPlaneMethod = "V0";
648 // Allocate memory (not sure this is the right place)
649 fCTSTracks = new TObjArray();
650 fEMCALClusters = new TObjArray();
651 fPHOSClusters = new TObjArray();
652 fTriggerAnalysis = new AliTriggerAnalysis;
653 fAODBranchList = new TList ;
655 fImportGeometryFromFile = kFALSE;
657 fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
658 fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
660 // Parametrized time cut (LHC11d)
661 fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1. ;
662 fEMCALParamTimeCutMax[0] = 5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.45; fEMCALParamTimeCutMax[3] = 1.25;
664 // Parametrized time cut (LHC11c)
665 //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
666 //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
668 fTimeStampRunMin = -1;
669 fTimeStampRunMax = 1e12;
670 fTimeStampEventFracMin = -1;
671 fTimeStampEventFracMax = 2;
673 for(Int_t i = 0; i < 19; i++)
675 fEMCalBCEvent [i] = 0;
676 fEMCalBCEventCut[i] = 0;
677 fTrackBCEvent [i] = 0;
678 fTrackBCEventCut[i] = 0;
681 // Trigger match-rejection
682 fTriggerPatchTimeWindow[0] = 8;
683 fTriggerPatchTimeWindow[1] = 9;
685 fTriggerClusterBC = -10000 ;
686 fTriggerEventThreshold = 2.;
687 fTriggerClusterIndex = -1;
688 fTriggerClusterId = -1;
691 fInputNonStandardJetBranchName = "jets";
692 fFillInputNonStandardJetBranch = kFALSE;
693 if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
697 //___________________________________________________________________
698 Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const
700 // Check if it is a cluster from EMCAL. For old AODs cluster type has
701 // different number and need to patch here
703 if(fDataType==kAOD && fOldAOD)
705 if (cluster->GetType() == 2) return kTRUE;
710 return cluster->IsEMCAL();
715 //___________________________________________________________________
716 Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const
718 //Check if it is a cluster from PHOS.For old AODs cluster type has
719 // different number and need to patch here
721 if(fDataType==kAOD && fOldAOD)
723 Int_t type = cluster->GetType();
724 if (type == 0 || type == 1) return kTRUE;
729 return cluster->IsPHOS();
734 //________________________________________________________________________
735 Bool_t AliCaloTrackReader::IsHIJINGLabel(Int_t label)
738 // Find if cluster/track was generated by HIJING
740 AliGenHijingEventHeader* hijingHeader = dynamic_cast<AliGenHijingEventHeader *> (GetGenEventHeader());
742 //printf("header %p, label %d\n",hijingHeader,label);
744 if(!hijingHeader || label < 0 ) return kFALSE;
747 //printf("pass a), N produced %d\n",nproduced);
749 if(label >= fNMCProducedMin && label < fNMCProducedMax)
751 //printf(" accept!, label is smaller than produced, N %d\n",nproduced);
758 if(!GetStack()) return kFALSE;
760 Int_t nprimaries = GetStack()->GetNtrack();
762 if(label > nprimaries) return kFALSE;
764 TParticle * mom = GetStack()->Particle(label);
767 Int_t iParent = mom->GetFirstMother();
770 if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax)
772 //printf("\t accept, mother is %d \n",iParent)
777 mom = GetStack()->Particle(iMom);
778 iParent = mom->GetFirstMother();
786 TClonesArray* mcparticles = GetAODMCParticles();
788 if(!mcparticles) return kFALSE;
790 Int_t nprimaries = mcparticles->GetEntriesFast();
792 if(label > nprimaries) return kFALSE;
794 //printf("pass b) N primaries %d \n",nprimaries);
796 if(label >= fNMCProducedMin && label < fNMCProducedMax)
801 // Find grand parent, check if produced in the good range
802 AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);
805 Int_t iParent = mom->GetMother();
808 if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax)
810 //printf("\t accept, mother is %d, with nProduced %d \n",iParent, nproduced);
815 mom = (AliAODMCParticle *) mcparticles->At(iMom);
816 iParent = mom->GetMother();
820 //printf("pass c), no match found \n");
827 //___________________________________________________________
828 Bool_t AliCaloTrackReader::IsInTimeWindow(const Double_t tof, const Float_t energy) const
830 // Cluster time selection window
832 // Parametrized cut depending on E
835 Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
836 Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
837 //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
838 if( tof < minCut || tof > maxCut ) return kFALSE ;
841 //In any case, the time should to be larger than the fixed window ...
842 if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
847 //________________________________________________
848 Bool_t AliCaloTrackReader::IsPileUpFromSPD() const
850 // Check if event is from pile-up determined by SPD
851 // Default values: (3, 0.8, 3., 2., 5.)
852 return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
853 fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
854 //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
858 //__________________________________________________
859 Bool_t AliCaloTrackReader::IsPileUpFromEMCal() const
861 // Check if event is from pile-up determined by EMCal
862 if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
866 //________________________________________________________
867 Bool_t AliCaloTrackReader::IsPileUpFromSPDAndEMCal() const
869 // Check if event is from pile-up determined by SPD and EMCal
870 if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
874 //_______________________________________________________
875 Bool_t AliCaloTrackReader::IsPileUpFromSPDOrEMCal() const
877 // Check if event is from pile-up determined by SPD or EMCal
878 if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
882 //___________________________________________________________
883 Bool_t AliCaloTrackReader::IsPileUpFromSPDAndNotEMCal() const
885 // Check if event is from pile-up determined by SPD and not by EMCal
886 if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
890 //___________________________________________________________
891 Bool_t AliCaloTrackReader::IsPileUpFromEMCalAndNotSPD() const
893 // Check if event is from pile-up determined by EMCal, not by SPD
894 if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
898 //______________________________________________________________
899 Bool_t AliCaloTrackReader::IsPileUpFromNotSPDAndNotEMCal() const
901 // Check if event not from pile-up determined neither by SPD nor by EMCal
902 if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
906 //_________________________________________________________________________
907 Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
908 const char * /*currentFileName*/)
910 //Fill the event counter and input lists that are needed, called by the analysis maker.
912 fEventNumber = iEntry;
913 fTriggerClusterIndex = -1;
914 fTriggerClusterId = -1;
915 fIsTriggerMatch = kFALSE;
916 fTriggerClusterBC = -10000;
917 fIsExoticEvent = kFALSE;
918 fIsBadCellEvent = kFALSE;
919 fIsBadMaxCellEvent = kFALSE;
921 fIsTriggerMatchOpenCut[0] = kFALSE ;
922 fIsTriggerMatchOpenCut[1] = kFALSE ;
923 fIsTriggerMatchOpenCut[2] = kFALSE ;
925 //fCurrentFileName = TString(currentFileName);
928 if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
932 //Select events only fired by a certain trigger configuration if it is provided
934 if(fInputEvent->GetHeader())
935 eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
937 if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
939 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
943 //-------------------------------------------------------------------------------------
944 // Reject event if large clusters with large energy
945 // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
946 // If clusterzer NxN or V2 it does not help
947 //-------------------------------------------------------------------------------------
948 Int_t run = fInputEvent->GetRunNumber();
949 if( fRemoveLEDEvents && run > 146857 && run < 146861 )
951 Bool_t reject = RejectLEDEvents();
952 if(reject) return kFALSE;
953 }// Remove LED events
955 //------------------------
956 // Reject pure LED events?
957 //-------------------------
958 if( fFiredTriggerClassName !="" && !fAnaLED)
960 //printf("Event type %d\n",eventType);
962 return kFALSE; //Only physics event, do not use for simulated events!!!
965 printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
966 GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
968 if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
969 else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n");
973 // kStartOfRun = 1, // START_OF_RUN
974 // kEndOfRun = 2, // END_OF_RUN
975 // kStartOfRunFiles = 3, // START_OF_RUN_FILES
976 // kEndOfRunFiles = 4, // END_OF_RUN_FILES
977 // kStartOfBurst = 5, // START_OF_BURST
978 // kEndOfBurst = 6, // END_OF_BURST
979 // kPhysicsEvent = 7, // PHYSICS_EVENT
980 // kCalibrationEvent = 8, // CALIBRATION_EVENT
981 // kFormatError = 9, // EVENT_FORMAT_ERROR
982 // kStartOfData = 10, // START_OF_DATA
983 // kEndOfData = 11, // END_OF_DATA
984 // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
985 // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
987 if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType);
988 if(eventType!=8)return kFALSE;
991 //In case of analysis of events with jets, skip those with jet pt > 5 pt hard
992 if(fComparePtHardAndJetPt)
994 if(!ComparePtHardAndJetPt()) return kFALSE ;
997 if(fComparePtHardAndClusterPt)
999 if(!ComparePtHardAndClusterPt()) return kFALSE ;
1004 //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
1005 if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
1007 //------------------------------------------------------
1008 //Event rejection depending on vertex, pileup, v0and
1009 //------------------------------------------------------
1010 if(fDataType==kESD && fTimeStampEventSelect)
1012 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1015 Int_t timeStamp = esd->GetTimeStamp();
1016 Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
1018 //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
1020 if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
1022 //printf("\t accept time stamp\n");
1026 //------------------------------------------------------
1027 //Event rejection depending on vertex, pileup, v0and
1028 //------------------------------------------------------
1030 if(fUseEventsWithPrimaryVertex)
1032 if( !CheckForPrimaryVertex() ) return kFALSE;
1033 if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
1034 TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
1035 TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
1038 //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
1040 if(fDoEventSelection)
1042 if(!fCaloFilterPatch)
1044 // Do not analyze events with pileup
1045 Bool_t bPileup = IsPileUpFromSPD();
1046 //IsPileupFromSPDInMultBins() // method to try
1047 //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
1048 if(bPileup) return kFALSE;
1050 if(fDoV0ANDEventSelection)
1052 Bool_t bV0AND = kTRUE;
1053 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1055 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
1056 //else bV0AND = //FIXME FOR AODs
1057 if(!bV0AND) return kFALSE;
1062 if(fInputEvent->GetNumberOfCaloClusters() > 0)
1064 AliVCluster * calo = fInputEvent->GetCaloCluster(0);
1065 if(calo->GetNLabels() == 4)
1067 Int_t * selection = calo->GetLabels();
1068 Bool_t bPileup = selection[0];
1069 if(bPileup) return kFALSE;
1071 Bool_t bGoodV = selection[1];
1072 if(fUseEventsWithPrimaryVertex && !bGoodV) return kFALSE;
1074 if(fDoV0ANDEventSelection)
1076 Bool_t bV0AND = selection[2];
1077 if(!bV0AND) return kFALSE;
1080 fTrackMult = selection[3];
1081 if(fTrackMult == 0) return kFALSE;
1085 //First filtered AODs, track multiplicity stored there.
1086 fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
1087 if(fTrackMult == 0) return kFALSE;
1089 }//at least one cluster
1092 //printf("AliCaloTrackReader::FillInputEvent() - No clusters in event\n");
1093 //Remove events with vertex (0,0,0), bad vertex reconstruction
1094 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;
1096 //First filtered AODs, track multiplicity stored there.
1097 fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
1098 if(fTrackMult == 0) return kFALSE;
1100 }// CaloFileter patch
1101 }// Event selection/AliceSoft/AliRoot/trunk/PWG/CaloTrackCorrBase/AliCaloTrackReader.h
1103 //------------------------------------------------------
1105 //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
1106 //If we need a centrality bin, we select only those events in the corresponding bin.
1107 if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100)
1109 Int_t cen = GetEventCentrality();
1110 if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
1113 //Fill the arrays with cluster/tracks/cells data
1115 if(!fEventTriggerAtSE)
1117 // In case of mixing analysis, accept MB events, not only Trigger
1118 // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
1119 // via de method in the base class FillMixedEventPool()
1121 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
1122 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
1124 if(!inputHandler) return kFALSE ; // to content coverity
1126 UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
1127 UInt_t isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
1129 if(!isTrigger && !isMB) return kFALSE;
1131 //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
1134 //----------------------------------------------------------------------
1135 // Do not count events that where likely triggered by an exotic cluster
1136 // or out BC cluster
1137 //----------------------------------------------------------------------
1139 // Set a bit with the event kind, MB, L0, L1 ...
1140 SetEventTriggerBit();
1142 //Get Patches that triggered
1143 TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
1145 if(fRemoveExoticEvents)
1147 RejectExoticEvents(patches);
1150 //printf("AliCaloTrackReader::FillInputEvent() - REJECT exotic triggered event \n");
1155 RejectTriggeredEventsByPileUp(patches);
1156 //printf("AliCaloTrackReader::FillInputEvent(), Trigger BC = %d\n",fTriggerClusterBC);
1158 if(fRemoveTriggerOutBCEvents)
1160 if(fTriggerClusterBC != 0 && fTriggerClusterBC != 6)
1162 //printf("\t REJECT, bad trigger cluster BC\n");
1168 MatchTriggerCluster(patches);
1170 if(fRemoveBadTriggerEvents)
1172 //printf("ACCEPT triggered event? - exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
1173 // fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
1174 if (fIsExoticEvent) return kFALSE;
1175 else if(fIsBadCellEvent) return kFALSE;
1176 else if(fTriggerClusterBC != 0) return kFALSE;
1177 //printf("\t *** YES\n");
1182 // Get the main vertex BC, in case not available
1183 // it is calculated in FillCTS checking the BC of tracks
1184 // with DCA small (if cut applied, if open)
1185 fVertexBC=fInputEvent->GetPrimaryVertex()->GetBC();
1187 if(fAcceptOnlyHIJINGLabels) SetGeneratorMinMaxParticles();
1189 //printf("N min %d, N max %d\n",fNMCProducedMin,fNMCProducedMax);
1194 //Accept events with at least one track
1195 if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
1198 if(fDoVertexBCEventSelection)
1200 if(fVertexBC!=0 && fVertexBC!=AliVTrack::kTOFBCNA) return kFALSE ;
1204 FillInputEMCALCells();
1207 FillInputPHOSCells();
1217 //one specified jet branch
1218 if(fFillInputNonStandardJetBranch)
1219 FillInputNonStandardJets();
1224 //__________________________________________________
1225 Int_t AliCaloTrackReader::GetEventCentrality() const
1227 //Return current event centrality
1231 if (fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1232 else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1233 else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
1236 printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
1244 //_____________________________________________________
1245 Double_t AliCaloTrackReader::GetEventPlaneAngle() const
1247 //Return current event centrality
1251 Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1253 if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
1255 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <Q> method : %f\n",ep);
1258 else if(GetEventPlaneMethod().Contains("V0") )
1260 if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1262 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep);
1266 ep+=TMath::Pi()/2; // put same range as for <Q> method
1270 //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep);
1273 if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1274 else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1281 if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() - No EP pointer\n");
1287 //__________________________________________________________
1288 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const
1290 //Return vertex position to be used for single event analysis
1291 vertex[0]=fVertex[0][0];
1292 vertex[1]=fVertex[0][1];
1293 vertex[2]=fVertex[0][2];
1296 //____________________________________________________________
1297 void AliCaloTrackReader::GetVertex(Double_t vertex[3],
1298 const Int_t evtIndex) const
1300 //Return vertex position for mixed event, recover the vertex in a particular event.
1302 vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2];
1306 //________________________________________
1307 void AliCaloTrackReader::FillVertexArray()
1310 //Fill data member with vertex
1311 //In case of Mixed event, multiple vertices
1313 //Delete previous vertex
1316 for (Int_t i = 0; i < fNMixedEvent; i++)
1318 delete [] fVertex[i] ;
1323 fVertex = new Double_t*[fNMixedEvent] ;
1324 for (Int_t i = 0; i < fNMixedEvent; i++)
1326 fVertex[i] = new Double_t[3] ;
1327 fVertex[i][0] = 0.0 ;
1328 fVertex[i][1] = 0.0 ;
1329 fVertex[i][2] = 0.0 ;
1333 { //Single event analysis
1337 if(fInputEvent->GetPrimaryVertex())
1339 fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
1343 printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
1344 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1345 }//Primary vertex pointer do not exist
1349 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1353 printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
1356 { // MultiEvent analysis
1357 for (Int_t iev = 0; iev < fNMixedEvent; iev++)
1359 if (fMixedEvent->GetVertexOfEvent(iev))
1360 fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
1362 { // no vertex found !!!!
1363 AliWarning("No vertex found");
1367 printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
1374 //_____________________________________
1375 void AliCaloTrackReader::FillInputCTS()
1377 //Return array with Central Tracking System (CTS) tracks
1379 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
1381 Double_t pTrack[3] = {0,0,0};
1383 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1386 Double_t bz = GetInputEvent()->GetMagneticField();
1388 for(Int_t i = 0; i < 19; i++)
1390 fTrackBCEvent [i] = 0;
1391 fTrackBCEventCut[i] = 0;
1394 Bool_t bc0 = kFALSE;
1395 if(fRecalculateVertexBC) fVertexBC=AliVTrack::kTOFBCNA;
1397 for (Int_t itrack = 0; itrack < nTracks; itrack++)
1398 {////////////// track loop
1399 AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
1401 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
1402 ULong_t status = track->GetStatus();
1404 if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
1409 Float_t dcaTPC =-999;
1411 if (fDataType==kESD)
1413 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track);
1417 if(fESDtrackCuts->AcceptTrack(esdTrack))
1419 track->GetPxPyPz(pTrack) ;
1423 if(esdTrack->GetConstrainedParam())
1425 const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam();
1426 esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
1427 esdTrack->GetConstrainedPxPyPz(pTrack);
1431 } // use constrained tracks
1433 if(fSelectSPDHitTracks)
1434 {//Not much sense to use with TPC only or Hybrid tracks
1435 if(!esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1)) continue ;
1438 // Complementary track to global : Hybrids (make sure that the previous selection is for Global)
1439 else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack))
1441 // constrain the track
1442 if(esdTrack->GetConstrainedParam())
1444 esdTrack->Set(esdTrack->GetConstrainedParam()->GetX(),esdTrack->GetConstrainedParam()->GetAlpha(),esdTrack->GetConstrainedParam()->GetParameter(),esdTrack->GetConstrainedParam()->GetCovariance());
1446 track->GetPxPyPz(pTrack) ;
1454 else if(fDataType==kAOD)
1456 AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track);
1460 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n",
1461 aodtrack->GetType(),AliAODTrack::kPrimary,
1462 aodtrack->IsHybridGlobalConstrainedGlobal());
1465 if (fSelectHybridTracks)
1467 if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
1471 if ( aodtrack->TestFilterBit(fTrackFilterMask)==kFALSE) continue ;
1474 if(fSelectSPDHitTracks)
1475 {//Not much sense to use with TPC only or Hybrid tracks
1476 if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) continue ;
1479 if (aodtrack->GetType()!= AliAODTrack::kPrimary) continue ;
1481 if (fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS(): \t accepted track! \n");
1483 //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1485 dcaTPC = aodtrack->DCA();
1487 track->GetPxPyPz(pTrack) ;
1489 } // aod track exists
1494 TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
1496 Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1497 Double_t tof = -1000;
1498 Int_t trackBC = -1000 ;
1502 trackBC = track->GetTOFBunchCrossing(bz);
1503 SetTrackEventBC(trackBC+9);
1505 tof = track->GetTOFsignal()*1e-3;
1510 //normal way to get the dca, cut on dca_xy
1513 Double_t dca[2] = {1e6,1e6};
1514 Double_t covar[3] = {1e6,1e6,1e6};
1515 Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1516 if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]);
1519 //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f, BC %d\n",momentum.Pt(),dca[0],trackBC);
1527 //SetTrackEventBCcut(bc);
1528 SetTrackEventBCcut(trackBC+9);
1530 //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1531 if(fRecalculateVertexBC)
1533 if (trackBC !=0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1534 else if(trackBC == 0) bc0 = kTRUE;
1537 //In any case, the time should to be larger than the fixed window ...
1538 if( fUseTrackTimeCut && (trackBC!=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1540 //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1543 //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1547 //Count the tracks in eta < 0.9
1548 //printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
1549 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1551 if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ;
1553 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
1555 if(fDebug > 2 && momentum.Pt() > 0.1)
1556 printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1557 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1559 if (fMixedEvent) track->SetID(itrack);
1561 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(track->GetLabel())) continue ;
1563 fCTSTracks->Add(track);
1567 if(fVertexBC ==0 || fVertexBC == AliVTrack::kTOFBCNA)
1569 if( bc0 ) fVertexBC = 0 ;
1570 else fVertexBC = AliVTrack::kTOFBCNA ;
1575 printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
1579 //__________________________________________________________________
1580 void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus,
1583 //Fill the EMCAL data in the array, do it
1587 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1589 if(fRecalculateClusters)
1591 //Recalibrate the cluster energy
1592 if(GetCaloUtils()->IsRecalibrationOn())
1594 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
1597 //printf("Recalibrated Energy %f\n",clus->E());
1599 GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus);
1600 GetCaloUtils()->RecalculateClusterPID(clus);
1604 //Recalculate distance to bad channels, if new list of bad channels provided
1605 GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus);
1607 //Recalculate cluster position
1608 if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1610 GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus);
1611 //clus->GetPosition(pos);
1612 //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1616 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1618 Double_t tof = clus->GetTOF();
1620 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1622 if(fDataType==AliCaloTrackReader::kESD)
1624 tof = fEMCALCells->GetCellTime(absIdMax);
1627 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1631 }// Time recalibration
1634 //Reject clusters with bad channels, close to borders and exotic;
1635 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return;
1637 //Mask all cells in collumns facing ALICE thick material if requested
1638 if(GetCaloUtils()->GetNMaskCellColumns())
1644 Bool_t shared = kFALSE;
1645 GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1646 if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1649 if(fSelectEmbeddedClusters)
1651 if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1652 //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1656 //clus->GetPosition(pos);
1657 //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1659 //Correct non linearity
1660 if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn())
1662 GetCaloUtils()->CorrectClusterEnergy(clus) ;
1663 //printf("Linearity Corrected Energy %f\n",clus->E());
1665 //In case of MC analysis, to match resolution/calibration in real data
1666 Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1667 // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy);
1668 clus->SetE(rdmEnergy);
1671 Double_t tof = clus->GetTOF()*1e9;
1673 Int_t bc = TMath::Nint(tof/50) + 9;
1674 //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1676 SetEMCalEventBC(bc);
1678 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
1680 TLorentzVector momentum ;
1682 clus->GetMomentum(momentum, fVertex[vindex]);
1684 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1686 SetEMCalEventBCcut(bc);
1688 if(!IsInTimeWindow(tof,clus->E()))
1690 fNPileUpClusters++ ;
1691 if(fUseEMCALTimeCut) return ;
1694 fNNonPileUpClusters++;
1696 if(fDebug > 2 && momentum.E() > 0.1)
1697 printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1698 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1701 clus->SetID(iclus) ;
1703 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel( clus->GetLabel() )) return ;
1705 // if(fAcceptOnlyHIJINGLabels)
1707 // printf("Accept label %d?\n",clus->GetLabel());
1709 // if( !IsHIJINGLabel( clus->GetLabel() ) ) { printf("\t Reject label\n") ; return ; }
1710 // else printf("\t Accept label\n") ;
1713 fEMCALClusters->Add(clus);
1717 //_______________________________________
1718 void AliCaloTrackReader::FillInputEMCAL()
1720 //Return array with EMCAL clusters in aod format
1722 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
1724 // First recalibrate cells, time or energy
1725 // if(GetCaloUtils()->IsRecalibrationOn())
1726 // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1728 // fInputEvent->GetBunchCrossNumber());
1730 fNPileUpClusters = 0; // Init counter
1731 fNNonPileUpClusters = 0; // Init counter
1732 for(Int_t i = 0; i < 19; i++)
1734 fEMCalBCEvent [i] = 0;
1735 fEMCalBCEventCut[i] = 0;
1738 //Loop to select clusters in fiducial cut and fill container with aodClusters
1739 if(fEMCALClustersListName=="")
1741 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1742 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1744 AliVCluster * clus = 0;
1745 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1747 if (IsEMCALCluster(clus))
1749 FillInputEMCALAlgorithm(clus, iclus);
1754 //Recalculate track matching
1755 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
1757 }//Get the clusters from the input event
1760 TClonesArray * clusterList = 0x0;
1762 if (fInputEvent->FindListObject(fEMCALClustersListName))
1764 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
1766 else if(fOutputEvent)
1768 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
1773 printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data());
1777 Int_t nclusters = clusterList->GetEntriesFast();
1778 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1780 AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
1781 //printf("E %f\n",clus->E());
1782 if (clus) FillInputEMCALAlgorithm(clus, iclus);
1783 else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
1786 // Recalculate the pile-up time, in case long time clusters removed during clusterization
1787 //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1789 fNPileUpClusters = 0; // Init counter
1790 fNNonPileUpClusters = 0; // Init counter
1791 for(Int_t i = 0; i < 19; i++)
1793 fEMCalBCEvent [i] = 0;
1794 fEMCalBCEventCut[i] = 0;
1797 for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
1799 AliVCluster * clus = 0;
1801 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1803 if (IsEMCALCluster(clus))
1807 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1808 Double_t tof = clus->GetTOF();
1809 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1812 //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
1814 //Reject clusters with bad channels, close to borders and exotic;
1815 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
1817 Int_t bc = TMath::Nint(tof/50) + 9;
1818 SetEMCalEventBC(bc);
1820 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
1822 TLorentzVector momentum ;
1824 clus->GetMomentum(momentum, fVertex[0]);
1826 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1828 SetEMCalEventBCcut(bc);
1830 if(!IsInTimeWindow(tof,clus->E()))
1831 fNPileUpClusters++ ;
1833 fNNonPileUpClusters++;
1839 //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1841 // Recalculate track matching, not necessary if already done in the reclusterization task.
1842 // in case it was not done ...
1843 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
1847 if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters);
1851 //______________________________________
1852 void AliCaloTrackReader::FillInputPHOS()
1854 //Return array with PHOS clusters in aod format
1856 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
1858 //Loop to select clusters in fiducial cut and fill container with aodClusters
1859 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1860 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1862 AliVCluster * clus = 0;
1863 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1865 if (IsPHOSCluster(clus))
1867 //Check if the cluster contains any bad channel and if close to calorimeter borders
1870 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1871 if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells()))
1873 if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex))
1876 if(fRecalculateClusters)
1878 //Recalibrate the cluster energy
1879 if(GetCaloUtils()->IsRecalibrationOn())
1881 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
1886 TLorentzVector momentum ;
1888 clus->GetMomentum(momentum, fVertex[vindex]);
1890 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
1892 if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue;
1894 if(fDebug > 2 && momentum.E() > 0.1)
1895 printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1896 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1901 clus->SetID(iclus) ;
1904 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(clus->GetLabel())) continue ;
1906 fPHOSClusters->Add(clus);
1912 if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast());
1916 //____________________________________________
1917 void AliCaloTrackReader::FillInputEMCALCells()
1919 //Return array with EMCAL cells in aod format
1921 fEMCALCells = fInputEvent->GetEMCALCells();
1925 //___________________________________________
1926 void AliCaloTrackReader::FillInputPHOSCells()
1928 //Return array with PHOS cells in aod format
1930 fPHOSCells = fInputEvent->GetPHOSCells();
1934 //_______________________________________
1935 void AliCaloTrackReader::FillInputVZERO()
1937 //Fill VZERO information in data member, add all the channels information.
1938 AliVVZERO* v0 = fInputEvent->GetVZEROData();
1939 //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1943 AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
1944 for (Int_t i = 0; i < 32; i++)
1947 {//Only available in ESDs
1948 fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
1949 fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
1952 fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
1953 fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
1956 printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1961 printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
1965 //_________________________________________________
1966 void AliCaloTrackReader::FillInputNonStandardJets()
1969 //fill array with non standard jets
1973 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputNonStandardJets()\n");
1975 //check if branch name is given
1976 if(!fInputNonStandardJetBranchName.Length())
1978 Printf("No non-standard jet branch name specified. Specify among existing ones.");
1979 fInputEvent->Print();
1983 fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
1985 if(!fNonStandardJets)
1987 //check if jet branch exist; exit if not
1988 Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data());
1989 fInputEvent->Print();
1995 printf("AliCaloTrackReader::FillInputNonStandardJets() - aod input jets %d\n", fNonStandardJets->GetEntriesFast() );
2000 //________________________________________________
2001 Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
2003 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
2006 AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent);
2007 if(!event) return kTRUE;
2009 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0)
2014 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1)
2017 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0)
2019 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
2023 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1)
2025 // cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl;
2034 //________________________________________________________________________________
2035 TArrayI AliCaloTrackReader::GetTriggerPatches(const Int_t tmin, const Int_t tmax )
2037 // Select the patches that triggered
2038 // Depend on L0 or L1
2041 Int_t trigtimes[30], globCol, globRow,ntimes, i;
2042 Int_t absId = -1; //[100];
2047 // get object pointer
2048 AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2050 // class is not empty
2051 if( caloTrigger->GetEntries() > 0 )
2053 // must reset before usage, or the class will fail
2054 caloTrigger->Reset();
2056 // go throuth the trigger channels
2057 while( caloTrigger->Next() )
2059 // get position in global 2x2 tower coordinates
2060 caloTrigger->GetPosition( globCol, globRow );
2063 if(IsEventEMCALL0())
2065 // get dimension of time arrays
2066 caloTrigger->GetNL0Times( ntimes );
2068 // no L0s in this channel
2069 // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2074 caloTrigger->GetL0Times( trigtimes );
2076 //printf("trigger time window %d - %d\n",fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
2077 // go through the array
2078 for( i = 0; i < ntimes; i++ )
2080 // check if in cut - 8,9 shall be accepted in 2011
2081 if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2083 //printf("Accepted trigger time %d \n",trigtimes[i]);
2084 //if(nTrig > 99) continue;
2085 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2086 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
2087 patches.Set(nPatch+1);
2088 patches.AddAt(absId,nPatch++);
2090 } // trigger time array
2092 else if(IsEventEMCALL1()) // L1
2095 caloTrigger->GetTriggerBits(bit);
2097 Bool_t isEGA = ((bit >> fBitEGA) & 0x1) && IsEventEMCALL1Gamma() ;
2098 Bool_t isEJE = ((bit >> fBitEJE) & 0x1) && IsEventEMCALL1Jet () ;
2100 if(!isEGA && !isEJE) continue;
2102 Int_t patchsize = -1;
2103 if (isEGA) patchsize = 2;
2104 else if (isEJE) patchsize = 16;
2106 // add 2x2 (EGA) or 16x16 (EJE) patches
2107 for(Int_t irow=0; irow < patchsize; irow++)
2109 for(Int_t icol=0; icol < patchsize; icol++)
2111 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2112 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
2113 patches.Set(nPatch+1);
2114 patches.AddAt(absId,nPatch++);
2120 } // trigger iterator
2121 } // go thorough triggers
2123 //printf("N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2128 //______________________________________________________________________
2129 void AliCaloTrackReader::MatchTriggerCluster(TArrayI patches)
2131 // Finds the cluster that triggered
2133 // Init info from previous event
2134 fTriggerClusterIndex = -1;
2135 fTriggerClusterId = -1;
2136 fTriggerClusterBC = -10000;
2137 fIsExoticEvent = kFALSE;
2138 fIsBadCellEvent = kFALSE;
2139 fIsBadMaxCellEvent = kFALSE;
2141 fIsTriggerMatch = kFALSE;
2142 fIsTriggerMatchOpenCut[0] = kFALSE;
2143 fIsTriggerMatchOpenCut[1] = kFALSE;
2144 fIsTriggerMatchOpenCut[2] = kFALSE;
2146 // Do only analysis for triggered events
2147 if(!IsEventEMCALL1() && !IsEventEMCALL0())
2149 fTriggerClusterBC = 0;
2153 //Recover the list of clusters
2154 TClonesArray * clusterList = 0;
2155 if (fInputEvent->FindListObject(fEMCALClustersListName))
2157 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2159 else if(fOutputEvent)
2161 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2164 // Get number of clusters and of trigger patches
2165 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2167 nclusters = clusterList->GetEntriesFast();
2169 Int_t nPatch = patches.GetSize();
2170 Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2172 //Init some variables used in the cluster loop
2173 Float_t tofPatchMax = 100000;
2174 Float_t ePatchMax =-1;
2176 Float_t tofMax = 100000;
2180 Int_t idclusMax =-1;
2181 Bool_t badClMax = kFALSE;
2182 Bool_t badCeMax = kFALSE;
2183 Bool_t exoMax = kFALSE;
2184 Int_t absIdMaxTrig= -1;
2185 Int_t absIdMaxMax = -1;
2187 Int_t nOfHighECl = 0 ;
2189 Float_t minE = fTriggerEventThreshold / 2.;
2190 // This method is not really suitable for JET trigger
2191 // but in case, reduce the energy cut since we do not trigger on high energy particle
2192 if(IsEventEMCALL1()) minE = 1;
2194 // Loop on the clusters, check if there is any that falls into one of the patches
2195 for (Int_t iclus = 0; iclus < nclusters; iclus++)
2197 AliVCluster * clus = 0;
2198 if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2199 else clus = fInputEvent->GetCaloCluster(iclus);
2201 if ( !clus ) continue ;
2203 if ( !IsEMCALCluster(clus)) continue ;
2205 //Skip clusters with too low energy to be triggering
2206 if ( clus->E() < minE ) continue ;
2209 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2211 Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2212 clus->GetCellsAbsId(),clus->GetNCells());
2213 UShort_t cellMax[] = {absIdMax};
2214 Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2216 // if cell is bad, it can happen that time calibration is not available,
2217 // when calculating if it is exotic, this can make it to be exotic by default
2218 // open it temporarily for this cluster
2220 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2222 Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2224 // Set back the time cut on exotics
2226 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2228 // Energy threshold for exotic Ecross typically at 4 GeV,
2229 // for lower energy, check that there are more than 1 cell in the cluster
2230 if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2232 Float_t energy = clus->E();
2233 Int_t idclus = clus->GetID();
2235 Double_t tof = clus->GetTOF();
2236 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
2237 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2240 //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2241 // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2243 // Find the highest energy cluster, avobe trigger threshold
2244 // in the event in case no match to trigger is found
2249 badClMax = badCluster;
2254 absIdMaxMax = absIdMax;
2257 // count the good clusters in the event avobe the trigger threshold
2258 // to check the exotic events
2259 if(!badCluster && !exotic)
2262 // Find match to trigger
2263 if(fTriggerPatchClusterMatch)
2265 for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2268 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2269 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2270 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2272 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2274 if(absIdMax == absIDCell[ipatch])
2276 //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2277 if(energy > ePatchMax)
2281 fIsBadCellEvent = badCluster;
2282 fIsBadMaxCellEvent = badCell;
2283 fIsExoticEvent = exotic;
2284 fTriggerClusterIndex = iclus;
2285 fTriggerClusterId = idclus;
2286 fIsTriggerMatch = kTRUE;
2287 absIdMaxTrig = absIdMax;
2291 }// trigger patch loop
2292 } // Do trigger patch matching
2296 // If there was no match, assign as trigger
2297 // the highest energy cluster in the event
2298 if(!fIsTriggerMatch)
2300 tofPatchMax = tofMax;
2302 fIsBadCellEvent = badClMax;
2303 fIsBadMaxCellEvent = badCeMax;
2304 fIsExoticEvent = exoMax;
2305 fTriggerClusterIndex = clusMax;
2306 fTriggerClusterId = idclusMax;
2309 Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2311 if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2312 else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2313 else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2314 else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2315 else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2316 else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2319 //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2320 if(fTriggerClusterIndex >= 0) fTriggerClusterBC = 6 ;
2323 fTriggerClusterIndex = -2;
2324 fTriggerClusterId = -2;
2328 if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2331 // printf("AliCaloTrackReader::MatchTriggerCluster(TArrayI patches) - Trigger cluster: index %d, ID %d, E = %2.2f, tof = %2.2f (BC = %d), bad cluster? %d, bad cell? %d, exotic? %d, patch match? %d, n High E cluster %d, absId Max %d\n",
2332 // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2333 // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2335 // if(!fIsTriggerMatch) printf("\t highest energy cluster: index %d, ID %d, E = %2.2f, tof = %2.2f, bad cluster? %d, bad cell? %d, exotic? %d\n",
2336 // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2338 //Redo matching but open cuts
2339 if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2341 // Open time patch time
2342 TArrayI patchOpen = GetTriggerPatches(7,10);
2345 Int_t patchAbsIdOpenTime = -1;
2346 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2349 patchAbsIdOpenTime = patchOpen.At(iabsId);
2350 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2351 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2352 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2354 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2356 if(absIdMaxMax == absIDCell[ipatch])
2358 fIsTriggerMatchOpenCut[0] = kTRUE;
2362 }// trigger patch loop
2364 // Check neighbour patches
2365 Int_t patchAbsId = -1;
2366 Int_t globalCol = -1;
2367 Int_t globalRow = -1;
2368 GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2369 GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2371 // Check patches with strict time cut
2372 Int_t patchAbsIdNeigh = -1;
2373 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2375 if(icol < 0 || icol > 47) continue;
2377 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2379 if(irow < 0 || irow > 63) continue;
2381 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2383 if ( patchAbsIdNeigh < 0 ) continue;
2385 for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2387 if(patchAbsIdNeigh == patches.At(iabsId))
2389 fIsTriggerMatchOpenCut[1] = kTRUE;
2392 }// trigger patch loop
2397 // Check patches with open time cut
2398 Int_t patchAbsIdNeighOpenTime = -1;
2399 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2401 if(icol < 0 || icol > 47) continue;
2403 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2405 if(irow < 0 || irow > 63) continue;
2407 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2409 if ( patchAbsIdNeighOpenTime < 0 ) continue;
2411 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2413 if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2415 fIsTriggerMatchOpenCut[2] = kTRUE;
2418 }// trigger patch loop
2423 // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2424 // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2425 // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2429 }// No trigger match found
2433 //________________________________________________________
2434 void AliCaloTrackReader::Print(const Option_t * opt) const
2437 //Print some relevant parameters set for the analysis
2441 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2442 printf("Task name : %s\n", fTaskName.Data()) ;
2443 printf("Data type : %d\n", fDataType) ;
2444 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2445 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2446 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2447 printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2448 printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2449 printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2450 printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2451 printf("Use CTS = %d\n", fFillCTS) ;
2452 printf("Use EMCAL = %d\n", fFillEMCAL) ;
2453 printf("Use PHOS = %d\n", fFillPHOS) ;
2454 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2455 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2456 printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2457 printf("AODs Track filter mask = %d or hybrid %d, SPD hit %d\n", (Int_t) fTrackFilterMask,fSelectHybridTracks,fSelectSPDHitTracks) ;
2458 printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ;
2459 printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2460 printf("Recalculate Clusters = %d\n", fRecalculateClusters) ;
2462 printf("Use Triggers selected in SE base class %d; If not what trigger Mask? %d; Trigger max for mixed %d \n",
2463 fEventTriggerAtSE, fEventTriggerMask,fMixEventTriggerMask);
2465 if(fComparePtHardAndClusterPt)
2466 printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2468 if(fComparePtHardAndClusterPt)
2469 printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2471 printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2472 printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2473 printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2479 //__________________________________________
2480 Bool_t AliCaloTrackReader::RejectLEDEvents()
2482 // LED Events in period LHC11a contaminated sample, simple method
2483 // to reject such events
2485 // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2486 Int_t ncellsSM3 = 0;
2487 for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2489 Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2490 Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2491 if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2494 Int_t ncellcut = 21;
2495 if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2497 if(ncellsSM3 >= ncellcut)
2500 printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d, cut %d, trig %s\n",
2501 ncellsSM3,ncellcut,GetFiredTriggerClasses().Data());
2509 //_________________________________________________________
2510 void AliCaloTrackReader::RemapMCLabelForAODs(Int_t & label)
2512 // MC label for Cells not remapped after ESD filtering, do it here.
2514 if(label < 0) return ;
2516 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2519 TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2522 if(label < arr->GetEntriesFast())
2524 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2525 if(!particle) return ;
2527 if(label == particle->Label()) return ; // label already OK
2528 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2530 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2532 // loop on the particles list and check if there is one with the same label
2533 for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2535 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2536 if(!particle) continue ;
2538 if(label == particle->Label())
2541 //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2548 //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2553 //___________________________________
2554 void AliCaloTrackReader::ResetLists()
2556 // Reset lists, called by the analysis maker
2558 if(fCTSTracks) fCTSTracks -> Clear();
2559 if(fEMCALClusters) fEMCALClusters -> Clear("C");
2560 if(fPHOSClusters) fPHOSClusters -> Clear("C");
2562 fV0ADC[0] = 0; fV0ADC[1] = 0;
2563 fV0Mul[0] = 0; fV0Mul[1] = 0;
2565 if(fNonStandardJets) fNonStandardJets -> Clear("C");
2569 //___________________________________________
2570 void AliCaloTrackReader::SetEventTriggerBit()
2572 // Tag event depeding on trigger name
2574 fEventTrigMinBias = kFALSE;
2575 fEventTrigCentral = kFALSE;
2576 fEventTrigSemiCentral = kFALSE;
2577 fEventTrigEMCALL0 = kFALSE;
2578 fEventTrigEMCALL1Gamma1 = kFALSE;
2579 fEventTrigEMCALL1Gamma2 = kFALSE;
2580 fEventTrigEMCALL1Jet1 = kFALSE;
2581 fEventTrigEMCALL1Jet2 = kFALSE;
2583 if(fEventTriggerMask <=0 )// in case no mask set
2585 // EMC triggered event? Which type?
2586 if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
2588 if ( GetFiredTriggerClasses().Contains("EGA" ) ||
2589 GetFiredTriggerClasses().Contains("EG1" ) )
2591 fEventTrigEMCALL1Gamma1 = kTRUE;
2592 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2594 else if( GetFiredTriggerClasses().Contains("EG2" ) )
2596 fEventTrigEMCALL1Gamma2 = kTRUE;
2597 if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2599 else if( GetFiredTriggerClasses().Contains("EJE" ) ||
2600 GetFiredTriggerClasses().Contains("EJ1" ) )
2602 fEventTrigEMCALL1Jet1 = kTRUE;
2603 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
2604 fEventTrigEMCALL1Jet1 = kFALSE;
2606 else if( GetFiredTriggerClasses().Contains("EJ2" ) )
2608 fEventTrigEMCALL1Jet2 = kTRUE;
2609 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2611 else if( GetFiredTriggerClasses().Contains("CEMC") &&
2612 !GetFiredTriggerClasses().Contains("EGA" ) &&
2613 !GetFiredTriggerClasses().Contains("EJE" ) &&
2614 !GetFiredTriggerClasses().Contains("EG1" ) &&
2615 !GetFiredTriggerClasses().Contains("EJ1" ) &&
2616 !GetFiredTriggerClasses().Contains("EG2" ) &&
2617 !GetFiredTriggerClasses().Contains("EJ2" ) )
2618 fEventTrigEMCALL0 = kTRUE;
2620 //Min bias event trigger?
2621 if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
2622 fEventTrigCentral = kTRUE;
2623 else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
2624 fEventTrigSemiCentral = kTRUE;
2625 else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
2626 GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
2627 fEventTrigMinBias = kTRUE;
2633 if ( fEventTriggerMask & AliVEvent::kEMCEGA )
2635 if (GetFiredTriggerClasses().Contains("EG1" ) ||
2636 GetFiredTriggerClasses().Contains("EGA" ) )
2638 fEventTrigEMCALL1Gamma1 = kTRUE;
2639 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2641 else if(GetFiredTriggerClasses().Contains("EG2" ))
2643 fEventTrigEMCALL1Gamma2 = kTRUE;
2644 if(!fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2648 else if( fEventTriggerMask & AliVEvent::kEMCEJE )
2650 if (GetFiredTriggerClasses().Contains("EJ1" )||
2651 GetFiredTriggerClasses().Contains("EJE" ) )
2653 fEventTrigEMCALL1Jet1 = kTRUE;
2654 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") ) fEventTrigEMCALL1Jet1 = kFALSE;
2656 else if(GetFiredTriggerClasses().Contains("EJ2" ))
2658 fEventTrigEMCALL1Jet2 = kTRUE;
2659 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2663 else if((fEventTriggerMask & AliVEvent::kEMC7) ||
2664 (fEventTriggerMask & AliVEvent::kEMC1) )
2665 fEventTrigEMCALL0 = kTRUE;
2667 else if( fEventTriggerMask & AliVEvent::kCentral )
2668 fEventTrigSemiCentral = kTRUE;
2670 else if( fEventTriggerMask & AliVEvent::kSemiCentral )
2671 fEventTrigCentral = kTRUE;
2672 // Min Bias pp, PbPb, pPb
2673 else if((fEventTriggerMask & AliVEvent::kMB ) ||
2674 (fEventTriggerMask & AliVEvent::kINT7) ||
2675 (fEventTriggerMask & AliVEvent::kINT8) )
2676 fEventTrigMinBias = kTRUE;
2680 printf("AliCaloTrackReader::SetEventTriggerBit() - Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d \n",
2681 fEventTrigMinBias, fEventTrigCentral, fEventTrigSemiCentral,
2682 fEventTrigEMCALL0 , fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2,
2683 fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2);
2685 if(fBitEGA == 0 && fBitEJE ==0)
2687 // Init the trigger bit once, correct depending on version
2691 TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
2693 const TList *clist = file->GetStreamerInfoCache();
2697 TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
2698 if(!cinfo) cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
2702 Int_t classversionid = cinfo->GetClassVersion();
2704 if (classversionid >= 5)
2709 } else printf("AliCaloTrackReader()::Init() - Streamer info for trigger class not available, bit not changed\n");
2710 } else printf("AliCaloTrackReader::Init() - Streamer list not available!, bit not changed\n");
2712 } // set once the EJE, EGA trigger bit
2716 //____________________________________________________________
2717 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
2719 fInputEvent = input;
2720 fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
2722 fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
2724 //Delete previous vertex
2727 for (Int_t i = 0; i < fNMixedEvent; i++)
2729 delete [] fVertex[i] ;
2734 fVertex = new Double_t*[fNMixedEvent] ;
2735 for (Int_t i = 0; i < fNMixedEvent; i++)
2737 fVertex[i] = new Double_t[3] ;
2738 fVertex[i][0] = 0.0 ;
2739 fVertex[i][1] = 0.0 ;
2740 fVertex[i][2] = 0.0 ;
2744 //____________________________________________________________
2745 void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts)
2749 if(fESDtrackCuts) delete fESDtrackCuts ;
2751 fESDtrackCuts = cuts ;
2755 //_________________________________________________________________________
2756 void AliCaloTrackReader::SetTrackComplementaryCuts(AliESDtrackCuts * cuts)
2758 // Set Track cuts for complementary tracks (hybrids)
2760 if(fESDtrackComplementaryCuts) delete fESDtrackComplementaryCuts ;
2762 fESDtrackComplementaryCuts = cuts ;