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), fTrackFilterMaskComplementary(0),
90 fESDtrackCuts(0), fESDtrackComplementaryCuts(0), fConstrainTrack(kFALSE),
91 fSelectHybridTracks(0), fSelectPrimaryTracks(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(""),
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(Float_t pt, 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.Contains("Hijing",TString::kIgnoreCase)) 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.Contains("Hijing",TString::kIgnoreCase)) 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.Contains("Hijing",TString::kIgnoreCase)) 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.Contains("Hijing",TString::kIgnoreCase)) 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;
616 fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks
620 //_______________________________________
621 void AliCaloTrackReader::InitParameters()
623 //Initialize the parameters of the analysis.
629 fEMCALPtMax = 1000. ;
633 // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
634 fTrackDCACut[0] = 0.0105;
635 fTrackDCACut[1] = 0.0350;
636 fTrackDCACut[2] = 1.1;
638 //Do not filter the detectors input by default.
642 fFillEMCALCells = kFALSE;
643 fFillPHOSCells = kFALSE;
645 fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
646 fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
647 fDeltaAODFileName = "deltaAODPartCorr.root";
648 fFiredTriggerClassName = "";
649 fEventTriggerMask = AliVEvent::kAny;
650 fMixEventTriggerMask = AliVEvent::kAnyINT;
651 fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
653 fAcceptFastCluster = kTRUE;
656 //We want tracks fitted in the detectors:
657 //fTrackStatus=AliESDtrack::kTPCrefit;
658 //fTrackStatus|=AliESDtrack::kITSrefit;
660 fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
661 fTrackFilterMaskComplementary = 0; // in case of hybrid tracks, without using the standard method
664 fESDtrackComplementaryCuts = 0;
666 fConstrainTrack = kFALSE ; // constrain tracks to vertex
668 fV0ADC[0] = 0; fV0ADC[1] = 0;
669 fV0Mul[0] = 0; fV0Mul[1] = 0;
675 fPtHardAndJetPtFactor = 7.;
676 fPtHardAndClusterPtFactor = 1.;
679 fCentralityClass = "V0M";
681 fCentralityBin[0] = fCentralityBin[1]=-1;
683 fEventPlaneMethod = "V0";
685 // Allocate memory (not sure this is the right place)
686 fCTSTracks = new TObjArray();
687 fEMCALClusters = new TObjArray();
688 fPHOSClusters = new TObjArray();
689 fTriggerAnalysis = new AliTriggerAnalysis;
690 fAODBranchList = new TList ;
692 fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
693 fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
695 // Parametrized time cut (LHC11d)
696 fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1. ;
697 fEMCALParamTimeCutMax[0] = 5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.45; fEMCALParamTimeCutMax[3] = 1.25;
699 // Parametrized time cut (LHC11c)
700 //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
701 //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
703 fTimeStampRunMin = -1;
704 fTimeStampRunMax = 1e12;
705 fTimeStampEventFracMin = -1;
706 fTimeStampEventFracMax = 2;
708 for(Int_t i = 0; i < 19; i++)
710 fEMCalBCEvent [i] = 0;
711 fEMCalBCEventCut[i] = 0;
712 fTrackBCEvent [i] = 0;
713 fTrackBCEventCut[i] = 0;
716 // Trigger match-rejection
717 fTriggerPatchTimeWindow[0] = 8;
718 fTriggerPatchTimeWindow[1] = 9;
720 fTriggerClusterBC = -10000 ;
721 fTriggerEventThreshold = 2.;
722 fTriggerClusterIndex = -1;
723 fTriggerClusterId = -1;
726 fInputNonStandardJetBranchName = "jets";
727 fFillInputNonStandardJetBranch = kFALSE;
728 if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
732 //___________________________________________________________________
733 Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const
735 // Check if it is a cluster from EMCAL. For old AODs cluster type has
736 // different number and need to patch here
738 if(fDataType==kAOD && fOldAOD)
740 if (cluster->GetType() == 2) return kTRUE;
745 return cluster->IsEMCAL();
750 //___________________________________________________________________
751 Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const
753 //Check if it is a cluster from PHOS.For old AODs cluster type has
754 // different number and need to patch here
756 if(fDataType==kAOD && fOldAOD)
758 Int_t type = cluster->GetType();
759 if (type == 0 || type == 1) return kTRUE;
764 return cluster->IsPHOS();
769 //________________________________________________________________________
770 Bool_t AliCaloTrackReader::IsHIJINGLabel(Int_t label)
773 // Find if cluster/track was generated by HIJING
775 AliGenHijingEventHeader* hijingHeader = dynamic_cast<AliGenHijingEventHeader *> (GetGenEventHeader());
777 //printf("header %p, label %d\n",hijingHeader,label);
779 if(!hijingHeader || label < 0 ) return kFALSE;
782 //printf("pass a), N produced %d\n",nproduced);
784 if(label >= fNMCProducedMin && label < fNMCProducedMax)
786 //printf(" accept!, label is smaller than produced, N %d\n",nproduced);
793 if(!GetStack()) return kFALSE;
795 Int_t nprimaries = GetStack()->GetNtrack();
797 if(label > nprimaries) return kFALSE;
799 TParticle * mom = GetStack()->Particle(label);
802 Int_t iParent = mom->GetFirstMother();
805 if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax)
807 //printf("\t accept, mother is %d \n",iParent)
812 mom = GetStack()->Particle(iMom);
813 iParent = mom->GetFirstMother();
821 TClonesArray* mcparticles = GetAODMCParticles();
823 if(!mcparticles) return kFALSE;
825 Int_t nprimaries = mcparticles->GetEntriesFast();
827 if(label > nprimaries) return kFALSE;
829 //printf("pass b) N primaries %d \n",nprimaries);
831 if(label >= fNMCProducedMin && label < fNMCProducedMax)
836 // Find grand parent, check if produced in the good range
837 AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);
840 Int_t iParent = mom->GetMother();
843 if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax)
845 //printf("\t accept, mother is %d, with nProduced %d \n",iParent, nproduced);
850 mom = (AliAODMCParticle *) mcparticles->At(iMom);
851 iParent = mom->GetMother();
855 //printf("pass c), no match found \n");
862 //__________________________________________________________________________
863 Bool_t AliCaloTrackReader::IsInTimeWindow(Double_t tof, Float_t energy) const
865 // Cluster time selection window
867 // Parametrized cut depending on E
870 Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
871 Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
872 //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
873 if( tof < minCut || tof > maxCut ) return kFALSE ;
876 //In any case, the time should to be larger than the fixed window ...
877 if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
882 //________________________________________________
883 Bool_t AliCaloTrackReader::IsPileUpFromSPD() const
885 // Check if event is from pile-up determined by SPD
886 // Default values: (3, 0.8, 3., 2., 5.)
887 return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
888 fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
889 //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
893 //__________________________________________________
894 Bool_t AliCaloTrackReader::IsPileUpFromEMCal() const
896 // Check if event is from pile-up determined by EMCal
897 if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
901 //________________________________________________________
902 Bool_t AliCaloTrackReader::IsPileUpFromSPDAndEMCal() const
904 // Check if event is from pile-up determined by SPD and EMCal
905 if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
909 //_______________________________________________________
910 Bool_t AliCaloTrackReader::IsPileUpFromSPDOrEMCal() const
912 // Check if event is from pile-up determined by SPD or EMCal
913 if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
917 //___________________________________________________________
918 Bool_t AliCaloTrackReader::IsPileUpFromSPDAndNotEMCal() const
920 // Check if event is from pile-up determined by SPD and not by EMCal
921 if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
925 //___________________________________________________________
926 Bool_t AliCaloTrackReader::IsPileUpFromEMCalAndNotSPD() const
928 // Check if event is from pile-up determined by EMCal, not by SPD
929 if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
933 //______________________________________________________________
934 Bool_t AliCaloTrackReader::IsPileUpFromNotSPDAndNotEMCal() const
936 // Check if event not from pile-up determined neither by SPD nor by EMCal
937 if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
941 //___________________________________________________________________________________
942 Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileName*/)
944 //Fill the event counter and input lists that are needed, called by the analysis maker.
946 fEventNumber = iEntry;
947 fTriggerClusterIndex = -1;
948 fTriggerClusterId = -1;
949 fIsTriggerMatch = kFALSE;
950 fTriggerClusterBC = -10000;
951 fIsExoticEvent = kFALSE;
952 fIsBadCellEvent = kFALSE;
953 fIsBadMaxCellEvent = kFALSE;
955 fIsTriggerMatchOpenCut[0] = kFALSE ;
956 fIsTriggerMatchOpenCut[1] = kFALSE ;
957 fIsTriggerMatchOpenCut[2] = kFALSE ;
959 //fCurrentFileName = TString(currentFileName);
962 if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
966 //Select events only fired by a certain trigger configuration if it is provided
968 if(fInputEvent->GetHeader())
969 eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
971 if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
973 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
977 //-------------------------------------------------------------------------------------
978 // Reject event if large clusters with large energy
979 // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
980 // If clusterzer NxN or V2 it does not help
981 //-------------------------------------------------------------------------------------
982 Int_t run = fInputEvent->GetRunNumber();
983 if( fRemoveLEDEvents && run > 146857 && run < 146861 )
985 Bool_t reject = RejectLEDEvents();
986 if(reject) return kFALSE;
987 }// Remove LED events
989 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass LED event rejection \n");
991 //-------------------------------------------------------------------------------------
992 // Reject or accept events depending on the trigger bit
993 //-------------------------------------------------------------------------------------
995 //printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>\n", GetFiredTriggerClasses().Data());
997 Bool_t okA = AcceptEventWithTriggerBit();
998 Bool_t okR = RejectEventWithTriggerBit();
1000 //printf("AliCaloTrackReader::FillInputEvent() - Accept event? %d, Reject event %d? \n",okA,okR);
1002 if(!okA || !okR) return kFALSE;
1004 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass event bit rejection \n");
1007 //-----------------------------------------------------------
1008 // Reject events depending on the trigger name and event type
1009 //-----------------------------------------------------------
1010 if( fFiredTriggerClassName !="" && !fAnaLED)
1012 //printf("Event type %d\n",eventType);
1014 return kFALSE; //Only physics event, do not use for simulated events!!!
1017 printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
1018 GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
1020 if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
1021 else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n");
1025 // kStartOfRun = 1, // START_OF_RUN
1026 // kEndOfRun = 2, // END_OF_RUN
1027 // kStartOfRunFiles = 3, // START_OF_RUN_FILES
1028 // kEndOfRunFiles = 4, // END_OF_RUN_FILES
1029 // kStartOfBurst = 5, // START_OF_BURST
1030 // kEndOfBurst = 6, // END_OF_BURST
1031 // kPhysicsEvent = 7, // PHYSICS_EVENT
1032 // kCalibrationEvent = 8, // CALIBRATION_EVENT
1033 // kFormatError = 9, // EVENT_FORMAT_ERROR
1034 // kStartOfData = 10, // START_OF_DATA
1035 // kEndOfData = 11, // END_OF_DATA
1036 // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
1037 // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
1039 if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType);
1040 if(eventType!=8)return kFALSE;
1043 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Trigger name rejection \n");
1046 //In case of analysis of events with jets, skip those with jet pt > 5 pt hard
1047 if(fComparePtHardAndJetPt)
1049 if(!ComparePtHardAndJetPt()) return kFALSE ;
1052 if(fComparePtHardAndClusterPt)
1054 if(!ComparePtHardAndClusterPt()) return kFALSE ;
1057 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Pt Hard rejection \n");
1061 //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
1062 if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
1064 //------------------------------------------------------
1065 //Event rejection depending on vertex, pileup, v0and
1066 //------------------------------------------------------
1067 if(fDataType==kESD && fTimeStampEventSelect)
1069 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1072 Int_t timeStamp = esd->GetTimeStamp();
1073 Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
1075 //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
1077 if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
1079 //printf("\t accept time stamp\n");
1082 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Time Stamp rejection \n");
1084 //------------------------------------------------------
1085 //Event rejection depending on vertex, pileup, v0and
1086 //------------------------------------------------------
1088 if(fUseEventsWithPrimaryVertex)
1090 if( !CheckForPrimaryVertex() ) return kFALSE;
1091 if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
1092 TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
1093 TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
1096 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass primary vertex rejection \n");
1098 //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
1100 if(fDoEventSelection)
1102 // Do not analyze events with pileup
1103 Bool_t bPileup = IsPileUpFromSPD();
1104 //IsPileupFromSPDInMultBins() // method to try
1105 //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]);
1106 if(bPileup) return kFALSE;
1108 if(fDoV0ANDEventSelection)
1110 Bool_t bV0AND = kTRUE;
1111 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
1113 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
1114 //else bV0AND = //FIXME FOR AODs
1115 if(!bV0AND) return kFALSE;
1117 }// Event selection/AliceSoft/AliRoot/trunk/PWG/CaloTrackCorrBase/AliCaloTrackReader.h
1119 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass Pile-Up, V0AND event rejection \n");
1121 //------------------------------------------------------
1123 //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
1124 //If we need a centrality bin, we select only those events in the corresponding bin.
1125 if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100)
1127 Int_t cen = GetEventCentrality();
1128 if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
1131 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass centrality rejection \n");
1134 //Fill the arrays with cluster/tracks/cells data
1136 if(!fEventTriggerAtSE)
1138 // In case of mixing analysis, accept MB events, not only Trigger
1139 // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
1140 // via de method in the base class FillMixedEventPool()
1142 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
1143 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
1145 if(!inputHandler) return kFALSE ; // to content coverity
1147 UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
1148 UInt_t isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
1150 if(!isTrigger && !isMB) return kFALSE;
1152 //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
1155 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass uninteresting triggered events rejection in case of mixing analysis \n");
1158 //----------------------------------------------------------------------
1159 // Do not count events that where likely triggered by an exotic cluster
1160 // or out BC cluster
1161 //----------------------------------------------------------------------
1163 // Set a bit with the event kind, MB, L0, L1 ...
1164 SetEventTriggerBit();
1166 //Get Patches that triggered
1167 TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
1169 MatchTriggerCluster(patches);
1171 // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set
1172 if(fRemoveBadTriggerEvents && (IsEventEMCALL1() || IsEventEMCALL0()))
1174 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
1175 fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
1176 if (fIsExoticEvent) return kFALSE;
1177 else if(fIsBadCellEvent) return kFALSE;
1178 else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
1179 else if(fTriggerClusterBC != 0) return kFALSE;
1180 //printf("\t *** YES\n");
1185 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass EMCal triggered event rejection \n");
1188 // Get the main vertex BC, in case not available
1189 // it is calculated in FillCTS checking the BC of tracks
1190 // with DCA small (if cut applied, if open)
1191 fVertexBC=fInputEvent->GetPrimaryVertex()->GetBC();
1193 if(fAcceptOnlyHIJINGLabels) SetGeneratorMinMaxParticles();
1195 //printf("N min %d, N max %d\n",fNMCProducedMin,fNMCProducedMax);
1200 //Accept events with at least one track
1201 if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
1204 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass rejection of null track events \n");
1207 if(fDoVertexBCEventSelection)
1209 if(fVertexBC!=0 && fVertexBC!=AliVTrack::kTOFBCNA) return kFALSE ;
1212 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass rejection of events with vertex at BC!=0 \n");
1216 FillInputEMCALCells();
1219 FillInputPHOSCells();
1229 //one specified jet branch
1230 if(fFillInputNonStandardJetBranch)
1231 FillInputNonStandardJets();
1236 //__________________________________________________
1237 Int_t AliCaloTrackReader::GetEventCentrality() const
1239 //Return current event centrality
1243 if (fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1244 else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1245 else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
1248 printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
1256 //_____________________________________________________
1257 Double_t AliCaloTrackReader::GetEventPlaneAngle() const
1259 //Return current event centrality
1263 Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1265 if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
1267 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <Q> method : %f\n",ep);
1270 else if(GetEventPlaneMethod().Contains("V0") )
1272 if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1274 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep);
1278 ep+=TMath::Pi()/2; // put same range as for <Q> method
1282 //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep);
1285 if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1286 else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1293 if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() - No EP pointer\n");
1299 //__________________________________________________________
1300 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const
1302 //Return vertex position to be used for single event analysis
1303 vertex[0]=fVertex[0][0];
1304 vertex[1]=fVertex[0][1];
1305 vertex[2]=fVertex[0][2];
1308 //__________________________________________________________________________
1309 void AliCaloTrackReader::GetVertex(Double_t vertex[3], Int_t evtIndex) const
1311 //Return vertex position for mixed event, recover the vertex in a particular event.
1313 vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2];
1317 //________________________________________
1318 void AliCaloTrackReader::FillVertexArray()
1321 //Fill data member with vertex
1322 //In case of Mixed event, multiple vertices
1324 //Delete previous vertex
1327 for (Int_t i = 0; i < fNMixedEvent; i++)
1329 delete [] fVertex[i] ;
1334 fVertex = new Double_t*[fNMixedEvent] ;
1335 for (Int_t i = 0; i < fNMixedEvent; i++)
1337 fVertex[i] = new Double_t[3] ;
1338 fVertex[i][0] = 0.0 ;
1339 fVertex[i][1] = 0.0 ;
1340 fVertex[i][2] = 0.0 ;
1344 { //Single event analysis
1348 if(fInputEvent->GetPrimaryVertex())
1350 fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
1354 printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
1355 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1356 }//Primary vertex pointer do not exist
1360 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1364 printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
1367 { // MultiEvent analysis
1368 for (Int_t iev = 0; iev < fNMixedEvent; iev++)
1370 if (fMixedEvent->GetVertexOfEvent(iev))
1371 fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
1373 { // no vertex found !!!!
1374 AliWarning("No vertex found");
1378 printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
1385 //_____________________________________
1386 void AliCaloTrackReader::FillInputCTS()
1388 //Return array with Central Tracking System (CTS) tracks
1390 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
1392 Double_t pTrack[3] = {0,0,0};
1394 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1397 Double_t bz = GetInputEvent()->GetMagneticField();
1399 for(Int_t i = 0; i < 19; i++)
1401 fTrackBCEvent [i] = 0;
1402 fTrackBCEventCut[i] = 0;
1405 Bool_t bc0 = kFALSE;
1406 if(fRecalculateVertexBC) fVertexBC=AliVTrack::kTOFBCNA;
1408 for (Int_t itrack = 0; itrack < nTracks; itrack++)
1409 {////////////// track loop
1410 AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
1412 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
1413 ULong_t status = track->GetStatus();
1415 if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
1420 Float_t dcaTPC =-999;
1422 if (fDataType==kESD)
1424 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track);
1428 if(fESDtrackCuts->AcceptTrack(esdTrack))
1430 track->GetPxPyPz(pTrack) ;
1434 if(esdTrack->GetConstrainedParam())
1436 const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam();
1437 esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
1438 esdTrack->GetConstrainedPxPyPz(pTrack);
1442 } // use constrained tracks
1444 if(fSelectSPDHitTracks)
1445 {//Not much sense to use with TPC only or Hybrid tracks
1446 if(!esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1)) continue ;
1449 // Complementary track to global : Hybrids (make sure that the previous selection is for Global)
1450 else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack))
1452 // constrain the track
1453 if(esdTrack->GetConstrainedParam())
1455 esdTrack->Set(esdTrack->GetConstrainedParam()->GetX(),esdTrack->GetConstrainedParam()->GetAlpha(),esdTrack->GetConstrainedParam()->GetParameter(),esdTrack->GetConstrainedParam()->GetCovariance());
1457 track->GetPxPyPz(pTrack) ;
1465 else if(fDataType==kAOD)
1467 AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track);
1471 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n",
1472 aodtrack->GetType(),AliAODTrack::kPrimary,
1473 aodtrack->IsHybridGlobalConstrainedGlobal());
1475 if (fSelectHybridTracks && fTrackFilterMaskComplementary == 0)
1477 if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
1481 Bool_t accept = aodtrack->TestFilterBit(fTrackFilterMask);
1483 if(!fSelectHybridTracks && !accept) continue ;
1485 if(fSelectHybridTracks)
1487 Bool_t acceptcomplement = aodtrack->TestFilterBit(fTrackFilterMaskComplementary);
1488 if (!accept && !acceptcomplement) continue ;
1492 if(fSelectSPDHitTracks)
1493 {//Not much sense to use with TPC only or Hybrid tracks
1494 if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) continue ;
1497 if ( fSelectPrimaryTracks )
1499 if ( aodtrack->GetType()!= AliAODTrack::kPrimary ) continue ;
1502 if (fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS(): \t accepted track! \n");
1504 //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1506 dcaTPC = aodtrack->DCA();
1508 track->GetPxPyPz(pTrack) ;
1510 } // aod track exists
1515 TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
1517 Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1518 Double_t tof = -1000;
1519 Int_t trackBC = -1000 ;
1523 trackBC = track->GetTOFBunchCrossing(bz);
1524 SetTrackEventBC(trackBC+9);
1526 tof = track->GetTOFsignal()*1e-3;
1531 //normal way to get the dca, cut on dca_xy
1534 Double_t dca[2] = {1e6,1e6};
1535 Double_t covar[3] = {1e6,1e6,1e6};
1536 Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1537 if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]);
1540 //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f, BC %d\n",momentum.Pt(),dca[0],trackBC);
1548 //SetTrackEventBCcut(bc);
1549 SetTrackEventBCcut(trackBC+9);
1551 //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1552 if(fRecalculateVertexBC)
1554 if (trackBC !=0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1555 else if(trackBC == 0) bc0 = kTRUE;
1558 //In any case, the time should to be larger than the fixed window ...
1559 if( fUseTrackTimeCut && (trackBC!=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1561 //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1564 //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1568 //Count the tracks in eta < 0.9
1569 //printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
1570 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1572 if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ;
1574 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
1576 if(fDebug > 2 && momentum.Pt() > 0.1)
1577 printf("AliCaloTrackReader::FillInputCTS() - Selected tracks pt %3.2f, phi %3.2f, eta %3.2f\n",
1578 momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1580 if (fMixedEvent) track->SetID(itrack);
1582 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(track->GetLabel())) continue ;
1584 fCTSTracks->Add(track);
1588 if(fVertexBC ==0 || fVertexBC == AliVTrack::kTOFBCNA)
1590 if( bc0 ) fVertexBC = 0 ;
1591 else fVertexBC = AliVTrack::kTOFBCNA ;
1596 printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
1600 //_______________________________________________________________________________
1601 void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus)
1603 //Fill the EMCAL data in the array, do it
1607 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1609 if(fRecalculateClusters)
1611 //Recalibrate the cluster energy
1612 if(GetCaloUtils()->IsRecalibrationOn())
1614 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
1617 //printf("Recalibrated Energy %f\n",clus->E());
1619 GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus);
1620 GetCaloUtils()->RecalculateClusterPID(clus);
1624 //Recalculate distance to bad channels, if new list of bad channels provided
1625 GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus);
1627 //Recalculate cluster position
1628 if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1630 GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus);
1631 //clus->GetPosition(pos);
1632 //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1636 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1638 Double_t tof = clus->GetTOF();
1640 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1642 if(fDataType==AliCaloTrackReader::kESD)
1644 tof = fEMCALCells->GetCellTime(absIdMax);
1647 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1651 }// Time recalibration
1654 //Reject clusters with bad channels, close to borders and exotic;
1655 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return;
1657 //Mask all cells in collumns facing ALICE thick material if requested
1658 if(GetCaloUtils()->GetNMaskCellColumns())
1664 Bool_t shared = kFALSE;
1665 GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1666 if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1669 if(fSelectEmbeddedClusters)
1671 if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1672 //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1676 //clus->GetPosition(pos);
1677 //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1679 //Correct non linearity
1680 if(fCorrectELinearity && GetCaloUtils()->IsCorrectionOfClusterEnergyOn())
1682 GetCaloUtils()->CorrectClusterEnergy(clus) ;
1684 //In case of MC analysis, to match resolution/calibration in real data
1685 Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1686 // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy);
1687 clus->SetE(rdmEnergy);
1690 Double_t tof = clus->GetTOF()*1e9;
1692 Int_t bc = TMath::Nint(tof/50) + 9;
1693 //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1695 SetEMCalEventBC(bc);
1697 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
1699 TLorentzVector momentum ;
1701 clus->GetMomentum(momentum, fVertex[vindex]);
1703 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1705 SetEMCalEventBCcut(bc);
1707 if(!IsInTimeWindow(tof,clus->E()))
1709 fNPileUpClusters++ ;
1710 if(fUseEMCALTimeCut) return ;
1713 fNNonPileUpClusters++;
1715 if(fDebug > 2 && momentum.E() > 0.1)
1716 printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1717 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1720 clus->SetID(iclus) ;
1722 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel( clus->GetLabel() )) return ;
1724 // if(fAcceptOnlyHIJINGLabels)
1726 // printf("Accept label %d?\n",clus->GetLabel());
1728 // if( !IsHIJINGLabel( clus->GetLabel() ) ) { printf("\t Reject label\n") ; return ; }
1729 // else printf("\t Accept label\n") ;
1732 fEMCALClusters->Add(clus);
1736 //_______________________________________
1737 void AliCaloTrackReader::FillInputEMCAL()
1739 //Return array with EMCAL clusters in aod format
1741 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
1743 // First recalibrate cells, time or energy
1744 // if(GetCaloUtils()->IsRecalibrationOn())
1745 // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1747 // fInputEvent->GetBunchCrossNumber());
1749 fNPileUpClusters = 0; // Init counter
1750 fNNonPileUpClusters = 0; // Init counter
1751 for(Int_t i = 0; i < 19; i++)
1753 fEMCalBCEvent [i] = 0;
1754 fEMCalBCEventCut[i] = 0;
1757 //Loop to select clusters in fiducial cut and fill container with aodClusters
1758 if(fEMCALClustersListName=="")
1760 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1761 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1763 AliVCluster * clus = 0;
1764 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1766 if (IsEMCALCluster(clus))
1768 FillInputEMCALAlgorithm(clus, iclus);
1773 //Recalculate track matching
1774 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
1776 }//Get the clusters from the input event
1779 TClonesArray * clusterList = 0x0;
1781 if (fInputEvent->FindListObject(fEMCALClustersListName))
1783 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
1785 else if(fOutputEvent)
1787 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
1792 printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data());
1796 Int_t nclusters = clusterList->GetEntriesFast();
1797 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1799 AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
1800 //printf("E %f\n",clus->E());
1801 if (clus) FillInputEMCALAlgorithm(clus, iclus);
1802 else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
1805 // Recalculate the pile-up time, in case long time clusters removed during clusterization
1806 //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1808 fNPileUpClusters = 0; // Init counter
1809 fNNonPileUpClusters = 0; // Init counter
1810 for(Int_t i = 0; i < 19; i++)
1812 fEMCalBCEvent [i] = 0;
1813 fEMCalBCEventCut[i] = 0;
1816 for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
1818 AliVCluster * clus = 0;
1820 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1822 if (IsEMCALCluster(clus))
1826 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1827 Double_t tof = clus->GetTOF();
1828 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1831 //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
1833 //Reject clusters with bad channels, close to borders and exotic;
1834 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
1836 Int_t bc = TMath::Nint(tof/50) + 9;
1837 SetEMCalEventBC(bc);
1839 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
1841 TLorentzVector momentum ;
1843 clus->GetMomentum(momentum, fVertex[0]);
1845 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
1847 SetEMCalEventBCcut(bc);
1849 if(!IsInTimeWindow(tof,clus->E()))
1850 fNPileUpClusters++ ;
1852 fNNonPileUpClusters++;
1858 //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1860 // Recalculate track matching, not necessary if already done in the reclusterization task.
1861 // in case it was not done ...
1862 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
1866 if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters);
1870 //______________________________________
1871 void AliCaloTrackReader::FillInputPHOS()
1873 //Return array with PHOS clusters in aod format
1875 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
1877 //Loop to select clusters in fiducial cut and fill container with aodClusters
1878 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1879 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1881 AliVCluster * clus = 0;
1882 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1884 if (IsPHOSCluster(clus))
1886 //Check if the cluster contains any bad channel and if close to calorimeter borders
1889 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1890 if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells()))
1892 if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex))
1895 if(fRecalculateClusters)
1897 //Recalibrate the cluster energy
1898 if(GetCaloUtils()->IsRecalibrationOn())
1900 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
1905 TLorentzVector momentum ;
1907 clus->GetMomentum(momentum, fVertex[vindex]);
1909 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
1911 if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue;
1913 if(fDebug > 2 && momentum.E() > 0.1)
1914 printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1915 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1920 clus->SetID(iclus) ;
1923 if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(clus->GetLabel())) continue ;
1925 fPHOSClusters->Add(clus);
1931 if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast());
1935 //____________________________________________
1936 void AliCaloTrackReader::FillInputEMCALCells()
1938 //Return array with EMCAL cells in aod format
1940 fEMCALCells = fInputEvent->GetEMCALCells();
1944 //___________________________________________
1945 void AliCaloTrackReader::FillInputPHOSCells()
1947 //Return array with PHOS cells in aod format
1949 fPHOSCells = fInputEvent->GetPHOSCells();
1953 //_______________________________________
1954 void AliCaloTrackReader::FillInputVZERO()
1956 //Fill VZERO information in data member, add all the channels information.
1957 AliVVZERO* v0 = fInputEvent->GetVZEROData();
1958 //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1962 AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
1963 for (Int_t i = 0; i < 32; i++)
1966 {//Only available in ESDs
1967 fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
1968 fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
1971 fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
1972 fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
1975 printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1980 printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
1984 //_________________________________________________
1985 void AliCaloTrackReader::FillInputNonStandardJets()
1988 //fill array with non standard jets
1992 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputNonStandardJets()\n");
1994 //check if branch name is given
1995 if(!fInputNonStandardJetBranchName.Length())
1997 Printf("No non-standard jet branch name specified. Specify among existing ones.");
1998 fInputEvent->Print();
2002 fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data()));
2004 if(!fNonStandardJets)
2006 //check if jet branch exist; exit if not
2007 Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data());
2008 fInputEvent->Print();
2014 printf("AliCaloTrackReader::FillInputNonStandardJets() - aod input jets %d\n", fNonStandardJets->GetEntriesFast() );
2019 //________________________________________________
2020 Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
2022 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
2025 AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent);
2026 if(!event) return kTRUE;
2028 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0)
2033 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1)
2036 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0)
2038 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
2042 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1)
2044 // cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl;
2053 //________________________________________________________________________________
2054 TArrayI AliCaloTrackReader::GetTriggerPatches(Int_t tmin, Int_t tmax )
2056 // Select the patches that triggered
2057 // Depend on L0 or L1
2060 Int_t trigtimes[30], globCol, globRow,ntimes, i;
2061 Int_t absId = -1; //[100];
2066 // get object pointer
2067 AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
2069 // class is not empty
2070 if( caloTrigger->GetEntries() > 0 )
2072 // must reset before usage, or the class will fail
2073 caloTrigger->Reset();
2075 // go throuth the trigger channels
2076 while( caloTrigger->Next() )
2078 // get position in global 2x2 tower coordinates
2079 caloTrigger->GetPosition( globCol, globRow );
2082 if(IsEventEMCALL0())
2084 // get dimension of time arrays
2085 caloTrigger->GetNL0Times( ntimes );
2087 // no L0s in this channel
2088 // presence of the channel in the iterator still does not guarantee that L0 was produced!!
2093 caloTrigger->GetL0Times( trigtimes );
2095 //printf("trigger time window %d - %d\n",fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
2096 // go through the array
2097 for( i = 0; i < ntimes; i++ )
2099 // check if in cut - 8,9 shall be accepted in 2011
2100 if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
2102 //printf("Accepted trigger time %d \n",trigtimes[i]);
2103 //if(nTrig > 99) continue;
2104 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
2105 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
2106 patches.Set(nPatch+1);
2107 patches.AddAt(absId,nPatch++);
2109 } // trigger time array
2111 else if(IsEventEMCALL1()) // L1
2114 caloTrigger->GetTriggerBits(bit);
2116 Bool_t isEGA = ((bit >> fBitEGA) & 0x1) && IsEventEMCALL1Gamma() ;
2117 Bool_t isEJE = ((bit >> fBitEJE) & 0x1) && IsEventEMCALL1Jet () ;
2119 if(!isEGA && !isEJE) continue;
2121 Int_t patchsize = -1;
2122 if (isEGA) patchsize = 2;
2123 else if (isEJE) patchsize = 16;
2125 // add 2x2 (EGA) or 16x16 (EJE) patches
2126 for(Int_t irow=0; irow < patchsize; irow++)
2128 for(Int_t icol=0; icol < patchsize; icol++)
2130 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
2131 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
2132 patches.Set(nPatch+1);
2133 patches.AddAt(absId,nPatch++);
2139 } // trigger iterator
2140 } // go thorough triggers
2142 //printf("N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
2147 //______________________________________________________________________
2148 void AliCaloTrackReader::MatchTriggerCluster(TArrayI patches)
2150 // Finds the cluster that triggered
2152 // Init info from previous event
2153 fTriggerClusterIndex = -1;
2154 fTriggerClusterId = -1;
2155 fTriggerClusterBC = -10000;
2156 fIsExoticEvent = kFALSE;
2157 fIsBadCellEvent = kFALSE;
2158 fIsBadMaxCellEvent = kFALSE;
2160 fIsTriggerMatch = kFALSE;
2161 fIsTriggerMatchOpenCut[0] = kFALSE;
2162 fIsTriggerMatchOpenCut[1] = kFALSE;
2163 fIsTriggerMatchOpenCut[2] = kFALSE;
2165 // Do only analysis for triggered events
2166 if(!IsEventEMCALL1() && !IsEventEMCALL0())
2168 fTriggerClusterBC = 0;
2172 //Recover the list of clusters
2173 TClonesArray * clusterList = 0;
2174 if (fInputEvent->FindListObject(fEMCALClustersListName))
2176 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
2178 else if(fOutputEvent)
2180 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
2183 // Get number of clusters and of trigger patches
2184 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
2186 nclusters = clusterList->GetEntriesFast();
2188 Int_t nPatch = patches.GetSize();
2189 Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
2191 //Init some variables used in the cluster loop
2192 Float_t tofPatchMax = 100000;
2193 Float_t ePatchMax =-1;
2195 Float_t tofMax = 100000;
2199 Int_t idclusMax =-1;
2200 Bool_t badClMax = kFALSE;
2201 Bool_t badCeMax = kFALSE;
2202 Bool_t exoMax = kFALSE;
2203 Int_t absIdMaxTrig= -1;
2204 Int_t absIdMaxMax = -1;
2206 Int_t nOfHighECl = 0 ;
2208 Float_t minE = fTriggerEventThreshold / 2.;
2209 // This method is not really suitable for JET trigger
2210 // but in case, reduce the energy cut since we do not trigger on high energy particle
2211 if(IsEventEMCALL1()) minE = 1;
2213 // Loop on the clusters, check if there is any that falls into one of the patches
2214 for (Int_t iclus = 0; iclus < nclusters; iclus++)
2216 AliVCluster * clus = 0;
2217 if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
2218 else clus = fInputEvent->GetCaloCluster(iclus);
2220 if ( !clus ) continue ;
2222 if ( !IsEMCALCluster(clus)) continue ;
2224 //Skip clusters with too low energy to be triggering
2225 if ( clus->E() < minE ) continue ;
2228 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
2230 Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
2231 clus->GetCellsAbsId(),clus->GetNCells());
2232 UShort_t cellMax[] = {absIdMax};
2233 Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
2235 // if cell is bad, it can happen that time calibration is not available,
2236 // when calculating if it is exotic, this can make it to be exotic by default
2237 // open it temporarily for this cluster
2239 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
2241 Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
2243 // Set back the time cut on exotics
2245 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
2247 // Energy threshold for exotic Ecross typically at 4 GeV,
2248 // for lower energy, check that there are more than 1 cell in the cluster
2249 if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
2251 Float_t energy = clus->E();
2252 Int_t idclus = clus->GetID();
2254 Double_t tof = clus->GetTOF();
2255 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal)
2256 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
2259 //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
2260 // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
2262 // Find the highest energy cluster, avobe trigger threshold
2263 // in the event in case no match to trigger is found
2268 badClMax = badCluster;
2273 absIdMaxMax = absIdMax;
2276 // count the good clusters in the event avobe the trigger threshold
2277 // to check the exotic events
2278 if(!badCluster && !exotic)
2281 // Find match to trigger
2282 if(fTriggerPatchClusterMatch)
2284 for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
2287 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
2288 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2289 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2291 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2293 if(absIdMax == absIDCell[ipatch])
2295 //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2296 if(energy > ePatchMax)
2300 fIsBadCellEvent = badCluster;
2301 fIsBadMaxCellEvent = badCell;
2302 fIsExoticEvent = exotic;
2303 fTriggerClusterIndex = iclus;
2304 fTriggerClusterId = idclus;
2305 fIsTriggerMatch = kTRUE;
2306 absIdMaxTrig = absIdMax;
2310 }// trigger patch loop
2311 } // Do trigger patch matching
2315 // If there was no match, assign as trigger
2316 // the highest energy cluster in the event
2317 if(!fIsTriggerMatch)
2319 tofPatchMax = tofMax;
2321 fIsBadCellEvent = badClMax;
2322 fIsBadMaxCellEvent = badCeMax;
2323 fIsExoticEvent = exoMax;
2324 fTriggerClusterIndex = clusMax;
2325 fTriggerClusterId = idclusMax;
2328 Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
2330 if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
2331 else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2332 else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2333 else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2334 else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2335 else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2338 //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2339 if(fTriggerClusterIndex >= 0) fTriggerClusterBC = 6 ;
2342 fTriggerClusterIndex = -2;
2343 fTriggerClusterId = -2;
2347 if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2350 // 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",
2351 // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2352 // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2354 // 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",
2355 // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2357 //Redo matching but open cuts
2358 if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2360 // Open time patch time
2361 TArrayI patchOpen = GetTriggerPatches(7,10);
2364 Int_t patchAbsIdOpenTime = -1;
2365 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2368 patchAbsIdOpenTime = patchOpen.At(iabsId);
2369 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2370 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2371 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2373 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2375 if(absIdMaxMax == absIDCell[ipatch])
2377 fIsTriggerMatchOpenCut[0] = kTRUE;
2381 }// trigger patch loop
2383 // Check neighbour patches
2384 Int_t patchAbsId = -1;
2385 Int_t globalCol = -1;
2386 Int_t globalRow = -1;
2387 GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2388 GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2390 // Check patches with strict time cut
2391 Int_t patchAbsIdNeigh = -1;
2392 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2394 if(icol < 0 || icol > 47) continue;
2396 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2398 if(irow < 0 || irow > 63) continue;
2400 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2402 if ( patchAbsIdNeigh < 0 ) continue;
2404 for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2406 if(patchAbsIdNeigh == patches.At(iabsId))
2408 fIsTriggerMatchOpenCut[1] = kTRUE;
2411 }// trigger patch loop
2416 // Check patches with open time cut
2417 Int_t patchAbsIdNeighOpenTime = -1;
2418 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2420 if(icol < 0 || icol > 47) continue;
2422 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2424 if(irow < 0 || irow > 63) continue;
2426 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2428 if ( patchAbsIdNeighOpenTime < 0 ) continue;
2430 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2432 if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2434 fIsTriggerMatchOpenCut[2] = kTRUE;
2437 }// trigger patch loop
2442 // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2443 // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2444 // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2448 }// No trigger match found
2452 //________________________________________________________
2453 void AliCaloTrackReader::Print(const Option_t * opt) const
2456 //Print some relevant parameters set for the analysis
2460 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2461 printf("Task name : %s\n", fTaskName.Data()) ;
2462 printf("Data type : %d\n", fDataType) ;
2463 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2464 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2465 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2466 printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2467 printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2468 printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2469 printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2470 printf("Use CTS = %d\n", fFillCTS) ;
2471 printf("Use EMCAL = %d\n", fFillEMCAL) ;
2472 printf("Use PHOS = %d\n", fFillPHOS) ;
2473 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2474 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2475 printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2476 printf("AODs Track filter mask = %d or hybrid %d (if filter bit comp %d), select : SPD hit %d, primary %d\n",
2477 (Int_t) fTrackFilterMask, fSelectHybridTracks, (Int_t) fTrackFilterMaskComplementary, fSelectSPDHitTracks,fSelectPrimaryTracks) ;
2478 printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ;
2479 printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2480 printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
2482 printf("Use Triggers selected in SE base class %d; If not what Trigger Mask? %d; MB Trigger Mask for mixed %d \n",
2483 fEventTriggerAtSE, fEventTriggerMask,fMixEventTriggerMask);
2485 if(fComparePtHardAndClusterPt)
2486 printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2488 if(fComparePtHardAndClusterPt)
2489 printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2491 printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2492 printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2493 printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2499 //__________________________________________
2500 Bool_t AliCaloTrackReader::RejectLEDEvents()
2502 // LED Events in period LHC11a contaminated sample, simple method
2503 // to reject such events
2505 // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2506 Int_t ncellsSM3 = 0;
2507 for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2509 Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2510 Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2511 if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2514 Int_t ncellcut = 21;
2515 if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
2517 if(ncellsSM3 >= ncellcut)
2520 printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d, cut %d, trig %s\n",
2521 ncellsSM3,ncellcut,GetFiredTriggerClasses().Data());
2529 //_________________________________________________________
2530 void AliCaloTrackReader::RemapMCLabelForAODs(Int_t & label)
2532 // MC label for Cells not remapped after ESD filtering, do it here.
2534 if(label < 0) return ;
2536 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2539 TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2542 if(label < arr->GetEntriesFast())
2544 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2545 if(!particle) return ;
2547 if(label == particle->Label()) return ; // label already OK
2548 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2550 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2552 // loop on the particles list and check if there is one with the same label
2553 for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2555 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2556 if(!particle) continue ;
2558 if(label == particle->Label())
2561 //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2568 //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2573 //___________________________________
2574 void AliCaloTrackReader::ResetLists()
2576 // Reset lists, called by the analysis maker
2578 if(fCTSTracks) fCTSTracks -> Clear();
2579 if(fEMCALClusters) fEMCALClusters -> Clear("C");
2580 if(fPHOSClusters) fPHOSClusters -> Clear("C");
2582 fV0ADC[0] = 0; fV0ADC[1] = 0;
2583 fV0Mul[0] = 0; fV0Mul[1] = 0;
2585 if(fNonStandardJets) fNonStandardJets -> Clear("C");
2589 //___________________________________________
2590 void AliCaloTrackReader::SetEventTriggerBit()
2592 // Tag event depeding on trigger name
2594 fEventTrigMinBias = kFALSE;
2595 fEventTrigCentral = kFALSE;
2596 fEventTrigSemiCentral = kFALSE;
2597 fEventTrigEMCALL0 = kFALSE;
2598 fEventTrigEMCALL1Gamma1 = kFALSE;
2599 fEventTrigEMCALL1Gamma2 = kFALSE;
2600 fEventTrigEMCALL1Jet1 = kFALSE;
2601 fEventTrigEMCALL1Jet2 = kFALSE;
2603 if(fDebug > 0) printf("AliCaloTrackReader::SetEventTriggerBit() - Select trigger mask bit %d - Trigger Event %s\n",fEventTriggerMask,GetFiredTriggerClasses().Data());
2605 if(fEventTriggerMask <=0 )// in case no mask set
2607 // EMC triggered event? Which type?
2608 if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
2610 if ( GetFiredTriggerClasses().Contains("EGA" ) ||
2611 GetFiredTriggerClasses().Contains("EG1" ) )
2613 fEventTrigEMCALL1Gamma1 = kTRUE;
2614 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2616 else if( GetFiredTriggerClasses().Contains("EG2" ) )
2618 fEventTrigEMCALL1Gamma2 = kTRUE;
2619 if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2621 else if( GetFiredTriggerClasses().Contains("EJE" ) ||
2622 GetFiredTriggerClasses().Contains("EJ1" ) )
2624 fEventTrigEMCALL1Jet1 = kTRUE;
2625 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
2626 fEventTrigEMCALL1Jet1 = kFALSE;
2628 else if( GetFiredTriggerClasses().Contains("EJ2" ) )
2630 fEventTrigEMCALL1Jet2 = kTRUE;
2631 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2633 else if( GetFiredTriggerClasses().Contains("CEMC") &&
2634 !GetFiredTriggerClasses().Contains("EGA" ) &&
2635 !GetFiredTriggerClasses().Contains("EJE" ) &&
2636 !GetFiredTriggerClasses().Contains("EG1" ) &&
2637 !GetFiredTriggerClasses().Contains("EJ1" ) &&
2638 !GetFiredTriggerClasses().Contains("EG2" ) &&
2639 !GetFiredTriggerClasses().Contains("EJ2" ) )
2641 fEventTrigEMCALL0 = kTRUE;
2644 //Min bias event trigger?
2645 if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
2647 fEventTrigCentral = kTRUE;
2649 else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
2651 fEventTrigSemiCentral = kTRUE;
2653 else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
2654 GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
2656 fEventTrigMinBias = kTRUE;
2663 if ( fEventTriggerMask & AliVEvent::kEMCEGA )
2665 if (GetFiredTriggerClasses().Contains("EG1" ) ||
2666 GetFiredTriggerClasses().Contains("EGA" ) )
2668 fEventTrigEMCALL1Gamma1 = kTRUE;
2669 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2671 else if(GetFiredTriggerClasses().Contains("EG2" ))
2673 fEventTrigEMCALL1Gamma2 = kTRUE;
2674 if(!fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2678 else if( fEventTriggerMask & AliVEvent::kEMCEJE )
2680 if (GetFiredTriggerClasses().Contains("EJ1" )||
2681 GetFiredTriggerClasses().Contains("EJE" ) )
2683 fEventTrigEMCALL1Jet1 = kTRUE;
2684 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") ) fEventTrigEMCALL1Jet1 = kFALSE;
2686 else if(GetFiredTriggerClasses().Contains("EJ2" ))
2688 fEventTrigEMCALL1Jet2 = kTRUE;
2689 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2693 else if((fEventTriggerMask & AliVEvent::kEMC7) ||
2694 (fEventTriggerMask & AliVEvent::kEMC1) )
2696 fEventTrigEMCALL0 = kTRUE;
2699 else if( fEventTriggerMask & AliVEvent::kCentral )
2701 fEventTrigSemiCentral = kTRUE;
2704 else if( fEventTriggerMask & AliVEvent::kSemiCentral )
2706 fEventTrigCentral = kTRUE;
2708 // Min Bias pp, PbPb, pPb
2709 else if((fEventTriggerMask & AliVEvent::kMB ) ||
2710 (fEventTriggerMask & AliVEvent::kINT7) ||
2711 (fEventTriggerMask & AliVEvent::kINT8) ||
2712 (fEventTriggerMask & AliVEvent::kAnyINT) )
2714 fEventTrigMinBias = kTRUE;
2719 printf("AliCaloTrackReader::SetEventTriggerBit() - Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d \n",
2720 fEventTrigMinBias, fEventTrigCentral, fEventTrigSemiCentral,
2721 fEventTrigEMCALL0 , fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2,
2722 fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2);
2724 if(fBitEGA == 0 && fBitEJE ==0)
2726 // Init the trigger bit once, correct depending on version
2730 TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
2732 const TList *clist = file->GetStreamerInfoCache();
2736 TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
2737 if(!cinfo) cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
2741 Int_t classversionid = cinfo->GetClassVersion();
2743 if (classversionid >= 5)
2748 } else printf("AliCaloTrackReader()::Init() - Streamer info for trigger class not available, bit not changed\n");
2749 } else printf("AliCaloTrackReader::Init() - Streamer list not available!, bit not changed\n");
2751 } // set once the EJE, EGA trigger bit
2755 //____________________________________________________________
2756 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
2758 fInputEvent = input;
2759 fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
2761 fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
2763 //Delete previous vertex
2766 for (Int_t i = 0; i < fNMixedEvent; i++)
2768 delete [] fVertex[i] ;
2773 fVertex = new Double_t*[fNMixedEvent] ;
2774 for (Int_t i = 0; i < fNMixedEvent; i++)
2776 fVertex[i] = new Double_t[3] ;
2777 fVertex[i][0] = 0.0 ;
2778 fVertex[i][1] = 0.0 ;
2779 fVertex[i][2] = 0.0 ;
2783 //____________________________________________________________
2784 void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts)
2788 if(fESDtrackCuts) delete fESDtrackCuts ;
2790 fESDtrackCuts = cuts ;
2794 //_________________________________________________________________________
2795 void AliCaloTrackReader::SetTrackComplementaryCuts(AliESDtrackCuts * cuts)
2797 // Set Track cuts for complementary tracks (hybrids)
2799 if(fESDtrackComplementaryCuts) delete fESDtrackComplementaryCuts ;
2801 fESDtrackComplementaryCuts = cuts ;