]>
Commit | Line | Data |
---|---|---|
7986e54e | 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 | // | |
16 | // Class AliHFEV0taginfo | |
17 | // Creates list of tracks with V0 information | |
18 | // | |
19 | // Author: | |
20 | // Jan Wagner <J.Wagner@gsi.de> | |
21 | // | |
22 | ||
23 | ||
24 | ||
25 | ||
26 | #include <iostream> | |
27 | #include <TClass.h> | |
28 | #include <TList.h> | |
29 | #include <TMath.h> | |
30 | ||
31 | ||
32 | #include "AliLog.h" | |
e2861c1a | 33 | #include "AliAODEvent.h" |
34 | #include "AliAODv0.h" | |
7986e54e | 35 | #include "AliESDEvent.h" |
36 | #include "AliESDv0.h" | |
37 | ||
38 | #include "AliHFEV0taginfo.h" | |
39 | ||
40 | ||
41 | ClassImp(AliHFEV0taginfo) | |
42 | ClassImp(AliHFEV0taginfo::AliHFEV0tag) | |
43 | ||
44 | //___________________________________________________________________ | |
45 | AliHFEV0taginfo::AliHFEV0taginfo(): | |
46 | TNamed(), | |
f4945911 | 47 | fIsAODana(NULL), |
7986e54e | 48 | fTaggedTracks(NULL), |
e2861c1a | 49 | fV0finder(NULL), |
50 | fAODV0finder(NULL) | |
7986e54e | 51 | { |
52 | // | |
53 | // default constructor | |
54 | // | |
55 | } | |
56 | //___________________________________________________________________ | |
57 | AliHFEV0taginfo::AliHFEV0taginfo(const char* name): | |
58 | TNamed(name, ""), | |
f4945911 | 59 | fIsAODana(kFALSE), |
7986e54e | 60 | fTaggedTracks(NULL), |
e2861c1a | 61 | fV0finder(NULL), |
62 | fAODV0finder(NULL) | |
7986e54e | 63 | { |
64 | // | |
65 | // constructor | |
66 | // | |
67 | ||
68 | fTaggedTracks = new TList(); | |
69 | if(fTaggedTracks){ | |
70 | fTaggedTracks->SetOwner(); | |
71 | } | |
72 | fV0finder = new AliESDv0KineCuts(); | |
e2861c1a | 73 | fAODV0finder = new AliAODv0KineCuts(); |
7986e54e | 74 | } |
f4945911 | 75 | |
76 | //__________________________________________________________________ | |
77 | AliHFEV0taginfo::AliHFEV0taginfo(const AliHFEV0taginfo &ref): | |
78 | TNamed(ref), | |
79 | fIsAODana(ref.fIsAODana), | |
80 | fTaggedTracks(NULL), | |
e2861c1a | 81 | fV0finder(ref.fV0finder), |
82 | fAODV0finder(ref.fAODV0finder) | |
f4945911 | 83 | { |
84 | // | |
85 | // Copy constructor | |
86 | // creates a new object with new (empty) containers | |
87 | // | |
88 | fTaggedTracks = new TList(); | |
89 | if(fTaggedTracks){ | |
90 | fTaggedTracks->SetOwner(); | |
91 | } | |
92 | ||
93 | ||
94 | AliHFEV0tag *tmp = NULL; | |
95 | for(Int_t ien = 0; ien < ref.fTaggedTracks->GetEntries(); ien++){ | |
96 | tmp = static_cast<AliHFEV0tag *>(ref.fTaggedTracks->At(ien)); | |
afb48e1d | 97 | fTaggedTracks->Add(new AliHFEV0tag(tmp->GetTrackID(),tmp->GetPinfo(),tmp->GetProdR())); |
f4945911 | 98 | } |
99 | } | |
100 | ||
101 | //__________________________________________________________________ | |
102 | AliHFEV0taginfo &AliHFEV0taginfo::operator=(const AliHFEV0taginfo &ref){ | |
103 | // | |
104 | // Assignment operator | |
105 | // Cleanup old object, create a new one with new containers inside | |
106 | // | |
107 | if(this == &ref) return *this; | |
108 | this->~AliHFEV0taginfo(); | |
109 | TNamed::operator=(ref); | |
110 | fIsAODana = ref.fIsAODana; | |
111 | fTaggedTracks = new TList(); | |
112 | AliHFEV0tag *tmp = NULL; | |
113 | for(Int_t ien = 0; ien < ref.fTaggedTracks->GetEntries(); ien++){ | |
114 | tmp = static_cast<AliHFEV0tag *>(ref.fTaggedTracks->At(ien)); | |
afb48e1d | 115 | fTaggedTracks->Add(new AliHFEV0tag(tmp->GetTrackID(),tmp->GetPinfo(),tmp->GetProdR())); |
f4945911 | 116 | } |
117 | fV0finder=ref.fV0finder; | |
e2861c1a | 118 | fAODV0finder=ref.fAODV0finder; |
f4945911 | 119 | return *this; |
120 | } | |
7986e54e | 121 | //___________________________________________________________________ |
122 | AliHFEV0taginfo::~AliHFEV0taginfo(){ | |
123 | ||
124 | // | |
125 | // Destructor | |
126 | // | |
127 | delete fTaggedTracks; | |
128 | delete fV0finder; | |
afb48e1d | 129 | delete fAODV0finder; |
7986e54e | 130 | AliDebug(6, "DESTRUCTOR"); |
131 | } | |
132 | ||
133 | //________________________________________________________________________________ | |
134 | // loops over V0s in event and fills fTaggedTracks with V0 tracks | |
e2861c1a | 135 | void AliHFEV0taginfo::TagV0Tracks(AliVEvent *fEvent){ |
7986e54e | 136 | |
137 | if (!fEvent) return; | |
138 | ||
139 | const Int_t nTracks = fEvent->GetNumberOfTracks(); | |
140 | if(nTracks < 2) return; | |
141 | ||
142 | const Int_t nV0s = fEvent->GetNumberOfV0s(); | |
143 | if(nV0s < 1) return; | |
144 | AliDebug(3,Form("%d V0s found!",nV0s)); | |
e2861c1a | 145 | |
146 | if(fEvent->IsA() == AliESDEvent::Class()){ | |
147 | AliDebug(4, "ESD part"); | |
148 | AliESDEvent *esdevent = static_cast<AliESDEvent *>(fEvent); | |
149 | fV0finder->SetEvent(esdevent); | |
150 | ||
151 | for(Int_t i=0; i<nV0s; ++i){ | |
152 | Int_t pdgP = 0; | |
153 | Int_t pdgN = 0; | |
154 | AliESDv0 *fV0 = esdevent->GetV0(i); | |
155 | if(!fV0) continue; | |
156 | if(fV0finder->ProcessV0(fV0,pdgP,pdgN)){ | |
157 | AliDebug(5,Form("V0 has: pos pdg: %d, neg pdg: %d",pdgP,pdgN)); | |
afb48e1d | 158 | AddTrack(fV0->GetPindex(),pdgP,TMath::Sqrt(fV0->Xv()*fV0->Xv()+fV0->Yv()*fV0->Yv())); |
159 | AddTrack(fV0->GetNindex(),pdgN,TMath::Sqrt(fV0->Xv()*fV0->Xv()+fV0->Yv()*fV0->Yv())); | |
e2861c1a | 160 | } |
161 | } | |
162 | } else if(fEvent->IsA() == AliAODEvent::Class()){ | |
163 | AliDebug(4,"AOD part"); | |
164 | AliAODEvent *aodevent = static_cast<AliAODEvent *>(fEvent); | |
165 | fAODV0finder->SetEvent(aodevent); | |
166 | ||
167 | for(Int_t i=0; i<nV0s; ++i){ | |
168 | Int_t pdgP = 0; | |
169 | Int_t pdgN = 0; | |
170 | AliAODv0 *fV0 = aodevent->GetV0(i); | |
171 | if(!fV0) continue; | |
172 | if(fAODV0finder->ProcessV0(fV0,pdgP,pdgN)){ | |
173 | AliDebug(5,Form("V0 has: pos pdg: %d, neg pdg: %d",pdgP,pdgN)); | |
afb48e1d | 174 | AddTrack(fV0->GetPosID(),pdgP,fV0->RadiusV0()); |
175 | AddTrack(fV0->GetNegID(),pdgN,fV0->RadiusV0()); | |
e2861c1a | 176 | } |
7986e54e | 177 | } |
178 | } | |
179 | } | |
180 | ||
181 | //________________________________________________________________________________ | |
182 | //Translates the pdg code to AliPID enum and adds track to tagged list | |
afb48e1d | 183 | void AliHFEV0taginfo::AddTrack(Int_t TrackID, Int_t pdgCode, Double_t prodR){ |
7986e54e | 184 | |
185 | if(TrackID<0) return; | |
186 | AliPID::EParticleType Pinfo; | |
187 | switch (TMath::Abs(pdgCode)){ | |
188 | case 11: | |
189 | Pinfo = AliPID::kElectron; | |
190 | break; | |
191 | case 211: | |
192 | Pinfo = AliPID::kPion; | |
193 | break; | |
194 | case 2212: | |
195 | Pinfo = AliPID::kProton; | |
196 | break; | |
197 | default: | |
198 | return; | |
199 | } | |
afb48e1d | 200 | fTaggedTracks->Add(new AliHFEV0tag(TrackID, Pinfo, prodR)); |
7986e54e | 201 | AliDebug(4,Form("Added new Track ID: %d with PID: %d, #entry: %d",TrackID, Pinfo, fTaggedTracks->GetEntries())); |
202 | } | |
203 | ||
204 | ||
205 | //________________________________________________________________________________ | |
206 | //check for V0 information from track ID | |
207 | //returns AliPID::kUnknown if track ID not found | |
208 | AliPID::EParticleType AliHFEV0taginfo::GetV0Info(Int_t trackID){ | |
209 | ||
afb48e1d | 210 | AliHFEV0tag test(trackID, AliPID::kUnknown,0); |
7986e54e | 211 | AliHFEV0tag *result = dynamic_cast<AliHFEV0tag *>(fTaggedTracks->FindObject(&test)); |
212 | if(!result){ | |
213 | AliDebug(6, Form("Could not find track ID %d", trackID)); | |
214 | return AliPID::kUnknown; | |
215 | } | |
216 | return result->GetPinfo(); | |
217 | } | |
218 | ||
afb48e1d | 219 | //________________________________________________________________________________ |
220 | //check for V0 daughter production vertex from track ID | |
221 | //returns -0.1 if track ID not found | |
222 | Float_t AliHFEV0taginfo::GetV0ProdR(Int_t trackID){ | |
223 | ||
224 | AliHFEV0tag test(trackID, AliPID::kUnknown, 0); | |
225 | AliHFEV0tag *result = dynamic_cast<AliHFEV0tag *>(fTaggedTracks->FindObject(&test)); | |
226 | if(!result){ | |
227 | AliDebug(6, Form("Could not find track ID %d", trackID)); | |
228 | return -0.1; | |
229 | } | |
230 | return result->GetProdR(); | |
231 | } | |
232 | ||
7986e54e | 233 | //________________________________________________________________________________ |
234 | //resets the fTaggedTracks TList | |
235 | void AliHFEV0taginfo::Reset(){ | |
236 | fTaggedTracks->Delete(); | |
237 | } | |
238 | ||
239 | ||
240 | //___________________________________________________________________ | |
241 | AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(): | |
242 | TObject(), | |
243 | fTrackID(0), | |
afb48e1d | 244 | fPinfo(AliPID::kUnknown), |
245 | fProdR(0) | |
7986e54e | 246 | { |
247 | // default constructor | |
248 | } | |
249 | //___________________________________________________________________ | |
7fcd6b0f | 250 | AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(Int_t TrackID, AliPID::EParticleType Pinfo, Double_t ProdR): |
7986e54e | 251 | TObject(), |
252 | fTrackID(TrackID), | |
afb48e1d | 253 | fPinfo(Pinfo), |
7fcd6b0f | 254 | fProdR(ProdR) |
7986e54e | 255 | { |
256 | } | |
257 | ||
258 | //____________________________________________________________ | |
259 | AliHFEV0taginfo::AliHFEV0tag::AliHFEV0tag(const AliHFEV0tag &ref): | |
260 | TObject(ref), | |
261 | fTrackID(ref.fTrackID), | |
afb48e1d | 262 | fPinfo(ref.fPinfo), |
263 | fProdR(ref.fProdR) | |
7986e54e | 264 | { |
265 | // Copy constructor | |
266 | } | |
267 | ||
268 | //____________________________________________________________ | |
269 | AliHFEV0taginfo::AliHFEV0tag &AliHFEV0taginfo::AliHFEV0tag::operator=(const AliHFEV0tag &ref){ | |
270 | // Assignment operator | |
271 | if(this != &ref){ | |
272 | TObject::operator=(ref); | |
273 | ||
274 | fTrackID = ref.fTrackID; | |
275 | fPinfo = ref.fPinfo; | |
afb48e1d | 276 | fProdR = ref.fProdR; |
7986e54e | 277 | } |
278 | return *this; | |
279 | } | |
280 | ||
281 | //___________________________________________________________________ | |
282 | AliHFEV0taginfo::AliHFEV0tag::~AliHFEV0tag(){ | |
283 | // | |
284 | // Destructor | |
285 | // | |
286 | AliDebug(6, "DESTRUCTOR"); | |
287 | } | |
288 | ||
289 | //Set track ID and particle info | |
290 | //___________________________________________________________________ | |
5a516e0a | 291 | void AliHFEV0taginfo::AliHFEV0tag::SetTrack(Int_t trackID, AliPID::EParticleType Pinfo){ |
7986e54e | 292 | fTrackID = trackID; |
293 | fPinfo = Pinfo; | |
294 | } | |
afb48e1d | 295 | |
296 | //Set track ID and production verxtex | |
297 | //___________________________________________________________________ | |
5a516e0a | 298 | void AliHFEV0taginfo::AliHFEV0tag::SetProdR(Int_t trackID, Double_t prodR){ |
afb48e1d | 299 | fTrackID = trackID; |
300 | fProdR = prodR; | |
301 | } | |
302 | ||
7986e54e | 303 | //____________________________________________________________ |
304 | Bool_t AliHFEV0taginfo::AliHFEV0tag::IsEqual(const TObject *ref) const { | |
305 | // | |
306 | // Check for equality of track ID | |
307 | // | |
308 | const AliHFEV0tag *refObj = dynamic_cast<const AliHFEV0tag *>(ref); | |
309 | if(!refObj) return kFALSE; | |
310 | return (fTrackID == refObj->GetTrackID()); | |
311 | } | |
312 | //____________________________________________________________ | |
313 | Int_t AliHFEV0taginfo::AliHFEV0tag::Compare(const TObject *ref) const{ | |
314 | // | |
315 | // Compares two objects | |
316 | // Order: | |
317 | // First compare track ID then particle info | |
318 | // | |
dab4f95d | 319 | const AliHFEV0tag *refObj = static_cast<const AliHFEV0tag *>(ref); |
7986e54e | 320 | if(fTrackID < refObj->GetTrackID()) return -1; |
321 | else if(fTrackID > refObj->GetTrackID()) return 1; | |
322 | else{ | |
323 | if(fPinfo < refObj->GetPinfo()) return -1; | |
324 | else if(fPinfo > refObj->GetPinfo()) return 1; | |
325 | else return 0; | |
326 | } | |
327 | } | |
328 | ||
329 |