]>
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) |
22 | // : AliCaloTrackMCReader: Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS) | |
23 | // : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS) | |
1c5acb87 | 24 | // |
25 | //-- Author: Gustavo Conesa (LNF-INFN) | |
26 | ////////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | ||
29 | // --- ROOT system --- | |
591cc579 | 30 | #include "TFile.h" |
4e2b43d8 | 31 | #include "TGeoManager.h" |
1c5acb87 | 32 | |
33 | //---- ANALYSIS system ---- | |
34 | #include "AliCaloTrackReader.h" | |
ff45398a | 35 | #include "AliFiducialCut.h" |
477d6cee | 36 | #include "AliMCEvent.h" |
591cc579 | 37 | #include "AliAODMCHeader.h" |
38 | #include "AliGenPythiaEventHeader.h" | |
8dacfd76 | 39 | #include "AliAODEvent.h" |
0866d83a | 40 | #include "AliESDEvent.h" |
1c5acb87 | 41 | |
42 | ClassImp(AliCaloTrackReader) | |
43 | ||
44 | ||
45 | //____________________________________________________________________________ | |
46 | AliCaloTrackReader::AliCaloTrackReader() : | |
a79a2424 | 47 | TObject(), fEventNumber(-1), fCurrentFileName(""),fDataType(0), fDebug(0), |
ff45398a | 48 | fFiducialCut(0x0), fComparePtHardAndJetPt(kFALSE), fPtHardAndJetPtFactor(7), |
1c5acb87 | 49 | fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0), |
591cc579 | 50 | fAODCTS(new TObjArray()), fAODEMCAL(new TObjArray()), fAODPHOS(new TObjArray()), |
1c5acb87 | 51 | fEMCALCells(0x0), fPHOSCells(0x0), |
477d6cee | 52 | fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0), |
1c5acb87 | 53 | fFillCTS(0),fFillEMCAL(0),fFillPHOS(0), |
591cc579 | 54 | fFillEMCALCells(0),fFillPHOSCells(0), |
afabc52f | 55 | fSecondInputAODTree(0x0), fSecondInputAODEvent(0x0), |
56 | fSecondInputFileName(""),fSecondInputFirstEvent(0), | |
57 | fAODCTSNormalInputEntries(0), fAODEMCALNormalInputEntries(0), | |
591cc579 | 58 | fAODPHOSNormalInputEntries(0), fTrackStatus(0), |
afabc52f | 59 | fReadStack(kFALSE), fReadAODMCParticles(kFALSE), |
60 | fCleanOutputStdAOD(kFALSE), fDeltaAODFileName("deltaAODPartCorr.root"),fFiredTriggerClassName(""), | |
0866d83a | 61 | fEMCALGeoName("EMCAL_COMPLETE"),fPHOSGeoName("PHOSgeo"), |
c1ac3823 | 62 | fEMCALGeo(0x0), fPHOSGeo(0x0), fEMCALGeoMatrixSet(kFALSE), fPHOSGeoMatrixSet(kFALSE), fAnaLED(kFALSE), |
63 | fRemoveBadChannels(kFALSE),fEMCALBadChannelMap(0),fPHOSBadChannelMap(0) | |
1c5acb87 | 64 | { |
65 | //Ctor | |
66 | ||
67 | //Initialize parameters | |
68 | InitParameters(); | |
69 | } | |
70 | ||
71 | //____________________________________________________________________________ | |
72 | AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) : | |
a79a2424 | 73 | TObject(g), fEventNumber(g.fEventNumber), fCurrentFileName(g.fCurrentFileName), |
74 | fDataType(g.fDataType), fDebug(g.fDebug), | |
ff45398a | 75 | fFiducialCut(g.fFiducialCut), |
591cc579 | 76 | fComparePtHardAndJetPt(g.fComparePtHardAndJetPt), |
77 | fPtHardAndJetPtFactor(g.fPtHardAndJetPtFactor), | |
1c5acb87 | 78 | fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin), |
591cc579 | 79 | fAODCTS(new TObjArray(*g.fAODCTS)), |
80 | fAODEMCAL(new TObjArray(*g.fAODEMCAL)), | |
81 | fAODPHOS(new TObjArray(*g.fAODPHOS)), | |
1c5acb87 | 82 | fEMCALCells(new TNamed(*g.fEMCALCells)), |
83 | fPHOSCells(new TNamed(*g.fPHOSCells)), | |
477d6cee | 84 | fInputEvent(g.fInputEvent), fOutputEvent(g.fOutputEvent), fMC(g.fMC), |
1c5acb87 | 85 | fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS), |
591cc579 | 86 | fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells), |
87 | fSecondInputAODTree(g.fSecondInputAODTree), | |
88 | fSecondInputAODEvent(g.fSecondInputAODEvent), | |
89 | fSecondInputFileName(g.fSecondInputFileName), | |
90 | fSecondInputFirstEvent(g.fSecondInputFirstEvent), | |
91 | fAODCTSNormalInputEntries(g.fAODCTSNormalInputEntries), | |
92 | fAODEMCALNormalInputEntries(g.fAODEMCALNormalInputEntries), | |
93 | fAODPHOSNormalInputEntries(g.fAODPHOSNormalInputEntries), | |
94 | fTrackStatus(g.fTrackStatus), | |
42dc8e7d | 95 | fReadStack(g.fReadStack), fReadAODMCParticles(g.fReadAODMCParticles), |
72d2488e | 96 | fCleanOutputStdAOD(g.fCleanOutputStdAOD), fDeltaAODFileName(g.fDeltaAODFileName), |
afabc52f | 97 | fFiredTriggerClassName(g.fFiredTriggerClassName), |
0866d83a | 98 | fEMCALGeoName(g.fEMCALGeoName), fPHOSGeoName(g.fPHOSGeoName), |
7ec23b5a | 99 | fEMCALGeo(new AliEMCALGeoUtils(*g.fEMCALGeo)), fPHOSGeo(new AliPHOSGeoUtils(*g.fPHOSGeo)), |
c1ac3823 | 100 | fEMCALGeoMatrixSet(g.fEMCALGeoMatrixSet), fPHOSGeoMatrixSet(g.fPHOSGeoMatrixSet), |
101 | fAnaLED(g.fAnaLED), fRemoveBadChannels(g.fRemoveBadChannels), | |
102 | fEMCALBadChannelMap(g.fEMCALBadChannelMap),fPHOSBadChannelMap(g.fPHOSBadChannelMap) | |
1c5acb87 | 103 | { |
104 | // cpy ctor | |
105 | ||
106 | } | |
107 | ||
108 | //_________________________________________________________________________ | |
109 | AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source) | |
110 | { | |
111 | // assignment operator | |
112 | ||
113 | if(&source == this) return *this; | |
114 | ||
6639984f | 115 | fDataType = source.fDataType ; |
116 | fDebug = source.fDebug ; | |
117 | fEventNumber = source.fEventNumber ; | |
a79a2424 | 118 | fCurrentFileName = source.fCurrentFileName ; |
ff45398a | 119 | fFiducialCut = source.fFiducialCut; |
591cc579 | 120 | |
29b2ceec | 121 | fComparePtHardAndJetPt = source.fComparePtHardAndJetPt; |
591cc579 | 122 | fPtHardAndJetPtFactor = source.fPtHardAndJetPtFactor; |
123 | ||
29b2ceec | 124 | fCTSPtMin = source.fCTSPtMin ; |
125 | fEMCALPtMin = source.fEMCALPtMin ; | |
126 | fPHOSPtMin = source.fPHOSPtMin ; | |
1c5acb87 | 127 | |
591cc579 | 128 | fAODCTS = new TObjArray(*source.fAODCTS) ; |
129 | fAODEMCAL = new TObjArray(*source.fAODEMCAL) ; | |
130 | fAODPHOS = new TObjArray(*source.fAODPHOS) ; | |
1c5acb87 | 131 | fEMCALCells = new TNamed(*source.fEMCALCells) ; |
6639984f | 132 | fPHOSCells = new TNamed(*source.fPHOSCells) ; |
1c5acb87 | 133 | |
477d6cee | 134 | fInputEvent = source.fInputEvent; |
135 | fOutputEvent = source.fOutputEvent; | |
136 | fMC = source.fMC; | |
1c5acb87 | 137 | |
6639984f | 138 | fFillCTS = source.fFillCTS; |
139 | fFillEMCAL = source.fFillEMCAL; | |
140 | fFillPHOS = source.fFillPHOS; | |
1c5acb87 | 141 | fFillEMCALCells = source.fFillEMCALCells; |
6639984f | 142 | fFillPHOSCells = source.fFillPHOSCells; |
1c5acb87 | 143 | |
591cc579 | 144 | fSecondInputAODTree = source.fSecondInputAODTree; |
145 | fSecondInputAODEvent = source.fSecondInputAODEvent; | |
146 | fSecondInputFileName = source.fSecondInputFileName; | |
147 | fSecondInputFirstEvent = source.fSecondInputFirstEvent; | |
148 | ||
149 | fAODCTSNormalInputEntries = source.fAODCTSNormalInputEntries; | |
150 | fAODEMCALNormalInputEntries = source.fAODEMCALNormalInputEntries; | |
151 | fAODPHOSNormalInputEntries = source.fAODPHOSNormalInputEntries; | |
152 | ||
153 | fTrackStatus = source.fTrackStatus; | |
154 | fReadStack = source.fReadStack; | |
155 | fReadAODMCParticles = source.fReadAODMCParticles; | |
156 | ||
08a064bc | 157 | fCleanOutputStdAOD = source.fCleanOutputStdAOD; |
42dc8e7d | 158 | fDeltaAODFileName = source.fDeltaAODFileName; |
159 | ||
0866d83a | 160 | fFiredTriggerClassName = source.fFiredTriggerClassName ; |
afabc52f | 161 | |
0866d83a | 162 | fEMCALGeoName = source.fEMCALGeoName ; |
163 | fPHOSGeoName = source.fPHOSGeoName ; | |
7ec23b5a | 164 | fEMCALGeo = new AliEMCALGeoUtils(*source.fEMCALGeo); |
165 | fPHOSGeo = new AliPHOSGeoUtils(*source.fPHOSGeo); | |
0866d83a | 166 | fEMCALGeoMatrixSet = source.fEMCALGeoMatrixSet; |
167 | fPHOSGeoMatrixSet = source.fPHOSGeoMatrixSet; | |
c1ac3823 | 168 | fAnaLED = source.fAnaLED; |
169 | fRemoveBadChannels = source.fRemoveBadChannels; | |
170 | fEMCALBadChannelMap= source.fEMCALBadChannelMap; | |
171 | fPHOSBadChannelMap = source.fPHOSBadChannelMap; | |
0866d83a | 172 | |
c1ac3823 | 173 | |
1c5acb87 | 174 | return *this; |
175 | ||
176 | } | |
177 | ||
178 | //_________________________________ | |
179 | AliCaloTrackReader::~AliCaloTrackReader() { | |
180 | //Dtor | |
181 | ||
ff45398a | 182 | if(fFiducialCut) delete fFiducialCut ; |
29b2ceec | 183 | |
1c5acb87 | 184 | if(fAODCTS){ |
185 | fAODCTS->Clear() ; | |
186 | delete fAODCTS ; | |
187 | } | |
188 | ||
189 | if(fAODEMCAL){ | |
190 | fAODEMCAL->Clear() ; | |
191 | delete fAODEMCAL ; | |
192 | } | |
193 | ||
194 | if(fAODPHOS){ | |
195 | fAODPHOS->Clear() ; | |
196 | delete fAODPHOS ; | |
197 | } | |
198 | ||
199 | if(fEMCALCells){ | |
200 | fEMCALCells->Clear() ; | |
201 | delete fEMCALCells ; | |
202 | } | |
203 | ||
204 | if(fPHOSCells){ | |
205 | fPHOSCells->Clear() ; | |
206 | delete fPHOSCells ; | |
207 | } | |
208 | ||
477d6cee | 209 | if(fInputEvent) delete fInputEvent ; |
210 | if(fOutputEvent) delete fOutputEvent ; | |
591cc579 | 211 | if(fMC) delete fMC ; |
212 | ||
213 | if(fSecondInputAODTree){ | |
afabc52f | 214 | fSecondInputAODTree->Clear(); |
215 | delete fSecondInputAODTree; | |
591cc579 | 216 | } |
217 | ||
218 | if(fSecondInputAODEvent) delete fSecondInputAODEvent ; | |
219 | ||
afabc52f | 220 | if(fPHOSGeo) delete fPHOSGeo ; |
221 | if(fEMCALGeo) delete fEMCALGeo ; | |
222 | ||
f7c2338a | 223 | fEMCALBadChannelMap.Delete(); |
224 | fPHOSBadChannelMap. Delete(); | |
225 | ||
1c5acb87 | 226 | } |
227 | ||
c1ac3823 | 228 | //_________________________________________________________________________________________________________ |
229 | Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells){ | |
230 | // Check that in the cluster cells, there is no bad channel of those stored | |
231 | // in fEMCALBadChannelMap or fPHOSBadChannelMap | |
232 | ||
233 | if (!fRemoveBadChannels) return kFALSE; | |
234 | ||
235 | Int_t icol = -1; | |
236 | Int_t irow = -1; | |
237 | Int_t imod = -1; | |
238 | for(Int_t iCell = 0; iCell<nCells; iCell++){ | |
239 | ||
240 | //Get the column and row | |
241 | if(calorimeter == "EMCAL"){ | |
242 | Int_t iTower = -1, iIphi = -1, iIeta = -1; | |
243 | fEMCALGeo->GetCellIndex(cellList[iCell],imod,iTower,iIphi,iIeta); | |
244 | fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol); | |
245 | if(GetEMCALChannelStatus(imod, icol, irow))return kTRUE; | |
246 | } | |
247 | else if(calorimeter=="PHOS"){ | |
248 | Int_t relId[4]; | |
249 | fPHOSGeo->AbsToRelNumbering(cellList[iCell],relId); | |
250 | irow = relId[2]; | |
251 | icol = relId[3]; | |
252 | imod = relId[0]-1; | |
253 | if(GetPHOSChannelStatus(imod, icol, irow)) return kTRUE; | |
254 | } | |
255 | else return kFALSE; | |
256 | ||
257 | }// cell cluster loop | |
258 | ||
259 | return kFALSE; | |
260 | ||
261 | } | |
477d6cee | 262 | |
591cc579 | 263 | //_________________________________________________________________________ |
264 | Bool_t AliCaloTrackReader::ComparePtHardAndJetPt(){ | |
265 | // Check the event, if the requested ptHard is much larger than the jet pT, then there is a problem. | |
266 | // Only for PYTHIA. | |
267 | if(!fReadStack) return kTRUE; //Information not filtered to AOD | |
268 | ||
269 | if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader")){ | |
270 | TParticle * jet = new TParticle; | |
271 | AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader(); | |
272 | Int_t nTriggerJets = pygeh->NTriggerJets(); | |
273 | Float_t ptHard = pygeh->GetPtHard(); | |
274 | ||
275 | //if(fDebug > 1) printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %f\n",nTriggerJets, ptHard); | |
276 | Float_t tmpjet[]={0,0,0,0}; | |
277 | for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){ | |
278 | pygeh->TriggerJet(ijet, tmpjet); | |
279 | jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0); | |
280 | //Compare jet pT and pt Hard | |
281 | //if(fDebug > 1) printf("AliMCAnalysisUtils:: %d pycell jet pT %f\n",ijet, jet->Pt()); | |
282 | if(jet->Pt() > fPtHardAndJetPtFactor * ptHard) { | |
283 | printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", | |
284 | nTriggerJets, ptHard, jet->Pt(), fPtHardAndJetPtFactor); | |
285 | return kFALSE; | |
286 | } | |
287 | } | |
288 | } | |
289 | ||
290 | return kTRUE ; | |
291 | ||
292 | } | |
293 | ||
1c5acb87 | 294 | //____________________________________________________________________________ |
295 | AliStack* AliCaloTrackReader::GetStack() const { | |
296 | //Return pointer to stack | |
297 | if(fMC) | |
298 | return fMC->Stack(); | |
299 | else{ | |
477d6cee | 300 | if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n"); |
1c5acb87 | 301 | return 0x0 ; |
302 | } | |
303 | } | |
304 | ||
305 | //____________________________________________________________________________ | |
306 | AliHeader* AliCaloTrackReader::GetHeader() const { | |
307 | //Return pointer to header | |
308 | if(fMC) | |
309 | return fMC->Header(); | |
310 | else{ | |
477d6cee | 311 | printf("AliCaloTrackReader::Header is not available\n"); |
1c5acb87 | 312 | return 0x0 ; |
313 | } | |
314 | } | |
315 | //____________________________________________________________________________ | |
316 | AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const { | |
317 | //Return pointer to Generated event header | |
318 | if(fMC) | |
319 | return fMC->GenEventHeader(); | |
320 | else{ | |
477d6cee | 321 | printf("AliCaloTrackReader::GenEventHeader is not available\n"); |
1c5acb87 | 322 | return 0x0 ; |
323 | } | |
324 | } | |
325 | ||
591cc579 | 326 | //____________________________________________________________________________ |
327 | TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const { | |
328 | //Return list of particles in AOD. Do it for the corresponding input event. | |
329 | if(fDataType == kAOD){ | |
330 | //Normal input AOD | |
331 | if(input == 0) return (TClonesArray*)((AliAODEvent*)fInputEvent)->FindListObject("mcparticles"); | |
332 | //Second input AOD | |
333 | else if(input == 1 && fSecondInputAODEvent) return (TClonesArray*) fSecondInputAODEvent->FindListObject("mcparticles"); | |
334 | else { | |
335 | printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); | |
336 | return 0x0; | |
337 | } | |
338 | } | |
339 | else { | |
340 | printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); | |
341 | return 0x0; | |
342 | } | |
343 | } | |
344 | ||
345 | //____________________________________________________________________________ | |
346 | AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader(Int_t input) const { | |
347 | //Return MC header in AOD. Do it for the corresponding input event. | |
348 | if(fDataType == kAOD){ | |
349 | //Normal input AOD | |
350 | if(input == 0) return (AliAODMCHeader*)((AliAODEvent*)fInputEvent)->FindListObject("mcheader"); | |
351 | //Second input AOD | |
352 | else if(input == 1) return (AliAODMCHeader*) fSecondInputAODEvent->FindListObject("mcheader"); | |
353 | else { | |
354 | printf("AliCaloTrackReader::GetAODMCHeader() - wrong AOD input index, %d\n",input); | |
355 | return 0x0; | |
356 | } | |
357 | } | |
358 | else { | |
359 | printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n"); | |
360 | return 0x0; | |
361 | } | |
362 | } | |
363 | ||
364 | //_______________________________________________________________ | |
365 | void AliCaloTrackReader::Init() | |
366 | { | |
367 | //Init reader. Method to be called in AliAnaPartCorrMaker | |
368 | ||
369 | //Get the file with second input events if the filename is given | |
370 | //Get the tree and connect the AODEvent. Only with AODs | |
f1f0bd84 | 371 | |
591cc579 | 372 | if(fReadStack && fReadAODMCParticles){ |
373 | printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n"); | |
374 | fReadStack = kFALSE; | |
375 | fReadAODMCParticles = kFALSE; | |
376 | } | |
377 | ||
591cc579 | 378 | if(fSecondInputFileName!=""){ |
379 | if(fDataType == kAOD){ | |
380 | TFile * input2 = new TFile(fSecondInputFileName,"read"); | |
ddcb0d54 | 381 | printf("AliCaloTrackReader::Init() - Second input file opened: %s, size %d \n", input2->GetName(), (Int_t) input2->GetSize()); |
591cc579 | 382 | fSecondInputAODTree = (TTree*) input2->Get("aodTree"); |
ddcb0d54 | 383 | if(fSecondInputAODTree) printf("AliCaloTrackReader::Init() - Second input tree opened: %s, entries %d \n", |
384 | fSecondInputAODTree->GetName(), (Int_t) fSecondInputAODTree->GetEntries()); | |
385 | else{ | |
386 | printf("AliCaloTrackReader::Init() - Second input tree not available, STOP \n"); | |
387 | abort(); | |
388 | } | |
591cc579 | 389 | fSecondInputAODEvent = new AliAODEvent; |
390 | fSecondInputAODEvent->ReadFromTree(fSecondInputAODTree); | |
391 | if(fSecondInputFirstEvent >= fSecondInputAODTree->GetEntriesFast()){ | |
392 | printf("AliCaloTrackReader::Init() - Requested first event of second input %d, is larger than number of events %d, STOP\n", | |
393 | fSecondInputFirstEvent, (Int_t) fSecondInputAODTree->GetEntriesFast()); | |
394 | abort(); | |
395 | } | |
396 | } | |
397 | else printf("AliCaloTrackReader::Init() - Second input not added, reader is not AOD\n"); | |
398 | } | |
591cc579 | 399 | } |
1c5acb87 | 400 | //_______________________________________________________________ |
401 | void AliCaloTrackReader::InitParameters() | |
402 | { | |
403 | ||
404 | //Initialize the parameters of the analysis. | |
591cc579 | 405 | fDataType = kESD ; |
1c5acb87 | 406 | fCTSPtMin = 0.2 ; |
29b2ceec | 407 | fEMCALPtMin = 0.2 ; |
408 | fPHOSPtMin = 0.2 ; | |
1c5acb87 | 409 | |
902aa95c | 410 | //Do not filter the detectors input by default. |
411 | fFillEMCAL = kFALSE; | |
412 | fFillPHOS = kFALSE; | |
413 | fFillCTS = kFALSE; | |
1c5acb87 | 414 | fFillEMCALCells = kFALSE; |
591cc579 | 415 | fFillPHOSCells = kFALSE; |
1c5acb87 | 416 | |
ff45398a | 417 | fFiducialCut = new AliFiducialCut(); |
591cc579 | 418 | fSecondInputFileName = "" ; |
419 | fSecondInputFirstEvent = 0 ; | |
420 | fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file | |
421 | fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file | |
08a064bc | 422 | fCleanOutputStdAOD = kFALSE; // Clean the standard clusters/tracks? |
42dc8e7d | 423 | fDeltaAODFileName = "deltaAODPartCorr.root"; |
72d2488e | 424 | fFiredTriggerClassName = ""; |
afabc52f | 425 | fEMCALGeoName = "EMCAL_COMPLETE"; |
426 | fPHOSGeoName = "PHOSgeo"; | |
4a461b2b | 427 | |
428 | if(gGeoManager) {// geoManager was set | |
429 | printf("Geometry manager available\n"); | |
430 | fEMCALGeoMatrixSet = kTRUE; | |
431 | fPHOSGeoMatrixSet = kTRUE; | |
432 | } | |
433 | else{ | |
434 | fEMCALGeoMatrixSet = kFALSE; | |
435 | fPHOSGeoMatrixSet = kFALSE; | |
436 | } | |
afabc52f | 437 | |
c1ac3823 | 438 | fAnaLED = kFALSE; |
439 | ||
440 | fRemoveBadChannels = kFALSE; | |
441 | ||
442 | for (int i = 0; i < 12; i++) | |
443 | fEMCALBadChannelMap.Add(new TH2I(Form("EMCALBadChannelMap_SM%d",i),Form("EMCALBadChannelMap_SM%d",i), | |
444 | 48, 0, 48, 24, 0, 24)); | |
445 | ||
446 | for (int i = 0; i < 5; i++) | |
447 | fPHOSBadChannelMap.Add(new TH2I(Form("PHOSBadChannelMap_Mod%d",i),Form("PHOSBadChannelMap_Mod%d",i), | |
448 | 56, 0, 56, 64, 0, 64)); | |
f7c2338a | 449 | fEMCALBadChannelMap.SetOwner(kTRUE); |
450 | fPHOSBadChannelMap. SetOwner(kTRUE); | |
c1ac3823 | 451 | fEMCALBadChannelMap.Compress(); |
f7c2338a | 452 | fPHOSBadChannelMap. Compress(); |
c1ac3823 | 453 | |
1c5acb87 | 454 | } |
455 | ||
4e2b43d8 | 456 | //________________________________________________________________ |
457 | void AliCaloTrackReader::InitEMCALGeometry() | |
458 | { | |
459 | //Initialize EMCAL geometry if it did not exist previously | |
460 | if (!fEMCALGeo){ | |
461 | fEMCALGeo = new AliEMCALGeoUtils(fEMCALGeoName); | |
0866d83a | 462 | if (!gGeoManager && fDebug > 0) printf("AliCaloTrackReader::InitEMCALGeometry() - Careful!, gGeoManager not loaded, load misalign matrices\n"); |
4e2b43d8 | 463 | } |
464 | } | |
465 | ||
466 | //________________________________________________________________ | |
467 | void AliCaloTrackReader::InitPHOSGeometry() | |
468 | { | |
469 | //Initialize PHOS geometry if it did not exist previously | |
470 | if (!fPHOSGeo){ | |
471 | fPHOSGeo = new AliPHOSGeoUtils(fPHOSGeoName); | |
0866d83a | 472 | if (!gGeoManager && fDebug > 0) printf("AliCaloTrackReader::InitPHOSGeometry() - Careful!, gGeoManager not loaded, load misalign matrices\n"); |
4e2b43d8 | 473 | } |
474 | } | |
1c5acb87 | 475 | |
476 | //________________________________________________________________ | |
477 | void AliCaloTrackReader::Print(const Option_t * opt) const | |
478 | { | |
479 | ||
480 | //Print some relevant parameters set for the analysis | |
481 | if(! opt) | |
482 | return; | |
483 | ||
484 | printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; | |
485 | printf("Data type : %d\n", fDataType) ; | |
486 | printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; | |
487 | printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; | |
488 | printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ; | |
489 | printf("Use CTS = %d\n", fFillCTS) ; | |
490 | printf("Use EMCAL = %d\n", fFillEMCAL) ; | |
491 | printf("Use PHOS = %d\n", fFillPHOS) ; | |
492 | printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ; | |
493 | printf("Use PHOS Cells = %d\n", fFillPHOSCells) ; | |
591cc579 | 494 | printf("Track status = %d\n", (Int_t) fTrackStatus) ; |
495 | if(fComparePtHardAndJetPt) | |
496 | printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor); | |
497 | ||
498 | if(fSecondInputFileName!="") { | |
499 | printf("Second Input File Name = %s\n", fSecondInputFileName.Data()) ; | |
500 | printf("Second Input First Event = %d\n", fSecondInputFirstEvent) ; | |
501 | } | |
502 | ||
42dc8e7d | 503 | printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ; |
08a064bc | 504 | printf("Clean std AOD = %d\n", fCleanOutputStdAOD) ; |
42dc8e7d | 505 | printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ; |
c1ac3823 | 506 | printf("Rremove Clusters with bad channels? %d\n",fRemoveBadChannels); |
1c5acb87 | 507 | printf(" \n") ; |
508 | } | |
509 | ||
510 | //___________________________________________________ | |
29b2ceec | 511 | Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * currentFileName) { |
6639984f | 512 | //Fill the event counter and input lists that are needed, called by the analysis maker. |
902aa95c | 513 | |
6639984f | 514 | fEventNumber = iEntry; |
a79a2424 | 515 | fCurrentFileName = TString(currentFileName); |
be1f5fa4 | 516 | if(!fInputEvent) { |
f7c2338a | 517 | if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n"); |
be1f5fa4 | 518 | return kFALSE; |
519 | } | |
72d2488e | 520 | //Select events only fired by a certain trigger configuration if it is provided |
be1f5fa4 | 521 | Int_t eventType = 0; |
522 | if(fInputEvent->GetHeader()) | |
523 | eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType(); | |
c1ac3823 | 524 | if( fFiredTriggerClassName !="" && !fAnaLED){ |
525 | if(eventType!=7)return kFALSE; //Only physics event, do not use for simulated events!!! | |
7ec23b5a | 526 | if(fDebug > 0) |
527 | printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n", | |
528 | GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName)); | |
529 | if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE; | |
72d2488e | 530 | } |
c1ac3823 | 531 | else if(fAnaLED){ |
532 | // kStartOfRun = 1, // START_OF_RUN | |
533 | // kEndOfRun = 2, // END_OF_RUN | |
534 | // kStartOfRunFiles = 3, // START_OF_RUN_FILES | |
535 | // kEndOfRunFiles = 4, // END_OF_RUN_FILES | |
536 | // kStartOfBurst = 5, // START_OF_BURST | |
537 | // kEndOfBurst = 6, // END_OF_BURST | |
538 | // kPhysicsEvent = 7, // PHYSICS_EVENT | |
539 | // kCalibrationEvent = 8, // CALIBRATION_EVENT | |
540 | // kFormatError = 9, // EVENT_FORMAT_ERROR | |
541 | // kStartOfData = 10, // START_OF_DATA | |
542 | // kEndOfData = 11, // END_OF_DATA | |
543 | // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT | |
544 | // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT | |
545 | ||
546 | if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType); | |
547 | if(eventType!=8)return kFALSE; | |
548 | } | |
549 | ||
902aa95c | 550 | if(fOutputEvent && (fDataType != kAOD) && ((fOutputEvent->GetCaloClusters())->GetEntriesFast()!=0 ||(fOutputEvent->GetTracks())->GetEntriesFast()!=0)){ |
7ec23b5a | 551 | if (fFillCTS || fFillEMCAL || fFillPHOS) { |
552 | printf("AliCaloTrackReader::AODCaloClusters or AODTracks already filled by the filter, do not use the ESD reader, use the AOD reader, STOP\n"); | |
6fc16b1d | 553 | abort(); |
7ec23b5a | 554 | } |
477d6cee | 555 | } |
902aa95c | 556 | |
29b2ceec | 557 | //In case of analysis of events with jets, skip those with jet pt > 5 pt hard |
558 | if(fComparePtHardAndJetPt && GetStack()) { | |
7ec23b5a | 559 | if(!ComparePtHardAndJetPt()) return kFALSE ; |
29b2ceec | 560 | } |
591cc579 | 561 | |
562 | //In case of mixing events with other AOD file | |
563 | if(fDataType == kAOD && fSecondInputAODTree){ | |
564 | ||
afabc52f | 565 | if(fDebug > 1) |
566 | printf("AliCaloTrackReader::FillInputEvent() - Get event %d from second input AOD file \n", iEntry+fSecondInputFirstEvent); | |
567 | if(fSecondInputAODTree->GetEntriesFast() <= iEntry+fSecondInputFirstEvent) { | |
568 | if(fSecondInputAODTree->GetEntriesFast() == iEntry+fSecondInputFirstEvent) | |
591cc579 | 569 | printf("AliCaloTrackReader::FillInputEvent() - Skip events from event %d, no more events in second AOD file \n", iEntry); |
afabc52f | 570 | return kFALSE; |
571 | } | |
572 | ||
573 | //Get the Event | |
574 | Int_t nbytes = fSecondInputAODTree->GetEvent(iEntry+fSecondInputFirstEvent); | |
575 | if ( nbytes == 0 ) {//If nothing in AOD | |
576 | printf("AliCaloTrackReader::FillInputEvent() - Nothing in Second AOD input, STOP\n"); | |
577 | abort() ; | |
578 | } | |
579 | ||
591cc579 | 580 | } |
4a461b2b | 581 | |
7ec23b5a | 582 | //Get the EMCAL transformation geometry matrices from ESD |
4a461b2b | 583 | if (!gGeoManager && fEMCALGeo) {//&& !fEMCALGeoMatrixSet) { |
7ec23b5a | 584 | if(fDebug > 1) |
585 | printf(" AliCaloTrackReader::FillInputEvent() - Load EMCAL misalignment matrices. \n"); | |
586 | if(!strcmp(fInputEvent->GetName(),"AliESDEvent")) { | |
587 | for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ | |
588 | if(((AliESDEvent*)fInputEvent)->GetEMCALMatrix(mod)) { | |
589 | //printf("EMCAL: mod %d, matrix %p\n",mod, ((AliESDEvent*)fInputEvent)->GetEMCALMatrix(mod)); | |
590 | fEMCALGeo->SetMisalMatrix(((AliESDEvent*)fInputEvent)->GetEMCALMatrix(mod),mod) ; | |
591 | fEMCALGeoMatrixSet = kTRUE;//At least one, so good | |
592 | } | |
593 | }// loop over super modules | |
594 | }//ESD as input | |
595 | else { | |
596 | if(fDebug > 1) | |
597 | printf("AliCaloTrackReader::FillInputEvent() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n"); | |
598 | }//AOD as input | |
599 | }//EMCAL geo && no geoManager | |
600 | ||
7ec23b5a | 601 | //Get the PHOS transformation geometry matrices from ESD |
1cd71065 | 602 | if (!gGeoManager && fPHOSGeo && !fPHOSGeoMatrixSet) { |
7ec23b5a | 603 | if(fDebug > 1) |
604 | printf(" AliCaloTrackReader::FillInputEvent() - Load PHOS misalignment matrices. \n"); | |
605 | if(!strcmp(fInputEvent->GetName(),"AliESDEvent")) { | |
606 | for(Int_t mod=0; mod < 5; mod++){ | |
607 | if(((AliESDEvent*)fInputEvent)->GetPHOSMatrix(mod)) { | |
608 | //printf("PHOS: mod %d, matrix %p\n",mod, ((AliESDEvent*)fInputEvent)->GetPHOSMatrix(mod)); | |
609 | fPHOSGeo->SetMisalMatrix(((AliESDEvent*)fInputEvent)->GetPHOSMatrix(mod),mod) ; | |
610 | fPHOSGeoMatrixSet = kTRUE; //At least one so good | |
611 | } | |
612 | }// loop over modules | |
613 | }//ESD as input | |
614 | else { | |
615 | if(fDebug > 1) | |
616 | printf("AliCaloTrackReader::FillInputEvent() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n"); | |
617 | }//AOD as input | |
618 | }//PHOS geo and geoManager was not set | |
4a461b2b | 619 | |
477d6cee | 620 | if(fFillCTS) FillInputCTS(); |
1c5acb87 | 621 | if(fFillEMCAL) FillInputEMCAL(); |
477d6cee | 622 | if(fFillPHOS) FillInputPHOS(); |
1c5acb87 | 623 | if(fFillEMCALCells) FillInputEMCALCells(); |
477d6cee | 624 | if(fFillPHOSCells) FillInputPHOSCells(); |
7ec23b5a | 625 | |
29b2ceec | 626 | return kTRUE ; |
1c5acb87 | 627 | } |
628 | ||
629 | //__________________________________________________ | |
630 | void AliCaloTrackReader::ResetLists() { | |
631 | // Reset lists, called by the analysis maker | |
632 | ||
477d6cee | 633 | if(fAODCTS) fAODCTS -> Clear(); |
1c5acb87 | 634 | if(fAODEMCAL) fAODEMCAL -> Clear(); |
477d6cee | 635 | if(fAODPHOS) fAODPHOS -> Clear(); |
1c5acb87 | 636 | if(fEMCALCells) fEMCALCells -> Clear(); |
477d6cee | 637 | if(fPHOSCells) fPHOSCells -> Clear(); |
902aa95c | 638 | if(fCleanOutputStdAOD && fOutputEvent ){ |
afabc52f | 639 | //Only keep copied tracks and clusters if requested |
640 | fOutputEvent->GetTracks() ->Clear(); | |
641 | fOutputEvent->GetCaloClusters()->Clear(); | |
42dc8e7d | 642 | } |
7ec23b5a | 643 | |
1c5acb87 | 644 | } |