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