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