]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/CaloTrackCorrBase/AliCaloTrackReader.cxx
AliCaloTrackReader: Reorder methods, add AOD cell remapping method
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliCaloTrackReader.cxx
CommitLineData
1c5acb87 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
1c5acb87 15
16//_________________________________________________________________________
85c4406e 17// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and
1c5acb87 18// Central Barrel Tracking detectors (CTS).
ff45398a 19// Not all MC particles/tracks/clusters are kept, some kinematical/fiducial restrictions are done.
591cc579 20// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS)
743aa53a 21// : AliCaloTrackMCReader : Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS)
85c4406e 22// : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS)
23//-- Author: Gustavo Conesa (LNF-INFN)
1c5acb87 24//////////////////////////////////////////////////////////////////////////////
25
26
27// --- ROOT system ---
49b53920 28#include <TFile.h>
de0b770d 29#include <TGeoManager.h>
d9bea110 30#include <TStreamerInfo.h>
1c5acb87 31
c5693f62 32// ---- ANALYSIS system ----
477d6cee 33#include "AliMCEvent.h"
591cc579 34#include "AliAODMCHeader.h"
35#include "AliGenPythiaEventHeader.h"
48c37e02 36#include "AliESDEvent.h"
8dacfd76 37#include "AliAODEvent.h"
c8fe2783 38#include "AliVTrack.h"
39#include "AliVParticle.h"
40#include "AliMixedEvent.h"
0ae57829 41#include "AliESDtrack.h"
3a58eee6 42#include "AliESDtrackCuts.h"
48c37e02 43#include "AliTriggerAnalysis.h"
37285e29 44#include "AliESDVZERO.h"
c5693f62 45#include "AliVCaloCells.h"
029dea5a 46#include "AliAnalysisManager.h"
47#include "AliInputEventHandler.h"
914b9fe7 48#include "AliAODMCParticle.h"
1c5acb87 49
c5693f62 50// ---- Detectors ----
51#include "AliPHOSGeoUtils.h"
52#include "AliEMCALGeometry.h"
f3138ecf 53#include "AliEMCALRecoUtils.h"
c5693f62 54
0de1814a 55// ---- CaloTrackCorr ---
c5693f62 56#include "AliCalorimeterUtils.h"
cfaba834 57#include "AliCaloTrackReader.h"
58
1c5acb87 59ClassImp(AliCaloTrackReader)
85c4406e 60
61
836b6989 62//________________________________________
85c4406e 63AliCaloTrackReader::AliCaloTrackReader() :
836b6989 64TObject(), fEventNumber(-1), //fCurrentFileName(""),
85c4406e 65fDataType(0), fDebug(0),
66fFiducialCut(0x0), fCheckFidCut(kFALSE),
de0b770d 67fComparePtHardAndJetPt(0), fPtHardAndJetPtFactor(0),
dbb3de7b 68fComparePtHardAndClusterPt(0),fPtHardAndClusterPtFactor(0),
85c4406e 69fCTSPtMin(0), fEMCALPtMin(0), fPHOSPtMin(0),
4b7f6e01 70fCTSPtMax(0), fEMCALPtMax(0), fPHOSPtMax(0),
71fUseEMCALTimeCut(1), fUseParamTimeCut(0), fUseTrackTimeCut(0),
d2655d46 72fEMCALTimeCutMin(-10000), fEMCALTimeCutMax(10000),
ff440946 73fEMCALParamTimeCutMin(), fEMCALParamTimeCutMax(),
975b29fa 74fTrackTimeCutMin(-10000), fTrackTimeCutMax(10000),
689d9f15 75fUseTrackDCACut(0),
f3138ecf 76fAODBranchList(0x0),
77fCTSTracks(0x0), fEMCALClusters(0x0), fPHOSClusters(0x0),
836b6989 78fEMCALCells(0x0), fPHOSCells(0x0),
79fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0),
80fFillCTS(0), fFillEMCAL(0), fFillPHOS(0),
85c4406e 81fFillEMCALCells(0), fFillPHOSCells(0),
836b6989 82fRecalculateClusters(kFALSE),fSelectEmbeddedClusters(kFALSE),
85c4406e 83fTrackStatus(0), fTrackFilterMask(0),
d7601185 84fESDtrackCuts(0), fESDtrackComplementaryCuts(0), fConstrainTrack(kFALSE),
f5500c7a 85fSelectHybridTracks(0), fSelectSPDHitTracks(kFALSE),
2644ead9 86fTrackMult(0), fTrackMultEtaCut(0.9),
85c4406e 87fReadStack(kFALSE), fReadAODMCParticles(kFALSE),
88fDeltaAODFileName(""), fFiredTriggerClassName(""),
d9bea110 89
85c4406e 90fEventTriggerMask(0), fMixEventTriggerMask(0), fEventTriggerAtSE(0),
d9bea110 91fEventTrigMinBias(0), fEventTrigCentral(0),
92fEventTrigSemiCentral(0), fEventTrigEMCALL0(0),
85c4406e 93fEventTrigEMCALL1Gamma1(0), fEventTrigEMCALL1Gamma2(0),
d9bea110 94fEventTrigEMCALL1Jet1(0), fEventTrigEMCALL1Jet2(0),
95fBitEGA(0), fBitEJE(0),
96
029dea5a 97fAnaLED(kFALSE),
85c4406e 98fTaskName(""), fCaloUtils(0x0),
99fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL),
d783becb 100fListMixedTracksEvents(), fListMixedCaloEvents(),
101fLastMixedTracksEvent(-1), fLastMixedCaloEvent(-1),
836b6989 102fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE), fCaloFilterPatch(kFALSE),
85c4406e 103fEMCALClustersListName(""), fZvtxCut(0.),
a529ae05 104fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kTRUE),
afb3af8a 105//Trigger rejection
106fRemoveBadTriggerEvents(0), fTriggerPatchClusterMatch(0),
107fTriggerPatchTimeWindow(), fTriggerEventThreshold(0),
108fTriggerClusterBC(0), fTriggerClusterIndex(0), fTriggerClusterId(0),
1035a8d9 109fIsExoticEvent(0), fIsBadCellEvent(0), fIsBadMaxCellEvent(0),
85c4406e 110fIsTriggerMatch(0), fIsTriggerMatchOpenCut(),
afb3af8a 111
2644ead9 112fDoEventSelection(kFALSE), fDoV0ANDEventSelection(kFALSE),
113fDoVertexBCEventSelection(kFALSE),
114fDoRejectNoTrackEvents(kFALSE),
cc944149 115fUseEventsWithPrimaryVertex(kFALSE),
034e885b 116fTriggerAnalysis (0x0), fTimeStampEventSelect(0),
117fTimeStampEventFracMin(0), fTimeStampEventFracMax(0),
118fTimeStampRunMin(0), fTimeStampRunMax(0),
3c1a2e95 119fNPileUpClusters(-1), fNNonPileUpClusters(-1), fNPileUpClustersCut(3),
cc944149 120fVertexBC(-200), fRecalculateVertexBC(0),
9bf1c947 121fCentralityClass(""), fCentralityOpt(0),
de0b770d 122fEventPlaneMethod(""), fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("")
af7b3903 123{
1c5acb87 124 //Ctor
85c4406e 125
1c5acb87 126 //Initialize parameters
127 InitParameters();
128}
1c5acb87 129
836b6989 130//_______________________________________
85c4406e 131AliCaloTrackReader::~AliCaloTrackReader()
836b6989 132{
1c5acb87 133 //Dtor
134
743aa53a 135 delete fFiducialCut ;
29b2ceec 136
d2655d46 137 if(fAODBranchList)
138 {
f37fa8d2 139 fAODBranchList->Delete();
140 delete fAODBranchList ;
85c4406e 141 }
f37fa8d2 142
d2655d46 143 if(fCTSTracks)
144 {
85c4406e 145 if(fDataType!=kMC)fCTSTracks->Clear() ;
146 else fCTSTracks->Delete() ;
be518ab0 147 delete fCTSTracks ;
1c5acb87 148 }
149
d2655d46 150 if(fEMCALClusters)
151 {
85c4406e 152 if(fDataType!=kMC)fEMCALClusters->Clear("C") ;
153 else fEMCALClusters->Delete() ;
be518ab0 154 delete fEMCALClusters ;
1c5acb87 155 }
156
029dea5a 157 if(fPHOSClusters)
158 {
85c4406e 159 if(fDataType!=kMC)fPHOSClusters->Clear("C") ;
160 else fPHOSClusters->Delete() ;
be518ab0 161 delete fPHOSClusters ;
1c5acb87 162 }
163
d2655d46 164 if(fVertex)
165 {
85c4406e 166 for (Int_t i = 0; i < fNMixedEvent; i++)
d2655d46 167 {
7e25653f 168 delete [] fVertex[i] ;
836b6989 169
7e25653f 170 }
171 delete [] fVertex ;
85c4406e 172 }
836b6989 173
743aa53a 174 delete fESDtrackCuts;
d7601185 175 delete fESDtrackComplementaryCuts;
743aa53a 176 delete fTriggerAnalysis;
3a58eee6 177
836b6989 178 // Pointers not owned, done by the analysis frame
179 // if(fInputEvent) delete fInputEvent ;
180 // if(fOutputEvent) delete fOutputEvent ;
85c4406e 181 // if(fMC) delete fMC ;
836b6989 182 // Pointer not owned, deleted by maker
183 // if (fCaloUtils) delete fCaloUtils ;
184
c1ac3823 185}
477d6cee 186
cc944149 187//________________________________________________________________________
188Bool_t AliCaloTrackReader::AcceptDCA(const Float_t pt, const Float_t dca)
189{
190 // Accept track if DCA is smaller than function
191
192 Float_t cut = fTrackDCACut[0]+fTrackDCACut[1]/TMath::Power(pt,fTrackDCACut[2]);
193
194 if(TMath::Abs(dca) < cut)
195 return kTRUE;
196 else
197 return kFALSE;
198
199}
200
836b6989 201//________________________________________________
202Bool_t AliCaloTrackReader::ComparePtHardAndJetPt()
203{
dbb3de7b 204 // Check the event, if the requested ptHard is much smaller than the jet pT, then there is a problem.
90995603 205 // Only for PYTHIA.
a20fbb55 206
207 //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName());
90995603 208
d2655d46 209 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
210 {
90995603 211 TParticle * jet = 0;
212 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
213 Int_t nTriggerJets = pygeh->NTriggerJets();
214 Float_t ptHard = pygeh->GetPtHard();
215
85c4406e 216 if(fDebug > 1)
a20fbb55 217 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Njets: %d, pT Hard %f\n",nTriggerJets, ptHard);
218
898c9d44 219 Float_t tmpjet[]={0,0,0,0};
d2655d46 220 for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
221 {
90995603 222 pygeh->TriggerJet(ijet, tmpjet);
223 jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
a20fbb55 224
85c4406e 225 if(fDebug > 1)
a20fbb55 226 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - jet %d; pycell jet pT %f\n",ijet, jet->Pt());
227
90995603 228 //Compare jet pT and pt Hard
d2655d46 229 if(jet->Pt() > fPtHardAndJetPtFactor * ptHard)
230 {
a20fbb55 231 printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
85c4406e 232 ptHard, jet->Pt(), fPtHardAndJetPtFactor);
cfaba834 233 return kFALSE;
90995603 234 }
235 }
a20fbb55 236
85c4406e 237 if(jet) delete jet;
90995603 238 }
239
240 return kTRUE ;
241
591cc579 242}
243
dbb3de7b 244//____________________________________________________________________
245Bool_t AliCaloTrackReader::ComparePtHardAndClusterPt()
246{
247 // Check the event, if the requested ptHard is smaller than the calorimeter cluster E, then there is a problem.
248 // Only for PYTHIA.
249
250 if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
251 {
252 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
253 Float_t ptHard = pygeh->GetPtHard();
254
255 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
85c4406e 256 for (Int_t iclus = 0; iclus < nclusters; iclus++)
dbb3de7b 257 {
85c4406e 258 AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ;
dbb3de7b 259 Float_t ecluster = clus->E();
260
85c4406e 261 if(ecluster > fPtHardAndClusterPtFactor*ptHard)
dbb3de7b 262 {
263 printf("AliCaloTrackReader::ComparePtHardAndClusterPt() - Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f\n",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard);
85c4406e 264
dbb3de7b 265 return kFALSE;
266 }
267 }
268
269 }
270
271 return kTRUE ;
272
273}
274
836b6989 275//____________________________________________
85c4406e 276AliStack* AliCaloTrackReader::GetStack() const
836b6989 277{
1c5acb87 278 //Return pointer to stack
279 if(fMC)
280 return fMC->Stack();
d2655d46 281 else
282 {
85c4406e 283 if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n");
1c5acb87 284 return 0x0 ;
285 }
286}
287
43074325 288//__________________________________________________
85c4406e 289TString AliCaloTrackReader::GetFiredTriggerClasses()
290{
43074325 291 // List of triggered classes in a TString
85c4406e 292
43074325 293 AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (GetInputEvent());
294 AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (GetInputEvent());
85c4406e 295
43074325 296 if (esdevent) return esdevent->GetFiredTriggerClasses();
297 else if(aodevent) return aodevent->GetFiredTriggerClasses();
298 else return ""; // Mixed Event, MC event, does not have this trigger info
85c4406e 299
43074325 300}
301
836b6989 302//______________________________________________
85c4406e 303AliHeader* AliCaloTrackReader::GetHeader() const
836b6989 304{
1c5acb87 305 //Return pointer to header
306 if(fMC)
029dea5a 307 {
1c5acb87 308 return fMC->Header();
029dea5a 309 }
310 else
311 {
85c4406e 312 printf("AliCaloTrackReader::Header is not available\n");
1c5acb87 313 return 0x0 ;
314 }
315}
836b6989 316
317//______________________________________________________________
85c4406e 318AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const
836b6989 319{
1c5acb87 320 //Return pointer to Generated event header
f1da7b44 321 if (ReadStack() && fMC)
029dea5a 322 {
1c5acb87 323 return fMC->GenEventHeader();
029dea5a 324 }
f1da7b44 325 else if(ReadAODMCParticles() && GetAODMCHeader())
326 {
327 //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",GetAODMCHeader()->GetNCocktailHeaders());
328 if( GetAODMCHeader()->GetNCocktailHeaders() > 0)
329 return GetAODMCHeader()->GetCocktailHeader(0) ;
85c4406e 330 else
f1da7b44 331 return 0x0;
332 }
85c4406e 333 else
f1da7b44 334 {
ec58c056 335 //printf("AliCaloTrackReader::GetGenEventHeader() - MC header not available! \n");
f1da7b44 336 return 0;
1c5acb87 337 }
338}
339
836b6989 340//____________________________________________________________________
85c4406e 341TClonesArray* AliCaloTrackReader::GetAODMCParticles() const
836b6989 342{
1e68a3f4 343 //Return list of particles in AOD. Do it for the corresponding input event.
344
85c4406e 345 TClonesArray * rv = NULL ;
029dea5a 346 if(fDataType == kAOD)
347 {
2644ead9 348 //Normal input AOD
349 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
350 if(evt)
351 rv = (TClonesArray*)evt->FindListObject("mcparticles");
85c4406e 352 else
353 printf("AliCaloTrackReader::GetAODMCParticles() - Null AOD event \n");
354 }
355 else
029dea5a 356 {
85c4406e 357 printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n");
c8fe2783 358 }
1e68a3f4 359
85c4406e 360 return rv ;
591cc579 361}
362
a20fbb55 363//________________________________________________________
85c4406e 364AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const
836b6989 365{
90995603 366 //Return MC header in AOD. Do it for the corresponding input event.
d2655d46 367
1e68a3f4 368 AliAODMCHeader *mch = NULL;
d2655d46 369
370 if(fDataType == kAOD)
371 {
a20fbb55 372 AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent);
373 if(aod) mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader"));
90995603 374 }
85c4406e 375 else
d2655d46 376 {
90995603 377 printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n");
378 }
1e68a3f4 379
380 return mch;
591cc579 381}
382
cc944149 383//___________________________________________________________
384Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx)
385{
386 // Get the vertex BC
85c4406e 387
cc944149 388 Int_t vertexBC=vtx->GetBC();
389 if(!fRecalculateVertexBC) return vertexBC;
390
391 // In old AODs BC not stored, recalculate it
392 // loop over the global track and select those which have small DCA to primary vertex (e.g. primary).
393 // If at least one of these primaries has valid BC != 0, then this vertex is a pile-up candidate.
394 // Execute after CTS
395 Double_t bz = fInputEvent->GetMagneticField();
396 Bool_t bc0 = kFALSE;
397 Int_t ntr = GetCTSTracks()->GetEntriesFast();
398 //printf("N Tracks %d\n",ntr);
399
400 for(Int_t i = 0 ; i < ntr ; i++)
401 {
402 AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
403
404 //Check if has TOF info, if not skip
405 ULong_t status = track->GetStatus();
406 Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
407 vertexBC = track->GetTOFBunchCrossing(bz);
408 Float_t pt = track->Pt();
409
410 if(!okTOF) continue;
411
412 // Get DCA x, y
413 Double_t dca[2] = {1e6,1e6};
414 Double_t covar[3] = {1e6,1e6,1e6};
415 track->PropagateToDCA(vtx,bz,100.,dca,covar);
416
417 if(AcceptDCA(pt,dca[0]))
418 {
419 if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC;
420 else if(vertexBC == 0) bc0 = kTRUE;
421 }
422 }
423
424 if( bc0 ) vertexBC = 0 ;
425 else vertexBC = AliVTrack::kTOFBCNA ;
426
427 return vertexBC;
428
429}
430
836b6989 431//_____________________________
591cc579 432void AliCaloTrackReader::Init()
433{
90995603 434 //Init reader. Method to be called in AliAnaPartCorrMaker
85c4406e 435
de0b770d 436 //printf(" AliCaloTrackReader::Init() %p \n",gGeoManager);
85c4406e 437
55d66f31 438 if(fReadStack && fReadAODMCParticles)
439 {
90995603 440 printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n");
de0b770d 441 fReadStack = kFALSE;
90995603 442 fReadAODMCParticles = kFALSE;
443 }
444
de0b770d 445 // Init geometry, I do not like much to do it like this ...
85c4406e 446 if(fImportGeometryFromFile && !gGeoManager)
55d66f31 447 {
2d8f2b73 448 if(fImportGeometryFilePath=="") // If not specified, set a default location
85c4406e 449 fImportGeometryFilePath = "$ALICE_ROOT/OADB/EMCAL/geometry_2011.root"; // "$ALICE_ROOT/EVE/alice-data/default_geo.root"
450
55d66f31 451 printf("AliCaloTrackReader::Init() - Import %s\n",fImportGeometryFilePath.Data());
452 TGeoManager::Import(fImportGeometryFilePath) ; // default need file "geometry.root" in local dir!!!!
de0b770d 453 }
85c4406e 454
d7601185 455 if(!fESDtrackCuts)
456 fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks
d9bea110 457
591cc579 458}
765d44e7 459
836b6989 460//_______________________________________
1c5acb87 461void AliCaloTrackReader::InitParameters()
462{
1c5acb87 463 //Initialize the parameters of the analysis.
591cc579 464 fDataType = kESD ;
98ec971d 465 fCTSPtMin = 0.1 ;
466 fEMCALPtMin = 0.1 ;
467 fPHOSPtMin = 0.1 ;
468 fCTSPtMax = 1000. ;
469 fEMCALPtMax = 1000. ;
470 fPHOSPtMax = 1000. ;
471
689d9f15 472 //Track DCA cuts
cc944149 473 // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1);
85c4406e 474 fTrackDCACut[0] = 0.0105;
475 fTrackDCACut[1] = 0.0350;
cc944149 476 fTrackDCACut[2] = 1.1;
477
902aa95c 478 //Do not filter the detectors input by default.
479 fFillEMCAL = kFALSE;
480 fFillPHOS = kFALSE;
481 fFillCTS = kFALSE;
1c5acb87 482 fFillEMCALCells = kFALSE;
591cc579 483 fFillPHOSCells = kFALSE;
836b6989 484
591cc579 485 fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
486 fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
42dc8e7d 487 fDeltaAODFileName = "deltaAODPartCorr.root";
743aa53a 488 fFiredTriggerClassName = "";
029dea5a 489 fEventTriggerMask = AliVEvent::kAny;
790dea42 490 fMixEventTriggerMask = AliVEvent::kAnyINT;
029dea5a 491 fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class
836b6989 492
de0b770d 493 fAcceptFastCluster = kTRUE;
494 fAnaLED = kFALSE;
0ae57829 495
496 //We want tracks fitted in the detectors:
3a58eee6 497 //fTrackStatus=AliESDtrack::kTPCrefit;
85c4406e 498 //fTrackStatus|=AliESDtrack::kITSrefit;
de0b770d 499 fTrackStatus = 0;
a5fb4114 500 fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
3a58eee6 501
d7601185 502 fESDtrackCuts = 0;
503 fESDtrackComplementaryCuts = 0;
836b6989 504
a9b8c1d0 505 fConstrainTrack = kFALSE ; // constrain tracks to vertex
506
85c4406e 507 fV0ADC[0] = 0; fV0ADC[1] = 0;
508 fV0Mul[0] = 0; fV0Mul[1] = 0;
836b6989 509
0b13c1f9 510 fZvtxCut = 10.;
511
de0b770d 512 fNMixedEvent = 1;
513
dbb3de7b 514 fPtHardAndJetPtFactor = 7.;
515 fPtHardAndClusterPtFactor = 1.;
85c4406e 516
32fd29fe 517 //Centrality
de0b770d 518 fCentralityClass = "V0M";
519 fCentralityOpt = 10;
520 fCentralityBin[0] = fCentralityBin[1]=-1;
836b6989 521
9929c80b 522 fEventPlaneMethod = "V0";
85c4406e 523
f3138ecf 524 // Allocate memory (not sure this is the right place)
525 fCTSTracks = new TObjArray();
526 fEMCALClusters = new TObjArray();
85c4406e 527 fPHOSClusters = new TObjArray();
f3138ecf 528 fTriggerAnalysis = new AliTriggerAnalysis;
529 fAODBranchList = new TList ;
85c4406e 530
de0b770d 531 fImportGeometryFromFile = kFALSE;
f3138ecf 532
3c1a2e95 533 fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ;
534 fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
4b75cb39 535
ff440946 536 // Parametrized time cut (LHC11d)
85c4406e 537 fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1. ;
538 fEMCALParamTimeCutMax[0] = 5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.45; fEMCALParamTimeCutMax[3] = 1.25;
539
ff440946 540 // Parametrized time cut (LHC11c)
85c4406e 541 //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4;
b8d661af 542 //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;
543
544 fTimeStampRunMin = -1;
b370e713 545 fTimeStampRunMax = 1e12;
b8d661af 546 fTimeStampEventFracMin = -1;
547 fTimeStampEventFracMax = 2;
85c4406e 548
47454666 549 for(Int_t i = 0; i < 19; i++)
550 {
551 fEMCalBCEvent [i] = 0;
552 fEMCalBCEventCut[i] = 0;
553 fTrackBCEvent [i] = 0;
554 fTrackBCEventCut[i] = 0;
555 }
556
afb3af8a 557 // Trigger match-rejection
9bf1c947 558 fTriggerPatchTimeWindow[0] = 8;
559 fTriggerPatchTimeWindow[1] = 9;
560
afb3af8a 561 fTriggerClusterBC = -10000 ;
562 fTriggerEventThreshold = 2.;
563 fTriggerClusterIndex = -1;
564 fTriggerClusterId = -1;
85c4406e 565
4e2b43d8 566}
1c5acb87 567
914b9fe7 568//___________________________________________________________________
569Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const
570{
571 // Check if it is a cluster from EMCAL. For old AODs cluster type has
572 // different number and need to patch here
573
574 if(fDataType==kAOD && fOldAOD)
575 {
576 if (cluster->GetType() == 2) return kTRUE;
577 else return kFALSE;
578 }
579 else
580 {
581 return cluster->IsEMCAL();
582 }
583
584}
585
586//___________________________________________________________________
587Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const
588{
589 //Check if it is a cluster from PHOS.For old AODs cluster type has
590 // different number and need to patch here
591
592 if(fDataType==kAOD && fOldAOD)
593 {
594 Int_t type = cluster->GetType();
595 if (type == 0 || type == 1) return kTRUE;
596 else return kFALSE;
597 }
598 else
599 {
600 return cluster->IsPHOS();
601 }
602
603}
604
3c1a2e95 605//___________________________________________________________
606Bool_t AliCaloTrackReader::IsInTimeWindow(const Double_t tof, const Float_t energy) const
607{
608 // Cluster time selection window
609
610 // Parametrized cut depending on E
611 if(fUseParamTimeCut)
612 {
613 Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
614 Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
615 //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
616 if( tof < minCut || tof > maxCut ) return kFALSE ;
617 }
618
619 //In any case, the time should to be larger than the fixed window ...
620 if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ;
621
622 return kTRUE ;
623}
64c78c5f 624
625//________________________________________________
626Bool_t AliCaloTrackReader::IsPileUpFromSPD() const
627{
628 // Check if event is from pile-up determined by SPD
629 // Default values: (3, 0.8, 3., 2., 5.)
85c4406e 630 return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] ,
631 fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] );
3c1a2e95 632 //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
85c4406e 633
3c1a2e95 634}
635
636//__________________________________________________
637Bool_t AliCaloTrackReader::IsPileUpFromEMCal() const
638{
639 // Check if event is from pile-up determined by EMCal
640 if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
641 else return kFALSE;
642}
643
644//________________________________________________________
645Bool_t AliCaloTrackReader::IsPileUpFromSPDAndEMCal() const
646{
647 // Check if event is from pile-up determined by SPD and EMCal
648 if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
649 else return kFALSE;
650}
099de61e 651
3c1a2e95 652//_______________________________________________________
653Bool_t AliCaloTrackReader::IsPileUpFromSPDOrEMCal() const
654{
655 // Check if event is from pile-up determined by SPD or EMCal
656 if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
657 else return kFALSE;
658}
659
660//___________________________________________________________
661Bool_t AliCaloTrackReader::IsPileUpFromSPDAndNotEMCal() const
662{
663 // Check if event is from pile-up determined by SPD and not by EMCal
664 if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
665 else return kFALSE;
666}
667
668//___________________________________________________________
669Bool_t AliCaloTrackReader::IsPileUpFromEMCalAndNotSPD() const
670{
671 // Check if event is from pile-up determined by EMCal, not by SPD
672 if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
673 else return kFALSE;
674}
675
676//______________________________________________________________
677Bool_t AliCaloTrackReader::IsPileUpFromNotSPDAndNotEMCal() const
678{
679 // Check if event not from pile-up determined neither by SPD nor by EMCal
680 if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
681 else return kFALSE;
64c78c5f 682}
683
836b6989 684//_________________________________________________________________________
85c4406e 685Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
686 const char * /*currentFileName*/)
836b6989 687{
6639984f 688 //Fill the event counter and input lists that are needed, called by the analysis maker.
cc944149 689
e2acbe6d 690 fEventNumber = iEntry;
afb3af8a 691 fTriggerClusterIndex = -1;
692 fTriggerClusterId = -1;
693 fIsTriggerMatch = kFALSE;
694 fTriggerClusterBC = -10000;
695 fIsExoticEvent = kFALSE;
696 fIsBadCellEvent = kFALSE;
1035a8d9 697 fIsBadMaxCellEvent = kFALSE;
afb3af8a 698
85c4406e 699 fIsTriggerMatchOpenCut[0] = kFALSE ;
700 fIsTriggerMatchOpenCut[1] = kFALSE ;
701 fIsTriggerMatchOpenCut[2] = kFALSE ;
702
1510eee3 703 //fCurrentFileName = TString(currentFileName);
55d66f31 704 if(!fInputEvent)
705 {
f6b8da1f 706 if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
707 return kFALSE;
be1f5fa4 708 }
55d66f31 709
72d2488e 710 //Select events only fired by a certain trigger configuration if it is provided
be1f5fa4 711 Int_t eventType = 0;
712 if(fInputEvent->GetHeader())
f6b8da1f 713 eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
836b6989 714
85c4406e 715 if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster)
55d66f31 716 {
836b6989 717 if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
cd2e4ce6 718 return kFALSE;
719 }
720
a529ae05 721
cd2e4ce6 722 //-------------------------------------------------------------------------------------
723 // Reject event if large clusters with large energy
724 // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
725 // If clusterzer NxN or V2 it does not help
726 //-------------------------------------------------------------------------------------
55d66f31 727 Int_t run = fInputEvent->GetRunNumber();
a1897f1e 728 if( fRemoveLEDEvents && run > 146857 && run < 146861 )
55d66f31 729 {
a529ae05 730 Bool_t reject = RejectLEDEvents();
731 if(reject) return kFALSE;
cd2e4ce6 732 }// Remove LED events
733
a529ae05 734 //------------------------
cd2e4ce6 735 // Reject pure LED events?
a529ae05 736 //-------------------------
55d66f31 737 if( fFiredTriggerClassName !="" && !fAnaLED)
738 {
f59ee2a0 739 //printf("Event type %d\n",eventType);
c8fe2783 740 if(eventType!=7)
741 return kFALSE; //Only physics event, do not use for simulated events!!!
f59ee2a0 742
85c4406e 743 if(fDebug > 0)
7ec23b5a 744 printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
836b6989 745 GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
f59ee2a0 746
7ec23b5a 747 if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
4d8a2fe1 748 else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n");
72d2488e 749 }
55d66f31 750 else if(fAnaLED)
751 {
836b6989 752 // kStartOfRun = 1, // START_OF_RUN
753 // kEndOfRun = 2, // END_OF_RUN
754 // kStartOfRunFiles = 3, // START_OF_RUN_FILES
755 // kEndOfRunFiles = 4, // END_OF_RUN_FILES
756 // kStartOfBurst = 5, // START_OF_BURST
757 // kEndOfBurst = 6, // END_OF_BURST
758 // kPhysicsEvent = 7, // PHYSICS_EVENT
759 // kCalibrationEvent = 8, // CALIBRATION_EVENT
760 // kFormatError = 9, // EVENT_FORMAT_ERROR
761 // kStartOfData = 10, // START_OF_DATA
762 // kEndOfData = 11, // END_OF_DATA
763 // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
764 // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
765
c1ac3823 766 if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType);
767 if(eventType!=8)return kFALSE;
768 }
cd2e4ce6 769
85c4406e 770 //In case of analysis of events with jets, skip those with jet pt > 5 pt hard
771 if(fComparePtHardAndJetPt)
55d66f31 772 {
7ec23b5a 773 if(!ComparePtHardAndJetPt()) return kFALSE ;
29b2ceec 774 }
836b6989 775
85c4406e 776 if(fComparePtHardAndClusterPt)
dbb3de7b 777 {
778 if(!ComparePtHardAndClusterPt()) return kFALSE ;
779 }
780
48c37e02 781 //Fill Vertex array
782 FillVertexArray();
783 //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
85c4406e 784 if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;
48c37e02 785
034e885b 786 //------------------------------------------------------
787 //Event rejection depending on vertex, pileup, v0and
788 //------------------------------------------------------
789 if(fDataType==kESD && fTimeStampEventSelect)
790 {
791 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
47454666 792 if(esd)
793 {
794 Int_t timeStamp = esd->GetTimeStamp();
795 Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
796
797 //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac);
798
799 if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
800 }
034e885b 801 //printf("\t accept time stamp\n");
802 }
85c4406e 803
034e885b 804
48c37e02 805 //------------------------------------------------------
806 //Event rejection depending on vertex, pileup, v0and
807 //------------------------------------------------------
85c4406e 808
d2655d46 809 if(fUseEventsWithPrimaryVertex)
810 {
811 if( !CheckForPrimaryVertex() ) return kFALSE;
85c4406e 812 if( TMath::Abs(fVertex[0][0] ) < 1.e-6 &&
813 TMath::Abs(fVertex[0][1] ) < 1.e-6 &&
814 TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE;
d2655d46 815 }
816
099de61e 817 //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins());
818
55d66f31 819 if(fDoEventSelection)
820 {
821 if(!fCaloFilterPatch)
822 {
4b75cb39 823 // Do not analyze events with pileup
64c78c5f 824 Bool_t bPileup = IsPileUpFromSPD();
4b75cb39 825 //IsPileupFromSPDInMultBins() // method to try
3c1a2e95 826 //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]);
48c37e02 827 if(bPileup) return kFALSE;
828
55d66f31 829 if(fDoV0ANDEventSelection)
830 {
85c4406e 831 Bool_t bV0AND = kTRUE;
ad30b142 832 AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
85c4406e 833 if(esd)
ad30b142 834 bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
48c37e02 835 //else bV0AND = //FIXME FOR AODs
836 if(!bV0AND) return kFALSE;
837 }
48c37e02 838 }//CaloFilter patch
55d66f31 839 else
85c4406e 840 {
841 if(fInputEvent->GetNumberOfCaloClusters() > 0)
55d66f31 842 {
48c37e02 843 AliVCluster * calo = fInputEvent->GetCaloCluster(0);
029dea5a 844 if(calo->GetNLabels() == 4)
845 {
48c37e02 846 Int_t * selection = calo->GetLabels();
847 Bool_t bPileup = selection[0];
848 if(bPileup) return kFALSE;
849
85c4406e 850 Bool_t bGoodV = selection[1];
20218aea 851 if(fUseEventsWithPrimaryVertex && !bGoodV) return kFALSE;
48c37e02 852
029dea5a 853 if(fDoV0ANDEventSelection)
854 {
85c4406e 855 Bool_t bV0AND = selection[2];
48c37e02 856 if(!bV0AND) return kFALSE;
857 }
858
859 fTrackMult = selection[3];
860 if(fTrackMult == 0) return kFALSE;
85c4406e 861 }
862 else
029dea5a 863 {
85c4406e 864 //First filtered AODs, track multiplicity stored there.
48c37e02 865 fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
85c4406e 866 if(fTrackMult == 0) return kFALSE;
48c37e02 867 }
868 }//at least one cluster
85c4406e 869 else
029dea5a 870 {
cfaba834 871 //printf("AliCaloTrackReader::FillInputEvent() - No clusters in event\n");
48c37e02 872 //Remove events with vertex (0,0,0), bad vertex reconstruction
20218aea 873 if(fUseEventsWithPrimaryVertex && TMath::Abs(fVertex[0][0]) < 1.e-6 && TMath::Abs(fVertex[0][1]) < 1.e-6 && TMath::Abs(fVertex[0][2]) < 1.e-6) return kFALSE;
48c37e02 874
85c4406e 875 //First filtered AODs, track multiplicity stored there.
48c37e02 876 fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
877 if(fTrackMult == 0) return kFALSE;
878 }// no cluster
879 }// CaloFileter patch
31864468 880 }// Event selection/AliceSoft/AliRoot/trunk/PWG/CaloTrackCorrBase/AliCaloTrackReader.h
e2acbe6d 881
48c37e02 882 //------------------------------------------------------
836b6989 883
32fd29fe 884 //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
885 //If we need a centrality bin, we select only those events in the corresponding bin.
55d66f31 886 if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100)
887 {
32fd29fe 888 Int_t cen = GetEventCentrality();
889 if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
890 }
85c4406e 891
f8006433 892 //Fill the arrays with cluster/tracks/cells data
029dea5a 893
31864468 894 if(!fEventTriggerAtSE)
029dea5a 895 {
31864468 896 // In case of mixing analysis, accept MB events, not only Trigger
897 // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis
898 // via de method in the base class FillMixedEventPool()
899
029dea5a 900 AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
901 AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler());
902
c6b4facc 903 if(!inputHandler) return kFALSE ; // to content coverity
904
029dea5a 905 UInt_t isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask;
790dea42 906 UInt_t isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask;
029dea5a 907
31864468 908 if(!isTrigger && !isMB) return kFALSE;
029dea5a 909
31864468 910 //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data());
911 }
912
e2acbe6d 913 //----------------------------------------------------------------------
914 // Do not count events that where likely triggered by an exotic cluster
915 // or out BC cluster
916 //----------------------------------------------------------------------
85c4406e 917
918 // Set a bit with the event kind, MB, L0, L1 ...
d9bea110 919 SetEventTriggerBit();
920
afb3af8a 921 //Get Patches that triggered
85c4406e 922 TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
923 /*
924 if(fRemoveExoticEvents)
925 {
926 RejectExoticEvents(patches);
927 if(fIsExoticEvent)
928 {
929 //printf("AliCaloTrackReader::FillInputEvent() - REJECT exotic triggered event \n");
930 return kFALSE;
931 }
932 }
933
934 RejectTriggeredEventsByPileUp(patches);
935 //printf("AliCaloTrackReader::FillInputEvent(), Trigger BC = %d\n",fTriggerClusterBC);
936
937 if(fRemoveTriggerOutBCEvents)
938 {
939 if(fTriggerClusterBC != 0 && fTriggerClusterBC != 6)
940 {
941 //printf("\t REJECT, bad trigger cluster BC\n");
942 return kFALSE;
943 }
944 }
945 */
e2acbe6d 946
afb3af8a 947 MatchTriggerCluster(patches);
948
949 if(fRemoveBadTriggerEvents)
950 {
1035a8d9 951 //printf("ACCEPT triggered event? - exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
952 // fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
afb3af8a 953 if (fIsExoticEvent) return kFALSE;
954 else if(fIsBadCellEvent) return kFALSE;
d9bea110 955 else if(fTriggerClusterBC != 0) return kFALSE;
1035a8d9 956 //printf("\t *** YES\n");
afb3af8a 957 }
e2acbe6d 958
959 patches.Reset();
960
cc944149 961 // Get the main vertex BC, in case not available
962 // it is calculated in FillCTS checking the BC of tracks
963 // with DCA small (if cut applied, if open)
964 fVertexBC=fInputEvent->GetPrimaryVertex()->GetBC();
965
31864468 966 if(fFillCTS)
967 {
968 FillInputCTS();
969 //Accept events with at least one track
2644ead9 970 if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ;
029dea5a 971 }
972
cc944149 973 if(fDoVertexBCEventSelection)
974 {
975 if(fVertexBC!=0 && fVertexBC!=AliVTrack::kTOFBCNA) return kFALSE ;
976 }
afb3af8a 977
31864468 978 if(fFillEMCALCells)
979 FillInputEMCALCells();
980
981 if(fFillPHOSCells)
982 FillInputPHOSCells();
983
984 if(fFillEMCAL)
985 FillInputEMCAL();
986
987 if(fFillPHOS)
988 FillInputPHOS();
989
990 FillInputVZERO();
85c4406e 991
31864468 992
29b2ceec 993 return kTRUE ;
1c5acb87 994}
995
32fd29fe 996//__________________________________________________
85c4406e 997Int_t AliCaloTrackReader::GetEventCentrality() const
836b6989 998{
32fd29fe 999 //Return current event centrality
1000
029dea5a 1001 if(GetCentrality())
1002 {
9929c80b 1003 if (fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
1004 else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
1005 else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
85c4406e 1006 else
029dea5a 1007 {
9929c80b 1008 printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
1009 return -1;
85c4406e 1010 }
32fd29fe 1011 }
9929c80b 1012 else return -1;
1013
1014}
1015
1016//_____________________________________________________
85c4406e 1017Double_t AliCaloTrackReader::GetEventPlaneAngle() const
9929c80b 1018{
1019 //Return current event centrality
1020
1021 if(GetEventPlane())
1022 {
1023 Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent());
1024
85c4406e 1025 if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi()))
9929c80b 1026 {
b14c2b20 1027 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <Q> method : %f\n",ep);
9929c80b 1028 return -1000;
1029 }
85c4406e 1030 else if(GetEventPlaneMethod().Contains("V0") )
9929c80b 1031 {
1032 if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2))
1033 {
b14c2b20 1034 if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep);
9929c80b 1035 return -1000;
1036 }
1037
1038 ep+=TMath::Pi()/2; // put same range as for <Q> method
1039
1040 }
85c4406e 1041
9929c80b 1042 //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep);
b14c2b20 1043 if(fDebug > 0 )
1044 {
1045 if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep);
1046 else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep);
1047 }
9929c80b 1048
8fd30003 1049 return ep;
9929c80b 1050 }
1051 else
1052 {
b14c2b20 1053 if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() - No EP pointer\n");
9929c80b 1054 return -1000;
85c4406e 1055 }
32fd29fe 1056
1057}
1058
836b6989 1059//__________________________________________________________
85c4406e 1060void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const
836b6989 1061{
f8006433 1062 //Return vertex position to be used for single event analysis
85c4406e 1063 vertex[0]=fVertex[0][0];
1064 vertex[1]=fVertex[0][1];
f8006433 1065 vertex[2]=fVertex[0][2];
1066}
1067
836b6989 1068//____________________________________________________________
85c4406e 1069void AliCaloTrackReader::GetVertex(Double_t vertex[3],
1070 const Int_t evtIndex) const
836b6989 1071{
f8006433 1072 //Return vertex position for mixed event, recover the vertex in a particular event.
1073
f8006433 1074 vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2];
1075
1076}
f8006433 1077
836b6989 1078//________________________________________
85c4406e 1079void AliCaloTrackReader::FillVertexArray()
836b6989 1080{
f8006433 1081
1082 //Fill data member with vertex
1083 //In case of Mixed event, multiple vertices
1084
1085 //Delete previous vertex
d2655d46 1086 if(fVertex)
1087 {
85c4406e 1088 for (Int_t i = 0; i < fNMixedEvent; i++)
d2655d46 1089 {
85c4406e 1090 delete [] fVertex[i] ;
f8006433 1091 }
85c4406e 1092 delete [] fVertex ;
f8006433 1093 }
1094
85c4406e 1095 fVertex = new Double_t*[fNMixedEvent] ;
1096 for (Int_t i = 0; i < fNMixedEvent; i++)
d2655d46 1097 {
85c4406e 1098 fVertex[i] = new Double_t[3] ;
1099 fVertex[i][0] = 0.0 ;
1100 fVertex[i][1] = 0.0 ;
1101 fVertex[i][2] = 0.0 ;
1102 }
f8006433 1103
85c4406e 1104 if (!fMixedEvent)
d2655d46 1105 { //Single event analysis
1106 if(fDataType!=kMC)
1107 {
836b6989 1108
d2655d46 1109 if(fInputEvent->GetPrimaryVertex())
1110 {
85c4406e 1111 fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]);
79395d30 1112 }
85c4406e 1113 else
d2655d46 1114 {
79395d30 1115 printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
1116 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1117 }//Primary vertex pointer do not exist
1118
d2655d46 1119 } else
85c4406e 1120 {//MC read event
edffc439 1121 fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.;
1122 }
836b6989 1123
f8006433 1124 if(fDebug > 1)
1125 printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
836b6989 1126
85c4406e 1127 } else
d2655d46 1128 { // MultiEvent analysis
85c4406e 1129 for (Int_t iev = 0; iev < fNMixedEvent; iev++)
d2655d46 1130 {
8e7bdfa9 1131 if (fMixedEvent->GetVertexOfEvent(iev))
1132 fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
d2655d46 1133 else
1134 { // no vertex found !!!!
8e7bdfa9 1135 AliWarning("No vertex found");
1136 }
836b6989 1137
f8006433 1138 if(fDebug > 1)
1139 printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
836b6989 1140
f8006433 1141 }
c8fe2783 1142 }
f8006433 1143
c8fe2783 1144}
1145
836b6989 1146//_____________________________________
85c4406e 1147void AliCaloTrackReader::FillInputCTS()
836b6989 1148{
f37fa8d2 1149 //Return array with Central Tracking System (CTS) tracks
1150
1151 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
1152
da91abdb 1153 Double_t pTrack[3] = {0,0,0};
1154
1155 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
1156 fTrackMult = 0;
3a58eee6 1157 Int_t nstatus = 0;
4b7f6e01 1158 Double_t bz = GetInputEvent()->GetMagneticField();
85c4406e 1159
975b29fa 1160 for(Int_t i = 0; i < 19; i++)
1161 {
1162 fTrackBCEvent [i] = 0;
1163 fTrackBCEventCut[i] = 0;
1164 }
d7601185 1165
cc944149 1166 Bool_t bc0 = kFALSE;
1167 if(fRecalculateVertexBC) fVertexBC=AliVTrack::kTOFBCNA;
1168
975b29fa 1169 for (Int_t itrack = 0; itrack < nTracks; itrack++)
d2655d46 1170 {////////////// track loop
c8fe2783 1171 AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
836b6989 1172
3a58eee6 1173 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
975b29fa 1174 ULong_t status = track->GetStatus();
85c4406e 1175
975b29fa 1176 if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus))
c8fe2783 1177 continue ;
1178
3a58eee6 1179 nstatus++;
1180
438953f7 1181 Float_t dcaTPC =-999;
1182
a9b8c1d0 1183 if (fDataType==kESD)
a5fb4114 1184 {
a9b8c1d0 1185 AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track);
1186
d7601185 1187 if(esdTrack)
a9b8c1d0 1188 {
d7601185 1189 if(fESDtrackCuts->AcceptTrack(esdTrack))
1190 {
1191 track->GetPxPyPz(pTrack) ;
85c4406e 1192
d7601185 1193 if(fConstrainTrack)
1194 {
1195 if(esdTrack->GetConstrainedParam())
1196 {
1197 const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam();
1198 esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance());
1199 esdTrack->GetConstrainedPxPyPz(pTrack);
1200 }
1201 else continue;
1202
1203 } // use constrained tracks
1204
1205 if(fSelectSPDHitTracks)
1206 {//Not much sense to use with TPC only or Hybrid tracks
1207 if(!esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1)) continue ;
1208 }
1209 }
1210 // Complementary track to global : Hybrids (make sure that the previous selection is for Global)
1211 else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack))
a9b8c1d0 1212 {
d7601185 1213 // constrain the track
a9b8c1d0 1214 if(esdTrack->GetConstrainedParam())
1215 {
d7601185 1216 esdTrack->Set(esdTrack->GetConstrainedParam()->GetX(),esdTrack->GetConstrainedParam()->GetAlpha(),esdTrack->GetConstrainedParam()->GetParameter(),esdTrack->GetConstrainedParam()->GetCovariance());
85c4406e 1217
d7601185 1218 track->GetPxPyPz(pTrack) ;
85c4406e 1219
a9b8c1d0 1220 }
1221 else continue;
f5500c7a 1222 }
d7601185 1223 else continue;
a9b8c1d0 1224 }
da91abdb 1225 } // ESD
a5fb4114 1226 else if(fDataType==kAOD)
1227 {
743aa53a 1228 AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track);
a9b8c1d0 1229
d2655d46 1230 if(aodtrack)
1231 {
85c4406e 1232 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n",
1233 aodtrack->GetType(),AliAODTrack::kPrimary,
1234 aodtrack->IsHybridGlobalConstrainedGlobal());
21812953 1235
da91abdb 1236
1237 if (fSelectHybridTracks)
21812953 1238 {
da91abdb 1239 if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
21812953 1240 }
85c4406e 1241 else
da91abdb 1242 {
1243 if ( aodtrack->TestFilterBit(fTrackFilterMask)==kFALSE) continue ;
1244 }
1245
f5500c7a 1246 if(fSelectSPDHitTracks)
1247 {//Not much sense to use with TPC only or Hybrid tracks
1248 if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) continue ;
1249 }
1250
da91abdb 1251 if (aodtrack->GetType()!= AliAODTrack::kPrimary) continue ;
1252
1253 if (fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS(): \t accepted track! \n");
a9b8c1d0 1254
438953f7 1255 //In case of AODs, TPC tracks cannot be propagated back to primary vertex,
1256 // info stored here
1257 dcaTPC = aodtrack->DCA();
1258
a9b8c1d0 1259 track->GetPxPyPz(pTrack) ;
da91abdb 1260
1261 } // aod track exists
1262 else continue ;
1263
1264 } // AOD
3b13c34c 1265
a9b8c1d0 1266 TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0);
c8fe2783 1267
cc944149 1268 Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ;
1269 Double_t tof = -1000;
4b7f6e01 1270 Int_t trackBC = -1000 ;
1271
975b29fa 1272 if(okTOF)
d2655d46 1273 {
4b7f6e01 1274 trackBC = track->GetTOFBunchCrossing(bz);
1275 SetTrackEventBC(trackBC+9);
85c4406e 1276
975b29fa 1277 tof = track->GetTOFsignal()*1e-3;
975b29fa 1278 }
85c4406e 1279
689d9f15 1280 if(fUseTrackDCACut)
1281 {
cc944149 1282 //normal way to get the dca, cut on dca_xy
1283 if(dcaTPC==-999)
689d9f15 1284 {
1285 Double_t dca[2] = {1e6,1e6};
1286 Double_t covar[3] = {1e6,1e6,1e6};
438953f7 1287 Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar);
1288 if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]);
1289 if(!okDCA)
1290 {
1291 //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f, BC %d\n",momentum.Pt(),dca[0],trackBC);
1292 continue ;
1293 }
689d9f15 1294 }
1295 }// DCA cuts
1296
cc944149 1297 if(okTOF)
1298 {
1299 //SetTrackEventBCcut(bc);
1300 SetTrackEventBCcut(trackBC+9);
1301
1302 //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC
1303 if(fRecalculateVertexBC)
1304 {
1305 if (trackBC !=0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC;
1306 else if(trackBC == 0) bc0 = kTRUE;
1307 }
85c4406e 1308
cc944149 1309 //In any case, the time should to be larger than the fixed window ...
1310 if( fUseTrackTimeCut && (trackBC!=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) )
1311 {
1312 //printf("Remove track time %f and bc = %d\n",tof,trackBC);
1313 continue ;
1314 }
1315 //else printf("Accept track time %f and bc = %d\n",tof,trackBC);
1316
1317 }
1318
2644ead9 1319 //Count the tracks in eta < 0.9
1320 //printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
1321 if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
1322
1323 if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ;
1324
1325 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
1326
975b29fa 1327 if(fDebug > 2 && momentum.Pt() > 0.1)
1328 printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1329 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
1330
1331 if (fMixedEvent) track->SetID(itrack);
85c4406e 1332
975b29fa 1333 fCTSTracks->Add(track);
1334
c8fe2783 1335 }// track loop
1336
cc944149 1337 if(fVertexBC ==0 || fVertexBC == AliVTrack::kTOFBCNA)
1338 {
1339 if( bc0 ) fVertexBC = 0 ;
1340 else fVertexBC = AliVTrack::kTOFBCNA ;
1341 }
1342
975b29fa 1343 if(fDebug > 1)
be518ab0 1344 printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
836b6989 1345
c8fe2783 1346}
1347
836b6989 1348//__________________________________________________________________
85c4406e 1349void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus,
1350 const Int_t iclus)
836b6989 1351{
c4eec29f 1352 //Fill the EMCAL data in the array, do it
85c4406e 1353
1354 Int_t vindex = 0 ;
1355 if (fMixedEvent)
c4eec29f 1356 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
1357
d2655d46 1358 if(fRecalculateClusters)
1359 {
35954a8e 1360 //Recalibrate the cluster energy
d2655d46 1361 if(GetCaloUtils()->IsRecalibrationOn())
1362 {
b487d080 1363 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
9e8998b1 1364
b487d080 1365 clus->SetE(energy);
35954a8e 1366 //printf("Recalibrated Energy %f\n",clus->E());
9e8998b1 1367
b487d080 1368 GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus);
1369 GetCaloUtils()->RecalculateClusterPID(clus);
9e8998b1 1370
b487d080 1371 } // recalculate E
1372
1373 //Recalculate distance to bad channels, if new list of bad channels provided
1374 GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus);
1375
1376 //Recalculate cluster position
d2655d46 1377 if(GetCaloUtils()->IsRecalculationOfClusterPositionOn())
1378 {
35954a8e 1379 GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus);
b487d080 1380 //clus->GetPosition(pos);
1381 //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1382 }
c4eec29f 1383
f46af216 1384 // Recalculate TOF
35954a8e 1385 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
d2655d46 1386 {
f46af216 1387 Double_t tof = clus->GetTOF();
1388 Float_t frac =-1;
1389 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1390
d2655d46 1391 if(fDataType==AliCaloTrackReader::kESD)
35954a8e 1392 {
f46af216 1393 tof = fEMCALCells->GetCellTime(absIdMax);
1394 }
1395
1396 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1397
1398 clus->SetTOF(tof);
1399
35954a8e 1400 }// Time recalibration
f46af216 1401 }
b487d080 1402
35954a8e 1403 //Reject clusters with bad channels, close to borders and exotic;
1404 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return;
1405
1406 //Mask all cells in collumns facing ALICE thick material if requested
1407 if(GetCaloUtils()->GetNMaskCellColumns())
1408 {
1409 Int_t absId = -1;
1410 Int_t iSupMod = -1;
1411 Int_t iphi = -1;
1412 Int_t ieta = -1;
1413 Bool_t shared = kFALSE;
1414 GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
1415 if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
1416 }
1417
1418 if(fSelectEmbeddedClusters)
1419 {
1420 if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
1421 //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel());
1422 }
1423
1424 //Float_t pos[3];
1425 //clus->GetPosition(pos);
1426 //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
1427
b487d080 1428 //Correct non linearity
d2655d46 1429 if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn())
1430 {
b487d080 1431 GetCaloUtils()->CorrectClusterEnergy(clus) ;
85c4406e 1432 //printf("Linearity Corrected Energy %f\n",clus->E());
b487d080 1433
1434 //In case of MC analysis, to match resolution/calibration in real data
1435 Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
1436 // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy);
1437 clus->SetE(rdmEnergy);
c4eec29f 1438 }
b487d080 1439
975b29fa 1440 Double_t tof = clus->GetTOF()*1e9;
85c4406e 1441
975b29fa 1442 Int_t bc = TMath::Nint(tof/50) + 9;
1443 //printf("tof %2.2f, bc+5=%d\n",tof,bc);
1444
1445 SetEMCalEventBC(bc);
1446
1447 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ;
85c4406e 1448
b487d080 1449 TLorentzVector momentum ;
1450
975b29fa 1451 clus->GetMomentum(momentum, fVertex[vindex]);
b487d080 1452
ff440946 1453 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
ca0c58aa 1454
975b29fa 1455 SetEMCalEventBCcut(bc);
85c4406e 1456
975b29fa 1457 if(!IsInTimeWindow(tof,clus->E()))
ff440946 1458 {
3c1a2e95 1459 fNPileUpClusters++ ;
4b7f6e01 1460 if(fUseEMCALTimeCut) return ;
ff440946 1461 }
3c1a2e95 1462 else
1463 fNNonPileUpClusters++;
975b29fa 1464
85c4406e 1465 if(fDebug > 2 && momentum.E() > 0.1)
b487d080 1466 printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
1467 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
836b6989 1468
85c4406e 1469 if (fMixedEvent)
1470 clus->SetID(iclus) ;
b487d080 1471
2644ead9 1472 //Correct MC label for AODs
1473
2644ead9 1474 fEMCALClusters->Add(clus);
1475
c4eec29f 1476}
1477
836b6989 1478//_______________________________________
85c4406e 1479void AliCaloTrackReader::FillInputEMCAL()
836b6989 1480{
f37fa8d2 1481 //Return array with EMCAL clusters in aod format
c8fe2783 1482
f37fa8d2 1483 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
1484
3bfc4732 1485 // First recalibrate cells, time or energy
1486 // if(GetCaloUtils()->IsRecalibrationOn())
85c4406e 1487 // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(),
1488 // GetEMCALCells(),
3bfc4732 1489 // fInputEvent->GetBunchCrossNumber());
1490
3c1a2e95 1491 fNPileUpClusters = 0; // Init counter
1492 fNNonPileUpClusters = 0; // Init counter
975b29fa 1493 for(Int_t i = 0; i < 19; i++)
1494 {
1495 fEMCalBCEvent [i] = 0;
1496 fEMCalBCEventCut[i] = 0;
1497 }
3c1a2e95 1498
f37fa8d2 1499 //Loop to select clusters in fiducial cut and fill container with aodClusters
029dea5a 1500 if(fEMCALClustersListName=="")
1501 {
c4eec29f 1502 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
85c4406e 1503 for (Int_t iclus = 0; iclus < nclusters; iclus++)
d2655d46 1504 {
c4eec29f 1505 AliVCluster * clus = 0;
85c4406e 1506 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
d2655d46 1507 {
029dea5a 1508 if (IsEMCALCluster(clus))
85c4406e 1509 {
c4eec29f 1510 FillInputEMCALAlgorithm(clus, iclus);
1511 }//EMCAL cluster
1512 }// cluster exists
1513 }// cluster loop
385b7abf 1514
1515 //Recalculate track matching
a38a48f2 1516 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
385b7abf 1517
c4eec29f 1518 }//Get the clusters from the input event
d2655d46 1519 else
1520 {
85c4406e 1521 TClonesArray * clusterList = 0x0;
7842c845 1522
1523 if (fInputEvent->FindListObject(fEMCALClustersListName))
1524 {
24026a5c 1525 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
7842c845 1526 }
1527 else if(fOutputEvent)
24026a5c 1528 {
7842c845 1529 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
1530 }
1531
d2655d46 1532 if(!clusterList)
1533 {
85c4406e 1534 printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data());
1535 return;
c4eec29f 1536 }
ca0c58aa 1537
c4eec29f 1538 Int_t nclusters = clusterList->GetEntriesFast();
85c4406e 1539 for (Int_t iclus = 0; iclus < nclusters; iclus++)
d2655d46 1540 {
c4eec29f 1541 AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
1542 //printf("E %f\n",clus->E());
e615d952 1543 if (clus) FillInputEMCALAlgorithm(clus, iclus);
1544 else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
c4eec29f 1545 }// cluster loop
385b7abf 1546
24026a5c 1547 // Recalculate the pile-up time, in case long time clusters removed during clusterization
1548 //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
85c4406e 1549
24026a5c 1550 fNPileUpClusters = 0; // Init counter
1551 fNNonPileUpClusters = 0; // Init counter
975b29fa 1552 for(Int_t i = 0; i < 19; i++)
1553 {
1554 fEMCalBCEvent [i] = 0;
1555 fEMCalBCEventCut[i] = 0;
1556 }
24026a5c 1557
1558 for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++)
1559 {
1560 AliVCluster * clus = 0;
1561
1562 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
1563 {
1564 if (IsEMCALCluster(clus))
1565 {
1566
24026a5c 1567 Float_t frac =-1;
1568 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
1569 Double_t tof = clus->GetTOF();
1570 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1571 tof*=1e9;
85c4406e 1572
24026a5c 1573 //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof);
85c4406e 1574
24026a5c 1575 //Reject clusters with bad channels, close to borders and exotic;
1576 if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue;
85c4406e 1577
975b29fa 1578 Int_t bc = TMath::Nint(tof/50) + 9;
1579 SetEMCalEventBC(bc);
1580
1581 if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ;
85c4406e 1582
975b29fa 1583 TLorentzVector momentum ;
1584
1585 clus->GetMomentum(momentum, fVertex[0]);
1586
1587 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ;
85c4406e 1588
975b29fa 1589 SetEMCalEventBCcut(bc);
85c4406e 1590
24026a5c 1591 if(!IsInTimeWindow(tof,clus->E()))
24026a5c 1592 fNPileUpClusters++ ;
24026a5c 1593 else
1594 fNNonPileUpClusters++;
975b29fa 1595
24026a5c 1596 }
1597 }
1598 }
1599
1600 //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters);
1601
cb5780f4 1602 // Recalculate track matching, not necessary if already done in the reclusterization task.
1603 // in case it was not done ...
1604 GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
385b7abf 1605
c4eec29f 1606 }
85c4406e 1607
3c1a2e95 1608 if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters);
c8fe2783 1609
c8fe2783 1610}
1611
836b6989 1612//______________________________________
85c4406e 1613void AliCaloTrackReader::FillInputPHOS()
836b6989 1614{
f37fa8d2 1615 //Return array with PHOS clusters in aod format
c8fe2783 1616
f37fa8d2 1617 if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
b487d080 1618
f37fa8d2 1619 //Loop to select clusters in fiducial cut and fill container with aodClusters
c8fe2783 1620 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
85c4406e 1621 for (Int_t iclus = 0; iclus < nclusters; iclus++)
d2655d46 1622 {
c8fe2783 1623 AliVCluster * clus = 0;
85c4406e 1624 if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
d2655d46 1625 {
029dea5a 1626 if (IsPHOSCluster(clus))
1627 {
f37fa8d2 1628 //Check if the cluster contains any bad channel and if close to calorimeter borders
85c4406e 1629 Int_t vindex = 0 ;
1630 if (fMixedEvent)
c8fe2783 1631 vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
85c4406e 1632 if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells()))
c8fe2783 1633 continue;
85c4406e 1634 if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex))
c8fe2783 1635 continue;
836b6989 1636
d2655d46 1637 if(fRecalculateClusters)
1638 {
85c4406e 1639 //Recalibrate the cluster energy
1640 if(GetCaloUtils()->IsRecalibrationOn())
d2655d46 1641 {
b487d080 1642 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
1643 clus->SetE(energy);
1644 }
b487d080 1645 }
c8fe2783 1646
1647 TLorentzVector momentum ;
1648
85c4406e 1649 clus->GetMomentum(momentum, fVertex[vindex]);
c8fe2783 1650
ca0c58aa 1651 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
1652
1653 if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue;
b487d080 1654
85c4406e 1655 if(fDebug > 2 && momentum.E() > 0.1)
b487d080 1656 printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
85c4406e 1657 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
b487d080 1658
b487d080 1659
85c4406e 1660 if (fMixedEvent)
d2655d46 1661 {
85c4406e 1662 clus->SetID(iclus) ;
1663 }
b487d080 1664
85c4406e 1665 fPHOSClusters->Add(clus);
b487d080 1666
c8fe2783 1667 }//PHOS cluster
1668 }//cluster exists
1669 }//esd cluster loop
1670
b487d080 1671 if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast());
1672
c8fe2783 1673}
1674
836b6989 1675//____________________________________________
85c4406e 1676void AliCaloTrackReader::FillInputEMCALCells()
836b6989 1677{
743aa53a 1678 //Return array with EMCAL cells in aod format
c8fe2783 1679
85c4406e 1680 fEMCALCells = fInputEvent->GetEMCALCells();
c8fe2783 1681
1682}
1683
836b6989 1684//___________________________________________
85c4406e 1685void AliCaloTrackReader::FillInputPHOSCells()
836b6989 1686{
743aa53a 1687 //Return array with PHOS cells in aod format
c8fe2783 1688
85c4406e 1689 fPHOSCells = fInputEvent->GetPHOSCells();
c8fe2783 1690
1691}
1692
836b6989 1693//_______________________________________
1694void AliCaloTrackReader::FillInputVZERO()
1695{
be518ab0 1696 //Fill VZERO information in data member, add all the channels information.
1697 AliVVZERO* v0 = fInputEvent->GetVZEROData();
1698 //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1699
85c4406e 1700 if (v0)
be518ab0 1701 {
1702 AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
1703 for (Int_t i = 0; i < 32; i++)
1704 {
029dea5a 1705 if(esdV0)
1706 {//Only available in ESDs
be518ab0 1707 fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
1708 fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
1709 }
029dea5a 1710
be518ab0 1711 fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
1712 fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
1713 }
1714 if(fDebug > 0)
1715 printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
1716 }
1717 else
1718 {
713a258b 1719 if(fDebug > 0)
1720 printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
be518ab0 1721 }
1722}
1723
798a9b04 1724
f37fa8d2 1725
c5693f62 1726//________________________________________________
1727Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
1728{
48c37e02 1729 //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
1730 //Only for ESDs ...
ad30b142 1731
48c37e02 1732 AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent);
20218aea 1733 if(!event) return kTRUE;
ad30b142 1734
a529ae05 1735 if(event->GetPrimaryVertexTracks()->GetNContributors() > 0)
d2655d46 1736 {
ad30b142 1737 return kTRUE;
1738 }
1739
85c4406e 1740 if(event->GetPrimaryVertexTracks()->GetNContributors() < 1)
d2655d46 1741 {
ad30b142 1742 // SPD vertex
85c4406e 1743 if(event->GetPrimaryVertexSPD()->GetNContributors() > 0)
d2655d46 1744 {
ad30b142 1745 //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
48c37e02 1746 return kTRUE;
ad30b142 1747
48c37e02 1748 }
d7601185 1749 if(event->GetPrimaryVertexSPD()->GetNContributors() < 1)
d2655d46 1750 {
ad30b142 1751 // cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl;
1752 return kFALSE;
48c37e02 1753 }
48c37e02 1754 }
1755
85c4406e 1756 return kFALSE;
48c37e02 1757
1758}
1759
85c4406e 1760//________________________________________________________________________________
1761TArrayI AliCaloTrackReader::GetTriggerPatches(const Int_t tmin, const Int_t tmax )
c2a62a94 1762{
d9bea110 1763 // Select the patches that triggered
1764 // Depend on L0 or L1
1765
c2a62a94 1766 // some variables
1767 Int_t trigtimes[30], globCol, globRow,ntimes, i;
1768 Int_t absId = -1; //[100];
1769 Int_t nPatch = 0;
d9bea110 1770
c2a62a94 1771 TArrayI patches(0);
85c4406e 1772
c2a62a94 1773 // get object pointer
1774 AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
1775
1776 // class is not empty
1777 if( caloTrigger->GetEntries() > 0 )
1778 {
1779 // must reset before usage, or the class will fail
1780 caloTrigger->Reset();
1781
1782 // go throuth the trigger channels
1783 while( caloTrigger->Next() )
1784 {
1785 // get position in global 2x2 tower coordinates
1786 caloTrigger->GetPosition( globCol, globRow );
1787
85c4406e 1788 //L0
1789 if(IsEventEMCALL0())
1790 {
1791 // get dimension of time arrays
1792 caloTrigger->GetNL0Times( ntimes );
1793
1794 // no L0s in this channel
1795 // presence of the channel in the iterator still does not guarantee that L0 was produced!!
1796 if( ntimes < 1 )
1797 continue;
1798
1799 // get timing array
1800 caloTrigger->GetL0Times( trigtimes );
1801
1802 //printf("trigger time window %d - %d\n",fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
1803 // go through the array
1804 for( i = 0; i < ntimes; i++ )
1805 {
1806 // check if in cut - 8,9 shall be accepted in 2011
1807 if( trigtimes[i] >= tmin && trigtimes[i] <= tmax )
1808 {
1809 //printf("Accepted trigger time %d \n",trigtimes[i]);
1810 //if(nTrig > 99) continue;
1811 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
1812 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
1813 patches.Set(nPatch+1);
1814 patches.AddAt(absId,nPatch++);
1815 }
1816 } // trigger time array
d9bea110 1817 }//L0
85c4406e 1818 else if(IsEventEMCALL1()) // L1
1819 {
1820 Int_t bit = 0;
1821 caloTrigger->GetTriggerBits(bit);
1822
1823 Bool_t isEGA = ((bit >> fBitEGA) & 0x1) && IsEventEMCALL1Gamma() ;
1824 Bool_t isEJE = ((bit >> fBitEJE) & 0x1) && IsEventEMCALL1Jet () ;
1825
1826 if(!isEGA && !isEJE) continue;
1827
1828 Int_t patchsize = -1;
1829 if (isEGA) patchsize = 2;
1830 else if (isEJE) patchsize = 16;
1831
1832 // add 2x2 (EGA) or 16x16 (EJE) patches
1833 for(Int_t irow=0; irow < patchsize; irow++)
1834 {
1835 for(Int_t icol=0; icol < patchsize; icol++)
1836 {
1837 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
1838 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
1839 patches.Set(nPatch+1);
1840 patches.AddAt(absId,nPatch++);
1841 }
1842 }
1843
1844 } // L1
1845
c2a62a94 1846 } // trigger iterator
1847 } // go thorough triggers
85c4406e 1848
d9bea110 1849 //printf("N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
c2a62a94 1850
1851 return patches;
1852}
1853
afb3af8a 1854//______________________________________________________________________
1855void AliCaloTrackReader::MatchTriggerCluster(TArrayI patches)
1856{
1857 // Finds the cluster that triggered
1858
1859 // Init info from previous event
1860 fTriggerClusterIndex = -1;
1861 fTriggerClusterId = -1;
afb3af8a 1862 fTriggerClusterBC = -10000;
1863 fIsExoticEvent = kFALSE;
1864 fIsBadCellEvent = kFALSE;
1035a8d9 1865 fIsBadMaxCellEvent = kFALSE;
afb3af8a 1866
85c4406e 1867 fIsTriggerMatch = kFALSE;
1868 fIsTriggerMatchOpenCut[0] = kFALSE;
1869 fIsTriggerMatchOpenCut[1] = kFALSE;
1870 fIsTriggerMatchOpenCut[2] = kFALSE;
1871
afb3af8a 1872 // Do only analysis for triggered events
d9bea110 1873 if(!IsEventEMCALL1() && !IsEventEMCALL0())
afb3af8a 1874 {
1035a8d9 1875 fTriggerClusterBC = 0;
afb3af8a 1876 return;
1877 }
1878
1879 //Recover the list of clusters
1880 TClonesArray * clusterList = 0;
1881 if (fInputEvent->FindListObject(fEMCALClustersListName))
1882 {
1883 clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
1884 }
1885 else if(fOutputEvent)
1886 {
1887 clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
1888 }
1889
1890 // Get number of clusters and of trigger patches
1035a8d9 1891 Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
1892 if(clusterList)
85c4406e 1893 nclusters = clusterList->GetEntriesFast();
1894
1035a8d9 1895 Int_t nPatch = patches.GetSize();
1896 Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut();
85c4406e 1897
afb3af8a 1898 //Init some variables used in the cluster loop
1899 Float_t tofPatchMax = 100000;
1900 Float_t ePatchMax =-1;
1901
1902 Float_t tofMax = 100000;
1903 Float_t eMax =-1;
1904
1905 Int_t clusMax =-1;
1906 Int_t idclusMax =-1;
1035a8d9 1907 Bool_t badClMax = kFALSE;
1908 Bool_t badCeMax = kFALSE;
afb3af8a 1909 Bool_t exoMax = kFALSE;
85c4406e 1910 Int_t absIdMaxTrig= -1;
1911 Int_t absIdMaxMax = -1;
afb3af8a 1912
1913 Int_t nOfHighECl = 0 ;
d9bea110 1914
85c4406e 1915 Float_t minE = fTriggerEventThreshold / 2.;
1916 // This method is not really suitable for JET trigger
1917 // but in case, reduce the energy cut since we do not trigger on high energy particle
1918 if(IsEventEMCALL1()) minE = 1;
d9bea110 1919
afb3af8a 1920 // Loop on the clusters, check if there is any that falls into one of the patches
1921 for (Int_t iclus = 0; iclus < nclusters; iclus++)
1922 {
1923 AliVCluster * clus = 0;
1924 if(clusterList) clus = (AliVCluster*) clusterList->At(iclus);
1925 else clus = fInputEvent->GetCaloCluster(iclus);
1926
1927 if ( !clus ) continue ;
1928
1929 if ( !IsEMCALCluster(clus)) continue ;
85c4406e 1930
f6b8da1f 1931 //Skip clusters with too low energy to be triggering
d9bea110 1932 if ( clus->E() < minE ) continue ;
afb3af8a 1933
1035a8d9 1934 Float_t frac = -1;
1935 Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
1936
1937 Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
85c4406e 1938 clus->GetCellsAbsId(),clus->GetNCells());
1035a8d9 1939 UShort_t cellMax[] = {absIdMax};
1940 Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
1941
1942 // if cell is bad, it can happen that time calibration is not available,
1943 // when calculating if it is exotic, this can make it to be exotic by default
1944 // open it temporarily for this cluster
1945 if(badCell)
85c4406e 1946 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000);
1035a8d9 1947
1948 Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
afb3af8a 1949
1035a8d9 1950 // Set back the time cut on exotics
1951 if(badCell)
1952 GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime);
afb3af8a 1953
1035a8d9 1954 // Energy threshold for exotic Ecross typically at 4 GeV,
1955 // for lower energy, check that there are more than 1 cell in the cluster
1956 if(!exotic && clus->GetNCells() < 2) exotic = kTRUE;
afb3af8a 1957
1035a8d9 1958 Float_t energy = clus->E();
1959 Int_t idclus = clus->GetID();
afb3af8a 1960
1035a8d9 1961 Double_t tof = clus->GetTOF();
afb3af8a 1962 if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn())
1963 GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
1964 tof *=1.e9;
1965
d9bea110 1966 //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n",
1967 // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell);
85c4406e 1968
afb3af8a 1969 // Find the highest energy cluster, avobe trigger threshold
1970 // in the event in case no match to trigger is found
05ace4e1 1971 if( energy > eMax )
afb3af8a 1972 {
85c4406e 1973 tofMax = tof;
1974 eMax = energy;
1975 badClMax = badCluster;
1976 badCeMax = badCell;
1977 exoMax = exotic;
1978 clusMax = iclus;
1979 idclusMax = idclus;
1980 absIdMaxMax = absIdMax;
afb3af8a 1981 }
1982
1983 // count the good clusters in the event avobe the trigger threshold
85c4406e 1984 // to check the exotic events
05ace4e1 1985 if(!badCluster && !exotic)
afb3af8a 1986 nOfHighECl++;
1987
1988 // Find match to trigger
1989 if(fTriggerPatchClusterMatch)
1990 {
1991 for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
1992 {
1993 Int_t absIDCell[4];
1994 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
1995 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
1996 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
1997
1998 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
1999 {
2000 if(absIdMax == absIDCell[ipatch])
2001 {
2002 //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
2003 if(energy > ePatchMax)
2004 {
2005 tofPatchMax = tof;
2006 ePatchMax = energy;
1035a8d9 2007 fIsBadCellEvent = badCluster;
2008 fIsBadMaxCellEvent = badCell;
afb3af8a 2009 fIsExoticEvent = exotic;
2010 fTriggerClusterIndex = iclus;
2011 fTriggerClusterId = idclus;
2012 fIsTriggerMatch = kTRUE;
85c4406e 2013 absIdMaxTrig = absIdMax;
afb3af8a 2014 }
2015 }
2016 }// cell patch loop
2017 }// trigger patch loop
2018 } // Do trigger patch matching
2019
2020 }// Cluster loop
85c4406e 2021
afb3af8a 2022 // If there was no match, assign as trigger
2023 // the highest energy cluster in the event
2024 if(!fIsTriggerMatch)
2025 {
2026 tofPatchMax = tofMax;
2027 ePatchMax = eMax;
1035a8d9 2028 fIsBadCellEvent = badClMax;
2029 fIsBadMaxCellEvent = badCeMax;
afb3af8a 2030 fIsExoticEvent = exoMax;
2031 fTriggerClusterIndex = clusMax;
2032 fTriggerClusterId = idclusMax;
2033 }
2034
2035 Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax);
85c4406e 2036
f6b8da1f 2037 if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ;
afb3af8a 2038 else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ;
2039 else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ;
2040 else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ;
2041 else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ;
2042 else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ;
2043 else
2044 {
2045 //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex);
2046 if(fTriggerClusterIndex >= 0) fTriggerClusterBC = 6 ;
2047 else
2048 {
2049 fTriggerClusterIndex = -2;
2050 fTriggerClusterId = -2;
2051 }
2052 }
2053
2054 if(tofPatchMax < 0) fTriggerClusterBC*=-1;
2055
85c4406e 2056
2057 // 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",
2058 // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax,
2059 // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax);
2060 //
2061 // 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",
2062 // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax);
2063
2064 //Redo matching but open cuts
2065 if(!fIsTriggerMatch && fTriggerClusterId >= 0)
2066 {
2067 // Open time patch time
2068 TArrayI patchOpen = GetTriggerPatches(7,10);
2069
2070
2071 Int_t patchAbsIdOpenTime = -1;
2072 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2073 {
2074 Int_t absIDCell[4];
2075 patchAbsIdOpenTime = patchOpen.At(iabsId);
2076 GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell);
2077 //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
2078 // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
2079
2080 for(Int_t ipatch = 0; ipatch < 4; ipatch++)
2081 {
2082 if(absIdMaxMax == absIDCell[ipatch])
2083 {
2084 fIsTriggerMatchOpenCut[0] = kTRUE;
2085 break;
2086 }
2087 }// cell patch loop
2088 }// trigger patch loop
2089
2090 // Check neighbour patches
2091 Int_t patchAbsId = -1;
2092 Int_t globalCol = -1;
2093 Int_t globalRow = -1;
2094 GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId);
2095 GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow);
2096
2097 // Check patches with strict time cut
2098 Int_t patchAbsIdNeigh = -1;
2099 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2100 {
2101 if(icol < 0 || icol > 47) continue;
2102
2103 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2104 {
2105 if(irow < 0 || irow > 63) continue;
2106
2107 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh);
2108
2109 if ( patchAbsIdNeigh < 0 ) continue;
2110
2111 for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++)
2112 {
2113 if(patchAbsIdNeigh == patches.At(iabsId))
2114 {
2115 fIsTriggerMatchOpenCut[1] = kTRUE;
2116 break;
2117 }
2118 }// trigger patch loop
2119
2120 }// row
2121 }// col
2122
2123 // Check patches with open time cut
2124 Int_t patchAbsIdNeighOpenTime = -1;
2125 for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++)
2126 {
2127 if(icol < 0 || icol > 47) continue;
2128
2129 for(Int_t irow = globalRow; irow <= globalRow+1; irow++)
2130 {
2131 if(irow < 0 || irow > 63) continue;
2132
2133 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime);
2134
2135 if ( patchAbsIdNeighOpenTime < 0 ) continue;
2136
2137 for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++)
2138 {
2139 if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId))
2140 {
2141 fIsTriggerMatchOpenCut[2] = kTRUE;
2142 break;
2143 }
2144 }// trigger patch loop
2145
2146 }// row
2147 }// col
2148
2149 // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime,
2150 // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh,
2151 // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime);
2152
2153 patchOpen.Reset();
2154
2155 }// No trigger match found
2156
a529ae05 2157}
2158
914b9fe7 2159//________________________________________________________
2160void AliCaloTrackReader::Print(const Option_t * opt) const
2161{
2162
2163 //Print some relevant parameters set for the analysis
2164 if(! opt)
2165 return;
2166
2167 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2168 printf("Task name : %s\n", fTaskName.Data()) ;
2169 printf("Data type : %d\n", fDataType) ;
2170 printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ;
2171 printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ;
2172 printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ;
2173 printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ;
2174 printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ;
2175 printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ;
2176 printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax);
2177 printf("Use CTS = %d\n", fFillCTS) ;
2178 printf("Use EMCAL = %d\n", fFillEMCAL) ;
2179 printf("Use PHOS = %d\n", fFillPHOS) ;
2180 printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
2181 printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
2182 printf("Track status = %d\n", (Int_t) fTrackStatus) ;
2183 printf("AODs Track filter mask = %d or hybrid %d, SPD hit %d\n", (Int_t) fTrackFilterMask,fSelectHybridTracks,fSelectSPDHitTracks) ;
2184 printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ;
2185 printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
2186 printf("Recalculate Clusters = %d\n", fRecalculateClusters) ;
2187
2188 printf("Use Triggers selected in SE base class %d; If not what trigger Mask? %d; Trigger max for mixed %d \n",
2189 fEventTriggerAtSE, fEventTriggerMask,fMixEventTriggerMask);
2190
2191 if(fComparePtHardAndClusterPt)
2192 printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
2193
2194 if(fComparePtHardAndClusterPt)
2195 printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor);
2196
2197 printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
2198 printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ;
2199 printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
2200
2201 printf(" \n") ;
2202
2203}
2204
a529ae05 2205//__________________________________________
2206Bool_t AliCaloTrackReader::RejectLEDEvents()
2207{
2208 // LED Events in period LHC11a contaminated sample, simple method
2209 // to reject such events
2210
2211 // Count number of cells with energy larger than 0.1 in SM3, cut on this number
2212 Int_t ncellsSM3 = 0;
2213 for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++)
2214 {
2215 Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
2216 Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
2217 if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
2218 }
2219
2220 Int_t ncellcut = 21;
2221 if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35;
85c4406e 2222
a529ae05 2223 if(ncellsSM3 >= ncellcut)
2224 {
2225 if(fDebug > 0)
2226 printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d, cut %d, trig %s\n",
2227 ncellsSM3,ncellcut,GetFiredTriggerClasses().Data());
2228 return kTRUE;
2229 }
2230
2231 return kFALSE;
2232
2233}
2234
914b9fe7 2235//_________________________________________________________
2236void AliCaloTrackReader::RemapMCLabelForAODs(Int_t & label)
2237{
2238 // MC label for Cells not remapped after ESD filtering, do it here.
2239
2240 if(label < 0) return ;
2241
2242 AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
2243 if(!evt) return ;
2244
2245 TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ;
2246 if(!arr) return ;
2247
2248 if(label < arr->GetEntriesFast())
2249 {
2250 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label));
2251 if(!particle) return ;
2252
2253 if(label == particle->Label()) return ; // label already OK
2254 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label());
2255 }
2256 //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast());
2257
2258 // loop on the particles list and check if there is one with the same label
2259 for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ )
2260 {
2261 AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind));
2262 if(!particle) continue ;
2263
2264 if(label == particle->Label())
2265 {
2266 label = ind;
2267 //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label);
2268 return;
2269 }
2270 }
2271
2272 label = -1;
2273
2274 //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n");
2275
2276}
2277
2278
2279//___________________________________
2280void AliCaloTrackReader::ResetLists()
2281{
2282 // Reset lists, called by the analysis maker
2283
2284 if(fCTSTracks) fCTSTracks -> Clear();
2285 if(fEMCALClusters) fEMCALClusters -> Clear("C");
2286 if(fPHOSClusters) fPHOSClusters -> Clear("C");
2287
2288 fV0ADC[0] = 0; fV0ADC[1] = 0;
2289 fV0Mul[0] = 0; fV0Mul[1] = 0;
2290
2291}
2292
d9bea110 2293//___________________________________________
2294void AliCaloTrackReader::SetEventTriggerBit()
2295{
85c4406e 2296 // Tag event depeding on trigger name
d9bea110 2297
85c4406e 2298 fEventTrigMinBias = kFALSE;
2299 fEventTrigCentral = kFALSE;
2300 fEventTrigSemiCentral = kFALSE;
2301 fEventTrigEMCALL0 = kFALSE;
2302 fEventTrigEMCALL1Gamma1 = kFALSE;
2303 fEventTrigEMCALL1Gamma2 = kFALSE;
2304 fEventTrigEMCALL1Jet1 = kFALSE;
2305 fEventTrigEMCALL1Jet2 = kFALSE;
2306
2307 if(fEventTriggerMask <=0 )// in case no mask set
2308 {
2309 // EMC triggered event? Which type?
2310 if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") )
2311 {
2312 if ( GetFiredTriggerClasses().Contains("EGA" ) ||
2313 GetFiredTriggerClasses().Contains("EG1" ) )
2314 {
2315 fEventTrigEMCALL1Gamma1 = kTRUE;
2316 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2317 }
2318 else if( GetFiredTriggerClasses().Contains("EG2" ) )
2319 {
2320 fEventTrigEMCALL1Gamma2 = kTRUE;
2321 if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2322 }
2323 else if( GetFiredTriggerClasses().Contains("EJE" ) ||
2324 GetFiredTriggerClasses().Contains("EJ1" ) )
2325 {
2326 fEventTrigEMCALL1Jet1 = kTRUE;
2327 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") )
2328 fEventTrigEMCALL1Jet1 = kFALSE;
2329 }
2330 else if( GetFiredTriggerClasses().Contains("EJ2" ) )
2331 {
2332 fEventTrigEMCALL1Jet2 = kTRUE;
2333 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2334 }
2335 else if( GetFiredTriggerClasses().Contains("CEMC") &&
2336 !GetFiredTriggerClasses().Contains("EGA" ) &&
2337 !GetFiredTriggerClasses().Contains("EJE" ) &&
2338 !GetFiredTriggerClasses().Contains("EG1" ) &&
2339 !GetFiredTriggerClasses().Contains("EJ1" ) &&
2340 !GetFiredTriggerClasses().Contains("EG2" ) &&
2341 !GetFiredTriggerClasses().Contains("EJ2" ) )
2342 fEventTrigEMCALL0 = kTRUE;
2343
2344 //Min bias event trigger?
2345 if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD"))
2346 fEventTrigCentral = kTRUE;
2347 else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD"))
2348 fEventTrigSemiCentral = kTRUE;
2349 else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) &&
2350 GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") )
2351 fEventTrigMinBias = kTRUE;
2352 }
d9bea110 2353 }
85c4406e 2354 else
d9bea110 2355 {
85c4406e 2356 // EMC L1 Gamma
2357 if ( fEventTriggerMask & AliVEvent::kEMCEGA )
2358 {
2359 if (GetFiredTriggerClasses().Contains("EG1" ) ||
2360 GetFiredTriggerClasses().Contains("EGA" ) )
2361 {
2362 fEventTrigEMCALL1Gamma1 = kTRUE;
2363 if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
2364 }
2365 else if(GetFiredTriggerClasses().Contains("EG2" ))
2366 {
2367 fEventTrigEMCALL1Gamma2 = kTRUE;
2368 if(!fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE;
2369 }
2370 }
2371 // EMC L1 Jet
2372 else if( fEventTriggerMask & AliVEvent::kEMCEJE )
2373 {
2374 if (GetFiredTriggerClasses().Contains("EJ1" )||
2375 GetFiredTriggerClasses().Contains("EJE" ) )
2376 {
2377 fEventTrigEMCALL1Jet1 = kTRUE;
2378 if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") ) fEventTrigEMCALL1Jet1 = kFALSE;
2379 }
2380 else if(GetFiredTriggerClasses().Contains("EJ2" ))
2381 {
2382 fEventTrigEMCALL1Jet2 = kTRUE;
2383 if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE;
2384 }
2385 }
2386 // EMC L0
2387 else if((fEventTriggerMask & AliVEvent::kEMC7) ||
2388 (fEventTriggerMask & AliVEvent::kEMC1) )
2389 fEventTrigEMCALL0 = kTRUE;
2390 // Min Bias Pb-Pb
2391 else if( fEventTriggerMask & AliVEvent::kCentral )
2392 fEventTrigSemiCentral = kTRUE;
2393 // Min Bias Pb-Pb
2394 else if( fEventTriggerMask & AliVEvent::kSemiCentral )
2395 fEventTrigCentral = kTRUE;
2396 // Min Bias pp, PbPb, pPb
2397 else if((fEventTriggerMask & AliVEvent::kMB ) ||
2398 (fEventTriggerMask & AliVEvent::kINT7) ||
2399 (fEventTriggerMask & AliVEvent::kINT8) )
2400 fEventTrigMinBias = kTRUE;
2401 }
2402
2403 if(fDebug > 0 )
2404 printf("AliCaloTrackReader::SetEventTriggerBit() - Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d \n",
2405 fEventTrigMinBias, fEventTrigCentral, fEventTrigSemiCentral,
2406 fEventTrigEMCALL0 , fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2,
2407 fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2);
2408
2409 if(fBitEGA == 0 && fBitEJE ==0)
2410 {
2411 // Init the trigger bit once, correct depending on version
2412 fBitEGA = 4;
2413 fBitEJE = 5;
2414
2415 TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
2416
2417 const TList *clist = file->GetStreamerInfoCache();
2418
2419 if(clist)
2420 {
2421 TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
2422 if(!cinfo) cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
2423
2424 if(cinfo)
2425 {
2426 Int_t classversionid = cinfo->GetClassVersion();
2427
2428 if (classversionid >= 5)
2429 {
2430 fBitEGA = 6;
2431 fBitEJE = 8;
2432 }
2433 } else printf("AliCaloTrackReader()::Init() - Streamer info for trigger class not available, bit not changed\n");
2434 } else printf("AliCaloTrackReader::Init() - Streamer list not available!, bit not changed\n");
2435
2436 } // set once the EJE, EGA trigger bit
2437
d9bea110 2438}
2439
914b9fe7 2440//____________________________________________________________
2441void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)
2442{
2443 fInputEvent = input;
2444 fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ;
2445 if (fMixedEvent)
2446 fNMixedEvent = fMixedEvent->GetNumberOfEvents() ;
2447
2448 //Delete previous vertex
2449 if(fVertex)
2450 {
2451 for (Int_t i = 0; i < fNMixedEvent; i++)
2452 {
2453 delete [] fVertex[i] ;
2454 }
2455 delete [] fVertex ;
2456 }
2457
2458 fVertex = new Double_t*[fNMixedEvent] ;
2459 for (Int_t i = 0; i < fNMixedEvent; i++)
2460 {
2461 fVertex[i] = new Double_t[3] ;
2462 fVertex[i][0] = 0.0 ;
2463 fVertex[i][1] = 0.0 ;
2464 fVertex[i][2] = 0.0 ;
2465 }
2466}
d9bea110 2467
c5693f62 2468//____________________________________________________________
a529ae05 2469void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts)
85c4406e 2470{
c5693f62 2471 // Set Track cuts
2472
2473 if(fESDtrackCuts) delete fESDtrackCuts ;
2474
85c4406e 2475 fESDtrackCuts = cuts ;
836b6989 2476
85c4406e 2477}
48c37e02 2478
d7601185 2479//_________________________________________________________________________
2480void AliCaloTrackReader::SetTrackComplementaryCuts(AliESDtrackCuts * cuts)
2481{
2482 // Set Track cuts for complementary tracks (hybrids)
2483
2484 if(fESDtrackComplementaryCuts) delete fESDtrackComplementaryCuts ;
2485
2486 fESDtrackComplementaryCuts = cuts ;
2487
2488}
2489
2490