]>
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 | ||
1c5acb87 | 223 | } |
224 | ||
c1ac3823 | 225 | //_________________________________________________________________________________________________________ |
226 | Bool_t AliCaloTrackReader::ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells){ | |
227 | // Check that in the cluster cells, there is no bad channel of those stored | |
228 | // in fEMCALBadChannelMap or fPHOSBadChannelMap | |
229 | ||
230 | if (!fRemoveBadChannels) return kFALSE; | |
231 | ||
232 | Int_t icol = -1; | |
233 | Int_t irow = -1; | |
234 | Int_t imod = -1; | |
235 | for(Int_t iCell = 0; iCell<nCells; iCell++){ | |
236 | ||
237 | //Get the column and row | |
238 | if(calorimeter == "EMCAL"){ | |
239 | Int_t iTower = -1, iIphi = -1, iIeta = -1; | |
240 | fEMCALGeo->GetCellIndex(cellList[iCell],imod,iTower,iIphi,iIeta); | |
241 | fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,irow,icol); | |
242 | if(GetEMCALChannelStatus(imod, icol, irow))return kTRUE; | |
243 | } | |
244 | else if(calorimeter=="PHOS"){ | |
245 | Int_t relId[4]; | |
246 | fPHOSGeo->AbsToRelNumbering(cellList[iCell],relId); | |
247 | irow = relId[2]; | |
248 | icol = relId[3]; | |
249 | imod = relId[0]-1; | |
250 | if(GetPHOSChannelStatus(imod, icol, irow)) return kTRUE; | |
251 | } | |
252 | else return kFALSE; | |
253 | ||
254 | }// cell cluster loop | |
255 | ||
256 | return kFALSE; | |
257 | ||
258 | } | |
477d6cee | 259 | |
591cc579 | 260 | //_________________________________________________________________________ |
261 | Bool_t AliCaloTrackReader::ComparePtHardAndJetPt(){ | |
262 | // Check the event, if the requested ptHard is much larger than the jet pT, then there is a problem. | |
263 | // Only for PYTHIA. | |
264 | if(!fReadStack) return kTRUE; //Information not filtered to AOD | |
265 | ||
266 | if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader")){ | |
267 | TParticle * jet = new TParticle; | |
268 | AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader(); | |
269 | Int_t nTriggerJets = pygeh->NTriggerJets(); | |
270 | Float_t ptHard = pygeh->GetPtHard(); | |
271 | ||
272 | //if(fDebug > 1) printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %f\n",nTriggerJets, ptHard); | |
273 | Float_t tmpjet[]={0,0,0,0}; | |
274 | for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){ | |
275 | pygeh->TriggerJet(ijet, tmpjet); | |
276 | jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0); | |
277 | //Compare jet pT and pt Hard | |
278 | //if(fDebug > 1) printf("AliMCAnalysisUtils:: %d pycell jet pT %f\n",ijet, jet->Pt()); | |
279 | if(jet->Pt() > fPtHardAndJetPtFactor * ptHard) { | |
280 | printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", | |
281 | nTriggerJets, ptHard, jet->Pt(), fPtHardAndJetPtFactor); | |
282 | return kFALSE; | |
283 | } | |
284 | } | |
285 | } | |
286 | ||
287 | return kTRUE ; | |
288 | ||
289 | } | |
290 | ||
1c5acb87 | 291 | //____________________________________________________________________________ |
292 | AliStack* AliCaloTrackReader::GetStack() const { | |
293 | //Return pointer to stack | |
294 | if(fMC) | |
295 | return fMC->Stack(); | |
296 | else{ | |
477d6cee | 297 | if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n"); |
1c5acb87 | 298 | return 0x0 ; |
299 | } | |
300 | } | |
301 | ||
302 | //____________________________________________________________________________ | |
303 | AliHeader* AliCaloTrackReader::GetHeader() const { | |
304 | //Return pointer to header | |
305 | if(fMC) | |
306 | return fMC->Header(); | |
307 | else{ | |
477d6cee | 308 | printf("AliCaloTrackReader::Header is not available\n"); |
1c5acb87 | 309 | return 0x0 ; |
310 | } | |
311 | } | |
312 | //____________________________________________________________________________ | |
313 | AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const { | |
314 | //Return pointer to Generated event header | |
315 | if(fMC) | |
316 | return fMC->GenEventHeader(); | |
317 | else{ | |
477d6cee | 318 | printf("AliCaloTrackReader::GenEventHeader is not available\n"); |
1c5acb87 | 319 | return 0x0 ; |
320 | } | |
321 | } | |
322 | ||
591cc579 | 323 | //____________________________________________________________________________ |
324 | TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const { | |
325 | //Return list of particles in AOD. Do it for the corresponding input event. | |
326 | if(fDataType == kAOD){ | |
327 | //Normal input AOD | |
328 | if(input == 0) return (TClonesArray*)((AliAODEvent*)fInputEvent)->FindListObject("mcparticles"); | |
329 | //Second input AOD | |
330 | else if(input == 1 && fSecondInputAODEvent) return (TClonesArray*) fSecondInputAODEvent->FindListObject("mcparticles"); | |
331 | else { | |
332 | printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); | |
333 | return 0x0; | |
334 | } | |
335 | } | |
336 | else { | |
337 | printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); | |
338 | return 0x0; | |
339 | } | |
340 | } | |
341 | ||
342 | //____________________________________________________________________________ | |
343 | AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader(Int_t input) const { | |
344 | //Return MC header in AOD. Do it for the corresponding input event. | |
345 | if(fDataType == kAOD){ | |
346 | //Normal input AOD | |
347 | if(input == 0) return (AliAODMCHeader*)((AliAODEvent*)fInputEvent)->FindListObject("mcheader"); | |
348 | //Second input AOD | |
349 | else if(input == 1) return (AliAODMCHeader*) fSecondInputAODEvent->FindListObject("mcheader"); | |
350 | else { | |
351 | printf("AliCaloTrackReader::GetAODMCHeader() - wrong AOD input index, %d\n",input); | |
352 | return 0x0; | |
353 | } | |
354 | } | |
355 | else { | |
356 | printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n"); | |
357 | return 0x0; | |
358 | } | |
359 | } | |
360 | ||
361 | //_______________________________________________________________ | |
362 | void AliCaloTrackReader::Init() | |
363 | { | |
364 | //Init reader. Method to be called in AliAnaPartCorrMaker | |
365 | ||
366 | //Get the file with second input events if the filename is given | |
367 | //Get the tree and connect the AODEvent. Only with AODs | |
f1f0bd84 | 368 | |
591cc579 | 369 | if(fReadStack && fReadAODMCParticles){ |
370 | printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n"); | |
371 | fReadStack = kFALSE; | |
372 | fReadAODMCParticles = kFALSE; | |
373 | } | |
374 | ||
591cc579 | 375 | if(fSecondInputFileName!=""){ |
376 | if(fDataType == kAOD){ | |
377 | TFile * input2 = new TFile(fSecondInputFileName,"read"); | |
ddcb0d54 | 378 | printf("AliCaloTrackReader::Init() - Second input file opened: %s, size %d \n", input2->GetName(), (Int_t) input2->GetSize()); |
591cc579 | 379 | fSecondInputAODTree = (TTree*) input2->Get("aodTree"); |
ddcb0d54 | 380 | if(fSecondInputAODTree) printf("AliCaloTrackReader::Init() - Second input tree opened: %s, entries %d \n", |
381 | fSecondInputAODTree->GetName(), (Int_t) fSecondInputAODTree->GetEntries()); | |
382 | else{ | |
383 | printf("AliCaloTrackReader::Init() - Second input tree not available, STOP \n"); | |
384 | abort(); | |
385 | } | |
591cc579 | 386 | fSecondInputAODEvent = new AliAODEvent; |
387 | fSecondInputAODEvent->ReadFromTree(fSecondInputAODTree); | |
388 | if(fSecondInputFirstEvent >= fSecondInputAODTree->GetEntriesFast()){ | |
389 | printf("AliCaloTrackReader::Init() - Requested first event of second input %d, is larger than number of events %d, STOP\n", | |
390 | fSecondInputFirstEvent, (Int_t) fSecondInputAODTree->GetEntriesFast()); | |
391 | abort(); | |
392 | } | |
393 | } | |
394 | else printf("AliCaloTrackReader::Init() - Second input not added, reader is not AOD\n"); | |
395 | } | |
591cc579 | 396 | } |
1c5acb87 | 397 | //_______________________________________________________________ |
398 | void AliCaloTrackReader::InitParameters() | |
399 | { | |
400 | ||
401 | //Initialize the parameters of the analysis. | |
591cc579 | 402 | fDataType = kESD ; |
1c5acb87 | 403 | fCTSPtMin = 0.2 ; |
29b2ceec | 404 | fEMCALPtMin = 0.2 ; |
405 | fPHOSPtMin = 0.2 ; | |
1c5acb87 | 406 | |
902aa95c | 407 | //Do not filter the detectors input by default. |
408 | fFillEMCAL = kFALSE; | |
409 | fFillPHOS = kFALSE; | |
410 | fFillCTS = kFALSE; | |
1c5acb87 | 411 | fFillEMCALCells = kFALSE; |
591cc579 | 412 | fFillPHOSCells = kFALSE; |
1c5acb87 | 413 | |
ff45398a | 414 | fFiducialCut = new AliFiducialCut(); |
591cc579 | 415 | fSecondInputFileName = "" ; |
416 | fSecondInputFirstEvent = 0 ; | |
417 | fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file | |
418 | fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file | |
08a064bc | 419 | fCleanOutputStdAOD = kFALSE; // Clean the standard clusters/tracks? |
42dc8e7d | 420 | fDeltaAODFileName = "deltaAODPartCorr.root"; |
72d2488e | 421 | fFiredTriggerClassName = ""; |
afabc52f | 422 | fEMCALGeoName = "EMCAL_COMPLETE"; |
423 | fPHOSGeoName = "PHOSgeo"; | |
4a461b2b | 424 | |
425 | if(gGeoManager) {// geoManager was set | |
426 | printf("Geometry manager available\n"); | |
427 | fEMCALGeoMatrixSet = kTRUE; | |
428 | fPHOSGeoMatrixSet = kTRUE; | |
429 | } | |
430 | else{ | |
431 | fEMCALGeoMatrixSet = kFALSE; | |
432 | fPHOSGeoMatrixSet = kFALSE; | |
433 | } | |
afabc52f | 434 | |
c1ac3823 | 435 | fAnaLED = kFALSE; |
436 | ||
437 | fRemoveBadChannels = kFALSE; | |
438 | ||
439 | for (int i = 0; i < 12; i++) | |
440 | fEMCALBadChannelMap.Add(new TH2I(Form("EMCALBadChannelMap_SM%d",i),Form("EMCALBadChannelMap_SM%d",i), | |
441 | 48, 0, 48, 24, 0, 24)); | |
442 | ||
443 | for (int i = 0; i < 5; i++) | |
444 | fPHOSBadChannelMap.Add(new TH2I(Form("PHOSBadChannelMap_Mod%d",i),Form("PHOSBadChannelMap_Mod%d",i), | |
445 | 56, 0, 56, 64, 0, 64)); | |
446 | fEMCALBadChannelMap.Compress(); | |
447 | fPHOSBadChannelMap.Compress(); | |
448 | ||
1c5acb87 | 449 | } |
450 | ||
4e2b43d8 | 451 | //________________________________________________________________ |
452 | void AliCaloTrackReader::InitEMCALGeometry() | |
453 | { | |
454 | //Initialize EMCAL geometry if it did not exist previously | |
455 | if (!fEMCALGeo){ | |
456 | fEMCALGeo = new AliEMCALGeoUtils(fEMCALGeoName); | |
0866d83a | 457 | if (!gGeoManager && fDebug > 0) printf("AliCaloTrackReader::InitEMCALGeometry() - Careful!, gGeoManager not loaded, load misalign matrices\n"); |
4e2b43d8 | 458 | } |
459 | } | |
460 | ||
461 | //________________________________________________________________ | |
462 | void AliCaloTrackReader::InitPHOSGeometry() | |
463 | { | |
464 | //Initialize PHOS geometry if it did not exist previously | |
465 | if (!fPHOSGeo){ | |
466 | fPHOSGeo = new AliPHOSGeoUtils(fPHOSGeoName); | |
0866d83a | 467 | if (!gGeoManager && fDebug > 0) printf("AliCaloTrackReader::InitPHOSGeometry() - Careful!, gGeoManager not loaded, load misalign matrices\n"); |
4e2b43d8 | 468 | } |
469 | } | |
1c5acb87 | 470 | |
471 | //________________________________________________________________ | |
472 | void AliCaloTrackReader::Print(const Option_t * opt) const | |
473 | { | |
474 | ||
475 | //Print some relevant parameters set for the analysis | |
476 | if(! opt) | |
477 | return; | |
478 | ||
479 | printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; | |
480 | printf("Data type : %d\n", fDataType) ; | |
481 | printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; | |
482 | printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; | |
483 | printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ; | |
484 | printf("Use CTS = %d\n", fFillCTS) ; | |
485 | printf("Use EMCAL = %d\n", fFillEMCAL) ; | |
486 | printf("Use PHOS = %d\n", fFillPHOS) ; | |
487 | printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ; | |
488 | printf("Use PHOS Cells = %d\n", fFillPHOSCells) ; | |
591cc579 | 489 | printf("Track status = %d\n", (Int_t) fTrackStatus) ; |
490 | if(fComparePtHardAndJetPt) | |
491 | printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor); | |
492 | ||
493 | if(fSecondInputFileName!="") { | |
494 | printf("Second Input File Name = %s\n", fSecondInputFileName.Data()) ; | |
495 | printf("Second Input First Event = %d\n", fSecondInputFirstEvent) ; | |
496 | } | |
497 | ||
42dc8e7d | 498 | printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ; |
08a064bc | 499 | printf("Clean std AOD = %d\n", fCleanOutputStdAOD) ; |
42dc8e7d | 500 | printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ; |
c1ac3823 | 501 | printf("Rremove Clusters with bad channels? %d\n",fRemoveBadChannels); |
1c5acb87 | 502 | printf(" \n") ; |
503 | } | |
504 | ||
505 | //___________________________________________________ | |
29b2ceec | 506 | Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * currentFileName) { |
6639984f | 507 | //Fill the event counter and input lists that are needed, called by the analysis maker. |
902aa95c | 508 | |
6639984f | 509 | fEventNumber = iEntry; |
a79a2424 | 510 | fCurrentFileName = TString(currentFileName); |
72d2488e | 511 | |
512 | //Select events only fired by a certain trigger configuration if it is provided | |
c1ac3823 | 513 | Int_t eventType = ((AliESDHeader*)fInputEvent->GetHeader())->GetEventType(); |
514 | if( fFiredTriggerClassName !="" && !fAnaLED){ | |
515 | if(eventType!=7)return kFALSE; //Only physics event, do not use for simulated events!!! | |
7ec23b5a | 516 | if(fDebug > 0) |
517 | printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n", | |
518 | GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName)); | |
519 | if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE; | |
72d2488e | 520 | } |
c1ac3823 | 521 | else if(fAnaLED){ |
522 | // kStartOfRun = 1, // START_OF_RUN | |
523 | // kEndOfRun = 2, // END_OF_RUN | |
524 | // kStartOfRunFiles = 3, // START_OF_RUN_FILES | |
525 | // kEndOfRunFiles = 4, // END_OF_RUN_FILES | |
526 | // kStartOfBurst = 5, // START_OF_BURST | |
527 | // kEndOfBurst = 6, // END_OF_BURST | |
528 | // kPhysicsEvent = 7, // PHYSICS_EVENT | |
529 | // kCalibrationEvent = 8, // CALIBRATION_EVENT | |
530 | // kFormatError = 9, // EVENT_FORMAT_ERROR | |
531 | // kStartOfData = 10, // START_OF_DATA | |
532 | // kEndOfData = 11, // END_OF_DATA | |
533 | // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT | |
534 | // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT | |
535 | ||
536 | if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n", eventType); | |
537 | if(eventType!=8)return kFALSE; | |
538 | } | |
539 | ||
902aa95c | 540 | if(fOutputEvent && (fDataType != kAOD) && ((fOutputEvent->GetCaloClusters())->GetEntriesFast()!=0 ||(fOutputEvent->GetTracks())->GetEntriesFast()!=0)){ |
7ec23b5a | 541 | if (fFillCTS || fFillEMCAL || fFillPHOS) { |
542 | printf("AliCaloTrackReader::AODCaloClusters or AODTracks already filled by the filter, do not use the ESD reader, use the AOD reader, STOP\n"); | |
6fc16b1d | 543 | abort(); |
7ec23b5a | 544 | } |
477d6cee | 545 | } |
902aa95c | 546 | |
29b2ceec | 547 | //In case of analysis of events with jets, skip those with jet pt > 5 pt hard |
548 | if(fComparePtHardAndJetPt && GetStack()) { | |
7ec23b5a | 549 | if(!ComparePtHardAndJetPt()) return kFALSE ; |
29b2ceec | 550 | } |
591cc579 | 551 | |
552 | //In case of mixing events with other AOD file | |
553 | if(fDataType == kAOD && fSecondInputAODTree){ | |
554 | ||
afabc52f | 555 | if(fDebug > 1) |
556 | printf("AliCaloTrackReader::FillInputEvent() - Get event %d from second input AOD file \n", iEntry+fSecondInputFirstEvent); | |
557 | if(fSecondInputAODTree->GetEntriesFast() <= iEntry+fSecondInputFirstEvent) { | |
558 | if(fSecondInputAODTree->GetEntriesFast() == iEntry+fSecondInputFirstEvent) | |
591cc579 | 559 | printf("AliCaloTrackReader::FillInputEvent() - Skip events from event %d, no more events in second AOD file \n", iEntry); |
afabc52f | 560 | return kFALSE; |
561 | } | |
562 | ||
563 | //Get the Event | |
564 | Int_t nbytes = fSecondInputAODTree->GetEvent(iEntry+fSecondInputFirstEvent); | |
565 | if ( nbytes == 0 ) {//If nothing in AOD | |
566 | printf("AliCaloTrackReader::FillInputEvent() - Nothing in Second AOD input, STOP\n"); | |
567 | abort() ; | |
568 | } | |
569 | ||
591cc579 | 570 | } |
4a461b2b | 571 | |
7ec23b5a | 572 | //Get the EMCAL transformation geometry matrices from ESD |
4a461b2b | 573 | if (!gGeoManager && fEMCALGeo) {//&& !fEMCALGeoMatrixSet) { |
7ec23b5a | 574 | if(fDebug > 1) |
575 | printf(" AliCaloTrackReader::FillInputEvent() - Load EMCAL misalignment matrices. \n"); | |
576 | if(!strcmp(fInputEvent->GetName(),"AliESDEvent")) { | |
577 | for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ | |
578 | if(((AliESDEvent*)fInputEvent)->GetEMCALMatrix(mod)) { | |
579 | //printf("EMCAL: mod %d, matrix %p\n",mod, ((AliESDEvent*)fInputEvent)->GetEMCALMatrix(mod)); | |
580 | fEMCALGeo->SetMisalMatrix(((AliESDEvent*)fInputEvent)->GetEMCALMatrix(mod),mod) ; | |
581 | fEMCALGeoMatrixSet = kTRUE;//At least one, so good | |
582 | } | |
583 | }// loop over super modules | |
584 | }//ESD as input | |
585 | else { | |
586 | if(fDebug > 1) | |
587 | printf("AliCaloTrackReader::FillInputEvent() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n"); | |
588 | }//AOD as input | |
589 | }//EMCAL geo && no geoManager | |
590 | ||
7ec23b5a | 591 | //Get the PHOS transformation geometry matrices from ESD |
1cd71065 | 592 | if (!gGeoManager && fPHOSGeo && !fPHOSGeoMatrixSet) { |
7ec23b5a | 593 | if(fDebug > 1) |
594 | printf(" AliCaloTrackReader::FillInputEvent() - Load PHOS misalignment matrices. \n"); | |
595 | if(!strcmp(fInputEvent->GetName(),"AliESDEvent")) { | |
596 | for(Int_t mod=0; mod < 5; mod++){ | |
597 | if(((AliESDEvent*)fInputEvent)->GetPHOSMatrix(mod)) { | |
598 | //printf("PHOS: mod %d, matrix %p\n",mod, ((AliESDEvent*)fInputEvent)->GetPHOSMatrix(mod)); | |
599 | fPHOSGeo->SetMisalMatrix(((AliESDEvent*)fInputEvent)->GetPHOSMatrix(mod),mod) ; | |
600 | fPHOSGeoMatrixSet = kTRUE; //At least one so good | |
601 | } | |
602 | }// loop over modules | |
603 | }//ESD as input | |
604 | else { | |
605 | if(fDebug > 1) | |
606 | printf("AliCaloTrackReader::FillInputEvent() - Setting of EMCAL transformation matrixes for AODs not implemented yet. \n Import geometry.root file\n"); | |
607 | }//AOD as input | |
608 | }//PHOS geo and geoManager was not set | |
4a461b2b | 609 | |
477d6cee | 610 | if(fFillCTS) FillInputCTS(); |
1c5acb87 | 611 | if(fFillEMCAL) FillInputEMCAL(); |
477d6cee | 612 | if(fFillPHOS) FillInputPHOS(); |
1c5acb87 | 613 | if(fFillEMCALCells) FillInputEMCALCells(); |
477d6cee | 614 | if(fFillPHOSCells) FillInputPHOSCells(); |
7ec23b5a | 615 | |
29b2ceec | 616 | return kTRUE ; |
1c5acb87 | 617 | } |
618 | ||
619 | //__________________________________________________ | |
620 | void AliCaloTrackReader::ResetLists() { | |
621 | // Reset lists, called by the analysis maker | |
622 | ||
477d6cee | 623 | if(fAODCTS) fAODCTS -> Clear(); |
1c5acb87 | 624 | if(fAODEMCAL) fAODEMCAL -> Clear(); |
477d6cee | 625 | if(fAODPHOS) fAODPHOS -> Clear(); |
1c5acb87 | 626 | if(fEMCALCells) fEMCALCells -> Clear(); |
477d6cee | 627 | if(fPHOSCells) fPHOSCells -> Clear(); |
902aa95c | 628 | if(fCleanOutputStdAOD && fOutputEvent ){ |
afabc52f | 629 | //Only keep copied tracks and clusters if requested |
630 | fOutputEvent->GetTracks() ->Clear(); | |
631 | fOutputEvent->GetCaloClusters()->Clear(); | |
42dc8e7d | 632 | } |
7ec23b5a | 633 | |
1c5acb87 | 634 | } |