]>
Commit | Line | Data |
---|---|---|
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 | **************************************************************************/ | |
15 | /* $Id: $ */ | |
16 | ||
17 | //_________________________________________________________________________ | |
18 | // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and | |
19 | // Central Barrel Tracking detectors (CTS). | |
ff45398a | 20 | // Not all MC particles/tracks/clusters are kept, some kinematical/fiducial restrictions are done. |
591cc579 | 21 | // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS) |
743aa53a | 22 | // : AliCaloTrackMCReader : Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS) |
23 | // : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS) | |
1c5acb87 | 24 | //-- Author: Gustavo Conesa (LNF-INFN) |
25 | ////////////////////////////////////////////////////////////////////////////// | |
26 | ||
27 | ||
28 | // --- ROOT system --- | |
49b53920 | 29 | #include <TFile.h> |
de0b770d | 30 | #include <TGeoManager.h> |
31 | #include <TGeoGlobalMagField.h> | |
1c5acb87 | 32 | |
c5693f62 | 33 | // ---- ANALYSIS system ---- |
477d6cee | 34 | #include "AliMCEvent.h" |
591cc579 | 35 | #include "AliAODMCHeader.h" |
36 | #include "AliGenPythiaEventHeader.h" | |
48c37e02 | 37 | #include "AliESDEvent.h" |
8dacfd76 | 38 | #include "AliAODEvent.h" |
c8fe2783 | 39 | #include "AliVTrack.h" |
40 | #include "AliVParticle.h" | |
41 | #include "AliMixedEvent.h" | |
0ae57829 | 42 | #include "AliESDtrack.h" |
3a58eee6 | 43 | #include "AliESDtrackCuts.h" |
48c37e02 | 44 | #include "AliTriggerAnalysis.h" |
37285e29 | 45 | #include "AliESDVZERO.h" |
c5693f62 | 46 | #include "AliVCaloCells.h" |
de0b770d | 47 | #include "AliMagF.h" |
1c5acb87 | 48 | |
c5693f62 | 49 | // ---- Detectors ---- |
50 | #include "AliPHOSGeoUtils.h" | |
51 | #include "AliEMCALGeometry.h" | |
f3138ecf | 52 | #include "AliEMCALRecoUtils.h" |
c5693f62 | 53 | |
54 | // ---- PartCorr --- | |
55 | #include "AliCalorimeterUtils.h" | |
cfaba834 | 56 | #include "AliCaloTrackReader.h" |
57 | ||
1c5acb87 | 58 | ClassImp(AliCaloTrackReader) |
59 | ||
60 | ||
836b6989 | 61 | //________________________________________ |
62 | AliCaloTrackReader::AliCaloTrackReader() : | |
63 | TObject(), fEventNumber(-1), //fCurrentFileName(""), | |
64 | fDataType(0), fDebug(0), | |
65 | fFiducialCut(0x0), fCheckFidCut(kFALSE), | |
de0b770d | 66 | fComparePtHardAndJetPt(0), fPtHardAndJetPtFactor(0), |
836b6989 | 67 | fCTSPtMin(0), fEMCALPtMin(0), fPHOSPtMin(0), |
de0b770d | 68 | fCTSPtMax(0), fEMCALPtMax(0), fPHOSPtMax(0), |
f3138ecf | 69 | fAODBranchList(0x0), |
70 | fCTSTracks(0x0), fEMCALClusters(0x0), fPHOSClusters(0x0), | |
836b6989 | 71 | fEMCALCells(0x0), fPHOSCells(0x0), |
72 | fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0), | |
73 | fFillCTS(0), fFillEMCAL(0), fFillPHOS(0), | |
74 | fFillEMCALCells(0), fFillPHOSCells(0), | |
75 | fRecalculateClusters(kFALSE),fSelectEmbeddedClusters(kFALSE), | |
76 | fTrackStatus(0), fTrackFilterMask(0), fESDtrackCuts(0), | |
77 | fTrackMult(0), fTrackMultEtaCut(0.8), | |
78 | fReadStack(kFALSE), fReadAODMCParticles(kFALSE), | |
de0b770d | 79 | fDeltaAODFileName(""), fFiredTriggerClassName(""), fAnaLED(kFALSE), |
836b6989 | 80 | fTaskName(""), fCaloUtils(0x0), |
de0b770d | 81 | fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL), |
836b6989 | 82 | fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE), fCaloFilterPatch(kFALSE), |
83 | fEMCALClustersListName(""), fZvtxCut(0.), | |
de0b770d | 84 | fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kFALSE), |
836b6989 | 85 | fDoEventSelection(kFALSE), fDoV0ANDEventSelection(kFALSE), fUseEventsWithPrimaryVertex(kFALSE), |
f3138ecf | 86 | fTriggerAnalysis (0x0), |
de0b770d | 87 | fCentralityClass(""), fCentralityOpt(0), |
88 | fEventPlaneMethod(""), fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("") | |
836b6989 | 89 | |
af7b3903 | 90 | { |
1c5acb87 | 91 | //Ctor |
f3138ecf | 92 | |
1c5acb87 | 93 | //Initialize parameters |
94 | InitParameters(); | |
95 | } | |
1c5acb87 | 96 | |
836b6989 | 97 | //_______________________________________ |
98 | AliCaloTrackReader::~AliCaloTrackReader() | |
99 | { | |
1c5acb87 | 100 | //Dtor |
101 | ||
743aa53a | 102 | delete fFiducialCut ; |
29b2ceec | 103 | |
f37fa8d2 | 104 | if(fAODBranchList){ |
105 | fAODBranchList->Delete(); | |
106 | delete fAODBranchList ; | |
107 | } | |
108 | ||
be518ab0 | 109 | if(fCTSTracks){ |
110 | if(fDataType!=kMC)fCTSTracks->Clear() ; | |
111 | else fCTSTracks->Delete() ; | |
112 | delete fCTSTracks ; | |
1c5acb87 | 113 | } |
114 | ||
be518ab0 | 115 | if(fEMCALClusters){ |
116 | if(fDataType!=kMC)fEMCALClusters->Clear("C") ; | |
117 | else fEMCALClusters->Delete() ; | |
118 | delete fEMCALClusters ; | |
1c5acb87 | 119 | } |
120 | ||
be518ab0 | 121 | if(fPHOSClusters){ |
122 | if(fDataType!=kMC)fPHOSClusters->Clear("C") ; | |
123 | else fPHOSClusters->Delete() ; | |
124 | delete fPHOSClusters ; | |
1c5acb87 | 125 | } |
126 | ||
7e25653f | 127 | if(fVertex){ |
128 | for (Int_t i = 0; i < fNMixedEvent; i++) { | |
129 | delete [] fVertex[i] ; | |
836b6989 | 130 | |
7e25653f | 131 | } |
132 | delete [] fVertex ; | |
133 | } | |
836b6989 | 134 | |
743aa53a | 135 | delete fESDtrackCuts; |
136 | delete fTriggerAnalysis; | |
3a58eee6 | 137 | |
836b6989 | 138 | // Pointers not owned, done by the analysis frame |
139 | // if(fInputEvent) delete fInputEvent ; | |
140 | // if(fOutputEvent) delete fOutputEvent ; | |
141 | // if(fMC) delete fMC ; | |
142 | // Pointer not owned, deleted by maker | |
143 | // if (fCaloUtils) delete fCaloUtils ; | |
144 | ||
c1ac3823 | 145 | } |
477d6cee | 146 | |
836b6989 | 147 | //________________________________________________ |
148 | Bool_t AliCaloTrackReader::ComparePtHardAndJetPt() | |
149 | { | |
90995603 | 150 | // Check the event, if the requested ptHard is much larger than the jet pT, then there is a problem. |
151 | // Only for PYTHIA. | |
152 | if(!fReadStack) return kTRUE; //Information not filtered to AOD | |
153 | ||
154 | if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader")){ | |
155 | TParticle * jet = 0; | |
156 | AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader(); | |
157 | Int_t nTriggerJets = pygeh->NTriggerJets(); | |
158 | Float_t ptHard = pygeh->GetPtHard(); | |
159 | ||
160 | //if(fDebug > 1) printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %f\n",nTriggerJets, ptHard); | |
898c9d44 | 161 | Float_t tmpjet[]={0,0,0,0}; |
90995603 | 162 | for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){ |
163 | pygeh->TriggerJet(ijet, tmpjet); | |
164 | jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0); | |
165 | //Compare jet pT and pt Hard | |
166 | //if(fDebug > 1) printf("AliMCAnalysisUtils:: %d pycell jet pT %f\n",ijet, jet->Pt()); | |
167 | if(jet->Pt() > fPtHardAndJetPtFactor * ptHard) { | |
cfaba834 | 168 | printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", |
169 | nTriggerJets, ptHard, jet->Pt(), fPtHardAndJetPtFactor); | |
170 | return kFALSE; | |
90995603 | 171 | } |
172 | } | |
898c9d44 | 173 | if(jet) delete jet; |
90995603 | 174 | } |
175 | ||
176 | return kTRUE ; | |
177 | ||
591cc579 | 178 | } |
179 | ||
836b6989 | 180 | //____________________________________________ |
181 | AliStack* AliCaloTrackReader::GetStack() const | |
182 | { | |
1c5acb87 | 183 | //Return pointer to stack |
184 | if(fMC) | |
185 | return fMC->Stack(); | |
186 | else{ | |
477d6cee | 187 | if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n"); |
1c5acb87 | 188 | return 0x0 ; |
189 | } | |
190 | } | |
191 | ||
43074325 | 192 | //__________________________________________________ |
193 | TString AliCaloTrackReader::GetFiredTriggerClasses() | |
194 | { | |
195 | // List of triggered classes in a TString | |
196 | ||
197 | AliESDEvent* esdevent = dynamic_cast<AliESDEvent*> (GetInputEvent()); | |
198 | AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (GetInputEvent()); | |
199 | ||
200 | if (esdevent) return esdevent->GetFiredTriggerClasses(); | |
201 | else if(aodevent) return aodevent->GetFiredTriggerClasses(); | |
202 | else return ""; // Mixed Event, MC event, does not have this trigger info | |
203 | ||
204 | } | |
205 | ||
836b6989 | 206 | //______________________________________________ |
207 | AliHeader* AliCaloTrackReader::GetHeader() const | |
208 | { | |
1c5acb87 | 209 | //Return pointer to header |
210 | if(fMC) | |
211 | return fMC->Header(); | |
212 | else{ | |
477d6cee | 213 | printf("AliCaloTrackReader::Header is not available\n"); |
1c5acb87 | 214 | return 0x0 ; |
215 | } | |
216 | } | |
836b6989 | 217 | |
218 | //______________________________________________________________ | |
219 | AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const | |
220 | { | |
1c5acb87 | 221 | //Return pointer to Generated event header |
222 | if(fMC) | |
223 | return fMC->GenEventHeader(); | |
224 | else{ | |
477d6cee | 225 | printf("AliCaloTrackReader::GenEventHeader is not available\n"); |
1c5acb87 | 226 | return 0x0 ; |
227 | } | |
228 | } | |
229 | ||
836b6989 | 230 | //____________________________________________________________________ |
231 | TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const | |
232 | { | |
1e68a3f4 | 233 | //Return list of particles in AOD. Do it for the corresponding input event. |
234 | ||
c8fe2783 | 235 | TClonesArray * rv = NULL ; |
1e68a3f4 | 236 | if(fDataType == kAOD){ |
836b6989 | 237 | |
c8fe2783 | 238 | if(input == 0){ |
1e68a3f4 | 239 | //Normal input AOD |
240 | AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ; | |
241 | if(evt) | |
242 | rv = (TClonesArray*)evt->FindListObject("mcparticles"); | |
243 | else | |
244 | printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); | |
245 | ||
743aa53a | 246 | } |
1e68a3f4 | 247 | |
c8fe2783 | 248 | } else { |
836b6989 | 249 | printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); |
c8fe2783 | 250 | } |
1e68a3f4 | 251 | |
c8fe2783 | 252 | return rv ; |
591cc579 | 253 | } |
254 | ||
836b6989 | 255 | //___________________________________________________________________ |
256 | AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader(Int_t input) const | |
257 | { | |
90995603 | 258 | //Return MC header in AOD. Do it for the corresponding input event. |
1e68a3f4 | 259 | AliAODMCHeader *mch = NULL; |
90995603 | 260 | if(fDataType == kAOD){ |
261 | //Normal input AOD | |
262 | if(input == 0) { | |
1e68a3f4 | 263 | mch = (AliAODMCHeader*)((AliAODEvent*)fInputEvent)->FindListObject("mcheader"); |
264 | } | |
90995603 | 265 | // //Second input AOD |
266 | // else if(input == 1){ | |
267 | // mch = (AliAODMCHeader*) fSecondInputAODEvent->FindListObject("mcheader"); | |
268 | // } | |
269 | else { | |
270 | printf("AliCaloTrackReader::GetAODMCHeader() - wrong AOD input index, %d\n",input); | |
271 | } | |
272 | } | |
273 | else { | |
274 | printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n"); | |
275 | } | |
1e68a3f4 | 276 | |
277 | return mch; | |
591cc579 | 278 | } |
279 | ||
836b6989 | 280 | //_____________________________ |
591cc579 | 281 | void AliCaloTrackReader::Init() |
282 | { | |
90995603 | 283 | //Init reader. Method to be called in AliAnaPartCorrMaker |
de0b770d | 284 | |
285 | //printf(" AliCaloTrackReader::Init() %p \n",gGeoManager); | |
286 | ||
90995603 | 287 | if(fReadStack && fReadAODMCParticles){ |
288 | printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n"); | |
de0b770d | 289 | fReadStack = kFALSE; |
90995603 | 290 | fReadAODMCParticles = kFALSE; |
291 | } | |
292 | ||
de0b770d | 293 | // Init geometry, I do not like much to do it like this ... |
294 | if(fImportGeometryFromFile && !gGeoManager) { | |
295 | printf("AliCaloTrackReader::Init() - Import geometry.root file\n"); | |
296 | TGeoManager::Import(Form("%s/geometry.root", fImportGeometryFilePath.Data())) ; // default need file "geometry.root" in local dir!!!! | |
297 | } | |
298 | ||
591cc579 | 299 | } |
765d44e7 | 300 | |
836b6989 | 301 | //_______________________________________ |
1c5acb87 | 302 | void AliCaloTrackReader::InitParameters() |
303 | { | |
1c5acb87 | 304 | //Initialize the parameters of the analysis. |
591cc579 | 305 | fDataType = kESD ; |
98ec971d | 306 | fCTSPtMin = 0.1 ; |
307 | fEMCALPtMin = 0.1 ; | |
308 | fPHOSPtMin = 0.1 ; | |
309 | fCTSPtMax = 1000. ; | |
310 | fEMCALPtMax = 1000. ; | |
311 | fPHOSPtMax = 1000. ; | |
312 | ||
902aa95c | 313 | //Do not filter the detectors input by default. |
314 | fFillEMCAL = kFALSE; | |
315 | fFillPHOS = kFALSE; | |
316 | fFillCTS = kFALSE; | |
1c5acb87 | 317 | fFillEMCALCells = kFALSE; |
591cc579 | 318 | fFillPHOSCells = kFALSE; |
836b6989 | 319 | |
591cc579 | 320 | fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file |
321 | fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file | |
42dc8e7d | 322 | fDeltaAODFileName = "deltaAODPartCorr.root"; |
743aa53a | 323 | fFiredTriggerClassName = ""; |
836b6989 | 324 | |
de0b770d | 325 | fAcceptFastCluster = kTRUE; |
326 | fAnaLED = kFALSE; | |
0ae57829 | 327 | |
328 | //We want tracks fitted in the detectors: | |
3a58eee6 | 329 | //fTrackStatus=AliESDtrack::kTPCrefit; |
de0b770d | 330 | //fTrackStatus|=AliESDtrack::kITSrefit; |
331 | fTrackStatus = 0; | |
a5fb4114 | 332 | fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask? |
3a58eee6 | 333 | |
a5fb4114 | 334 | fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks |
836b6989 | 335 | |
798a9b04 | 336 | fV0ADC[0] = 0; fV0ADC[1] = 0; |
337 | fV0Mul[0] = 0; fV0Mul[1] = 0; | |
836b6989 | 338 | |
0b13c1f9 | 339 | fZvtxCut = 10.; |
340 | ||
de0b770d | 341 | fNMixedEvent = 1; |
342 | ||
343 | fPtHardAndJetPtFactor = 7; | |
344 | ||
32fd29fe | 345 | //Centrality |
de0b770d | 346 | fCentralityClass = "V0M"; |
347 | fCentralityOpt = 10; | |
348 | fCentralityBin[0] = fCentralityBin[1]=-1; | |
836b6989 | 349 | |
de0b770d | 350 | fEventPlaneMethod = "Q"; |
351 | ||
f3138ecf | 352 | // Allocate memory (not sure this is the right place) |
353 | fCTSTracks = new TObjArray(); | |
354 | fEMCALClusters = new TObjArray(); | |
355 | fPHOSClusters = new TObjArray(); | |
356 | fTriggerAnalysis = new AliTriggerAnalysis; | |
357 | fAODBranchList = new TList ; | |
358 | ||
de0b770d | 359 | fImportGeometryFromFile = kFALSE; |
360 | fImportGeometryFilePath = "."; | |
f3138ecf | 361 | |
4e2b43d8 | 362 | } |
1c5acb87 | 363 | |
836b6989 | 364 | //________________________________________________________ |
1c5acb87 | 365 | void AliCaloTrackReader::Print(const Option_t * opt) const |
366 | { | |
836b6989 | 367 | |
1c5acb87 | 368 | //Print some relevant parameters set for the analysis |
369 | if(! opt) | |
370 | return; | |
836b6989 | 371 | |
1c5acb87 | 372 | printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; |
486258c9 | 373 | printf("Task name : %s\n", fTaskName.Data()) ; |
1c5acb87 | 374 | printf("Data type : %d\n", fDataType) ; |
375 | printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; | |
376 | printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; | |
377 | printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ; | |
98ec971d | 378 | printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ; |
379 | printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ; | |
380 | printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ; | |
1c5acb87 | 381 | printf("Use CTS = %d\n", fFillCTS) ; |
382 | printf("Use EMCAL = %d\n", fFillEMCAL) ; | |
383 | printf("Use PHOS = %d\n", fFillPHOS) ; | |
384 | printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ; | |
385 | printf("Use PHOS Cells = %d\n", fFillPHOSCells) ; | |
591cc579 | 386 | printf("Track status = %d\n", (Int_t) fTrackStatus) ; |
a5fb4114 | 387 | printf("Track filter mask (AODs) = %d\n", (Int_t) fTrackFilterMask) ; |
3a58eee6 | 388 | printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ; |
f37fa8d2 | 389 | printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ; |
3bfc4732 | 390 | printf("Recalculate Clusters = %d\n", fRecalculateClusters) ; |
391 | ||
591cc579 | 392 | if(fComparePtHardAndJetPt) |
393 | printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor); | |
836b6989 | 394 | |
42dc8e7d | 395 | printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ; |
42dc8e7d | 396 | printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ; |
8a3f4796 | 397 | printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ; |
836b6989 | 398 | |
1c5acb87 | 399 | printf(" \n") ; |
32fd29fe | 400 | |
1c5acb87 | 401 | } |
402 | ||
836b6989 | 403 | //_________________________________________________________________________ |
404 | Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, | |
405 | const char * /*currentFileName*/) | |
406 | { | |
6639984f | 407 | //Fill the event counter and input lists that are needed, called by the analysis maker. |
de0b770d | 408 | |
6639984f | 409 | fEventNumber = iEntry; |
1510eee3 | 410 | //fCurrentFileName = TString(currentFileName); |
be1f5fa4 | 411 | if(!fInputEvent) { |
f7c2338a | 412 | if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n"); |
be1f5fa4 | 413 | return kFALSE; |
414 | } | |
72d2488e | 415 | //Select events only fired by a certain trigger configuration if it is provided |
be1f5fa4 | 416 | Int_t eventType = 0; |
417 | if(fInputEvent->GetHeader()) | |
418 | eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType(); | |
836b6989 | 419 | |
cd2e4ce6 | 420 | if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster) { |
836b6989 | 421 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data()); |
cd2e4ce6 | 422 | return kFALSE; |
423 | } | |
424 | ||
425 | //------------------------------------------------------------------------------------- | |
426 | // Reject event if large clusters with large energy | |
427 | // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding | |
428 | // If clusterzer NxN or V2 it does not help | |
429 | //------------------------------------------------------------------------------------- | |
430 | if(fRemoveLEDEvents){ | |
f5036bcb | 431 | |
f5036bcb | 432 | //printf("Event %d\n",GetEventNumber()); |
cd2e4ce6 | 433 | for (Int_t i = 0; i < fInputEvent->GetNumberOfCaloClusters(); i++) |
434 | { | |
435 | AliVCluster *clus = fInputEvent->GetCaloCluster(i); | |
f5036bcb | 436 | if(clus->IsEMCAL()){ |
cd2e4ce6 | 437 | if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200) { |
438 | Int_t absID = clus->GetCellsAbsId()[0]; | |
439 | Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID); | |
836b6989 | 440 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - reject event %d with cluster : E %f, ncells %d, absId(0) %d, SM %d\n",GetEventNumber(),clus->E(), clus->GetNCells(),absID, sm); |
cd2e4ce6 | 441 | return kFALSE; |
442 | } | |
443 | } | |
444 | } | |
445 | ||
446 | // Count number of cells with energy larger than 0.1 in SM3, cut on this number | |
75153e10 | 447 | Int_t ncellsSM3 = 0; |
448 | Int_t ncellsSM4 = 0; | |
cd2e4ce6 | 449 | for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++){ |
450 | Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell); | |
451 | Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID); | |
75153e10 | 452 | if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++; |
453 | if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==4) ncellsSM4++; | |
cd2e4ce6 | 454 | } |
455 | ||
456 | Int_t ncellcut = 21; | |
457 | if(fFiredTriggerClassName.Contains("EMC")) ncellcut = 35; | |
458 | ||
75153e10 | 459 | if(ncellsSM3 >= ncellcut || ncellsSM4 >= 100) { |
836b6989 | 460 | if(fDebug > 0) printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d and SM4 %d\n",ncellsSM3, ncellsSM4); |
cd2e4ce6 | 461 | return kFALSE; |
462 | } | |
463 | }// Remove LED events | |
464 | ||
465 | // Reject pure LED events? | |
c1ac3823 | 466 | if( fFiredTriggerClassName !="" && !fAnaLED){ |
c8fe2783 | 467 | if(eventType!=7) |
468 | return kFALSE; //Only physics event, do not use for simulated events!!! | |
7ec23b5a | 469 | if(fDebug > 0) |
470 | printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n", | |
836b6989 | 471 | GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName)); |
7ec23b5a | 472 | if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE; |
4d8a2fe1 | 473 | else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n"); |
72d2488e | 474 | } |
c1ac3823 | 475 | else if(fAnaLED){ |
836b6989 | 476 | // kStartOfRun = 1, // START_OF_RUN |
477 | // kEndOfRun = 2, // END_OF_RUN | |
478 | // kStartOfRunFiles = 3, // START_OF_RUN_FILES | |
479 | // kEndOfRunFiles = 4, // END_OF_RUN_FILES | |
480 | // kStartOfBurst = 5, // START_OF_BURST | |
481 | // kEndOfBurst = 6, // END_OF_BURST | |
482 | // kPhysicsEvent = 7, // PHYSICS_EVENT | |
483 | // kCalibrationEvent = 8, // CALIBRATION_EVENT | |
484 | // kFormatError = 9, // EVENT_FORMAT_ERROR | |
485 | // kStartOfData = 10, // START_OF_DATA | |
486 | // kEndOfData = 11, // END_OF_DATA | |
487 | // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT | |
488 | // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT | |
489 | ||
c1ac3823 | 490 | if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType); |
491 | if(eventType!=8)return kFALSE; | |
492 | } | |
cd2e4ce6 | 493 | |
29b2ceec | 494 | //In case of analysis of events with jets, skip those with jet pt > 5 pt hard |
495 | if(fComparePtHardAndJetPt && GetStack()) { | |
7ec23b5a | 496 | if(!ComparePtHardAndJetPt()) return kFALSE ; |
29b2ceec | 497 | } |
836b6989 | 498 | |
48c37e02 | 499 | //Fill Vertex array |
500 | FillVertexArray(); | |
501 | //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code | |
502 | if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE; | |
503 | ||
504 | //------------------------------------------------------ | |
505 | //Event rejection depending on vertex, pileup, v0and | |
506 | //------------------------------------------------------ | |
507 | if(fDoEventSelection){ | |
508 | if(!fCaloFilterPatch){ | |
509 | //Do not analyze events with pileup | |
510 | Bool_t bPileup = fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.); //Default values, if not it does not compile | |
511 | //Bool_t bPileup = event->IsPileupFromSPD(); | |
512 | if(bPileup) return kFALSE; | |
513 | ||
514 | if(fDoV0ANDEventSelection){ | |
515 | Bool_t bV0AND = kTRUE; | |
ad30b142 | 516 | AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent); |
517 | if(esd) | |
518 | bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND); | |
48c37e02 | 519 | //else bV0AND = //FIXME FOR AODs |
520 | if(!bV0AND) return kFALSE; | |
521 | } | |
522 | ||
20218aea | 523 | if(fUseEventsWithPrimaryVertex && !CheckForPrimaryVertex()) return kFALSE; |
ba1eeb1f | 524 | |
48c37e02 | 525 | }//CaloFilter patch |
526 | else{ | |
527 | if(fInputEvent->GetNumberOfCaloClusters() > 0) { | |
528 | AliVCluster * calo = fInputEvent->GetCaloCluster(0); | |
529 | if(calo->GetNLabels() == 4){ | |
530 | Int_t * selection = calo->GetLabels(); | |
531 | Bool_t bPileup = selection[0]; | |
532 | if(bPileup) return kFALSE; | |
533 | ||
534 | Bool_t bGoodV = selection[1]; | |
20218aea | 535 | if(fUseEventsWithPrimaryVertex && !bGoodV) return kFALSE; |
48c37e02 | 536 | |
537 | if(fDoV0ANDEventSelection){ | |
538 | Bool_t bV0AND = selection[2]; | |
539 | if(!bV0AND) return kFALSE; | |
540 | } | |
541 | ||
542 | fTrackMult = selection[3]; | |
543 | if(fTrackMult == 0) return kFALSE; | |
544 | } else { | |
545 | //First filtered AODs, track multiplicity stored there. | |
546 | fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality(); | |
547 | if(fTrackMult == 0) return kFALSE; | |
548 | } | |
549 | }//at least one cluster | |
550 | else { | |
cfaba834 | 551 | //printf("AliCaloTrackReader::FillInputEvent() - No clusters in event\n"); |
48c37e02 | 552 | //Remove events with vertex (0,0,0), bad vertex reconstruction |
20218aea | 553 | 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 | 554 | |
555 | //First filtered AODs, track multiplicity stored there. | |
556 | fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality(); | |
557 | if(fTrackMult == 0) return kFALSE; | |
558 | }// no cluster | |
559 | }// CaloFileter patch | |
560 | }// Event selection | |
561 | //------------------------------------------------------ | |
836b6989 | 562 | |
32fd29fe | 563 | //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested |
564 | //If we need a centrality bin, we select only those events in the corresponding bin. | |
565 | if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100){ | |
566 | Int_t cen = GetEventCentrality(); | |
567 | if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin. | |
568 | } | |
569 | ||
f8006433 | 570 | //Fill the arrays with cluster/tracks/cells data |
836b6989 | 571 | if(fFillEMCALCells) |
c8fe2783 | 572 | FillInputEMCALCells(); |
573 | if(fFillPHOSCells) | |
574 | FillInputPHOSCells(); | |
09e819c9 | 575 | |
90995603 | 576 | if(fFillCTS){ |
c8fe2783 | 577 | FillInputCTS(); |
90995603 | 578 | //Accept events with at least one track |
48c37e02 | 579 | if(fTrackMult == 0 && fDoEventSelection) return kFALSE; |
af7b3903 | 580 | } |
581 | ||
c8fe2783 | 582 | if(fFillEMCAL) |
583 | FillInputEMCAL(); | |
584 | if(fFillPHOS) | |
585 | FillInputPHOS(); | |
836b6989 | 586 | |
798a9b04 | 587 | FillInputVZERO(); |
7ec23b5a | 588 | |
29b2ceec | 589 | return kTRUE ; |
1c5acb87 | 590 | } |
591 | ||
836b6989 | 592 | //___________________________________ |
593 | void AliCaloTrackReader::ResetLists() | |
594 | { | |
1c5acb87 | 595 | // Reset lists, called by the analysis maker |
836b6989 | 596 | |
6060ed91 | 597 | if(fCTSTracks) fCTSTracks -> Clear(); |
836b6989 | 598 | if(fEMCALClusters) fEMCALClusters -> Clear("C"); |
599 | if(fPHOSClusters) fPHOSClusters -> Clear("C"); | |
600 | ||
798a9b04 | 601 | fV0ADC[0] = 0; fV0ADC[1] = 0; |
602 | fV0Mul[0] = 0; fV0Mul[1] = 0; | |
836b6989 | 603 | |
1c5acb87 | 604 | } |
c8fe2783 | 605 | |
836b6989 | 606 | //____________________________________________________________ |
c8fe2783 | 607 | void AliCaloTrackReader::SetInputEvent(AliVEvent* const input) |
608 | { | |
609 | fInputEvent = input; | |
610 | fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ; | |
611 | if (fMixedEvent) { | |
612 | fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; | |
613 | } | |
836b6989 | 614 | |
eb310db0 | 615 | //Delete previous vertex |
616 | if(fVertex){ | |
617 | for (Int_t i = 0; i < fNMixedEvent; i++) { | |
618 | delete [] fVertex[i] ; | |
619 | } | |
620 | delete [] fVertex ; | |
621 | } | |
622 | ||
c8fe2783 | 623 | fVertex = new Double_t*[fNMixedEvent] ; |
624 | for (Int_t i = 0; i < fNMixedEvent; i++) { | |
625 | fVertex[i] = new Double_t[3] ; | |
626 | fVertex[i][0] = 0.0 ; | |
627 | fVertex[i][1] = 0.0 ; | |
628 | fVertex[i][2] = 0.0 ; | |
629 | } | |
630 | } | |
631 | ||
32fd29fe | 632 | //__________________________________________________ |
836b6989 | 633 | Int_t AliCaloTrackReader::GetEventCentrality() const |
634 | { | |
32fd29fe | 635 | //Return current event centrality |
636 | ||
637 | if(GetCentrality()){ | |
20218aea | 638 | if(fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max |
639 | else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max | |
640 | else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max | |
32fd29fe | 641 | else { |
20218aea | 642 | printf("AliAnaPartCorrBaseClass::Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt); |
32fd29fe | 643 | return 0; |
644 | } | |
645 | } | |
646 | else return 0; | |
647 | ||
648 | } | |
649 | ||
836b6989 | 650 | //__________________________________________________________ |
651 | void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const | |
652 | { | |
f8006433 | 653 | //Return vertex position to be used for single event analysis |
654 | vertex[0]=fVertex[0][0]; | |
655 | vertex[1]=fVertex[0][1]; | |
656 | vertex[2]=fVertex[0][2]; | |
657 | } | |
658 | ||
836b6989 | 659 | //____________________________________________________________ |
660 | void AliCaloTrackReader::GetVertex(Double_t vertex[3], | |
661 | const Int_t evtIndex) const | |
662 | { | |
f8006433 | 663 | //Return vertex position for mixed event, recover the vertex in a particular event. |
664 | ||
f8006433 | 665 | vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2]; |
666 | ||
667 | } | |
f8006433 | 668 | |
836b6989 | 669 | //________________________________________ |
670 | void AliCaloTrackReader::FillVertexArray() | |
671 | { | |
f8006433 | 672 | |
673 | //Fill data member with vertex | |
674 | //In case of Mixed event, multiple vertices | |
675 | ||
676 | //Delete previous vertex | |
677 | if(fVertex){ | |
678 | for (Int_t i = 0; i < fNMixedEvent; i++) { | |
679 | delete [] fVertex[i] ; | |
680 | } | |
681 | delete [] fVertex ; | |
682 | } | |
683 | ||
684 | fVertex = new Double_t*[fNMixedEvent] ; | |
685 | for (Int_t i = 0; i < fNMixedEvent; i++) { | |
686 | fVertex[i] = new Double_t[3] ; | |
687 | fVertex[i][0] = 0.0 ; | |
688 | fVertex[i][1] = 0.0 ; | |
689 | fVertex[i][2] = 0.0 ; | |
690 | } | |
691 | ||
692 | if (!fMixedEvent) { //Single event analysis | |
79395d30 | 693 | if(fDataType!=kMC){ |
836b6989 | 694 | |
79395d30 | 695 | if(fInputEvent->GetPrimaryVertex()){ |
696 | fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]); | |
697 | } | |
698 | else { | |
699 | printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n"); | |
700 | fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.; | |
701 | }//Primary vertex pointer do not exist | |
702 | ||
703 | } else {//MC read event | |
edffc439 | 704 | fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.; |
705 | } | |
836b6989 | 706 | |
f8006433 | 707 | if(fDebug > 1) |
708 | printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]); | |
836b6989 | 709 | |
f8006433 | 710 | } else { // MultiEvent analysis |
711 | for (Int_t iev = 0; iev < fNMixedEvent; iev++) { | |
8e7bdfa9 | 712 | if (fMixedEvent->GetVertexOfEvent(iev)) |
713 | fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]); | |
714 | else { // no vertex found !!!! | |
715 | AliWarning("No vertex found"); | |
716 | } | |
836b6989 | 717 | |
f8006433 | 718 | if(fDebug > 1) |
719 | printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]); | |
836b6989 | 720 | |
f8006433 | 721 | } |
c8fe2783 | 722 | } |
f8006433 | 723 | |
c8fe2783 | 724 | } |
725 | ||
836b6989 | 726 | //_____________________________________ |
727 | void AliCaloTrackReader::FillInputCTS() | |
728 | { | |
f37fa8d2 | 729 | //Return array with Central Tracking System (CTS) tracks |
730 | ||
731 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n"); | |
732 | ||
c8fe2783 | 733 | Int_t nTracks = fInputEvent->GetNumberOfTracks() ; |
c8fe2783 | 734 | Double_t p[3]; |
3a58eee6 | 735 | fTrackMult = 0; |
736 | Int_t nstatus = 0; | |
c8fe2783 | 737 | for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop |
738 | AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd | |
836b6989 | 739 | |
3a58eee6 | 740 | //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits |
c8fe2783 | 741 | if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) |
742 | continue ; | |
743 | ||
3a58eee6 | 744 | nstatus++; |
745 | ||
a5fb4114 | 746 | if (fDataType==kESD && !fESDtrackCuts->AcceptTrack((AliESDtrack*)track)) |
747 | { | |
748 | continue; | |
749 | } | |
750 | else if(fDataType==kAOD) | |
751 | { | |
743aa53a | 752 | AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track); |
753 | if(aodtrack){ | |
754 | if(fDebug > 2 ) | |
755 | printf("AliCaloTrackReader::FillInputCTS():AOD track type: %c \n", aodtrack->GetType()); | |
836b6989 | 756 | if (fDataType!=kMC && aodtrack->TestFilterBit(fTrackFilterMask)==kFALSE) continue; |
743aa53a | 757 | if(aodtrack->GetType()!=AliAODTrack::kPrimary) continue; |
758 | } | |
a5fb4114 | 759 | } |
3b13c34c | 760 | |
3a58eee6 | 761 | //Count the tracks in eta < 0.9 |
762 | //printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut); | |
763 | if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++; | |
764 | ||
c8fe2783 | 765 | track->GetPxPyPz(p) ; |
766 | TLorentzVector momentum(p[0],p[1],p[2],0); | |
767 | ||
98ec971d | 768 | if(fCTSPtMin < momentum.Pt() && fCTSPtMax > momentum.Pt()){ |
c8fe2783 | 769 | |
770 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) | |
771 | continue; | |
772 | ||
773 | if(fDebug > 2 && momentum.Pt() > 0.1) | |
f37fa8d2 | 774 | printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", |
c8fe2783 | 775 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); |
776 | ||
777 | if (fMixedEvent) { | |
778 | track->SetID(itrack); | |
779 | } | |
f37fa8d2 | 780 | |
be518ab0 | 781 | fCTSTracks->Add(track); |
836b6989 | 782 | |
c8fe2783 | 783 | }//Pt and Fiducial cut passed. |
784 | }// track loop | |
785 | ||
be518ab0 | 786 | //fCTSTracksNormalInputEntries = fCTSTracks->GetEntriesFast(); |
3a58eee6 | 787 | if(fDebug > 1) |
be518ab0 | 788 | printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries); |
836b6989 | 789 | |
c8fe2783 | 790 | } |
791 | ||
836b6989 | 792 | //__________________________________________________________________ |
793 | void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, | |
794 | const Int_t iclus) | |
795 | { | |
c4eec29f | 796 | //Fill the EMCAL data in the array, do it |
797 | ||
798 | Int_t vindex = 0 ; | |
799 | if (fMixedEvent) | |
800 | vindex = fMixedEvent->EventIndexForCaloCluster(iclus); | |
801 | ||
a38a48f2 | 802 | //Reject clusters with bad channels, close to borders and exotic; |
a7e5a381 | 803 | if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return; |
48c37e02 | 804 | |
a5fb4114 | 805 | //Mask all cells in collumns facing ALICE thick material if requested |
806 | if(GetCaloUtils()->GetNMaskCellColumns()){ | |
807 | Int_t absId = -1; | |
808 | Int_t iSupMod = -1; | |
809 | Int_t iphi = -1; | |
810 | Int_t ieta = -1; | |
811 | Bool_t shared = kFALSE; | |
812 | GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared); | |
813 | if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return; | |
814 | } | |
815 | ||
6060ed91 | 816 | if(fSelectEmbeddedClusters){ |
1407394b | 817 | if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return; |
6060ed91 | 818 | //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel()); |
819 | } | |
836b6989 | 820 | |
b487d080 | 821 | //Float_t pos[3]; |
822 | //clus->GetPosition(pos); | |
823 | //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); | |
cfaba834 | 824 | |
b487d080 | 825 | if(fRecalculateClusters){ |
826 | //Recalibrate the cluster energy | |
827 | if(GetCaloUtils()->IsRecalibrationOn()) { | |
3bfc4732 | 828 | |
b487d080 | 829 | Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells()); |
9e8998b1 | 830 | |
b487d080 | 831 | clus->SetE(energy); |
832 | //printf("Recalibrated Energy %f\n",clus->E()); | |
9e8998b1 | 833 | |
b487d080 | 834 | GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus); |
835 | GetCaloUtils()->RecalculateClusterPID(clus); | |
9e8998b1 | 836 | |
b487d080 | 837 | } // recalculate E |
838 | ||
839 | //Recalculate distance to bad channels, if new list of bad channels provided | |
840 | GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus); | |
841 | ||
842 | //Recalculate cluster position | |
843 | if(GetCaloUtils()->IsRecalculationOfClusterPositionOn()){ | |
844 | GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus); | |
845 | //clus->GetPosition(pos); | |
846 | //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); | |
847 | } | |
848 | } | |
9e8998b1 | 849 | |
b487d080 | 850 | // Recalculate TOF |
851 | if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn()) { | |
9e8998b1 | 852 | |
b487d080 | 853 | Double_t tof = clus->GetTOF(); |
854 | Float_t frac =-1; | |
855 | Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac); | |
856 | ||
857 | if(fDataType==AliCaloTrackReader::kESD){ | |
858 | tof = fEMCALCells->GetCellTime(absIdMax); | |
3bfc4732 | 859 | } |
cfaba834 | 860 | |
b487d080 | 861 | GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof); |
c4eec29f | 862 | |
b487d080 | 863 | clus->SetTOF(tof); |
864 | ||
865 | }// Time recalibration | |
866 | ||
867 | //Correct non linearity | |
868 | if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn()){ | |
869 | GetCaloUtils()->CorrectClusterEnergy(clus) ; | |
870 | //printf("Linearity Corrected Energy %f\n",clus->E()); | |
871 | ||
872 | //In case of MC analysis, to match resolution/calibration in real data | |
873 | Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus); | |
874 | // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy); | |
875 | clus->SetE(rdmEnergy); | |
c4eec29f | 876 | } |
b487d080 | 877 | |
878 | TLorentzVector momentum ; | |
879 | ||
880 | clus->GetMomentum(momentum, fVertex[vindex]); | |
881 | ||
ca0c58aa | 882 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return; |
883 | ||
884 | if(fEMCALPtMin > momentum.E() || fEMCALPtMax < momentum.E()) return; | |
b487d080 | 885 | |
886 | if(fDebug > 2 && momentum.E() > 0.1) | |
887 | printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", | |
888 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
836b6989 | 889 | |
b487d080 | 890 | if (fMixedEvent) |
891 | clus->SetID(iclus) ; | |
892 | ||
893 | fEMCALClusters->Add(clus); | |
894 | ||
c4eec29f | 895 | } |
896 | ||
836b6989 | 897 | //_______________________________________ |
898 | void AliCaloTrackReader::FillInputEMCAL() | |
899 | { | |
f37fa8d2 | 900 | //Return array with EMCAL clusters in aod format |
c8fe2783 | 901 | |
f37fa8d2 | 902 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n"); |
903 | ||
3bfc4732 | 904 | // First recalibrate cells, time or energy |
905 | // if(GetCaloUtils()->IsRecalibrationOn()) | |
906 | // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(), | |
907 | // GetEMCALCells(), | |
908 | // fInputEvent->GetBunchCrossNumber()); | |
909 | ||
f37fa8d2 | 910 | //Loop to select clusters in fiducial cut and fill container with aodClusters |
c4eec29f | 911 | if(fEMCALClustersListName==""){ |
912 | Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); | |
913 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
914 | AliVCluster * clus = 0; | |
915 | if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) { | |
916 | if (IsEMCALCluster(clus)){ | |
917 | FillInputEMCALAlgorithm(clus, iclus); | |
918 | }//EMCAL cluster | |
919 | }// cluster exists | |
920 | }// cluster loop | |
385b7abf | 921 | |
922 | //Recalculate track matching | |
a38a48f2 | 923 | GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent); |
385b7abf | 924 | |
c4eec29f | 925 | }//Get the clusters from the input event |
926 | else { | |
a757b40b | 927 | TClonesArray * clusterList = 0x0; |
928 | if(fOutputEvent) clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName)); | |
c4eec29f | 929 | if(!clusterList){ |
1407394b | 930 | //printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? Try input event <%s>\n",fEMCALClustersListName.Data()); |
931 | //List not in output event, try input event | |
932 | clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName)); | |
933 | if(!clusterList){ | |
934 | printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data()); | |
935 | return; | |
936 | } | |
c4eec29f | 937 | } |
ca0c58aa | 938 | |
c4eec29f | 939 | Int_t nclusters = clusterList->GetEntriesFast(); |
940 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
941 | AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus)); | |
942 | //printf("E %f\n",clus->E()); | |
e615d952 | 943 | if (clus) FillInputEMCALAlgorithm(clus, iclus); |
944 | else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n"); | |
385b7abf | 945 | |
c4eec29f | 946 | }// cluster loop |
385b7abf | 947 | |
cb5780f4 | 948 | // Recalculate track matching, not necessary if already done in the reclusterization task. |
949 | // in case it was not done ... | |
950 | GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList); | |
385b7abf | 951 | |
c4eec29f | 952 | } |
836b6989 | 953 | |
b487d080 | 954 | if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d\n", fEMCALClusters->GetEntriesFast()); |
c8fe2783 | 955 | |
c8fe2783 | 956 | } |
957 | ||
836b6989 | 958 | //______________________________________ |
959 | void AliCaloTrackReader::FillInputPHOS() | |
960 | { | |
f37fa8d2 | 961 | //Return array with PHOS clusters in aod format |
c8fe2783 | 962 | |
f37fa8d2 | 963 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n"); |
b487d080 | 964 | |
f37fa8d2 | 965 | //Loop to select clusters in fiducial cut and fill container with aodClusters |
c8fe2783 | 966 | Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); |
967 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
968 | AliVCluster * clus = 0; | |
969 | if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) { | |
f37fa8d2 | 970 | if (IsPHOSCluster(clus)){ |
971 | //Check if the cluster contains any bad channel and if close to calorimeter borders | |
c8fe2783 | 972 | Int_t vindex = 0 ; |
973 | if (fMixedEvent) | |
974 | vindex = fMixedEvent->EventIndexForCaloCluster(iclus); | |
975 | if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) | |
976 | continue; | |
977 | if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex)) | |
978 | continue; | |
836b6989 | 979 | |
b487d080 | 980 | if(fRecalculateClusters){ |
981 | ||
982 | //Recalibrate the cluster energy | |
983 | if(GetCaloUtils()->IsRecalibrationOn()) { | |
984 | Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells()); | |
985 | clus->SetE(energy); | |
986 | } | |
987 | ||
988 | } | |
c8fe2783 | 989 | |
990 | TLorentzVector momentum ; | |
991 | ||
992 | clus->GetMomentum(momentum, fVertex[vindex]); | |
993 | ||
ca0c58aa | 994 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue; |
995 | ||
996 | if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue; | |
b487d080 | 997 | |
998 | if(fDebug > 2 && momentum.E() > 0.1) | |
999 | printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", | |
1000 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
1001 | ||
b487d080 | 1002 | |
1003 | if (fMixedEvent) { | |
1004 | clus->SetID(iclus) ; | |
1005 | } | |
1006 | ||
1007 | fPHOSClusters->Add(clus); | |
1008 | ||
c8fe2783 | 1009 | }//PHOS cluster |
1010 | }//cluster exists | |
1011 | }//esd cluster loop | |
1012 | ||
b487d080 | 1013 | if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast()); |
1014 | ||
c8fe2783 | 1015 | } |
1016 | ||
836b6989 | 1017 | //____________________________________________ |
1018 | void AliCaloTrackReader::FillInputEMCALCells() | |
1019 | { | |
743aa53a | 1020 | //Return array with EMCAL cells in aod format |
c8fe2783 | 1021 | |
1022 | fEMCALCells = fInputEvent->GetEMCALCells(); | |
1023 | ||
1024 | } | |
1025 | ||
836b6989 | 1026 | //___________________________________________ |
1027 | void AliCaloTrackReader::FillInputPHOSCells() | |
1028 | { | |
743aa53a | 1029 | //Return array with PHOS cells in aod format |
c8fe2783 | 1030 | |
1031 | fPHOSCells = fInputEvent->GetPHOSCells(); | |
1032 | ||
1033 | } | |
1034 | ||
836b6989 | 1035 | //_______________________________________ |
1036 | void AliCaloTrackReader::FillInputVZERO() | |
1037 | { | |
be518ab0 | 1038 | //Fill VZERO information in data member, add all the channels information. |
1039 | AliVVZERO* v0 = fInputEvent->GetVZEROData(); | |
1040 | //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]); | |
1041 | ||
1042 | if (v0) | |
1043 | { | |
1044 | AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0); | |
1045 | for (Int_t i = 0; i < 32; i++) | |
1046 | { | |
1047 | if(esdV0){//Only available in ESDs | |
1048 | fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i); | |
1049 | fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i); | |
1050 | } | |
1051 | fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i); | |
1052 | fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i); | |
1053 | } | |
1054 | if(fDebug > 0) | |
1055 | printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]); | |
1056 | } | |
1057 | else | |
1058 | { | |
713a258b | 1059 | if(fDebug > 0) |
1060 | printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n "); | |
be518ab0 | 1061 | } |
1062 | } | |
1063 | ||
798a9b04 | 1064 | |
c5693f62 | 1065 | //___________________________________________________________________ |
1066 | Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const | |
1067 | { | |
f37fa8d2 | 1068 | // Check if it is a cluster from EMCAL. For old AODs cluster type has |
1069 | // different number and need to patch here | |
836b6989 | 1070 | |
f37fa8d2 | 1071 | if(fDataType==kAOD && fOldAOD) |
1072 | { | |
1073 | if (cluster->GetType() == 2) return kTRUE; | |
1074 | else return kFALSE; | |
1075 | } | |
1076 | else | |
1077 | { | |
1078 | return cluster->IsEMCAL(); | |
1079 | } | |
836b6989 | 1080 | |
f37fa8d2 | 1081 | } |
1082 | ||
c5693f62 | 1083 | //___________________________________________________________________ |
1084 | Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const | |
1085 | { | |
f37fa8d2 | 1086 | //Check if it is a cluster from PHOS.For old AODs cluster type has |
1087 | // different number and need to patch here | |
1088 | ||
1089 | if(fDataType==kAOD && fOldAOD) | |
1090 | { | |
1091 | Int_t type = cluster->GetType(); | |
1092 | if (type == 0 || type == 1) return kTRUE; | |
1093 | else return kFALSE; | |
1094 | } | |
1095 | else | |
1096 | { | |
1097 | return cluster->IsPHOS(); | |
1098 | } | |
1099 | ||
1100 | } | |
1101 | ||
c5693f62 | 1102 | //________________________________________________ |
1103 | Bool_t AliCaloTrackReader::CheckForPrimaryVertex() | |
1104 | { | |
48c37e02 | 1105 | //Check if the vertex was well reconstructed, copy from V0Reader of conversion group |
1106 | //Only for ESDs ... | |
ad30b142 | 1107 | |
48c37e02 | 1108 | AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent); |
20218aea | 1109 | if(!event) return kTRUE; |
ad30b142 | 1110 | |
1111 | if(event->GetPrimaryVertexTracks()->GetNContributors() > 0) { | |
1112 | return kTRUE; | |
1113 | } | |
1114 | ||
1115 | if(event->GetPrimaryVertexTracks()->GetNContributors() < 1) { | |
1116 | // SPD vertex | |
1117 | if(event->GetPrimaryVertexSPD()->GetNContributors() > 0) { | |
1118 | //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl; | |
48c37e02 | 1119 | return kTRUE; |
ad30b142 | 1120 | |
48c37e02 | 1121 | } |
ad30b142 | 1122 | if(event->GetPrimaryVertexSPD()->GetNContributors() < 1) { |
1123 | // cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl; | |
1124 | return kFALSE; | |
48c37e02 | 1125 | } |
48c37e02 | 1126 | } |
1127 | ||
ad30b142 | 1128 | return kFALSE; |
48c37e02 | 1129 | |
1130 | } | |
1131 | ||
c5693f62 | 1132 | //____________________________________________________________ |
1133 | void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts) | |
1134 | { | |
1135 | // Set Track cuts | |
1136 | ||
1137 | if(fESDtrackCuts) delete fESDtrackCuts ; | |
1138 | ||
1139 | fESDtrackCuts = cuts ; | |
836b6989 | 1140 | |
c5693f62 | 1141 | } |
48c37e02 | 1142 |