]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | /* $Id: $ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // Class for reading data (AODs) in order to do prompt gamma | |
591cc579 | 20 | // or other particle identification and correlations. |
21 | // Mixing analysis can be done, input AOD with events | |
22 | // is opened in the AliCaloTrackReader::Init() | |
1c5acb87 | 23 | // |
24 | // | |
25 | //*-- Author: Gustavo Conesa (LNF-INFN) | |
26 | ////////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | ||
29 | // --- ROOT system --- | |
30 | //#include "Riostream.h" | |
31 | ||
32 | //---- ANALYSIS system ---- | |
33 | #include "AliCaloTrackAODReader.h" | |
34 | #include "AliAODEvent.h" | |
1c5acb87 | 35 | #include "AliAODCaloCluster.h" |
36 | #include "AliAODTrack.h" | |
591cc579 | 37 | #include "AliESDtrack.h" |
477d6cee | 38 | #include "AliFidutialCut.h" |
1c5acb87 | 39 | |
40 | ClassImp(AliCaloTrackAODReader) | |
41 | ||
42 | //____________________________________________________________________________ | |
43 | AliCaloTrackAODReader::AliCaloTrackAODReader() : | |
a8a55c9d | 44 | AliCaloTrackReader(), fWriteOutputAOD(kFALSE) |
1c5acb87 | 45 | { |
46 | //Default Ctor | |
47 | ||
48 | //Initialize parameters | |
49 | fDataType=kAOD; | |
591cc579 | 50 | fReadStack = kTRUE; |
51 | fReadAODMCParticles = kFALSE; | |
52 | //We want tracks fitted in the detectors: | |
53 | fTrackStatus=AliESDtrack::kTPCrefit; | |
54 | fTrackStatus|=AliESDtrack::kITSrefit; | |
55 | ||
1c5acb87 | 56 | } |
57 | ||
58 | //____________________________________________________________________________ | |
a8a55c9d | 59 | AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & aodr) : |
60 | AliCaloTrackReader(aodr),fWriteOutputAOD(aodr.fWriteOutputAOD) | |
1c5acb87 | 61 | { |
62 | // cpy ctor | |
63 | } | |
64 | ||
65 | //_________________________________________________________________________ | |
66 | //AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source) | |
67 | //{ | |
68 | // // assignment operator | |
69 | // | |
70 | // if(&source == this) return *this; | |
71 | // | |
72 | // return *this; | |
73 | // | |
74 | //} | |
75 | ||
76 | //____________________________________________________________________________ | |
77 | void AliCaloTrackAODReader::FillInputCTS() { | |
591cc579 | 78 | //Return array with Central Tracking System (CTS) tracks |
1c5acb87 | 79 | |
477d6cee | 80 | Int_t nTracks = fInputEvent->GetNumberOfTracks() ; |
a8a55c9d | 81 | Int_t naod = 0; |
1c5acb87 | 82 | Double_t p[3]; |
1c5acb87 | 83 | for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop |
477d6cee | 84 | AliAODTrack * track = ((AliAODEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd |
591cc579 | 85 | |
86 | //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits | |
87 | if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; | |
1c5acb87 | 88 | |
89 | track->GetPxPyPz(p) ; | |
90 | TLorentzVector momentum(p[0],p[1],p[2],0); | |
91 | ||
92 | if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){ | |
93 | ||
a3aebfff | 94 | if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", |
1c5acb87 | 95 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); |
a8a55c9d | 96 | |
97 | if(fWriteOutputAOD){ | |
98 | AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track); | |
99 | fAODCTS->Add(newtrack); //Use AOD stored in output for references. | |
100 | } | |
101 | else fAODCTS->Add(track); | |
1c5acb87 | 102 | }//Pt and Fidutial cut passed. |
1c5acb87 | 103 | }// track loop |
591cc579 | 104 | |
105 | fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast(); | |
106 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod entries %d\n", fAODCTSNormalInputEntries); | |
107 | ||
108 | //If second input event available, add the clusters. | |
109 | if(fSecondInputAODTree && fSecondInputAODEvent){ | |
110 | nTracks = fSecondInputAODEvent->GetNumberOfTracks() ; | |
111 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - Add second input tracks, entries %d\n", nTracks) ; | |
112 | for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop | |
113 | AliAODTrack * track = ((AliAODEvent*)fSecondInputAODEvent)->GetTrack(itrack) ; // retrieve track from esd | |
114 | ||
115 | //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits | |
116 | if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ; | |
117 | ||
118 | track->GetPxPyPz(p) ; | |
119 | TLorentzVector momentum(p[0],p[1],p[2],0); | |
120 | ||
121 | if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){ | |
122 | ||
123 | if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", | |
124 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
125 | ||
a8a55c9d | 126 | if(fWriteOutputAOD){ |
127 | AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track); | |
128 | fAODCTS->Add(newtrack); //Use AOD stored in output for references. | |
129 | } | |
130 | else fAODCTS->Add(track); | |
591cc579 | 131 | |
132 | }//Pt and Fidutial cut passed. | |
133 | }// track loop | |
134 | ||
135 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod normal entries %d, after second input %d\n", fAODCTSNormalInputEntries, fAODCTS->GetEntriesFast()); | |
136 | } //second input loop | |
137 | ||
1c5acb87 | 138 | } |
139 | ||
140 | //____________________________________________________________________________ | |
141 | void AliCaloTrackAODReader::FillInputEMCAL() { | |
142 | //Return array with EMCAL clusters in aod format | |
477d6cee | 143 | |
1c5acb87 | 144 | //Get vertex for momentum calculation |
145 | Double_t v[3] ; //vertex ; | |
146 | GetVertex(v); | |
a8a55c9d | 147 | |
148 | Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); | |
1c5acb87 | 149 | //Loop to select clusters in fidutial cut and fill container with aodClusters |
591cc579 | 150 | Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); |
151 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
477d6cee | 152 | AliAODCaloCluster * clus = 0; |
153 | if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) { | |
154 | if (clus->IsEMCALCluster()){ | |
155 | TLorentzVector momentum ; | |
156 | clus->GetMomentum(momentum, v); | |
157 | ||
158 | if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){ | |
1c5acb87 | 159 | |
a3aebfff | 160 | if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", |
477d6cee | 161 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); |
162 | ||
a8a55c9d | 163 | if(fWriteOutputAOD){ |
164 | AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); | |
165 | fAODEMCAL->Add(newclus); | |
166 | } | |
167 | else fAODEMCAL->Add(clus); | |
477d6cee | 168 | }//Pt and Fidutial cut passed. |
169 | }//EMCAL cluster | |
170 | }// cluster exists | |
591cc579 | 171 | }// cluster loop |
172 | ||
173 | fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast(); | |
174 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod entries %d\n", fAODEMCALNormalInputEntries); | |
175 | ||
176 | //If second input event available, add the clusters. | |
177 | if(fSecondInputAODTree && fSecondInputAODEvent){ | |
178 | nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters(); | |
179 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Add second input clusters, entries %d\n", nclusters) ; | |
180 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
181 | AliAODCaloCluster * clus = 0; | |
182 | if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) { | |
183 | if (clus->IsEMCALCluster()){ | |
184 | TLorentzVector momentum ; | |
185 | clus->GetMomentum(momentum, v); | |
186 | ||
187 | if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){ | |
188 | ||
189 | if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", | |
190 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
a8a55c9d | 191 | if(fWriteOutputAOD){ |
192 | AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); | |
193 | fAODEMCAL->Add(newclus); | |
194 | } | |
195 | else fAODEMCAL->Add(clus); | |
591cc579 | 196 | }//Pt and Fidutial cut passed. |
197 | }//EMCAL cluster | |
198 | }// cluster exists | |
199 | }// cluster loop | |
200 | ||
201 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod normal entries %d, after second input %d\n", fAODEMCALNormalInputEntries, fAODEMCAL->GetEntriesFast()); | |
1c5acb87 | 202 | |
591cc579 | 203 | } //second input loop |
1c5acb87 | 204 | } |
205 | ||
206 | //____________________________________________________________________________ | |
207 | void AliCaloTrackAODReader::FillInputPHOS() { | |
208 | //Return array with PHOS clusters in aod format | |
477d6cee | 209 | |
1c5acb87 | 210 | //Get vertex for momentum calculation |
211 | Double_t v[3] ; //vertex ; | |
212 | GetVertex(v); | |
a8a55c9d | 213 | |
214 | Int_t naod = (fOutputEvent->GetCaloClusters())->GetEntriesFast(); | |
1c5acb87 | 215 | //Loop to select clusters in fidutial cut and fill container with aodClusters |
591cc579 | 216 | Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); |
217 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
477d6cee | 218 | AliAODCaloCluster * clus = 0; |
219 | if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) { | |
220 | if (clus->IsPHOSCluster()){ | |
221 | TLorentzVector momentum ; | |
222 | clus->GetMomentum(momentum, v); | |
223 | ||
224 | if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){ | |
225 | ||
a3aebfff | 226 | if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", |
477d6cee | 227 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); |
591cc579 | 228 | |
a8a55c9d | 229 | if(fWriteOutputAOD){ |
230 | AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); | |
231 | fAODPHOS->Add(newclus); | |
232 | } | |
233 | else fAODPHOS->Add(clus); | |
477d6cee | 234 | }//Pt and Fidutial cut passed. |
235 | }//PHOS cluster | |
236 | }//cluster exists | |
1c5acb87 | 237 | }//esd cluster loop |
591cc579 | 238 | |
239 | fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ; | |
240 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod entries %d\n", fAODPHOSNormalInputEntries); | |
1c5acb87 | 241 | |
591cc579 | 242 | //If second input event available, add the clusters. |
243 | if(fSecondInputAODTree && fSecondInputAODEvent){ | |
244 | nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters(); | |
245 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - Add second input clusters, entries %d\n", nclusters); | |
246 | for (Int_t iclus = 0; iclus < nclusters; iclus++) { | |
247 | AliAODCaloCluster * clus = 0; | |
248 | if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) { | |
249 | if (clus->IsPHOSCluster()){ | |
250 | TLorentzVector momentum ; | |
251 | clus->GetMomentum(momentum, v); | |
252 | ||
253 | if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){ | |
254 | ||
255 | if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", | |
256 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
a8a55c9d | 257 | if(fWriteOutputAOD){ |
258 | AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus); | |
259 | fAODPHOS->Add(newclus); | |
260 | } | |
261 | else fAODPHOS->Add(clus); | |
591cc579 | 262 | }//Pt and Fidutial cut passed. |
263 | }//PHOS cluster | |
264 | }// cluster exists | |
265 | }// cluster loop | |
266 | if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod normal entries %d, after second input %d\n", fAODPHOSNormalInputEntries, fAODPHOS->GetEntriesFast()); | |
267 | } //second input loop | |
1c5acb87 | 268 | |
269 | } | |
270 | ||
271 | //____________________________________________________________________________ | |
272 | void AliCaloTrackAODReader::FillInputEMCALCells() { | |
273 | //Return array with EMCAL cells in aod format | |
274 | ||
477d6cee | 275 | fEMCALCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetEMCALCells(); |
1c5acb87 | 276 | |
277 | } | |
278 | ||
279 | //____________________________________________________________________________ | |
280 | void AliCaloTrackAODReader::FillInputPHOSCells() { | |
281 | //Return array with PHOS cells in aod format | |
282 | ||
477d6cee | 283 | fPHOSCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetPHOSCells(); |
1c5acb87 | 284 | |
285 | } | |
286 | ||
287 | //____________________________________________________________________________ | |
288 | void AliCaloTrackAODReader::GetVertex(Double_t v[3]) const { | |
289 | //Return vertex position | |
290 | ||
477d6cee | 291 | v[0] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetX() ;//CHECK!!! |
292 | v[1] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetY() ;//CHECK!!! | |
293 | v[2] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetZ() ;//CHECK!!! | |
1c5acb87 | 294 | } |
295 | ||
8dacfd76 | 296 | //____________________________________________________________________________ |
297 | Double_t AliCaloTrackAODReader::GetBField() const { | |
298 | //Return magnetic field | |
299 | ||
300 | Double_t bfield = ((AliAODEvent*)fInputEvent)->GetMagneticField(); | |
301 | ||
302 | return bfield; | |
303 | ||
304 | } | |
1c5acb87 | 305 | |
306 | //____________________________________________________________________________ | |
477d6cee | 307 | void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* aod, AliMCEvent* mc) { |
1c5acb87 | 308 | // Connect the data pointers |
477d6cee | 309 | // If input is AOD, do analysis with input, if not, do analysis with the output aod. |
310 | if(!strcmp(input->GetName(),"AliESDEvent")) { | |
311 | SetInputEvent(aod); | |
312 | SetOutputEvent(aod); | |
313 | } | |
314 | else if(!strcmp(input->GetName(),"AliAODEvent")){ | |
315 | SetInputEvent(input); | |
316 | SetOutputEvent(aod); | |
317 | } | |
318 | else{ | |
591cc579 | 319 | printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()); |
477d6cee | 320 | abort(); |
321 | } | |
322 | ||
323 | SetMC(mc); | |
1c5acb87 | 324 | |
1c5acb87 | 325 | } |