]>
Commit | Line | Data |
---|---|---|
88cb7938 | 1 | /************************************************************************** |
3decf5cb | 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 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
702ab87e | 18 | /* History of cvs commits: |
19 | * | |
20 | * $Log$ | |
e939a978 | 21 | * Revision 1.30 2006/09/13 07:31:01 kharlov |
22 | * Effective C++ corrections (T.Pocheptsov) | |
23 | * | |
43fbaae1 | 24 | * Revision 1.29 2005/05/28 14:19:05 schutz |
25 | * Compilation warnings fixed by T.P. | |
26 | * | |
702ab87e | 27 | */ |
28 | ||
3decf5cb | 29 | //_________________________________________________________________________ |
b2a60966 | 30 | // Implementation of the PHOS manager class for fast simulations |
31 | // Tracks particles until the reach a grossly designed PHOS module | |
32 | // Modify the particles property (momentum, energy, type) according to | |
33 | // the PHOS response function. The result is called a virtual reconstructed | |
34 | // particle. | |
35 | // | |
36 | //*-- Author: Yves Schutz (SUBATECH) | |
3decf5cb | 37 | |
38 | // --- ROOT system --- | |
3a4295ee | 39 | |
88cb7938 | 40 | #include <TBRIK.h> |
88cb7938 | 41 | #include <TGeometry.h> |
42 | #include <TNode.h> | |
43 | #include <TParticle.h> | |
e957fea8 | 44 | #include "TClonesArray.h" |
88cb7938 | 45 | #include <TVirtualMC.h> |
3decf5cb | 46 | |
47 | // --- Standard library --- | |
48 | ||
3decf5cb | 49 | // --- AliRoot header files --- |
3a4295ee | 50 | #include "AliPHOSFastRecParticle.h" |
88cb7938 | 51 | #include "AliPHOSGeometry.h" |
52 | #include "AliPHOSLoader.h" | |
3decf5cb | 53 | #include "AliPHOSvFast.h" |
3decf5cb | 54 | #include "AliRun.h" |
3decf5cb | 55 | |
56 | ClassImp(AliPHOSvFast) | |
57 | ||
43fbaae1 | 58 | AliPHOSvFast::AliPHOSvFast() : |
59 | fBigBoxX(0.), | |
60 | fBigBoxY(0.), | |
61 | fBigBoxZ(0.), | |
62 | fFastRecParticles(0), | |
63 | fNRecParticles(0), | |
64 | fRan(0), | |
65 | fResPara1(0.), | |
66 | fResPara2(0.), | |
67 | fResPara3(0.), | |
68 | fPosParaA0(0.), | |
69 | fPosParaA1(0.), | |
70 | fPosParaB0(0.), | |
71 | fPosParaB1(0.), | |
72 | fPosParaB2(0.) | |
3decf5cb | 73 | { |
3a4295ee | 74 | // default ctor : initialize data member |
3decf5cb | 75 | } |
76 | ||
77 | //____________________________________________________________________________ | |
78 | AliPHOSvFast::AliPHOSvFast(const char *name, const char *title): | |
43fbaae1 | 79 | AliPHOS(name,title), |
80 | fBigBoxX(0.), | |
81 | fBigBoxY(0.), | |
82 | fBigBoxZ(0.), | |
83 | fFastRecParticles(new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100)), | |
84 | fNRecParticles(0), | |
85 | fRan(0), | |
86 | fResPara1(0.030), // GeV | |
87 | fResPara2(0.00003), | |
88 | fResPara3(0.00001), | |
89 | fPosParaA0(2.87), // mm | |
90 | fPosParaA1(-0.0975), | |
91 | fPosParaB0(0.257), | |
92 | fPosParaB1(0.137), | |
93 | fPosParaB2(0.00619) | |
3decf5cb | 94 | { |
b2a60966 | 95 | // ctor |
88cb7938 | 96 | // create the Loader |
7a9d98f9 | 97 | SetBigBox(0, GetGeometry()->GetOuterBoxSize(0) ) ; |
98 | SetBigBox(1, GetGeometry()->GetOuterBoxSize(3) + GetGeometry()->GetCPVBoxSize(1) ) ; | |
99 | SetBigBox(2, GetGeometry()->GetOuterBoxSize(2) ); | |
3decf5cb | 100 | } |
101 | ||
102 | //____________________________________________________________________________ | |
103 | AliPHOSvFast::~AliPHOSvFast() | |
104 | { | |
b2a60966 | 105 | // dtor |
3decf5cb | 106 | |
a73f33f0 | 107 | fFastRecParticles->Delete() ; |
108 | delete fFastRecParticles ; | |
109 | fFastRecParticles = 0 ; | |
3decf5cb | 110 | |
111 | } | |
112 | ||
113 | //____________________________________________________________________________ | |
a73f33f0 | 114 | void AliPHOSvFast::AddRecParticle(const AliPHOSFastRecParticle & rp) |
115 | { | |
b2a60966 | 116 | // Add a virtually reconstructed particle to the list |
117 | ||
f96d3dc7 | 118 | new( (*fFastRecParticles)[fNRecParticles] ) AliPHOSFastRecParticle(rp) ; |
119 | fNRecParticles++ ; | |
3decf5cb | 120 | } |
121 | ||
122 | //____________________________________________________________________________ | |
123 | void AliPHOSvFast::BuildGeometry() | |
124 | { | |
3decf5cb | 125 | // Build the PHOS geometry for the ROOT display |
b2a60966 | 126 | //BEGIN_HTML |
127 | /* | |
128 | <H2> | |
129 | PHOS FAST in ALICE displayed by root | |
130 | </H2> | |
131 | <H4> All Views </H4> | |
132 | <P> | |
133 | <CENTER> | |
134 | <IMG Align=BOTTOM ALT="Fast All Views" SRC="../images/AliPHOSvFastAllViews.gif"> | |
135 | </CENTER></P> | |
136 | <H4> Front View </H4> | |
137 | <P> | |
138 | <CENTER> | |
139 | <IMG Align=BOTTOM ALT="Fast Front View" SRC="../images/AliPHOSvFastFrontView.gif"> | |
140 | </CENTER></P> | |
141 | */ | |
142 | //END_HTML | |
143 | ||
3decf5cb | 144 | const Int_t kColorPHOS = kRed ; |
145 | ||
a8c47ab6 | 146 | Double_t const kRADDEG = 180.0 / TMath::Pi() ; |
3decf5cb | 147 | |
148 | new TBRIK( "BigBox", "PHOS box", "void", GetBigBox(0)/2, | |
149 | GetBigBox(1)/2, | |
150 | GetBigBox(2)/2 ); | |
151 | ||
152 | // position PHOS into ALICE | |
153 | ||
fa7cce36 | 154 | Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ; |
3decf5cb | 155 | Int_t number = 988 ; |
fa7cce36 | 156 | Float_t pphi = TMath::ATan( GetBigBox(0) / ( 2.0 * GetGeometry()->GetIPtoCrystalSurface() ) ) ; |
3decf5cb | 157 | pphi *= kRADDEG ; |
158 | TNode * top = gAlice->GetGeometry()->GetNode("alice") ; | |
159 | ||
160 | char * nodename = new char[20] ; | |
161 | char * rotname = new char[20] ; | |
162 | ||
fa7cce36 | 163 | for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) { |
164 | Float_t angle = pphi * 2 * ( i - GetGeometry()->GetNModules() / 2.0 - 0.5 ) ; | |
3decf5cb | 165 | sprintf(rotname, "%s%d", "rot", number++) ; |
166 | new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0); | |
167 | top->cd(); | |
168 | sprintf(nodename,"%s%d", "Module", i) ; | |
169 | Float_t x = r * TMath::Sin( angle / kRADDEG ) ; | |
170 | Float_t y = -r * TMath::Cos( angle / kRADDEG ) ; | |
171 | TNode * bigboxnode = new TNode(nodename, nodename, "BigBox", x, y, 0, rotname ) ; | |
172 | bigboxnode->SetLineColor(kColorPHOS) ; | |
173 | fNodes->Add(bigboxnode) ; | |
174 | } | |
175 | delete[] nodename ; | |
176 | delete[] rotname ; | |
177 | } | |
178 | ||
179 | //____________________________________________________________________________ | |
180 | void AliPHOSvFast::CreateGeometry() | |
181 | { | |
b2a60966 | 182 | // Create the geometry for GEANT |
183 | ||
3decf5cb | 184 | AliPHOSvFast *phostmp = (AliPHOSvFast*)gAlice->GetModule("PHOS") ; |
b2a60966 | 185 | |
3decf5cb | 186 | if ( phostmp == NULL ) { |
187 | ||
188 | fprintf(stderr, "PHOS detector not found!\n") ; | |
189 | return ; | |
190 | ||
191 | } | |
192 | ||
193 | // Get pointer to the array containing media indeces | |
194 | Int_t *idtmed = fIdtmed->GetArray() - 699 ; | |
195 | ||
196 | Float_t bigbox[3] ; | |
197 | bigbox[0] = GetBigBox(0) / 2.0 ; | |
198 | bigbox[1] = GetBigBox(1) / 2.0 ; | |
199 | bigbox[2] = GetBigBox(2) / 2.0 ; | |
200 | ||
201 | gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ; | |
202 | ||
203 | // --- Position PHOS mdules in ALICE setup --- | |
204 | ||
205 | Int_t idrotm[99] ; | |
a8c47ab6 | 206 | Double_t const kRADDEG = 180.0 / TMath::Pi() ; |
3decf5cb | 207 | |
fa7cce36 | 208 | for( Int_t i = 1; i <= GetGeometry()->GetNModules(); i++ ) { |
3decf5cb | 209 | |
fa7cce36 | 210 | Float_t angle = GetGeometry()->GetPHOSAngle(i) ; |
3decf5cb | 211 | AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ; |
212 | ||
fa7cce36 | 213 | Float_t r = GetGeometry()->GetIPtoCrystalSurface() + GetBigBox(1) / 2.0 ; |
3decf5cb | 214 | |
215 | Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ; | |
216 | Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ; | |
3decf5cb | 217 | gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ; |
218 | ||
219 | } // for GetNModules | |
220 | ||
221 | } | |
222 | ||
223 | ||
224 | //____________________________________________________________________________ | |
225 | void AliPHOSvFast::Init(void) | |
226 | { | |
b2a60966 | 227 | // Prints out an information message |
228 | ||
3decf5cb | 229 | Int_t i; |
230 | ||
231 | printf("\n"); | |
232 | for(i=0;i<35;i++) printf("*"); | |
233 | printf(" FAST PHOS_INIT "); | |
234 | for(i=0;i<35;i++) printf("*"); | |
235 | printf("\n"); | |
236 | ||
237 | // Here the PHOS initialisation code (if any!) | |
238 | ||
239 | for(i=0;i<80;i++) printf("*"); | |
240 | printf("\n"); | |
241 | ||
242 | } | |
243 | ||
244 | //___________________________________________________________________________ | |
3a4295ee | 245 | Float_t AliPHOSvFast::GetBigBox(Int_t index) const |
3decf5cb | 246 | { |
b2a60966 | 247 | // Get the X, Y or Z dimension of the box describing a PHOS module |
248 | ||
3decf5cb | 249 | Float_t rv = 0 ; |
250 | ||
251 | switch (index) { | |
252 | case 0: | |
253 | rv = fBigBoxX ; | |
254 | break ; | |
255 | case 1: | |
256 | rv = fBigBoxY ; | |
257 | break ; | |
258 | case 2: | |
259 | rv = fBigBoxZ ; | |
260 | break ; | |
261 | } | |
262 | return rv ; | |
263 | } | |
3decf5cb | 264 | //___________________________________________________________________________ |
88cb7938 | 265 | |
266 | void AliPHOSvFast::MakeBranch(Option_t* opt) | |
3decf5cb | 267 | { |
b2a60966 | 268 | // Create new branch in the current reconstructed Root Tree |
88cb7938 | 269 | AliDetector::MakeBranch(opt); |
3a4295ee | 270 | const char *cd = strstr(opt,"R"); |
3decf5cb | 271 | |
88cb7938 | 272 | if (fFastRecParticles && fLoader->TreeR() && cd) { |
273 | MakeBranchInTree(fLoader->TreeR(), GetName(), &fFastRecParticles, fBufferSize, 0); | |
3decf5cb | 274 | } |
275 | } | |
a73f33f0 | 276 | //____________________________________________________________________________ |
88cb7938 | 277 | |
fc7e2f43 | 278 | Double_t AliPHOSvFast::MakeEnergy(Double_t energy) |
a73f33f0 | 279 | { |
b2a60966 | 280 | // Smears the energy according to the energy dependent energy resolution. |
281 | // A gaussian distribution is assumed | |
282 | ||
b1aa729d | 283 | Double_t sigma = SigmaE(energy) ; |
284 | return fRan.Gaus(energy, sigma) ; | |
a73f33f0 | 285 | } |
a73f33f0 | 286 | //____________________________________________________________________________ |
88cb7938 | 287 | |
fc7e2f43 | 288 | TVector3 AliPHOSvFast::MakePosition(Double_t energy, TVector3 pos, Double_t theta, Double_t phi) |
a73f33f0 | 289 | { |
b2a60966 | 290 | // Smears the impact position according to the energy dependent position resolution |
291 | // A gaussian position distribution is assumed | |
292 | ||
b1aa729d | 293 | TVector3 newpos ; |
294 | Double_t sigma = SigmaP( energy, theta*180./TMath::Pi() ) ; | |
295 | Double_t x = fRan.Gaus( pos.X(), sigma ) ; | |
296 | sigma = SigmaP( energy, phi*180./TMath::Pi() ) ; | |
297 | Double_t z = fRan.Gaus( pos.Z(), sigma ) ; | |
298 | Double_t y = pos.Y() ; | |
299 | ||
300 | newpos.SetX(x) ; | |
301 | newpos.SetY(y) ; | |
302 | newpos.SetZ(z) ; | |
303 | ||
304 | return newpos ; | |
305 | } | |
a73f33f0 | 306 | |
b1aa729d | 307 | //____________________________________________________________________________ |
fc7e2f43 | 308 | void AliPHOSvFast::MakeRecParticle(Int_t modid, TVector3 pos, AliPHOSFastRecParticle & rp) |
b1aa729d | 309 | { |
b2a60966 | 310 | // Modify the primary particle properties according |
311 | // 1. the response function of PHOS | |
312 | // 2. the performance of the EMC+PPSD setup | |
313 | ||
b1aa729d | 314 | Int_t type = MakeType( rp ) ; |
a73f33f0 | 315 | rp.SetType(type) ; |
316 | ||
317 | ||
318 | // get the detected energy | |
319 | ||
320 | TLorentzVector momentum ; | |
321 | rp.Momentum(momentum) ; | |
322 | Double_t kineticenergy = TMath::Sqrt( TMath::Power(momentum.E(), 2) - TMath::Power(rp.GetMass(), 2) ) ; | |
323 | Double_t modifiedkineticenergy = MakeEnergy(kineticenergy ) ; | |
b1aa729d | 324 | Double_t modifiedenergy = TMath::Sqrt( TMath::Power(modifiedkineticenergy, 2) |
325 | + TMath::Power( rp.GetMass(), 2) ) ; | |
326 | ||
327 | // get the angle of incidence | |
328 | ||
329 | Double_t incidencetheta = 90. * TMath::Pi() /180 - rp.Theta() ; | |
fa7cce36 | 330 | Double_t incidencephi = ( 270 + GetGeometry()->GetPHOSAngle(modid) ) * TMath::Pi() / 180. - rp.Phi() ; |
b1aa729d | 331 | |
332 | // get the detected direction | |
333 | ||
334 | TVector3 modifiedposition = MakePosition(kineticenergy, pos, incidencetheta, incidencephi) ; | |
335 | modifiedposition *= modifiedkineticenergy / modifiedposition.Mag() ; | |
336 | ||
337 | // Set the modified 4-momentum of the reconstructed particle | |
338 | ||
339 | rp.SetMomentum(modifiedposition.X(), modifiedposition.Y(), modifiedposition.Z(), modifiedenergy) ; | |
340 | ||
a73f33f0 | 341 | } |
342 | ||
343 | //____________________________________________________________________________ | |
b1aa729d | 344 | Int_t AliPHOSvFast::MakeType(AliPHOSFastRecParticle & rp ) |
a73f33f0 | 345 | { |
b2a60966 | 346 | // Generate a particle type using the performance of the EMC+PPSD setup |
347 | ||
9ec91567 | 348 | Int_t rv = AliPHOSFastRecParticle::kUNDEFINED ; |
b1aa729d | 349 | Int_t charge = (Int_t)rp.GetPDG()->Charge() ; |
350 | Int_t test ; | |
351 | Float_t ran ; | |
f96d3dc7 | 352 | if ( charge != 0 && ( TMath::Abs(rp.GetPdgCode()) != 11 ) ) |
b1aa729d | 353 | test = - 1 ; |
354 | else | |
355 | test = rp.GetPdgCode() ; | |
356 | ||
a4765fe4 | 357 | Fatal("MakeType", "SHOULD NOT BE USED until values of probabilities are properly set ") ; |
358 | // NB: ALL VALUES SHOULD BE CHECKED !!!! | |
b1aa729d | 359 | switch (test) { |
360 | ||
3a4295ee | 361 | case 22: // it's a photon // NB: ALL VALUES SHOLD BE CHECKED !!!! |
b1aa729d | 362 | ran = fRan.Rndm() ; |
3a4295ee | 363 | if( ran <= 0.9498 ) |
364 | rv = AliPHOSFastRecParticle::kNEUTRALHAFAST ; | |
365 | else | |
366 | rv = AliPHOSFastRecParticle::kNEUTRALEMFAST ; | |
b1aa729d | 367 | break ; |
368 | ||
369 | case 2112: // it's a neutron | |
370 | ran = fRan.Rndm() ; | |
371 | if ( ran <= 0.9998 ) | |
3a4295ee | 372 | rv = AliPHOSFastRecParticle::kNEUTRALHASLOW ; |
b1aa729d | 373 | else |
3a4295ee | 374 | rv = AliPHOSFastRecParticle::kNEUTRALEMSLOW ; |
b1aa729d | 375 | break ; |
3a4295ee | 376 | |
b1aa729d | 377 | case -2112: // it's a anti-neutron |
378 | ran = fRan.Rndm() ; | |
379 | if ( ran <= 0.9984 ) | |
3a4295ee | 380 | rv = AliPHOSFastRecParticle::kNEUTRALHASLOW ; |
b1aa729d | 381 | else |
3a4295ee | 382 | rv = AliPHOSFastRecParticle::kNEUTRALEMSLOW ; |
b1aa729d | 383 | break ; |
384 | ||
385 | case 11: // it's a electron | |
386 | ran = fRan.Rndm() ; | |
387 | if ( ran <= 0.9996 ) | |
3a4295ee | 388 | rv = AliPHOSFastRecParticle::kCHARGEDEMFAST ; |
b1aa729d | 389 | else |
3a4295ee | 390 | rv = AliPHOSFastRecParticle::kCHARGEDHAFAST ; |
b1aa729d | 391 | break; |
392 | ||
f96d3dc7 | 393 | case -11: // it's a positon |
b1aa729d | 394 | ran = fRan.Rndm() ; |
395 | if ( ran <= 0.9996 ) | |
3a4295ee | 396 | rv = AliPHOSFastRecParticle::kCHARGEDEMFAST ; |
b1aa729d | 397 | else |
3a4295ee | 398 | rv = AliPHOSFastRecParticle::kCHARGEDHAFAST ; |
b1aa729d | 399 | break; |
400 | ||
401 | case -1: // it's a charged | |
402 | ran = fRan.Rndm() ; | |
403 | if ( ran <= 0.9996 ) | |
3a4295ee | 404 | rv = AliPHOSFastRecParticle::kCHARGEDHAFAST ; |
b1aa729d | 405 | else |
3a4295ee | 406 | rv = AliPHOSFastRecParticle::kNEUTRALHAFAST ; |
b1aa729d | 407 | |
408 | break ; | |
409 | } | |
410 | ||
411 | ||
a73f33f0 | 412 | return rv ; |
413 | } | |
414 | ||
f96d3dc7 | 415 | //___________________________________________________________________________ |
416 | void AliPHOSvFast::ResetPoints() | |
417 | { | |
b2a60966 | 418 | // This overloads the method in AliDetector |
419 | ||
f96d3dc7 | 420 | ResetFastRecParticles() ; |
421 | } | |
422 | ||
423 | //___________________________________________________________________________ | |
424 | void AliPHOSvFast::ResetFastRecParticles() | |
425 | { | |
b2a60966 | 426 | // Resets the list of virtual reconstructed particles |
427 | ||
f96d3dc7 | 428 | if (fFastRecParticles) |
429 | fFastRecParticles->Clear() ; | |
430 | fNRecParticles = 0 ; | |
431 | } | |
432 | ||
3decf5cb | 433 | //___________________________________________________________________________ |
434 | void AliPHOSvFast::SetBigBox(Int_t index, Float_t value) | |
435 | { | |
b2a60966 | 436 | // Set the size of the Box describing a PHOS module |
437 | ||
3decf5cb | 438 | switch (index) { |
439 | case 0: | |
440 | fBigBoxX = value ; | |
441 | break ; | |
442 | case 1: | |
443 | fBigBoxY = value ; | |
444 | break ; | |
445 | case 2: | |
446 | fBigBoxZ = value ; | |
447 | break ; | |
448 | } | |
449 | ||
450 | } | |
451 | ||
a73f33f0 | 452 | //____________________________________________________________________________ |
453 | Double_t AliPHOSvFast::SigmaE(Double_t energy) | |
454 | { | |
b2a60966 | 455 | // Calculates the energy dependent energy resolution |
456 | ||
a73f33f0 | 457 | Double_t rv = -1 ; |
458 | ||
459 | rv = TMath::Sqrt( TMath::Power(fResPara1/energy, 2) | |
460 | + TMath::Power(fResPara2/TMath::Sqrt(energy), 2) | |
461 | + TMath::Power(fResPara3, 2) ) ; | |
462 | ||
463 | return rv * energy ; | |
464 | } | |
465 | ||
b1aa729d | 466 | //____________________________________________________________________________ |
7a9d98f9 | 467 | Double_t AliPHOSvFast::SigmaP(Double_t energy, Double_t incidence) |
b1aa729d | 468 | { |
b2a60966 | 469 | // Calculates the energy dependent position resolution |
470 | ||
b1aa729d | 471 | Double_t paraA = fPosParaA0 + fPosParaA1 * incidence ; |
472 | Double_t paraB = fPosParaB0 + fPosParaB1 * incidence + fPosParaB2 * incidence * incidence ; | |
473 | ||
474 | return ( paraA / TMath::Sqrt(energy) + paraB ) * 0.1 ; // in cm | |
475 | } | |
476 | ||
3decf5cb | 477 | //____________________________________________________________________________ |
478 | void AliPHOSvFast::StepManager(void) | |
479 | { | |
b2a60966 | 480 | // Only verifies if the particle reaches PHOS and stops the tracking |
3a4295ee | 481 | |
a73f33f0 | 482 | TLorentzVector lv ; |
483 | gMC->TrackPosition(lv) ; | |
b1aa729d | 484 | TVector3 pos = lv.Vect() ; |
485 | Int_t modid ; | |
486 | gMC->CurrentVolID(modid); | |
a73f33f0 | 487 | |
3a4295ee | 488 | Float_t energy = gMC->Etot() ; //Total energy of current track |
3decf5cb | 489 | |
3a4295ee | 490 | //Calculating mass of current particle |
491 | TDatabasePDG * pdg = TDatabasePDG::Instance() ; | |
492 | TParticlePDG * partPDG = pdg->GetParticle(gMC->TrackPid()) ; | |
493 | Float_t mass = partPDG->Mass() ; | |
a73f33f0 | 494 | |
3a4295ee | 495 | if(energy > mass){ |
496 | pos.SetMag(TMath::Sqrt(energy*energy-mass*mass)) ; | |
497 | TLorentzVector pTrack(pos, energy) ; | |
a73f33f0 | 498 | |
3a4295ee | 499 | TParticle * part = new TParticle(gMC->TrackPid(), 0,-1,-1,-1,-1, pTrack, lv) ; |
500 | ||
501 | AliPHOSFastRecParticle rp(*part) ; | |
b1aa729d | 502 | |
3a4295ee | 503 | // Adds the response of PHOS to the particle |
504 | MakeRecParticle(modid, pos, rp) ; | |
505 | ||
506 | // add the `track' particle to the FastRecParticles list | |
b1aa729d | 507 | |
3a4295ee | 508 | AddRecParticle(rp) ; |
a73f33f0 | 509 | |
3a4295ee | 510 | part->Delete() ; |
511 | } | |
a73f33f0 | 512 | // stop the track as soon PHOS is reached |
b1aa729d | 513 | |
3decf5cb | 514 | gMC->StopTrack() ; |
515 | ||
516 | } | |
517 |