]>
Commit | Line | Data |
---|---|---|
6ad0bfa0 | 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 | **************************************************************************/ | |
b2a60966 | 15 | /* $Id$ */ |
6ad0bfa0 | 16 | //_________________________________________________________________________ |
b2a60966 | 17 | // A Reconstructed Particle in PHOS |
2f04ed65 | 18 | // To become a general class of AliRoot ? |
19 | // Why should I put meaningless comments | |
20 | // just to satisfy | |
21 | // the code checker | |
b2a60966 | 22 | // |
23 | //*-- Author: Yves Schutz (SUBATECH) | |
24 | ||
6ad0bfa0 | 25 | |
26 | // --- ROOT system --- | |
27 | ||
28 | // --- Standard library --- | |
29 | ||
ed4205d8 | 30 | |
6ad0bfa0 | 31 | // --- AliRoot header files --- |
6ad0bfa0 | 32 | #include "AliPHOSRecParticle.h" |
8f3968d8 | 33 | #include "AliPHOSGetter.h" |
c81ced2d | 34 | #include "AliPHOSGeometry.h" |
1212b8da | 35 | #include "AliLog.h" |
6ad0bfa0 | 36 | |
0272607d | 37 | //____________________________________________________________________________ |
38 | AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0) , fDebug( kFALSE ) | |
39 | { | |
40 | // ctor | |
304864ab | 41 | const Int_t nSPECIES = AliPID::kSPECIESN; |
88340ded | 42 | for(Int_t i = 0; i<nSPECIES ; i++) |
0272607d | 43 | fPID[i]=0.; |
44 | } | |
6ad0bfa0 | 45 | |
46 | ||
a73f33f0 | 47 | //____________________________________________________________________________ |
48 | AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp) | |
a8c47ab6 | 49 | : AliPHOSFastRecParticle(rp) |
a73f33f0 | 50 | { |
b2a60966 | 51 | // copy ctor |
52 | ||
83974468 | 53 | fPHOSTrackSegment = rp.fPHOSTrackSegment ; |
51d189f4 | 54 | fDebug = kFALSE ; |
a73f33f0 | 55 | fType = rp.fType ; |
83974468 | 56 | fIndexInList = rp.fIndexInList ; |
b2a60966 | 57 | |
cafda784 | 58 | fPdgCode = rp.fPdgCode; |
59 | fStatusCode = rp.fStatusCode; | |
60 | fMother[0] = rp.fMother[0]; | |
61 | fMother[1] = rp.fMother[1]; | |
62 | fDaughter[0] = rp.fDaughter[0]; | |
63 | fDaughter[1] = rp.fDaughter[1]; | |
64 | fWeight = rp.fWeight; | |
65 | fCalcMass = rp.fCalcMass; | |
66 | fPx = rp.fPx; | |
67 | fPy = rp.fPy; | |
68 | fPz = rp.fPz; | |
69 | fE = rp.fE; | |
70 | fVx = rp.fVx; | |
71 | fVy = rp.fVy; | |
72 | fVz = rp.fVz; | |
73 | fVt = rp.fVt; | |
74 | fPolarTheta = rp.fPolarTheta; | |
75 | fPolarPhi = rp.fPolarPhi; | |
76 | fParticlePDG = rp.fParticlePDG; | |
304864ab | 77 | const Int_t nSPECIES = AliPID::kSPECIESN; |
88340ded | 78 | for(Int_t i = 0; i<nSPECIES ; i++) |
0272607d | 79 | fPID[i]=rp.fPID[i]; |
b2a60966 | 80 | } |
83974468 | 81 | |
8f3968d8 | 82 | //____________________________________________________________________________ |
17323043 | 83 | Int_t AliPHOSRecParticle::GetNPrimaries() const |
88cb7938 | 84 | { |
85 | return -1; | |
a278df55 | 86 | } |
87 | ||
88 | //____________________________________________________________________________ | |
17323043 | 89 | Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const |
8f3968d8 | 90 | { |
e957fea8 | 91 | // Get the number of primaries at the origine of the RecParticle |
8f3968d8 | 92 | Int_t rv = 0 ; |
88cb7938 | 93 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
94 | Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex(); | |
95 | dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ; | |
8f3968d8 | 96 | return rv ; |
97 | } | |
83974468 | 98 | |
c81ced2d | 99 | //____________________________________________________________________________ |
100 | const TParticle * AliPHOSRecParticle::GetPrimary() const | |
101 | { | |
102 | // Get the primary particle at the origine of the RecParticle and | |
103 | // which has deposited the largest energy in SDigits | |
104 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; | |
105 | if (!gime) | |
106 | Error("GetPrimary", "Getter not yet instantiated") ; | |
107 | gime->Event(gime->EventNumber(), "SRTPX") ; | |
108 | if(GetNPrimaries() == 0) | |
109 | return 0 ; | |
110 | if(GetNPrimaries() == 1) | |
111 | return GetPrimary(0) ; | |
112 | Int_t AbsId = 0; | |
113 | Int_t module ; | |
114 | const AliPHOSGeometry * geom = gime->PHOSGeometry() ; | |
115 | Double_t x,z ; | |
116 | geom->ImpactOnEmc(static_cast<double>(Theta()),static_cast<double>(Phi()), module,z,x); | |
117 | Int_t amp = 0 ; | |
118 | Int_t iPrim=-1 ; | |
119 | if(module != 0){ | |
120 | geom->RelPosToAbsId(module,x,z,AbsId) ; | |
121 | TClonesArray * sdigits = gime->SDigits() ; | |
122 | AliPHOSDigit * sdig ; | |
123 | ||
124 | for(Int_t i = 0 ; i < sdigits->GetEntriesFast() ; i++){ | |
125 | sdig = static_cast<AliPHOSDigit *>(sdigits->At(i)) ; | |
126 | if((sdig->GetId() == AbsId)){ | |
127 | if((sdig->GetAmp() > amp) && (sdig->GetNprimary())){ | |
128 | amp = sdig->GetAmp() ; | |
129 | iPrim = sdig->GetPrimary(1) ; | |
130 | } | |
131 | // do not scan rest of list | |
132 | if(sdig->GetId() > AbsId) | |
133 | continue ; | |
134 | } | |
135 | } | |
136 | } | |
137 | if(iPrim >= 0) | |
138 | return gime->Primary(iPrim) ; | |
139 | else | |
140 | return 0 ; | |
141 | } | |
142 | ||
09286392 | 143 | //____________________________________________________________________________ |
eb0b1051 | 144 | Int_t AliPHOSRecParticle::GetPrimaryIndex() const |
09286392 | 145 | { |
146 | // Get the primary track index in TreeK which deposits the most energy | |
147 | // in Digits which forms EmcRecPoint, which produces TrackSegment, | |
148 | // which the RecParticle is created from | |
149 | ||
1212b8da | 150 | |
09286392 | 151 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
152 | if (!gime) | |
1212b8da | 153 | AliError(Form("Getter not yet instantiated")) ; |
eb0b1051 | 154 | //PH gime->Event(gime->EventNumber(), "DRTX") ; |
84294dcd | 155 | gime->Event(gime->EventNumber(), "DRT") ; |
1212b8da | 156 | |
09286392 | 157 | // Get TrackSegment corresponding to this RecParticle |
158 | AliPHOSTrackSegment *ts = gime->TrackSegment(fPHOSTrackSegment); | |
159 | ||
160 | // Get EmcRecPoint corresponding to this TrackSegment | |
161 | Int_t emcRecPointIndex = ts->GetEmcIndex(); | |
1212b8da | 162 | |
09286392 | 163 | AliPHOSEmcRecPoint *emcRecPoint = gime->EmcRecPoint(emcRecPointIndex); |
164 | ||
165 | // Get the list of digits forming this EmcRecParticle | |
166 | Int_t nDigits = emcRecPoint->GetDigitsMultiplicity(); | |
167 | Int_t *digitList = emcRecPoint->GetDigitsList(); | |
e4ca05c3 | 168 | |
09286392 | 169 | // Find the digit with maximum amplitude |
170 | AliPHOSDigit *digit = 0; | |
171 | Int_t maxAmp = 0; | |
172 | Int_t bestDigitIndex = -1; | |
173 | for (Int_t iDigit=0; iDigit<nDigits; iDigit++) { | |
1212b8da | 174 | digit = gime->Digit(digitList[iDigit]); |
09286392 | 175 | if (digit->GetAmp() > maxAmp) { |
176 | maxAmp = digit->GetAmp(); | |
177 | bestDigitIndex = iDigit; | |
178 | } | |
179 | } | |
180 | digit = gime->Digit(digitList[bestDigitIndex]); | |
c48a7283 | 181 | |
09286392 | 182 | // Get the list of primary tracks producing this digit |
183 | // and find which track has more track energy. | |
c48a7283 | 184 | //Int_t nPrimary = digit->GetNprimary(); |
185 | //TParticle *track = 0; | |
186 | //Double_t energyEM = 0; | |
187 | //Double_t energyHadron = 0; | |
188 | //Int_t trackEM = -1; | |
189 | //Int_t trackHadron = -1; | |
190 | //for (Int_t iPrim=0; iPrim<nPrimary; iPrim++) { | |
191 | // Int_t iPrimary = digit->GetPrimary(iPrim+1); | |
192 | // if (iPrimary == -1 || TMath::Abs(iPrimary)>10000000) | |
193 | // continue ; //PH 10000000 is the shift of the track | |
194 | // //PH indexes in the underlying event | |
195 | // track = gime->Primary(iPrimary); | |
196 | // Int_t pdgCode = track->GetPdgCode(); | |
197 | // Double_t energy = track->Energy(); | |
198 | // if (pdgCode==22 || TMath::Abs(pdgCode)==11) { | |
199 | // if (energy > energyEM) { | |
200 | // energyEM = energy; | |
201 | // trackEM = iPrimary; | |
202 | // } | |
203 | // } | |
204 | // else { | |
205 | // if (energy > energyHadron) { | |
206 | // energyHadron = energy; | |
207 | // trackHadron = iPrimary; | |
208 | // } | |
209 | // } | |
210 | //} | |
211 | // Preferences are given to electromagnetic tracks | |
212 | //if (trackEM != -1) return trackEM; // track is gamma or e+- | |
213 | //if (trackHadron != -1) return trackHadron; // track is hadron | |
214 | //return -12345; // no track found :( | |
215 | ||
216 | ||
217 | // Get the list of hits producing this digit, | |
218 | // find which hit has deposited more energy | |
219 | // and find the primary track. | |
220 | ||
221 | AliPHOSHit *hit = 0; | |
222 | TClonesArray *hits = gime->Hits(); | |
223 | Double_t maxedep = 0; | |
224 | Int_t maxtrack = -1; | |
225 | Int_t nHits = hits ->GetEntries(); | |
226 | Int_t id = digit->GetId(); | |
227 | ||
228 | for (Int_t iHit=0; iHit<nHits; iHit++) { | |
229 | hit = gime->Hit(iHit); | |
230 | if(hit->GetId() == id){ | |
231 | Double_t edep = hit->GetEnergy(); | |
232 | Int_t track = hit->GetPrimary(); | |
233 | if(edep > maxedep){ | |
234 | maxedep = edep; | |
235 | maxtrack = track; | |
09286392 | 236 | } |
237 | } | |
238 | } | |
c48a7283 | 239 | |
240 | if (maxtrack != -1) return maxtrack; // track is hadron | |
241 | return -12345; // no track found :( | |
09286392 | 242 | } |
243 | ||
8f3968d8 | 244 | //____________________________________________________________________________ |
245 | const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const | |
246 | { | |
c81ced2d | 247 | // Get one of the primary particles at the origine of the RecParticle |
a278df55 | 248 | if ( index > GetNPrimariesToRecParticles() ) { |
51d189f4 | 249 | if (fDebug) |
88cb7938 | 250 | Warning("GetPrimary", "AliPHOSRecParticle::GetPrimary -> %d is larger that the number of primaries %d", |
251 | index, GetNPrimaries()) ; | |
252 | return 0 ; | |
51d189f4 | 253 | } |
88cb7938 | 254 | else { |
255 | Int_t dummy ; | |
256 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; | |
257 | ||
258 | Int_t emcRPindex = dynamic_cast<AliPHOSTrackSegment*>(gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex(); | |
259 | Int_t primaryindex = dynamic_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy)[index] ; | |
260 | return gime->Primary(primaryindex) ; | |
261 | } | |
fc7e2f43 | 262 | // return 0 ; |
8f3968d8 | 263 | } |
948a4b24 | 264 | |
06e774ed | 265 | //____________________________________________________________________________ |
85c60a8e | 266 | void AliPHOSRecParticle::SetPID(Int_t type, Float_t weight) |
06e774ed | 267 | { |
cc1fe362 | 268 | // Set the probability densities that this reconstructed particle |
06e774ed | 269 | // has a type of i: |
270 | // i particle types | |
271 | // ---------------------- | |
272 | // 0 electron | |
273 | // 1 muon | |
274 | // 2 pi+- | |
275 | // 3 K+- | |
276 | // 4 p/pbar | |
277 | // 5 photon | |
278 | // 6 pi0 at high pt | |
279 | // 7 neutron | |
280 | // 8 K0L | |
cc1fe362 | 281 | // 9 Conversion electron |
282 | ||
283 | fPID[type] = weight ; | |
06e774ed | 284 | } |