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),fCorrectELinearity(kTRUE),
88 fSelectEmbeddedClusters(kFALSE),
89 fTrackStatus(0), fTrackFilterMask(0),
90 fESDtrackCuts(0), fESDtrackComplementaryCuts(0), fConstrainTrack(kFALSE),
91 fSelectHybridTracks(0), fSelectSPDHitTracks(kFALSE),
92 fTrackMult(0), fTrackMultEtaCut(0.9),
93 fReadStack(kFALSE), fReadAODMCParticles(kFALSE),
94 fDeltaAODFileName(""), fFiredTriggerClassName(""),
96 fEventTriggerMask(0), fMixEventTriggerMask(0), fEventTriggerAtSE(0),
97 fEventTrigMinBias(0), fEventTrigCentral(0),
98 fEventTrigSemiCentral(0), fEventTrigEMCALL0(0),
99 fEventTrigEMCALL1Gamma1(0), fEventTrigEMCALL1Gamma2(0),
100 fEventTrigEMCALL1Jet1(0), fEventTrigEMCALL1Jet2(0),
101 fBitEGA(0), fBitEJE(0),
104 fTaskName(""), fCaloUtils(0x0),
105 fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL),
106 fListMixedTracksEvents(), fListMixedCaloEvents(),
107 fLastMixedTracksEvent(-1), fLastMixedCaloEvent(-1),
108 fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),
109 fEMCALClustersListName(""), fZvtxCut(0.),
110 fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kTRUE),
112 fRemoveBadTriggerEvents(0), fTriggerPatchClusterMatch(0),
113 fTriggerPatchTimeWindow(), fTriggerEventThreshold(0),
114 fTriggerClusterBC(0), fTriggerClusterIndex(0), fTriggerClusterId(0),
115 fIsExoticEvent(0), fIsBadCellEvent(0), fIsBadMaxCellEvent(0),
116 fIsTriggerMatch(0), fIsTriggerMatchOpenCut(),
117 fTriggerClusterTimeRecal(kTRUE), fRemoveUnMatchedTriggers(kTRUE),
118 fDoEventSelection(kFALSE), fDoV0ANDEventSelection(kFALSE),
119 fDoVertexBCEventSelection(kFALSE),
120 fDoRejectNoTrackEvents(kFALSE),
121 fUseEventsWithPrimaryVertex(kFALSE),
122 fTriggerAnalysis (0x0), fTimeStampEventSelect(0),
123 fTimeStampEventFracMin(0), fTimeStampEventFracMax(0),
124 fTimeStampRunMin(0), fTimeStampRunMax(0),
125 fNPileUpClusters(-1), fNNonPileUpClusters(-1), fNPileUpClustersCut(3),
126 fVertexBC(-200), fRecalculateVertexBC(0),
127 fCentralityClass(""), fCentralityOpt(0),
128 fEventPlaneMethod(""), fImportGeometryFromFile(kFALSE), fImportGeometryFilePath(""),
129 fAcceptOnlyHIJINGLabels(0), fNMCProducedMin(0), fNMCProducedMax(0),
130 fFillInputNonStandardJetBranch(kFALSE),
131 fNonStandardJets(new TClonesArray("AliAODJet",100)),fInputNonStandardJetBranchName("jets"),
132 fAcceptEventsWithBit(0), fRejectEventsWithBit(0)
136 //Initialize parameters
140 //_______________________________________
141 AliCaloTrackReader::~AliCaloTrackReader()
145 delete fFiducialCut ;
149 fAODBranchList->Delete();
150 delete fAODBranchList ;
155 if(fDataType!=kMC)fCTSTracks->Clear() ;
156 else fCTSTracks->Delete() ;
162 if(fDataType!=kMC)fEMCALClusters->Clear("C") ;
163 else fEMCALClusters->Delete() ;
164 delete fEMCALClusters ;
169 if(fDataType!=kMC)fPHOSClusters->Clear("C") ;
170 else fPHOSClusters->Delete() ;
171 delete fPHOSClusters ;
176 for (Int_t i = 0; i < fNMixedEvent; i++)
178 delete [] fVertex[i] ;
184 delete fESDtrackCuts;
185 delete fESDtrackComplementaryCuts;
186 delete fTriggerAnalysis;
190 if(fDataType!=kMC) fNonStandardJets->Clear("C") ;
191 else fNonStandardJets->Delete() ;
192 delete fNonStandardJets ;
195 fRejectEventsWithBit.Reset();
196 fAcceptEventsWithBit.Reset();
198 // Pointers not owned, done by the analysis frame
199 // if(fInputEvent) delete fInputEvent ;
200 // if(fOutputEvent) delete fOutputEvent ;
201 // if(fMC) delete fMC ;
202 // Pointer not owned, deleted by maker
203 // if (fCaloUtils) delete fCaloUtils ;
207 //________________________________________________________________________
208 Bool_t AliCaloTrackReader::AcceptDCA(const Float_t pt, const Float_t dca)
210 // Accept track if DCA is smaller than function
212 Float_t cut = fTrackDCACut[0]+fTrackDCACut[1]/TMath::Power(pt,fTrackDCACut[2]);
214 if(TMath::Abs(dca) < cut)
221 //_____________________________________________________
222 Bool_t AliCaloTrackReader::AcceptEventWithTriggerBit()
224 // Accept events that pass the physics selection
225 // depending on an array of trigger bits set during the configuration
227 Int_t nAccept = fAcceptEventsWithBit.GetSize();
229 //printf("N accept %d\n", nAccept);
232 return kTRUE ; // accept the event
234 UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
236 for(Int_t ibit = 0; ibit < nAccept; ibit++)
238 Bool_t accept = (trigFired & fAcceptEventsWithBit.At(ibit));
240 //printf("accept %d, ibit %d, bit %d \n",accept, ibit,fAcceptEventsWithBit.At(ibit));
241 if(accept) return kTRUE ; // accept the event
244 return kFALSE ; // reject the event
248 //_____________________________________________________
249 Bool_t AliCaloTrackReader::RejectEventWithTriggerBit()
251 // Reject events that pass the physics selection
252 // depending on an array of trigger bits set during the configuration
254 Int_t nReject = fRejectEventsWithBit.GetSize();
256 //printf("N reject %d\n", nReject);
259 return kTRUE ; // accept the event
261 UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
263 for(Int_t ibit = 0; ibit < nReject; ibit++)
265 Bool_t reject = (trigFired & fRejectEventsWithBit.At(ibit));
267 //printf("reject %d, ibit %d, bit %d \n",reject, ibit,fRejectEventsWithBit.At(ibit));
268 if(reject) return kFALSE ; // reject the event
271 return kTRUE ; // accept the event
276 //________________________________________________
277 Bool_t AliCaloTrackReader::ComparePtHardAndJetPt()
279 // Check the event, if the requested ptHard is much smaller than the jet pT, then there is a problem.
282 //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName());
284 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
287 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
288 Int_t nTriggerJets = pygeh->NTriggerJets();
289 Float_t ptHard = pygeh->GetPtHard();
292 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Njets: %d, pT Hard %f\n",nTriggerJets, ptHard);
294 Float_t tmpjet[]={0,0,0,0};
295 for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
297 pygeh->TriggerJet(ijet, tmpjet);
298 jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
301 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - jet %d; pycell jet pT %f\n",ijet, jet->Pt());
303 //Compare jet pT and pt Hard
304 if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
306 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
307 ptHard, jet->Pt(), fPtHardAndJetPtFactor);
319 //____________________________________________________________________
320 Bool_t AliCaloTrackReader::ComparePtHardAndClusterPt()
322 // Check the event, if the requested ptHard is smaller than the calorimeter cluster E, then there is a problem.
325 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
327 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
328 Float_t ptHard = pygeh->GetPtHard();
330 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
331 for (Int_t iclus = 0; iclus < nclusters; iclus++)
333 AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
334 Float_t ecluster = clus->E();
336 if(ecluster > fPtHardAndClusterPtFactor*ptHard)
338 printf("AliCaloTrackReader::ComparePtHardAndClusterPt() - Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f\n",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard);
350 //____________________________________________
351 AliStack* AliCaloTrackReader::GetStack() const
353 //Return pointer to stack
358 if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n");
363 //______________________________________________
364 AliHeader* AliCaloTrackReader::GetHeader() const
366 //Return pointer to header
369 return fMC->Header();
373 printf("AliCaloTrackReader::Header is not available\n");
378 //____________________________________________________
379 void AliCaloTrackReader::SetGeneratorMinMaxParticles()
381 // In case of access only to hijing particles in cocktail
382 // get the min and max labels
383 // TODO: Check when generator is not the first one ...
388 if (ReadStack() && fMC)
390 AliGenEventHeader * eventHeader = fMC->GenEventHeader();
392 if(!fAcceptOnlyHIJINGLabels) return ;
394 // TODO Check if it works from here ...
396 AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
398 if(!cocktail) return ;
400 TList *genHeaders = cocktail->GetHeaders();
402 Int_t nGenerators = genHeaders->GetEntries();
403 //printf("N generators %d \n", nGenerators);
405 for(Int_t igen = 0; igen < nGenerators; igen++)
407 AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
408 TString name = eventHeader2->GetName();
410 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
412 fNMCProducedMin = fNMCProducedMax;
413 fNMCProducedMax+= eventHeader2->NProduced();
415 if(name == "Hijing") return ;
419 else if(ReadAODMCParticles() && GetAODMCHeader())
421 Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
422 //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",nGenerators);
424 if( nGenerators <= 0) return ;
426 if(!fAcceptOnlyHIJINGLabels) return ;
428 for(Int_t igen = 0; igen < nGenerators; igen++)
430 AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
431 TString name = eventHeader->GetName();
433 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader->ClassName(), name.Data(), eventHeader->GetTitle());
435 fNMCProducedMin = fNMCProducedMax;
436 fNMCProducedMax+= eventHeader->NProduced();
438 if(name == "Hijing") return ;
445 //______________________________________________________________
446 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const
448 // Return pointer to Generated event header
449 // If requested and cocktail, search for the hijing generator
451 if (ReadStack() && fMC)
453 AliGenEventHeader * eventHeader = fMC->GenEventHeader();
455 if(!fAcceptOnlyHIJINGLabels) return eventHeader ;
457 // TODO Check if it works from here ...
459 AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
461 if(!cocktail) return 0x0 ;
463 TList *genHeaders = cocktail->GetHeaders();
465 Int_t nGenerators = genHeaders->GetEntries();
466 //printf("N generators %d \n", nGenerators);
468 for(Int_t igen = 0; igen < nGenerators; igen++)
470 AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
471 TString name = eventHeader2->GetName();
473 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
475 if(name == "Hijing") return eventHeader2 ;
481 else if(ReadAODMCParticles() && GetAODMCHeader())
483 Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders();
484 //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",nGenerators);
486 if( nGenerators <= 0) return 0x0;
488 if(!fAcceptOnlyHIJINGLabels) return GetAODMCHeader()->GetCocktailHeader(0);
490 for(Int_t igen = 0; igen < nGenerators; igen++)
492 AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ;
493 TString name = eventHeader->GetName();
495 //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader->ClassName(), name.Data(), eventHeader->GetTitle());
497 if(name == "Hijing") return eventHeader ;
505 //printf("AliCaloTrackReader::GetGenEventHeader() - MC header not available! \n");
510 //____________________________________________________________________
511 TClonesArray* AliCaloTrackReader::GetAODMCParticles() const
513 //Return list of particles in AOD. Do it for the corresponding input event.
515 TClonesArray * rv = NULL ;
516 if(fDataType == kAOD)
519 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
521 rv = (TClonesArray*)evt->FindListObject("mcparticles");
523 printf("AliCaloTrackReader::GetAODMCParticles() - Null AOD event \n");
527 printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n");
533 //________________________________________________________
534 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
536 //Return MC header in AOD. Do it for the corresponding input event.
538 AliAODMCHeader *mch = NULL;
540 if(fDataType == kAOD)
542 AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent);
543 if(aod) mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
547 printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n");
553 //___________________________________________________________
554 Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
558 Int_t vertexBC=vtx->GetBC();
559 if(!fRecalculateVertexBC) return vertexBC;
561 // In old AODs BC not stored, recalculate it
562 // loop over the global track and select those which have small DCA to primary vertex (e.g. primary).
563 // If at least one of these primaries has valid BC != 0, then this vertex is a pile-up candidate.
565 Double_t bz = fInputEvent->GetMagneticField();
567 Int_t ntr = GetCTSTracks()->GetEntriesFast();
568 //printf("N Tracks %d\n",ntr);
570 for(Int_t i = 0 ; i < ntr ; i++)
572 AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
574 //Check if has TOF info, if not skip
575 ULong_t status = track->GetStatus();
576 Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
577 vertexBC = track->GetTOFBunchCrossing(bz);
578 Float_t pt = track->Pt();
583 Double_t dca[2] = {1e6,1e6};
584 Double_t covar[3] = {1e6,1e6,1e6};
585 track->PropagateToDCA(vtx,bz,100.,dca,covar);
587 if(AcceptDCA(pt,dca[0]))
589 if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC;
590 else if(vertexBC == 0) bc0 = kTRUE;
594 if( bc0 ) vertexBC = 0 ;
595 else vertexBC = AliVTrack::kTOFBCNA ;
601 //_____________________________
602 void AliCaloTrackReader::Init()
604 //Init reader. Method to be called in AliAnaPartCorrMaker
606 //printf(" AliCaloTrackReader::Init() %p \n",gGeoManager);
608 if(fReadStack && fReadAODMCParticles)
610 printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n");
612 fReadAODMCParticles = kFALSE;
615 // Init geometry, I do not like much to do it like this ...
616 if(fImportGeometryFromFile && !gGeoManager)
618 if(fImportGeometryFilePath=="") // If not specified, set a default location
619 fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root"; // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
621 printf("AliCaloTrackReader::Init() - Import %s\n",fImportGeometryFilePath.Data());
622 TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
626 fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks
630 //_______________________________________
631 void AliCaloTrackReader::InitParameters()
633 //Initialize the parameters of the analysis.
639 fEMCALPtMax = 1000. ;
643 // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
644 fTrackDCACut[0] = 0.0105;
645 fTrackDCACut[1] = 0.0350;
646 fTrackDCACut[2] = 1.1;
648 //Do not filter the detectors input by default.
652 fFillEMCALCells = kFALSE;
653 fFillPHOSCells = kFALSE;
655 fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
656 fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
657 fDeltaAODFileName = "deltaAODPartCorr.root";
658 fFiredTriggerClassName = "";
659 fEventTriggerMask = AliVEvent::kAny;
660 fMixEventTriggerMask = AliVEvent::kAnyINT;
661 fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
663 fAcceptFastCluster = kTRUE;
666 //We want tracks fitted in the detectors:
667 //fTrackStatus=AliESDtrack::kTPCrefit;
668 //fTrackStatus|=AliESDtrack::kITSrefit;
670 fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
673 fESDtrackComplementaryCuts = 0;
675 fConstrainTrack = kFALSE ; // constrain tracks to vertex
677 fV0ADC[0] = 0; fV0ADC[1] = 0;
678 fV0Mul[0] = 0; fV0Mul[1] = 0;
684 fPtHardAndJetPtFactor = 7.;
685 fPtHardAndClusterPtFactor = 1.;
688 fCentralityClass = "V0M";
690 fCentralityBin[0] = fCentralityBin[1]=-1;
692 fEventPlaneMethod = "V0";
694 // Allocate memory (not sure this is the right place)
695 fCTSTracks = new TObjArray();
696 fEMCALClusters = new TObjArray();
697 fPHOSClusters = new TObjArray();
698 fTriggerAnalysis = new AliTriggerAnalysis;
699 fAODBranchList = new TList ;
701 fImportGeometryFromFile = kFALSE;
703 fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
704 fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
706 // Parametrized time cut (LHC11d)
707 fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1. ;
708 fEMCALParamTimeCutMax[0] = 5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.45; fEMCALParamTimeCutMax[3] = 1.25;
710 // Parametrized time cut (LHC11c)
711 //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
712 //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
714 fTimeStampRunMin = -1;
715 fTimeStampRunMax = 1e12;
716 fTimeStampEventFracMin = -1;
717 fTimeStampEventFracMax = 2;
719 for(Int_t i = 0; i < 19; i++)
721 fEMCalBCEvent [i] = 0;
722 fEMCalBCEventCut[i] = 0;
723 fTrackBCEvent [i] = 0;
724 fTrackBCEventCut[i] = 0;
727 // Trigger match-rejection
728 fTriggerPatchTimeWindow[0] = 8;
729 fTriggerPatchTimeWindow[1] = 9;
731 fTriggerClusterBC = -10000 ;
732 fTriggerEventThreshold = 2.;
733 fTriggerClusterIndex = -1;
734 fTriggerClusterId = -1;
737 fInputNonStandardJetBranchName = "jets";
738 fFillInputNonStandardJetBranch = kFALSE;
739 if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
743 //___________________________________________________________________
744 Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const
746 // Check if it is a cluster from EMCAL. For old AODs cluster type has
747 // different number and need to patch here
749 if(fDataType==kAOD && fOldAOD)
751 if (cluster->GetType() == 2) return kTRUE;
756 return cluster->IsEMCAL();
761 //___________________________________________________________________
762 Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const
764 //Check if it is a cluster from PHOS.For old AODs cluster type has
765 // different number and need to patch here
767 if(fDataType==kAOD && fOldAOD)
769 Int_t type = cluster->GetType();
770 if (type == 0 || type == 1) return kTRUE;
775 return cluster->IsPHOS();
780 //________________________________________________________________________
781 Bool_t AliCaloTrackReader::IsHIJINGLabel(Int_t label)
784 // Find if cluster/track was generated by HIJING
786 AliGenHijingEventHeader* hijingHeader = dynamic_cast<AliGenHijingEventHeader *> (GetGenEventHeader());
788 //printf("header %p, label %d\n",hijingHeader,label);
790 if(!hijingHeader || label < 0 ) return kFALSE;
793 //printf("pass a), N produced %d\n",nproduced);
795 if(label >= fNMCProducedMin && label < fNMCProducedMax)
797 //printf(" accept!, label is smaller than produced, N %d\n",nproduced);
804 if(!GetStack()) return kFALSE;
806 Int_t nprimaries = GetStack()->GetNtrack();
808 if(label > nprimaries) return kFALSE;
810 TParticle * mom = GetStack()->Particle(label);
813 Int_t iParent = mom->GetFirstMother();
816 if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax)
818 //printf("\t accept, mother is %d \n",iParent)
823 mom = GetStack()->Particle(iMom);
824 iParent = mom->GetFirstMother();
832 TClonesArray* mcparticles = GetAODMCParticles();
834 if(!mcparticles) return kFALSE;
836 Int_t nprimaries = mcparticles->GetEntriesFast();
838 if(label > nprimaries) return kFALSE;
840 //printf("pass b) N primaries %d \n",nprimaries);
842 if(label >= fNMCProducedMin && label < fNMCProducedMax)
847 // Find grand parent, check if produced in the good range
848 AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);
851 Int_t iParent = mom->GetMother();
854 if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax)
856 //printf("\t accept, mother is %d, with nProduced %d \n",iParent, nproduced);
861 mom = (AliAODMCParticle *) mcparticles->At(iMom);
862 iParent = mom->GetMother();
866 //printf("pass c), no match found \n");
873 //___________________________________________________________
874 Bool_t AliCaloTrackReader::IsInTimeWindow(const Double_t tof, const Float_t energy) const
876 // Cluster time selection window
878 // Parametrized cut depending on E
881 Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
882 Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
883 //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
884 if( tof < minCut || tof > maxCut ) return kFALSE ;
887 //In any case, the time should to be larger than the fixed window ...
888 if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
893 //________________________________________________
894 Bool_t AliCaloTrackReader::IsPileUpFromSPD() const
896 // Check if event is from pile-up determined by SPD
897 // Default values: (3, 0.8, 3., 2., 5.)
898 return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
899 fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
900 //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
904 //__________________________________________________
905 Bool_t AliCaloTrackReader::IsPileUpFromEMCal() const
907 // Check if event is from pile-up determined by EMCal
908 if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
912 //________________________________________________________
913 Bool_t AliCaloTrackReader::IsPileUpFromSPDAndEMCal() const
915 // Check if event is from pile-up determined by SPD and EMCal
916 if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
920 //_______________________________________________________
921 Bool_t AliCaloTrackReader::IsPileUpFromSPDOrEMCal() const
923 // Check if event is from pile-up determined by SPD or EMCal
924 if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
928 //___________________________________________________________
929 Bool_t AliCaloTrackReader::IsPileUpFromSPDAndNotEMCal() const
931 // Check if event is from pile-up determined by SPD and not by EMCal
932 if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
936 //___________________________________________________________
937 Bool_t AliCaloTrackReader::IsPileUpFromEMCalAndNotSPD() const
939 // Check if event is from pile-up determined by EMCal, not by SPD
940 if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
944 //______________________________________________________________
945 Bool_t AliCaloTrackReader::IsPileUpFromNotSPDAndNotEMCal() const
947 // Check if event not from pile-up determined neither by SPD nor by EMCal
948 if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
952 //_________________________________________________________________________
953 Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
954 const char * /*currentFileName*/)
956 //Fill the event counter and input lists that are needed, called by the analysis maker.
958 fEventNumber = iEntry;
959 fTriggerClusterIndex = -1;
960 fTriggerClusterId = -1;
961 fIsTriggerMatch = kFALSE;
962 fTriggerClusterBC = -10000;
963 fIsExoticEvent = kFALSE;
964 fIsBadCellEvent = kFALSE;
965 fIsBadMaxCellEvent = kFALSE;
967 fIsTriggerMatchOpenCut[0] = kFALSE ;
968 fIsTriggerMatchOpenCut[1] = kFALSE ;
969 fIsTriggerMatchOpenCut[2] = kFALSE ;
971 //fCurrentFileName = TString(currentFileName);
974 if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
978 //Select events only fired by a certain trigger configuration if it is provided
980 if(fInputEvent->GetHeader())
981 eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
983 if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
985 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
989 //-------------------------------------------------------------------------------------
990 // Reject event if large clusters with large energy
991 // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
992 // If clusterzer NxN or V2 it does not help
993 //-------------------------------------------------------------------------------------
994 Int_t run = fInputEvent->GetRunNumber();
995 if( fRemoveLEDEvents && run > 146857 && run < 146861 )
997 Bool_t reject = RejectLEDEvents();
998 if(reject) return kFALSE;
999 }// Remove LED events
1001 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass LED event rejection \n");
1003 //-------------------------------------------------------------------------------------
1004 // Reject or accept events depending on the trigger bit
1005 //-------------------------------------------------------------------------------------
1007 //printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>\n", GetFiredTriggerClasses().Data());
1009 Bool_t okA = AcceptEventWithTriggerBit();
1010 Bool_t okR = RejectEventWithTriggerBit();
1012 //printf("AliCaloTrackReader::FillInputEvent() - Accept event? %d, Reject event %d? \n",okA,okR);
1014 if(!okA || !okR) return kFALSE;
1016 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass event bit rejection \n");
1019 //-----------------------------------------------------------
1020 // Reject events depending on the trigger name and event type
1021 //-----------------------------------------------------------
1022 if( fFiredTriggerClassName !="" && !fAnaLED)
1024 //printf("Event type %d\n",eventType);
1026 return kFALSE; //Only physics event, do not use for simulated events!!!
1029 printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
1030 GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
1032 if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
1033 else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n");
1037 // kStartOfRun = 1, // START_OF_RUN
1038 // kEndOfRun = 2, // END_OF_RUN
1039 // kStartOfRunFiles = 3, // START_OF_RUN_FILES
1040 // kEndOfRunFiles = 4, // END_OF_RUN_FILES
1041 // kStartOfBurst = 5, // START_OF_BURST
1042 // kEndOfBurst = 6, // END_OF_BURST
1043 // kPhysicsEvent = 7, // PHYSICS_EVENT
1044 // kCalibrationEvent = 8, // CALIBRATION_EVENT
1045 // kFormatError = 9, // EVENT_FORMAT_ERROR
1046 // kStartOfData = 10, // START_OF_DATA
1047 // kEndOfData = 11, // END_OF_DATA
1048 // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
1049 // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
1051 if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType);
1052 if(eventType!=8)return kFALSE;
1055 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Trigger name rejection \n");
1058 //In case of analysis of events with jets, skip those with jet pt > 5 pt hard
1059 if(fComparePtHardAndJetPt)
1061 if(!ComparePtHardAndJetPt()) return kFALSE ;
1064 if(fComparePtHardAndClusterPt)
1066 if(!ComparePtHardAndClusterPt()) return kFALSE ;
1069 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Pt Hard rejection \n");
1073 //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
1074 if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
1076 //------------------------------------------------------
1077 //Event rejection depending on vertex, pileup, v0and
1078 //------------------------------------------------------
1079 if(fDataType==kESD && fTimeStampEventSelect)
1081 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1084 Int_t timeStamp = esd->GetTimeStamp();
1085 Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
1087 //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
1089 if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
1091 //printf("\t accept time stamp\n");
1094 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Time Stamp rejection \n");
1096 //------------------------------------------------------
1097 //Event rejection depending on vertex, pileup, v0and
1098 //------------------------------------------------------
1100 if(fUseEventsWithPrimaryVertex)
1102 if( !CheckForPrimaryVertex() ) return kFALSE;
1103 if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
1104 TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
1105 TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
1108 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass primary vertex rejection \n");
1110 //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
1112 if(fDoEventSelection)
1114 // Do not analyze events with pileup
1115 Bool_t bPileup = IsPileUpFromSPD();
1116 //IsPileupFromSPDInMultBins() // method to try
1117 //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]);
1118 if(bPileup) return kFALSE;
1120 if(fDoV0ANDEventSelection)
1122 Bool_t bV0AND = kTRUE;
1123 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1125 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
1126 //else bV0AND = //FIXME FOR AODs
1127 if(!bV0AND) return kFALSE;
1129 }// Event selection/AliceSoft/AliRoot/trunk/PWG/CaloTrackCorrBase/AliCaloTrackReader.h
1131 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Pile-Up, V0AND event rejection \n");
1133 //------------------------------------------------------
1135 //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
1136 //If we need a centrality bin, we select only those events in the corresponding bin.
1137 if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100)
1139 Int_t cen = GetEventCentrality();
1140 if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
1143 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass centrality rejection \n");
1146 //Fill the arrays with cluster/tracks/cells data
1148 if(!fEventTriggerAtSE)
1150 // In case of mixing analysis, accept MB events, not only Trigger
1151 // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
1152 // via de method in the base class FillMixedEventPool()
1154 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
1155 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
1157 if(!inputHandler) return kFALSE ; // to content coverity
1159 UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
1160 UInt_t isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
1162 if(!isTrigger && !isMB) return kFALSE;
1164 //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
1167 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass uninteresting triggered events rejection in case of mixing analysis \n");
1170 //----------------------------------------------------------------------
1171 // Do not count events that where likely triggered by an exotic cluster
1172 // or out BC cluster
1173 //----------------------------------------------------------------------
1175 // Set a bit with the event kind, MB, L0, L1 ...
1176 SetEventTriggerBit();
1178 //Get Patches that triggered
1179 TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
1181 MatchTriggerCluster(patches);
1183 if(fRemoveBadTriggerEvents)
1185 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
1186 fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
1187 if (fIsExoticEvent) return kFALSE;
1188 else if(fIsBadCellEvent) return kFALSE;
1189 else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
1190 else if(fTriggerClusterBC != 0) return kFALSE;
1191 //printf("\t *** YES\n");
1196 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass EMCal triggered event rejection \n");
1199 // Get the main vertex BC, in case not available
1200 // it is calculated in FillCTS checking the BC of tracks
1201 // with DCA small (if cut applied, if open)
1202 fVertexBC=fInputEvent->GetPrimaryVertex()->GetBC();
1204 if(fAcceptOnlyHIJINGLabels) SetGeneratorMinMaxParticles();
1206 //printf("N min %d, N max %d\n",fNMCProducedMin,fNMCProducedMax);
1211 //Accept events with at least one track
1212 if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
1215 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass rejection of null track events \n");
1218 if(fDoVertexBCEventSelection)
1220 if(fVertexBC!=0 && fVertexBC!=AliVTrack::kTOFBCNA) return kFALSE ;
1223 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass rejection of events with vertex at BC!=0 \n");
1227 FillInputEMCALCells();
1230 FillInputPHOSCells();
1240 //one specified jet branch
1241 if(fFillInputNonStandardJetBranch)
1242 FillInputNonStandardJets();
1247 //__________________________________________________
1248 Int_t AliCaloTrackReader::GetEventCentrality() const
1250 //Return current event centrality
1254 if (fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1255 else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1256 else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
1259 printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
1267 //_____________________________________________________
1268 Double_t AliCaloTrackReader::GetEventPlaneAngle() const
1270 //Return current event centrality
1274 Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1276 if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
1278 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <Q> method : %f\n",ep);
1281 else if(GetEventPlaneMethod().Contains("V0") )
1283 if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1285 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep);
1289 ep+=TMath::Pi()/2; // put same range as for <Q> method
1293 //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep);
1296 if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1297 else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1304 if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() - No EP pointer\n");
1310 //__________________________________________________________
1311 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const
1313 //Return vertex position to be used for single event analysis
1314 vertex[0]=fVertex[0][0];
1315 vertex[1]=fVertex[0][1];
1316 vertex[2]=fVertex[0][2];
1319 //____________________________________________________________
1320 void AliCaloTrackReader::GetVertex(Double_t vertex[3],
1321 const Int_t evtIndex) const
1323 //Return vertex position for mixed event, recover the vertex in a particular event.
1325 vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2];
1329 //________________________________________
1330 void AliCaloTrackReader::FillVertexArray()
1333 //Fill data member with vertex
1334 //In case of Mixed event, multiple vertices
1336 //Delete previous vertex
1339 for (Int_t i = 0; i < fNMixedEvent; i++)
1341 delete [] fVertex[i] ;
1346 fVertex = new Double_t*[fNMixedEvent] ;
1347 for (Int_t i = 0; i < fNMixedEvent; i++)
1349 fVertex[i] = new Double_t[3] ;
1350 fVertex[i][0] = 0.0 ;
1351 fVertex[i][1] = 0.0 ;
1352 fVertex[i][2] = 0.0 ;
1356 { //Single event analysis
1360 if(fInputEvent->GetPrimaryVertex())
1362 fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
1366 printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
1367 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1368 }//Primary vertex pointer do not exist
1372 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1376 printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
1379 { // MultiEvent analysis
1380 for (Int_t iev = 0; iev < fNMixedEvent; iev++)
1382 if (fMixedEvent->GetVertexOfEvent(iev))
1383 fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
1385 { // no vertex found !!!!
1386 AliWarning("No vertex found");
1390 printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
1397 //_____________________________________
1398 void AliCaloTrackReader::FillInputCTS()
1400 //Return array with Central Tracking System (CTS) tracks
1402 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
1404 Double_t pTrack[3] = {0,0,0};
1406 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1409 Double_t bz = GetInputEvent()->GetMagneticField();
1411 for(Int_t i = 0; i < 19; i++)
1413 fTrackBCEvent [i] = 0;
1414 fTrackBCEventCut[i] = 0;
1417 Bool_t bc0 = kFALSE;
1418 if(fRecalculateVertexBC) fVertexBC=AliVTrack::kTOFBCNA;
1420 for (Int_t itrack = 0; itrack < nTracks; itrack++)
1421 {////////////// track loop
1422 AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
1424 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
1425 ULong_t status = track->GetStatus();
1427 if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
1432 Float_t dcaTPC =-999;
1434 if (fDataType==kESD)
1436 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track);
1440 if(fESDtrackCuts->AcceptTrack(esdTrack))
1442 track->GetPxPyPz(pTrack) ;
1446 if(esdTrack->GetConstrainedParam())
1448 const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam();
1449 esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
1450 esdTrack->GetConstrainedPxPyPz(pTrack);
1454 } // use constrained tracks
1456 if(fSelectSPDHitTracks)
1457 {//Not much sense to use with TPC only or Hybrid tracks
1458 if(!esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1)) continue ;
1461 // Complementary track to global : Hybrids (make sure that the previous selection is for Global)
1462 else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack))
1464 // constrain the track
1465 if(esdTrack->GetConstrainedParam())
1467 esdTrack->Set(esdTrack->GetConstrainedParam()->GetX(),esdTrack->GetConstrainedParam()->GetAlpha(),esdTrack->GetConstrainedParam()->GetParameter(),esdTrack->GetConstrainedParam()->GetCovariance());
1469 track->GetPxPyPz(pTrack) ;
1477 else if(fDataType==kAOD)
1479 AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track);
1483 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n",
1484 aodtrack->GetType(),AliAODTrack::kPrimary,
1485 aodtrack->IsHybridGlobalConstrainedGlobal());
1488 if (fSelectHybridTracks)
1490 if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
1494 if ( aodtrack->TestFilterBit(fTrackFilterMask)==kFALSE) continue ;
1497 if(fSelectSPDHitTracks)
1498 {//Not much sense to use with TPC only or Hybrid tracks
1499 if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) continue ;
1502 if (aodtrack->GetType()!= AliAODTrack::kPrimary) continue ;
1504 if (fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS(): \t accepted track! \n");
1506 //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1508 dcaTPC = aodtrack->DCA();
1510 track->GetPxPyPz(pTrack) ;
1512 } // aod track exists
1517 TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
1519 Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1520 Double_t tof = -1000;
1521 Int_t trackBC = -1000 ;
1525 trackBC = track->GetTOFBunchCrossing(bz);
1526 SetTrackEventBC(trackBC+9);
1528 tof = track->GetTOFsignal()*1e-3;
1533 //normal way to get the dca, cut on dca_xy
1536 Double_t dca[2] = {1e6,1e6};
1537 Double_t covar[3] = {1e6,1e6,1e6};
1538 Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1539 if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]);
1542 //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f, BC %d\n",momentum.Pt(),dca[0],trackBC);
1550 //SetTrackEventBCcut(bc);
1551 SetTrackEventBCcut(trackBC+9);
1553 //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1554 if(fRecalculateVertexBC)
1556 if (trackBC !=0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1557 else if(trackBC == 0) bc0 = kTRUE;
1560 //In any case, the time should to be larger than the fixed window ...
1561 if( fUseTrackTimeCut && (trackBC!=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1563 //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1566 //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1570 //Count the tracks in eta < 0.9
1571 //printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
1572 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1574 if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ;
1576 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
1578 if(fDebug > 2 && momentum.Pt() > 0.1)
1579 printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1580 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1582 if (fMixedEvent) track->SetID(itrack);
1584 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(track->GetLabel())) continue ;
1586 fCTSTracks->Add(track);
1590 if(fVertexBC ==0 || fVertexBC == AliVTrack::kTOFBCNA)
1592 if( bc0 ) fVertexBC = 0 ;
1593 else fVertexBC = AliVTrack::kTOFBCNA ;
1598 printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
1602 //__________________________________________________________________
1603 void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus,
1606 //Fill the EMCAL data in the array, do it
1610 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1612 if(fRecalculateClusters)
1614 //Recalibrate the cluster energy
1615 if(GetCaloUtils()->IsRecalibrationOn())
1617 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
1620 //printf("Recalibrated Energy %f\n",clus->E());
1622 GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus);
1623 GetCaloUtils()->RecalculateClusterPID(clus);
1627 //Recalculate distance to bad channels, if new list of bad channels provided
1628 GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus);
1630 //Recalculate cluster position
1631 if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1633 GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus);
1634 //clus->GetPosition(pos);
1635 //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1639 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1641 Double_t tof = clus->GetTOF();
1643 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1645 if(fDataType==AliCaloTrackReader::kESD)
1647 tof = fEMCALCells->GetCellTime(absIdMax);
1650 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1654 }// Time recalibration
1657 //Reject clusters with bad channels, close to borders and exotic;
1658 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return;
1660 //Mask all cells in collumns facing ALICE thick material if requested
1661 if(GetCaloUtils()->GetNMaskCellColumns())
1667 Bool_t shared = kFALSE;
1668 GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1669 if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1672 if(fSelectEmbeddedClusters)
1674 if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1675 //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1679 //clus->GetPosition(pos);
1680 //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1682 //Correct non linearity
1683 if(fCorrectELinearity && GetCaloUtils()->IsCorrectionOfClusterEnergyOn())
1685 GetCaloUtils()->CorrectClusterEnergy(clus) ;
1687 //In case of MC analysis, to match resolution/calibration in real data
1688 Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1689 // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy);
1690 clus->SetE(rdmEnergy);
1693 Double_t tof = clus->GetTOF()*1e9;
1695 Int_t bc = TMath::Nint(tof/50) + 9;
1696 //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1698 SetEMCalEventBC(bc);
1700 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
1702 TLorentzVector momentum ;
1704 clus->GetMomentum(momentum, fVertex[vindex]);
1706 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1708 SetEMCalEventBCcut(bc);
1710 if(!IsInTimeWindow(tof,clus->E()))
1712 fNPileUpClusters++ ;
1713 if(fUseEMCALTimeCut) return ;
1716 fNNonPileUpClusters++;
1718 if(fDebug > 2 && momentum.E() > 0.1)
1719 printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1720 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1723 clus->SetID(iclus) ;
1725 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel( clus->GetLabel() )) return ;
1727 // if(fAcceptOnlyHIJINGLabels)
1729 // printf("Accept label %d?\n",clus->GetLabel());
1731 // if( !IsHIJINGLabel( clus->GetLabel() ) ) { printf("\t Reject label\n") ; return ; }
1732 // else printf("\t Accept label\n") ;
1735 fEMCALClusters->Add(clus);
1739 //_______________________________________
1740 void AliCaloTrackReader::FillInputEMCAL()
1742 //Return array with EMCAL clusters in aod format
1744 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
1746 // First recalibrate cells, time or energy
1747 // if(GetCaloUtils()->IsRecalibrationOn())
1748 // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1750 // fInputEvent->GetBunchCrossNumber());
1752 fNPileUpClusters = 0; // Init counter
1753 fNNonPileUpClusters = 0; // Init counter
1754 for(Int_t i = 0; i < 19; i++)
1756 fEMCalBCEvent [i] = 0;
1757 fEMCalBCEventCut[i] = 0;
1760 //Loop to select clusters in fiducial cut and fill container with aodClusters
1761 if(fEMCALClustersListName=="")
1763 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1764 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1766 AliVCluster * clus = 0;
1767 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1769 if (IsEMCALCluster(clus))
1771 FillInputEMCALAlgorithm(clus, iclus);
1776 //Recalculate track matching
1777 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
1779 }//Get the clusters from the input event
1782 TClonesArray * clusterList = 0x0;
1784 if (fInputEvent->FindListObject(fEMCALClustersListName))
1786 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
1788 else if(fOutputEvent)
1790 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
1795 printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data());
1799 Int_t nclusters = clusterList->GetEntriesFast();
1800 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1802 AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
1803 //printf("E %f\n",clus->E());
1804 if (clus) FillInputEMCALAlgorithm(clus, iclus);
1805 else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
1808 // Recalculate the pile-up time, in case long time clusters removed during clusterization
1809 //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1811 fNPileUpClusters = 0; // Init counter
1812 fNNonPileUpClusters = 0; // Init counter
1813 for(Int_t i = 0; i < 19; i++)
1815 fEMCalBCEvent [i] = 0;
1816 fEMCalBCEventCut[i] = 0;
1819 for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
1821 AliVCluster * clus = 0;
1823 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1825 if (IsEMCALCluster(clus))
1829 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1830 Double_t tof = clus->GetTOF();
1831 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1834 //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
1836 //Reject clusters with bad channels, close to borders and exotic;
1837 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
1839 Int_t bc = TMath::Nint(tof/50) + 9;
1840 SetEMCalEventBC(bc);
1842 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
1844 TLorentzVector momentum ;
1846 clus->GetMomentum(momentum, fVertex[0]);
1848 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1850 SetEMCalEventBCcut(bc);
1852 if(!IsInTimeWindow(tof,clus->E()))
1853 fNPileUpClusters++ ;
1855 fNNonPileUpClusters++;
1861 //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1863 // Recalculate track matching, not necessary if already done in the reclusterization task.
1864 // in case it was not done ...
1865 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
1869 if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters);
1873 //______________________________________
1874 void AliCaloTrackReader::FillInputPHOS()
1876 //Return array with PHOS clusters in aod format
1878 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
1880 //Loop to select clusters in fiducial cut and fill container with aodClusters
1881 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1882 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1884 AliVCluster * clus = 0;
1885 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1887 if (IsPHOSCluster(clus))
1889 //Check if the cluster contains any bad channel and if close to calorimeter borders
1892 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1893 if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells()))
1895 if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex))
1898 if(fRecalculateClusters)
1900 //Recalibrate the cluster energy
1901 if(GetCaloUtils()->IsRecalibrationOn())
1903 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
1908 TLorentzVector momentum ;
1910 clus->GetMomentum(momentum, fVertex[vindex]);
1912 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
1914 if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue;
1916 if(fDebug > 2 && momentum.E() > 0.1)
1917 printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1918 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1923 clus->SetID(iclus) ;
1926 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(clus->GetLabel())) continue ;
1928 fPHOSClusters->Add(clus);
1934 if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast());
1938 //____________________________________________
1939 void AliCaloTrackReader::FillInputEMCALCells()
1941 //Return array with EMCAL cells in aod format
1943 fEMCALCells = fInputEvent->GetEMCALCells();
1947 //___________________________________________
1948 void AliCaloTrackReader::FillInputPHOSCells()
1950 //Return array with PHOS cells in aod format
1952 fPHOSCells = fInputEvent->GetPHOSCells();
1956 //_______________________________________
1957 void AliCaloTrackReader::FillInputVZERO()
1959 //Fill VZERO information in data member, add all the channels information.
1960 AliVVZERO* v0 = fInputEvent->GetVZEROData();
1961 //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1965 AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
1966 for (Int_t i = 0; i < 32; i++)
1969 {//Only available in ESDs
1970 fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
1971 fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
1974 fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
1975 fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
1978 printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1983 printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
1987 //_________________________________________________
1988 void AliCaloTrackReader::FillInputNonStandardJets()
1991 //fill array with non standard jets
1995 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputNonStandardJets()\n");
1997 //check if branch name is given
1998 if(!fInputNonStandardJetBranchName.Length())
2000 Printf("No non-standard jet branch name specified. Specify among existing ones.");
2001 fInputEvent->Print();
2005 fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
2007 if(!fNonStandardJets)
2009 //check if jet branch exist; exit if not
2010 Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data());
2011 fInputEvent->Print();
2017 printf("AliCaloTrackReader::FillInputNonStandardJets() - aod input jets %d\n", fNonStandardJets->GetEntriesFast() );
2022 //________________________________________________
2023 Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
2025 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
2028 AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent);
2029 if(!event) return kTRUE;
2031 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0)
2036 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1)
2039 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0)
2041 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
2045 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1)
2047 // cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl;
2056 //________________________________________________________________________________
2057 TArrayI AliCaloTrackReader::GetTriggerPatches(const Int_t tmin, const Int_t tmax )
2059 // Select the patches that triggered
2060 // Depend on L0 or L1
2063 Int_t trigtimes[30], globCol, globRow,ntimes, i;
2064 Int_t absId = -1; //[100];
2069 // get object pointer
2070 AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2072 // class is not empty
2073 if( caloTrigger->GetEntries() > 0 )
2075 // must reset before usage, or the class will fail
2076 caloTrigger->Reset();
2078 // go throuth the trigger channels
2079 while( caloTrigger->Next() )
2081 // get position in global 2x2 tower coordinates
2082 caloTrigger->GetPosition( globCol, globRow );
2085 if(IsEventEMCALL0())
2087 // get dimension of time arrays
2088 caloTrigger->GetNL0Times( ntimes );
2090 // no L0s in this channel
2091 // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2096 caloTrigger->GetL0Times( trigtimes );
2098 //printf("trigger time window %d - %d\n",fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
2099 // go through the array
2100 for( i = 0; i < ntimes; i++ )
2102 // check if in cut - 8,9 shall be accepted in 2011
2103 if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2105 //printf("Accepted trigger time %d \n",trigtimes[i]);
2106 //if(nTrig > 99) continue;
2107 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2108 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
2109 patches.Set(nPatch+1);
2110 patches.AddAt(absId,nPatch++);
2112 } // trigger time array
2114 else if(IsEventEMCALL1()) // L1
2117 caloTrigger->GetTriggerBits(bit);
2119 Bool_t isEGA = ((bit >> fBitEGA) & 0x1) && IsEventEMCALL1Gamma() ;
2120 Bool_t isEJE = ((bit >> fBitEJE) & 0x1) && IsEventEMCALL1Jet () ;
2122 if(!isEGA && !isEJE) continue;
2124 Int_t patchsize = -1;
2125 if (isEGA) patchsize = 2;
2126 else if (isEJE) patchsize = 16;
2128 // add 2x2 (EGA) or 16x16 (EJE) patches
2129 for(Int_t irow=0; irow < patchsize; irow++)
2131 for(Int_t icol=0; icol < patchsize; icol++)
2133 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2134 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
2135 patches.Set(nPatch+1);
2136 patches.AddAt(absId,nPatch++);
2142 } // trigger iterator
2143 } // go thorough triggers
2145 //printf("N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2150 //______________________________________________________________________
2151 void AliCaloTrackReader::MatchTriggerCluster(TArrayI patches)
2153 // Finds the cluster that triggered
2155 // Init info from previous event
2156 fTriggerClusterIndex = -1;
2157 fTriggerClusterId = -1;
2158 fTriggerClusterBC = -10000;
2159 fIsExoticEvent = kFALSE;
2160 fIsBadCellEvent = kFALSE;
2161 fIsBadMaxCellEvent = kFALSE;
2163 fIsTriggerMatch = kFALSE;
2164 fIsTriggerMatchOpenCut[0] = kFALSE;
2165 fIsTriggerMatchOpenCut[1] = kFALSE;
2166 fIsTriggerMatchOpenCut[2] = kFALSE;
2168 // Do only analysis for triggered events
2169 if(!IsEventEMCALL1() && !IsEventEMCALL0())
2171 fTriggerClusterBC = 0;
2175 //Recover the list of clusters
2176 TClonesArray * clusterList = 0;
2177 if (fInputEvent->FindListObject(fEMCALClustersListName))
2179 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2181 else if(fOutputEvent)
2183 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2186 // Get number of clusters and of trigger patches
2187 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2189 nclusters = clusterList->GetEntriesFast();
2191 Int_t nPatch = patches.GetSize();
2192 Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2194 //Init some variables used in the cluster loop
2195 Float_t tofPatchMax = 100000;
2196 Float_t ePatchMax =-1;
2198 Float_t tofMax = 100000;
2202 Int_t idclusMax =-1;
2203 Bool_t badClMax = kFALSE;
2204 Bool_t badCeMax = kFALSE;
2205 Bool_t exoMax = kFALSE;
2206 Int_t absIdMaxTrig= -1;
2207 Int_t absIdMaxMax = -1;
2209 Int_t nOfHighECl = 0 ;
2211 Float_t minE = fTriggerEventThreshold / 2.;
2212 // This method is not really suitable for JET trigger
2213 // but in case, reduce the energy cut since we do not trigger on high energy particle
2214 if(IsEventEMCALL1()) minE = 1;
2216 // Loop on the clusters, check if there is any that falls into one of the patches
2217 for (Int_t iclus = 0; iclus < nclusters; iclus++)
2219 AliVCluster * clus = 0;
2220 if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2221 else clus = fInputEvent->GetCaloCluster(iclus);
2223 if ( !clus ) continue ;
2225 if ( !IsEMCALCluster(clus)) continue ;
2227 //Skip clusters with too low energy to be triggering
2228 if ( clus->E() < minE ) continue ;
2231 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2233 Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2234 clus->GetCellsAbsId(),clus->GetNCells());
2235 UShort_t cellMax[] = {absIdMax};
2236 Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2238 // if cell is bad, it can happen that time calibration is not available,
2239 // when calculating if it is exotic, this can make it to be exotic by default
2240 // open it temporarily for this cluster
2242 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2244 Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2246 // Set back the time cut on exotics
2248 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2250 // Energy threshold for exotic Ecross typically at 4 GeV,
2251 // for lower energy, check that there are more than 1 cell in the cluster
2252 if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2254 Float_t energy = clus->E();
2255 Int_t idclus = clus->GetID();
2257 Double_t tof = clus->GetTOF();
2258 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal)
2259 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2262 //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2263 // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2265 // Find the highest energy cluster, avobe trigger threshold
2266 // in the event in case no match to trigger is found
2271 badClMax = badCluster;
2276 absIdMaxMax = absIdMax;
2279 // count the good clusters in the event avobe the trigger threshold
2280 // to check the exotic events
2281 if(!badCluster && !exotic)
2284 // Find match to trigger
2285 if(fTriggerPatchClusterMatch)
2287 for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2290 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2291 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2292 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2294 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2296 if(absIdMax == absIDCell[ipatch])
2298 //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2299 if(energy > ePatchMax)
2303 fIsBadCellEvent = badCluster;
2304 fIsBadMaxCellEvent = badCell;
2305 fIsExoticEvent = exotic;
2306 fTriggerClusterIndex = iclus;
2307 fTriggerClusterId = idclus;
2308 fIsTriggerMatch = kTRUE;
2309 absIdMaxTrig = absIdMax;
2313 }// trigger patch loop
2314 } // Do trigger patch matching
2318 // If there was no match, assign as trigger
2319 // the highest energy cluster in the event
2320 if(!fIsTriggerMatch)
2322 tofPatchMax = tofMax;
2324 fIsBadCellEvent = badClMax;
2325 fIsBadMaxCellEvent = badCeMax;
2326 fIsExoticEvent = exoMax;
2327 fTriggerClusterIndex = clusMax;
2328 fTriggerClusterId = idclusMax;
2331 Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2333 if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2334 else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2335 else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2336 else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2337 else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2338 else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2341 //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2342 if(fTriggerClusterIndex >= 0) fTriggerClusterBC = 6 ;
2345 fTriggerClusterIndex = -2;
2346 fTriggerClusterId = -2;
2350 if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2353 // 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",
2354 // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2355 // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2357 // 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",
2358 // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2360 //Redo matching but open cuts
2361 if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2363 // Open time patch time
2364 TArrayI patchOpen = GetTriggerPatches(7,10);
2367 Int_t patchAbsIdOpenTime = -1;
2368 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2371 patchAbsIdOpenTime = patchOpen.At(iabsId);
2372 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2373 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2374 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2376 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2378 if(absIdMaxMax == absIDCell[ipatch])
2380 fIsTriggerMatchOpenCut[0] = kTRUE;
2384 }// trigger patch loop
2386 // Check neighbour patches
2387 Int_t patchAbsId = -1;
2388 Int_t globalCol = -1;
2389 Int_t globalRow = -1;
2390 GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2391 GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2393 // Check patches with strict time cut
2394 Int_t patchAbsIdNeigh = -1;
2395 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2397 if(icol < 0 || icol > 47) continue;
2399 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2401 if(irow < 0 || irow > 63) continue;
2403 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2405 if ( patchAbsIdNeigh < 0 ) continue;
2407 for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2409 if(patchAbsIdNeigh == patches.At(iabsId))
2411 fIsTriggerMatchOpenCut[1] = kTRUE;
2414 }// trigger patch loop
2419 // Check patches with open time cut
2420 Int_t patchAbsIdNeighOpenTime = -1;
2421 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2423 if(icol < 0 || icol > 47) continue;
2425 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2427 if(irow < 0 || irow > 63) continue;
2429 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2431 if ( patchAbsIdNeighOpenTime < 0 ) continue;
2433 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2435 if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2437 fIsTriggerMatchOpenCut[2] = kTRUE;
2440 }// trigger patch loop
2445 // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2446 // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2447 // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2451 }// No trigger match found
2455 //________________________________________________________
2456 void AliCaloTrackReader::Print(const Option_t * opt) const
2459 //Print some relevant parameters set for the analysis
2463 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2464 printf("Task name : %s\n", fTaskName.Data()) ;
2465 printf("Data type : %d\n", fDataType) ;
2466 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2467 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2468 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2469 printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2470 printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2471 printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2472 printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2473 printf("Use CTS = %d\n", fFillCTS) ;
2474 printf("Use EMCAL = %d\n", fFillEMCAL) ;
2475 printf("Use PHOS = %d\n", fFillPHOS) ;
2476 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2477 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2478 printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2479 printf("AODs Track filter mask = %d or hybrid %d, SPD hit %d\n", (Int_t) fTrackFilterMask,fSelectHybridTracks,fSelectSPDHitTracks) ;
2480 printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ;
2481 printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2482 printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
2484 printf("Use Triggers selected in SE base class %d; If not what trigger Mask? %d; Trigger max for mixed %d \n",
2485 fEventTriggerAtSE, fEventTriggerMask,fMixEventTriggerMask);
2487 if(fComparePtHardAndClusterPt)
2488 printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2490 if(fComparePtHardAndClusterPt)
2491 printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2493 printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2494 printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2495 printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2501 //__________________________________________
2502 Bool_t AliCaloTrackReader::RejectLEDEvents()
2504 // LED Events in period LHC11a contaminated sample, simple method
2505 // to reject such events
2507 // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2508 Int_t ncellsSM3 = 0;
2509 for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2511 Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2512 Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2513 if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2516 Int_t ncellcut = 21;
2517 if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2519 if(ncellsSM3 >= ncellcut)
2522 printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d, cut %d, trig %s\n",
2523 ncellsSM3,ncellcut,GetFiredTriggerClasses().Data());
2531 //_________________________________________________________
2532 void AliCaloTrackReader::RemapMCLabelForAODs(Int_t & label)
2534 // MC label for Cells not remapped after ESD filtering, do it here.
2536 if(label < 0) return ;
2538 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2541 TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2544 if(label < arr->GetEntriesFast())
2546 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2547 if(!particle) return ;
2549 if(label == particle->Label()) return ; // label already OK
2550 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2552 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2554 // loop on the particles list and check if there is one with the same label
2555 for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2557 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2558 if(!particle) continue ;
2560 if(label == particle->Label())
2563 //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2570 //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2575 //___________________________________
2576 void AliCaloTrackReader::ResetLists()
2578 // Reset lists, called by the analysis maker
2580 if(fCTSTracks) fCTSTracks -> Clear();
2581 if(fEMCALClusters) fEMCALClusters -> Clear("C");
2582 if(fPHOSClusters) fPHOSClusters -> Clear("C");
2584 fV0ADC[0] = 0; fV0ADC[1] = 0;
2585 fV0Mul[0] = 0; fV0Mul[1] = 0;
2587 if(fNonStandardJets) fNonStandardJets -> Clear("C");
2591 //___________________________________________
2592 void AliCaloTrackReader::SetEventTriggerBit()
2594 // Tag event depeding on trigger name
2596 fEventTrigMinBias = kFALSE;
2597 fEventTrigCentral = kFALSE;
2598 fEventTrigSemiCentral = kFALSE;
2599 fEventTrigEMCALL0 = kFALSE;
2600 fEventTrigEMCALL1Gamma1 = kFALSE;
2601 fEventTrigEMCALL1Gamma2 = kFALSE;
2602 fEventTrigEMCALL1Jet1 = kFALSE;
2603 fEventTrigEMCALL1Jet2 = kFALSE;
2605 if(fDebug > 0) printf("AliCaloTrackReader::SetEventTriggerBit() - Select trigger mask bit %d - Trigger Event %s\n",fEventTriggerMask,GetFiredTriggerClasses().Data());
2607 if(fEventTriggerMask <=0 )// in case no mask set
2609 // EMC triggered event? Which type?
2610 if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
2612 if ( GetFiredTriggerClasses().Contains("EGA" ) ||
2613 GetFiredTriggerClasses().Contains("EG1" ) )
2615 fEventTrigEMCALL1Gamma1 = kTRUE;
2616 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2618 else if( GetFiredTriggerClasses().Contains("EG2" ) )
2620 fEventTrigEMCALL1Gamma2 = kTRUE;
2621 if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2623 else if( GetFiredTriggerClasses().Contains("EJE" ) ||
2624 GetFiredTriggerClasses().Contains("EJ1" ) )
2626 fEventTrigEMCALL1Jet1 = kTRUE;
2627 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
2628 fEventTrigEMCALL1Jet1 = kFALSE;
2630 else if( GetFiredTriggerClasses().Contains("EJ2" ) )
2632 fEventTrigEMCALL1Jet2 = kTRUE;
2633 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2635 else if( GetFiredTriggerClasses().Contains("CEMC") &&
2636 !GetFiredTriggerClasses().Contains("EGA" ) &&
2637 !GetFiredTriggerClasses().Contains("EJE" ) &&
2638 !GetFiredTriggerClasses().Contains("EG1" ) &&
2639 !GetFiredTriggerClasses().Contains("EJ1" ) &&
2640 !GetFiredTriggerClasses().Contains("EG2" ) &&
2641 !GetFiredTriggerClasses().Contains("EJ2" ) )
2643 fEventTrigEMCALL0 = kTRUE;
2646 //Min bias event trigger?
2647 if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
2649 fEventTrigCentral = kTRUE;
2651 else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
2653 fEventTrigSemiCentral = kTRUE;
2655 else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
2656 GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
2658 fEventTrigMinBias = kTRUE;
2665 if ( fEventTriggerMask & AliVEvent::kEMCEGA )
2667 if (GetFiredTriggerClasses().Contains("EG1" ) ||
2668 GetFiredTriggerClasses().Contains("EGA" ) )
2670 fEventTrigEMCALL1Gamma1 = kTRUE;
2671 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2673 else if(GetFiredTriggerClasses().Contains("EG2" ))
2675 fEventTrigEMCALL1Gamma2 = kTRUE;
2676 if(!fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2680 else if( fEventTriggerMask & AliVEvent::kEMCEJE )
2682 if (GetFiredTriggerClasses().Contains("EJ1" )||
2683 GetFiredTriggerClasses().Contains("EJE" ) )
2685 fEventTrigEMCALL1Jet1 = kTRUE;
2686 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") ) fEventTrigEMCALL1Jet1 = kFALSE;
2688 else if(GetFiredTriggerClasses().Contains("EJ2" ))
2690 fEventTrigEMCALL1Jet2 = kTRUE;
2691 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2695 else if((fEventTriggerMask & AliVEvent::kEMC7) ||
2696 (fEventTriggerMask & AliVEvent::kEMC1) )
2698 fEventTrigEMCALL0 = kTRUE;
2701 else if( fEventTriggerMask & AliVEvent::kCentral )
2703 fEventTrigSemiCentral = kTRUE;
2706 else if( fEventTriggerMask & AliVEvent::kSemiCentral )
2708 fEventTrigCentral = kTRUE;
2710 // Min Bias pp, PbPb, pPb
2711 else if((fEventTriggerMask & AliVEvent::kMB ) ||
2712 (fEventTriggerMask & AliVEvent::kINT7) ||
2713 (fEventTriggerMask & AliVEvent::kINT8) )
2715 fEventTrigMinBias = kTRUE;
2720 printf("AliCaloTrackReader::SetEventTriggerBit() - Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d \n",
2721 fEventTrigMinBias, fEventTrigCentral, fEventTrigSemiCentral,
2722 fEventTrigEMCALL0 , fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2,
2723 fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2);
2725 if(fBitEGA == 0 && fBitEJE ==0)
2727 // Init the trigger bit once, correct depending on version
2731 TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
2733 const TList *clist = file->GetStreamerInfoCache();
2737 TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
2738 if(!cinfo) cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
2742 Int_t classversionid = cinfo->GetClassVersion();
2744 if (classversionid >= 5)
2749 } else printf("AliCaloTrackReader()::Init() - Streamer info for trigger class not available, bit not changed\n");
2750 } else printf("AliCaloTrackReader::Init() - Streamer list not available!, bit not changed\n");
2752 } // set once the EJE, EGA trigger bit
2756 //____________________________________________________________
2757 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
2759 fInputEvent = input;
2760 fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
2762 fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
2764 //Delete previous vertex
2767 for (Int_t i = 0; i < fNMixedEvent; i++)
2769 delete [] fVertex[i] ;
2774 fVertex = new Double_t*[fNMixedEvent] ;
2775 for (Int_t i = 0; i < fNMixedEvent; i++)
2777 fVertex[i] = new Double_t[3] ;
2778 fVertex[i][0] = 0.0 ;
2779 fVertex[i][1] = 0.0 ;
2780 fVertex[i][2] = 0.0 ;
2784 //____________________________________________________________
2785 void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts)
2789 if(fESDtrackCuts) delete fESDtrackCuts ;
2791 fESDtrackCuts = cuts ;
2795 //_________________________________________________________________________
2796 void AliCaloTrackReader::SetTrackComplementaryCuts(AliESDtrackCuts * cuts)
2798 // Set Track cuts for complementary tracks (hybrids)
2800 if(fESDtrackComplementaryCuts) delete fESDtrackComplementaryCuts ;
2802 fESDtrackComplementaryCuts = cuts ;