]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | /* | |
17 | $Log$ | |
db30bf0f | 18 | Revision 1.29 2001/05/16 14:57:28 alibrary |
19 | New files for folders and Stack | |
20 | ||
9e1a0ddb | 21 | Revision 1.28 2001/05/07 08:03:22 cblume |
22 | Generate also hits in the amplification region | |
23 | ||
f73816f5 | 24 | Revision 1.27 2001/03/30 14:40:15 cblume |
25 | Update of the digitization parameter | |
26 | ||
a3c76cdc | 27 | Revision 1.26 2000/11/30 17:38:08 cblume |
28 | Changes to get in line with new STEER and EVGEN | |
29 | ||
1819f4bb | 30 | Revision 1.25 2000/11/15 14:30:16 cblume |
31 | Fixed bug in calculating detector no. of extra hit | |
32 | ||
990e4068 | 33 | Revision 1.24 2000/11/10 14:58:36 cblume |
34 | Introduce additional hit with amplitude 0 at the chamber borders | |
35 | ||
769257f4 | 36 | Revision 1.23 2000/11/01 14:53:21 cblume |
37 | Merge with TRD-develop | |
38 | ||
793ff80c | 39 | Revision 1.17.2.5 2000/10/15 23:40:01 cblume |
40 | Remove AliTRDconst | |
41 | ||
42 | Revision 1.17.2.4 2000/10/06 16:49:46 cblume | |
43 | Made Getters const | |
44 | ||
45 | Revision 1.17.2.3 2000/10/04 16:34:58 cblume | |
46 | Replace include files by forward declarations | |
47 | ||
48 | Revision 1.17.2.2 2000/09/18 13:50:17 cblume | |
49 | Include TR photon generation and adapt to new AliTRDhit | |
50 | ||
51 | Revision 1.22 2000/06/27 13:08:50 cblume | |
52 | Changed to Copy(TObject &A) to appease the HP-compiler | |
53 | ||
43da34c0 | 54 | Revision 1.21 2000/06/09 11:10:07 cblume |
55 | Compiler warnings and coding conventions, next round | |
56 | ||
dd9a6ee3 | 57 | Revision 1.20 2000/06/08 18:32:58 cblume |
58 | Make code compliant to coding conventions | |
59 | ||
8230f242 | 60 | Revision 1.19 2000/06/07 16:27:32 cblume |
61 | Try to remove compiler warnings on Sun and HP | |
62 | ||
9d0b222b | 63 | Revision 1.18 2000/05/08 16:17:27 cblume |
64 | Merge TRD-develop | |
65 | ||
6f1e466d | 66 | Revision 1.17.2.1 2000/05/08 14:59:16 cblume |
67 | Made inline function non-virtual. Bug fix in setting sensitive chamber | |
68 | ||
69 | Revision 1.17 2000/02/28 19:10:26 cblume | |
70 | Include the new TRD classes | |
71 | ||
851d3db9 | 72 | Revision 1.16.4.1 2000/02/28 18:04:35 cblume |
73 | Change to new hit version, introduce geometry class, and move digitization and clustering to AliTRDdigitizer/AliTRDclusterizerV1 | |
74 | ||
75 | Revision 1.16 1999/11/05 22:50:28 fca | |
76 | Do not use Atan, removed from ROOT too | |
77 | ||
90f8d287 | 78 | Revision 1.15 1999/11/02 17:20:19 fca |
79 | initialise nbytes before using it | |
80 | ||
036da493 | 81 | Revision 1.14 1999/11/02 17:15:54 fca |
82 | Correct ansi scoping not accepted by HP compilers | |
83 | ||
0549c011 | 84 | Revision 1.13 1999/11/02 17:14:51 fca |
85 | Correct ansi scoping not accepted by HP compilers | |
86 | ||
9c767df4 | 87 | Revision 1.12 1999/11/02 16:35:56 fca |
88 | New version of TRD introduced | |
89 | ||
5c7f4665 | 90 | Revision 1.11 1999/11/01 20:41:51 fca |
91 | Added protections against using the wrong version of FRAME | |
92 | ||
ab76897d | 93 | Revision 1.10 1999/09/29 09:24:35 fca |
94 | Introduction of the Copyright and cvs Log | |
95 | ||
4c039060 | 96 | */ |
97 | ||
fe4da5cc | 98 | /////////////////////////////////////////////////////////////////////////////// |
99 | // // | |
769257f4 | 100 | // Transition Radiation Detector version 1 -- slow simulator // |
fe4da5cc | 101 | // // |
102 | //Begin_Html | |
103 | /* | |
5c7f4665 | 104 | <img src="picts/AliTRDfullClass.gif"> |
fe4da5cc | 105 | */ |
106 | //End_Html | |
107 | // // | |
108 | // // | |
109 | /////////////////////////////////////////////////////////////////////////////// | |
110 | ||
769257f4 | 111 | #include <stdlib.h> |
112 | ||
fe4da5cc | 113 | #include <TMath.h> |
fe4da5cc | 114 | #include <TVector.h> |
5c7f4665 | 115 | #include <TRandom.h> |
793ff80c | 116 | #include <TF1.h> |
1819f4bb | 117 | #include <TLorentzVector.h> |
fe4da5cc | 118 | |
fe4da5cc | 119 | #include "AliRun.h" |
fe4da5cc | 120 | #include "AliMC.h" |
d3f347ff | 121 | #include "AliConst.h" |
5c7f4665 | 122 | |
851d3db9 | 123 | #include "AliTRDv1.h" |
793ff80c | 124 | #include "AliTRDhit.h" |
851d3db9 | 125 | #include "AliTRDmatrix.h" |
126 | #include "AliTRDgeometry.h" | |
793ff80c | 127 | #include "AliTRDsim.h" |
851d3db9 | 128 | |
fe4da5cc | 129 | ClassImp(AliTRDv1) |
8230f242 | 130 | |
131 | //_____________________________________________________________________________ | |
132 | AliTRDv1::AliTRDv1():AliTRD() | |
133 | { | |
134 | // | |
135 | // Default constructor | |
136 | // | |
137 | ||
f73816f5 | 138 | fIdSensDr = 0; |
139 | fIdSensAm = 0; | |
8230f242 | 140 | |
141 | fIdChamber1 = 0; | |
142 | fIdChamber2 = 0; | |
143 | fIdChamber3 = 0; | |
144 | ||
145 | fSensSelect = 0; | |
146 | fSensPlane = -1; | |
147 | fSensChamber = -1; | |
148 | fSensSector = -1; | |
149 | fSensSectorRange = 0; | |
150 | ||
151 | fDeltaE = NULL; | |
793ff80c | 152 | fTR = NULL; |
8230f242 | 153 | |
154 | } | |
155 | ||
fe4da5cc | 156 | //_____________________________________________________________________________ |
157 | AliTRDv1::AliTRDv1(const char *name, const char *title) | |
158 | :AliTRD(name, title) | |
159 | { | |
160 | // | |
851d3db9 | 161 | // Standard constructor for Transition Radiation Detector version 1 |
fe4da5cc | 162 | // |
82bbf98a | 163 | |
f73816f5 | 164 | fIdSensDr = 0; |
165 | fIdSensAm = 0; | |
82bbf98a | 166 | |
9d0b222b | 167 | fIdChamber1 = 0; |
168 | fIdChamber2 = 0; | |
169 | fIdChamber3 = 0; | |
5c7f4665 | 170 | |
9d0b222b | 171 | fSensSelect = 0; |
172 | fSensPlane = -1; | |
173 | fSensChamber = -1; | |
174 | fSensSector = -1; | |
8230f242 | 175 | fSensSectorRange = 0; |
5c7f4665 | 176 | |
9d0b222b | 177 | fDeltaE = NULL; |
793ff80c | 178 | fTR = NULL; |
5c7f4665 | 179 | |
180 | SetBufferSize(128000); | |
181 | ||
182 | } | |
183 | ||
8230f242 | 184 | //_____________________________________________________________________________ |
dd9a6ee3 | 185 | AliTRDv1::AliTRDv1(const AliTRDv1 &trd) |
8230f242 | 186 | { |
187 | // | |
188 | // Copy constructor | |
189 | // | |
190 | ||
dd9a6ee3 | 191 | ((AliTRDv1 &) trd).Copy(*this); |
8230f242 | 192 | |
193 | } | |
194 | ||
5c7f4665 | 195 | //_____________________________________________________________________________ |
196 | AliTRDv1::~AliTRDv1() | |
197 | { | |
dd9a6ee3 | 198 | // |
199 | // AliTRDv1 destructor | |
200 | // | |
82bbf98a | 201 | |
5c7f4665 | 202 | if (fDeltaE) delete fDeltaE; |
793ff80c | 203 | if (fTR) delete fTR; |
82bbf98a | 204 | |
fe4da5cc | 205 | } |
206 | ||
dd9a6ee3 | 207 | //_____________________________________________________________________________ |
208 | AliTRDv1 &AliTRDv1::operator=(const AliTRDv1 &trd) | |
209 | { | |
210 | // | |
211 | // Assignment operator | |
212 | // | |
213 | ||
214 | if (this != &trd) ((AliTRDv1 &) trd).Copy(*this); | |
215 | return *this; | |
216 | ||
217 | } | |
8230f242 | 218 | |
219 | //_____________________________________________________________________________ | |
43da34c0 | 220 | void AliTRDv1::Copy(TObject &trd) |
8230f242 | 221 | { |
222 | // | |
223 | // Copy function | |
224 | // | |
225 | ||
f73816f5 | 226 | ((AliTRDv1 &) trd).fIdSensDr = fIdSensDr; |
227 | ((AliTRDv1 &) trd).fIdSensAm = fIdSensAm; | |
8230f242 | 228 | |
43da34c0 | 229 | ((AliTRDv1 &) trd).fIdChamber1 = fIdChamber1; |
230 | ((AliTRDv1 &) trd).fIdChamber2 = fIdChamber2; | |
231 | ((AliTRDv1 &) trd).fIdChamber3 = fIdChamber3; | |
8230f242 | 232 | |
43da34c0 | 233 | ((AliTRDv1 &) trd).fSensSelect = fSensSelect; |
234 | ((AliTRDv1 &) trd).fSensPlane = fSensPlane; | |
235 | ((AliTRDv1 &) trd).fSensChamber = fSensChamber; | |
236 | ((AliTRDv1 &) trd).fSensSector = fSensSector; | |
237 | ((AliTRDv1 &) trd).fSensSectorRange = fSensSectorRange; | |
8230f242 | 238 | |
793ff80c | 239 | fDeltaE->Copy(*((AliTRDv1 &) trd).fDeltaE); |
240 | fTR->Copy(*((AliTRDv1 &) trd).fTR); | |
8230f242 | 241 | |
242 | } | |
243 | ||
fe4da5cc | 244 | //_____________________________________________________________________________ |
245 | void AliTRDv1::CreateGeometry() | |
246 | { | |
247 | // | |
851d3db9 | 248 | // Create the GEANT geometry for the Transition Radiation Detector - Version 1 |
5c7f4665 | 249 | // This version covers the full azimuth. |
d3f347ff | 250 | // |
251 | ||
82bbf98a | 252 | // Check that FRAME is there otherwise we have no place where to put the TRD |
8230f242 | 253 | AliModule* frame = gAlice->GetModule("FRAME"); |
254 | if (!frame) return; | |
d3f347ff | 255 | |
82bbf98a | 256 | // Define the chambers |
257 | AliTRD::CreateGeometry(); | |
d3f347ff | 258 | |
fe4da5cc | 259 | } |
260 | ||
261 | //_____________________________________________________________________________ | |
262 | void AliTRDv1::CreateMaterials() | |
263 | { | |
264 | // | |
851d3db9 | 265 | // Create materials for the Transition Radiation Detector version 1 |
fe4da5cc | 266 | // |
82bbf98a | 267 | |
d3f347ff | 268 | AliTRD::CreateMaterials(); |
82bbf98a | 269 | |
fe4da5cc | 270 | } |
271 | ||
793ff80c | 272 | //_____________________________________________________________________________ |
273 | void AliTRDv1::CreateTRhit(Int_t det) | |
274 | { | |
275 | // | |
276 | // Creates an electron cluster from a TR photon. | |
277 | // The photon is assumed to be created a the end of the radiator. The | |
278 | // distance after which it deposits its energy takes into account the | |
279 | // absorbtion of the entrance window and of the gas mixture in drift | |
280 | // volume. | |
281 | // | |
282 | ||
283 | // PDG code electron | |
284 | const Int_t kPdgElectron = 11; | |
285 | ||
286 | // Ionization energy | |
287 | const Float_t kWion = 22.04; | |
288 | ||
289 | // Maximum number of TR photons per track | |
290 | const Int_t kNTR = 50; | |
291 | ||
292 | TLorentzVector mom, pos; | |
293 | TClonesArray &lhits = *fHits; | |
294 | ||
793ff80c | 295 | // Create TR at the entrance of the chamber |
296 | if (gMC->IsTrackEntering()) { | |
297 | ||
f73816f5 | 298 | // Create TR only for electrons |
299 | Int_t iPdg = gMC->TrackPid(); | |
300 | if (TMath::Abs(iPdg) != kPdgElectron) return; | |
301 | ||
793ff80c | 302 | Float_t eTR[kNTR]; |
303 | Int_t nTR; | |
304 | ||
305 | // Create TR photons | |
306 | gMC->TrackMomentum(mom); | |
307 | Float_t pTot = mom.Rho(); | |
308 | fTR->CreatePhotons(iPdg,pTot,nTR,eTR); | |
309 | if (nTR > kNTR) { | |
310 | printf("AliTRDv1::CreateTRhit -- "); | |
311 | printf("Boundary error: nTR = %d, kNTR = %d\n",nTR,kNTR); | |
312 | exit(1); | |
313 | } | |
314 | ||
315 | // Loop through the TR photons | |
316 | for (Int_t iTR = 0; iTR < nTR; iTR++) { | |
317 | ||
318 | Float_t energyMeV = eTR[iTR] * 0.001; | |
319 | Float_t energyeV = eTR[iTR] * 1000.0; | |
320 | Float_t absLength = 0; | |
321 | Float_t sigma = 0; | |
322 | ||
323 | // Take the absorbtion in the entrance window into account | |
324 | Double_t muMy = fTR->GetMuMy(energyMeV); | |
325 | sigma = muMy * fFoilDensity; | |
326 | absLength = gRandom->Exp(sigma); | |
327 | if (absLength < AliTRDgeometry::MyThick()) continue; | |
328 | ||
329 | // The absorbtion cross sections in the drift gas | |
330 | if (fGasMix == 1) { | |
331 | // Gas-mixture (Xe/CO2) | |
332 | Double_t muXe = fTR->GetMuXe(energyMeV); | |
333 | Double_t muCO = fTR->GetMuCO(energyMeV); | |
db30bf0f | 334 | sigma = (0.85 * muXe + 0.15 * muCO) * fGasDensity; |
793ff80c | 335 | } |
336 | else { | |
337 | // Gas-mixture (Xe/Isobutane) | |
338 | Double_t muXe = fTR->GetMuXe(energyMeV); | |
339 | Double_t muBu = fTR->GetMuBu(energyMeV); | |
340 | sigma = (0.97 * muXe + 0.03 * muBu) * fGasDensity; | |
341 | } | |
342 | ||
343 | // The distance after which the energy of the TR photon | |
344 | // is deposited. | |
345 | absLength = gRandom->Exp(sigma); | |
346 | if (absLength > AliTRDgeometry::DrThick()) continue; | |
347 | ||
348 | // The position of the absorbtion | |
349 | Float_t posHit[3]; | |
350 | gMC->TrackPosition(pos); | |
351 | posHit[0] = pos[0] + mom[0] / pTot * absLength; | |
352 | posHit[1] = pos[1] + mom[1] / pTot * absLength; | |
353 | posHit[2] = pos[2] + mom[2] / pTot * absLength; | |
354 | ||
355 | // Create the charge | |
356 | Int_t q = ((Int_t) (energyeV / kWion)); | |
357 | ||
358 | // Add the hit to the array. TR photon hits are marked | |
359 | // by negative charge | |
f73816f5 | 360 | AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt |
361 | ,gAlice->CurrentTrack() | |
362 | ,det,posHit,-q); | |
363 | hit->SetTRphoton(); | |
793ff80c | 364 | |
365 | } | |
366 | ||
367 | } | |
368 | ||
369 | } | |
370 | ||
5c7f4665 | 371 | //_____________________________________________________________________________ |
372 | void AliTRDv1::Init() | |
373 | { | |
374 | // | |
375 | // Initialise Transition Radiation Detector after geometry has been built. | |
5c7f4665 | 376 | // |
377 | ||
378 | AliTRD::Init(); | |
379 | ||
9e1a0ddb | 380 | if(fDebug) printf("%s: Slow simulator\n",ClassName()); |
851d3db9 | 381 | if (fSensSelect) { |
382 | if (fSensPlane >= 0) | |
383 | printf(" Only plane %d is sensitive\n",fSensPlane); | |
384 | if (fSensChamber >= 0) | |
385 | printf(" Only chamber %d is sensitive\n",fSensChamber); | |
9d0b222b | 386 | if (fSensSector >= 0) { |
387 | Int_t sens1 = fSensSector; | |
388 | Int_t sens2 = fSensSector + fSensSectorRange; | |
793ff80c | 389 | sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) |
390 | * AliTRDgeometry::Nsect(); | |
9d0b222b | 391 | printf(" Only sectors %d - %d are sensitive\n",sens1,sens2-1); |
392 | } | |
851d3db9 | 393 | } |
793ff80c | 394 | if (fTR) |
9e1a0ddb | 395 | printf("%s: TR simulation on\n",ClassName()); |
793ff80c | 396 | else |
9e1a0ddb | 397 | printf("%s: TR simulation off\n",ClassName()); |
851d3db9 | 398 | printf("\n"); |
5c7f4665 | 399 | |
400 | // First ionization potential (eV) for the gas mixture (90% Xe + 10% CO2) | |
401 | const Float_t kPoti = 12.1; | |
402 | // Maximum energy (50 keV); | |
403 | const Float_t kEend = 50000.0; | |
404 | // Ermilova distribution for the delta-ray spectrum | |
8230f242 | 405 | Float_t poti = TMath::Log(kPoti); |
406 | Float_t eEnd = TMath::Log(kEend); | |
793ff80c | 407 | fDeltaE = new TF1("deltae",Ermilova,poti,eEnd,0); |
5c7f4665 | 408 | |
409 | // Identifier of the sensitive volume (drift region) | |
f73816f5 | 410 | fIdSensDr = gMC->VolId("UL05"); |
411 | // Identifier of the sensitive volume (amplification region) | |
412 | fIdSensAm = gMC->VolId("UL06"); | |
82bbf98a | 413 | |
414 | // Identifier of the TRD-driftchambers | |
415 | fIdChamber1 = gMC->VolId("UCIO"); | |
416 | fIdChamber2 = gMC->VolId("UCIM"); | |
417 | fIdChamber3 = gMC->VolId("UCII"); | |
418 | ||
9e1a0ddb | 419 | if(fDebug) { |
420 | printf("%s: ",ClassName()); | |
421 | for (Int_t i = 0; i < 80; i++) printf("*"); | |
422 | printf("\n"); | |
423 | } | |
5c7f4665 | 424 | |
fe4da5cc | 425 | } |
426 | ||
793ff80c | 427 | //_____________________________________________________________________________ |
428 | AliTRDsim *AliTRDv1::CreateTR() | |
429 | { | |
430 | // | |
431 | // Enables the simulation of TR | |
432 | // | |
433 | ||
434 | fTR = new AliTRDsim(); | |
435 | return fTR; | |
436 | ||
437 | } | |
438 | ||
5c7f4665 | 439 | //_____________________________________________________________________________ |
440 | void AliTRDv1::SetSensPlane(Int_t iplane) | |
441 | { | |
442 | // | |
851d3db9 | 443 | // Defines the hit-sensitive plane (0-5) |
5c7f4665 | 444 | // |
82bbf98a | 445 | |
851d3db9 | 446 | if ((iplane < 0) || (iplane > 5)) { |
5c7f4665 | 447 | printf("Wrong input value: %d\n",iplane); |
448 | printf("Use standard setting\n"); | |
851d3db9 | 449 | fSensPlane = -1; |
450 | fSensSelect = 0; | |
5c7f4665 | 451 | return; |
452 | } | |
82bbf98a | 453 | |
5c7f4665 | 454 | fSensSelect = 1; |
455 | fSensPlane = iplane; | |
82bbf98a | 456 | |
5c7f4665 | 457 | } |
458 | ||
459 | //_____________________________________________________________________________ | |
460 | void AliTRDv1::SetSensChamber(Int_t ichamber) | |
461 | { | |
462 | // | |
851d3db9 | 463 | // Defines the hit-sensitive chamber (0-4) |
5c7f4665 | 464 | // |
465 | ||
851d3db9 | 466 | if ((ichamber < 0) || (ichamber > 4)) { |
5c7f4665 | 467 | printf("Wrong input value: %d\n",ichamber); |
468 | printf("Use standard setting\n"); | |
851d3db9 | 469 | fSensChamber = -1; |
470 | fSensSelect = 0; | |
5c7f4665 | 471 | return; |
472 | } | |
473 | ||
474 | fSensSelect = 1; | |
475 | fSensChamber = ichamber; | |
476 | ||
477 | } | |
478 | ||
479 | //_____________________________________________________________________________ | |
480 | void AliTRDv1::SetSensSector(Int_t isector) | |
481 | { | |
482 | // | |
851d3db9 | 483 | // Defines the hit-sensitive sector (0-17) |
5c7f4665 | 484 | // |
485 | ||
9d0b222b | 486 | SetSensSector(isector,1); |
487 | ||
488 | } | |
489 | ||
490 | //_____________________________________________________________________________ | |
491 | void AliTRDv1::SetSensSector(Int_t isector, Int_t nsector) | |
492 | { | |
493 | // | |
494 | // Defines a range of hit-sensitive sectors. The range is defined by | |
495 | // <isector> (0-17) as the starting point and <nsector> as the number | |
496 | // of sectors to be included. | |
497 | // | |
498 | ||
851d3db9 | 499 | if ((isector < 0) || (isector > 17)) { |
9d0b222b | 500 | printf("Wrong input value <isector>: %d\n",isector); |
5c7f4665 | 501 | printf("Use standard setting\n"); |
9d0b222b | 502 | fSensSector = -1; |
503 | fSensSectorRange = 0; | |
504 | fSensSelect = 0; | |
5c7f4665 | 505 | return; |
506 | } | |
507 | ||
9d0b222b | 508 | if ((nsector < 1) || (nsector > 18)) { |
509 | printf("Wrong input value <nsector>: %d\n",nsector); | |
510 | printf("Use standard setting\n"); | |
511 | fSensSector = -1; | |
512 | fSensSectorRange = 0; | |
513 | fSensSelect = 0; | |
514 | return; | |
515 | } | |
516 | ||
517 | fSensSelect = 1; | |
518 | fSensSector = isector; | |
519 | fSensSectorRange = nsector; | |
5c7f4665 | 520 | |
521 | } | |
522 | ||
523 | //_____________________________________________________________________________ | |
524 | void AliTRDv1::StepManager() | |
525 | { | |
526 | // | |
5c7f4665 | 527 | // Slow simulator. Every charged track produces electron cluster as hits |
528 | // along its path across the drift volume. The step size is set acording | |
529 | // to Bethe-Bloch. The energy distribution of the delta electrons follows | |
530 | // a spectrum taken from Ermilova et al. | |
531 | // | |
532 | ||
533 | Int_t iIdSens, icSens; | |
5c7f4665 | 534 | Int_t iIdChamber, icChamber; |
851d3db9 | 535 | Int_t pla = 0; |
536 | Int_t cha = 0; | |
537 | Int_t sec = 0; | |
793ff80c | 538 | Int_t det = 0; |
851d3db9 | 539 | Int_t iPdg; |
793ff80c | 540 | Int_t qTot; |
5c7f4665 | 541 | |
793ff80c | 542 | Float_t hits[3]; |
990e4068 | 543 | Float_t moms[3]; |
5c7f4665 | 544 | Float_t random[1]; |
545 | Float_t charge; | |
546 | Float_t aMass; | |
547 | ||
f73816f5 | 548 | Double_t pTot = 0; |
5c7f4665 | 549 | Double_t eDelta; |
550 | Double_t betaGamma, pp; | |
f73816f5 | 551 | Double_t stepSize; |
5c7f4665 | 552 | |
553 | TLorentzVector pos, mom; | |
82bbf98a | 554 | TClonesArray &lhits = *fHits; |
555 | ||
851d3db9 | 556 | const Double_t kBig = 1.0E+12; |
5c7f4665 | 557 | |
558 | // Ionization energy | |
a3c76cdc | 559 | const Float_t kWion = 22.04; |
560 | // Maximum momentum for e+ e- g | |
561 | const Float_t kPTotMaxEl = 0.002; | |
f73816f5 | 562 | // Minimum energy for the step size adjustment |
563 | const Float_t kEkinMinStep = 1.0e-5; | |
5c7f4665 | 564 | // Plateau value of the energy-loss for electron in xenon |
565 | // taken from: Allison + Comb, Ann. Rev. Nucl. Sci. (1980), 30, 253 | |
566 | //const Double_t kPlateau = 1.70; | |
567 | // the averaged value (26/3/99) | |
a3c76cdc | 568 | const Float_t kPlateau = 1.55; |
5c7f4665 | 569 | // dN1/dx|min for the gas mixture (90% Xe + 10% CO2) |
a3c76cdc | 570 | const Float_t kPrim = 48.0; |
5c7f4665 | 571 | // First ionization potential (eV) for the gas mixture (90% Xe + 10% CO2) |
a3c76cdc | 572 | const Float_t kPoti = 12.1; |
851d3db9 | 573 | |
574 | // PDG code electron | |
8230f242 | 575 | const Int_t kPdgElectron = 11; |
5c7f4665 | 576 | |
577 | // Set the maximum step size to a very large number for all | |
578 | // neutral particles and those outside the driftvolume | |
579 | gMC->SetMaxStep(kBig); | |
580 | ||
581 | // Use only charged tracks | |
582 | if (( gMC->TrackCharge() ) && | |
583 | (!gMC->IsTrackStop() ) && | |
584 | (!gMC->IsTrackDisappeared())) { | |
fe4da5cc | 585 | |
5c7f4665 | 586 | // Inside a sensitive volume? |
82bbf98a | 587 | iIdSens = gMC->CurrentVolID(icSens); |
f73816f5 | 588 | if ((iIdSens == fIdSensDr) || |
589 | (iIdSens == fIdSensAm)) { | |
82bbf98a | 590 | |
82bbf98a | 591 | iIdChamber = gMC->CurrentVolOffID(1,icChamber); |
fe4da5cc | 592 | |
5c7f4665 | 593 | // The hit coordinates and charge |
594 | gMC->TrackPosition(pos); | |
595 | hits[0] = pos[0]; | |
596 | hits[1] = pos[1]; | |
597 | hits[2] = pos[2]; | |
5c7f4665 | 598 | |
851d3db9 | 599 | // The sector number (0 - 17) |
600 | // The numbering goes clockwise and starts at y = 0 | |
601 | Float_t phi = kRaddeg*TMath::ATan2(pos[0],pos[1]); | |
602 | if (phi < 90.) | |
603 | phi = phi + 270.; | |
604 | else | |
605 | phi = phi - 90.; | |
606 | sec = ((Int_t) (phi / 20)); | |
82bbf98a | 607 | |
d3f347ff | 608 | // The chamber number |
851d3db9 | 609 | // 0: outer left |
610 | // 1: middle left | |
611 | // 2: inner | |
612 | // 3: middle right | |
613 | // 4: outer right | |
82bbf98a | 614 | if (iIdChamber == fIdChamber1) |
851d3db9 | 615 | cha = (hits[2] < 0 ? 0 : 4); |
82bbf98a | 616 | else if (iIdChamber == fIdChamber2) |
851d3db9 | 617 | cha = (hits[2] < 0 ? 1 : 3); |
82bbf98a | 618 | else if (iIdChamber == fIdChamber3) |
851d3db9 | 619 | cha = 2; |
82bbf98a | 620 | |
fe4da5cc | 621 | // The plane number |
851d3db9 | 622 | // The numbering starts at the innermost plane |
623 | pla = icChamber - TMath::Nint((Float_t) (icChamber / 7)) * 6 - 1; | |
82bbf98a | 624 | |
5c7f4665 | 625 | // Check on selected volumes |
626 | Int_t addthishit = 1; | |
627 | if (fSensSelect) { | |
6f1e466d | 628 | if ((fSensPlane >= 0) && (pla != fSensPlane )) addthishit = 0; |
629 | if ((fSensChamber >= 0) && (cha != fSensChamber)) addthishit = 0; | |
9d0b222b | 630 | if (fSensSector >= 0) { |
631 | Int_t sens1 = fSensSector; | |
632 | Int_t sens2 = fSensSector + fSensSectorRange; | |
793ff80c | 633 | sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) |
634 | * AliTRDgeometry::Nsect(); | |
9d0b222b | 635 | if (sens1 < sens2) { |
636 | if ((sec < sens1) || (sec >= sens2)) addthishit = 0; | |
637 | } | |
638 | else { | |
639 | if ((sec < sens1) && (sec >= sens2)) addthishit = 0; | |
640 | } | |
641 | } | |
5c7f4665 | 642 | } |
643 | ||
644 | // Add this hit | |
645 | if (addthishit) { | |
646 | ||
f73816f5 | 647 | // The detector number |
793ff80c | 648 | det = fGeometry->GetDetector(pla,cha,sec); |
649 | ||
f73816f5 | 650 | // Special hits and TR photons only in the drift region |
651 | if (iIdSens == fIdSensDr) { | |
652 | ||
653 | // Create some special hits with amplitude 0 at the entrance and | |
654 | // exit of each chamber that contain the momentum components of the particle | |
655 | if (gMC->IsTrackEntering() || gMC->IsTrackExiting()) { | |
656 | gMC->TrackMomentum(mom); | |
657 | moms[0] = mom[0]; | |
658 | moms[1] = mom[1]; | |
659 | moms[2] = mom[2]; | |
660 | AliTRDhit *hitTest = new(lhits[fNhits++]) AliTRDhit(fIshunt | |
661 | ,gAlice->CurrentTrack() | |
662 | ,det,moms,0); | |
663 | hitTest->SetTest(); | |
664 | } | |
665 | ||
666 | // Create the hits from TR photons | |
667 | if (fTR) CreateTRhit(det); | |
668 | ||
669 | } | |
670 | ||
671 | // Calculate the energy of the delta-electrons | |
672 | eDelta = TMath::Exp(fDeltaE->GetRandom()) - kPoti; | |
673 | eDelta = TMath::Max(eDelta,0.0); | |
674 | ||
675 | // The number of secondary electrons created | |
676 | qTot = ((Int_t) (eDelta / kWion) + 1); | |
677 | ||
678 | // Create a new dEdx hit | |
679 | AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt | |
680 | ,gAlice->CurrentTrack() | |
681 | ,det,hits,qTot); | |
682 | if (iIdSens == fIdSensDr) { | |
683 | hit->SetDrift(); | |
684 | } | |
5c7f4665 | 685 | else { |
f73816f5 | 686 | hit->SetAmplification(); |
687 | } | |
688 | ||
5c7f4665 | 689 | // Calculate the maximum step size for the next tracking step |
f73816f5 | 690 | // Produce only one hit if Ekin is below cutoff |
691 | aMass = gMC->TrackMass(); | |
692 | if ((gMC->Etot() - aMass) > kEkinMinStep) { | |
693 | ||
694 | // The energy loss according to Bethe Bloch | |
695 | iPdg = TMath::Abs(gMC->TrackPid()); | |
696 | if ( (iPdg != kPdgElectron) || | |
697 | ((iPdg == kPdgElectron) && (pTot < kPTotMaxEl))) { | |
698 | gMC->TrackMomentum(mom); | |
699 | pTot = mom.Rho(); | |
700 | betaGamma = pTot / aMass; | |
701 | pp = kPrim * BetheBloch(betaGamma); | |
702 | // Take charge > 1 into account | |
703 | charge = gMC->TrackCharge(); | |
704 | if (TMath::Abs(charge) > 1) pp = pp * charge*charge; | |
705 | } | |
706 | // Electrons above 20 Mev/c are at the plateau | |
707 | else { | |
708 | pp = kPrim * kPlateau; | |
709 | } | |
710 | ||
711 | if (pp > 0) { | |
712 | do | |
713 | gMC->Rndm(random,1); | |
714 | while ((random[0] == 1.) || (random[0] == 0.)); | |
715 | stepSize = - TMath::Log(random[0]) / pp; | |
716 | gMC->SetMaxStep(stepSize); | |
717 | } | |
718 | ||
5c7f4665 | 719 | } |
720 | ||
721 | } | |
d3f347ff | 722 | |
723 | } | |
724 | ||
5c7f4665 | 725 | } |
726 | ||
727 | } | |
728 | ||
729 | //_____________________________________________________________________________ | |
730 | Double_t AliTRDv1::BetheBloch(Double_t bg) | |
731 | { | |
732 | // | |
733 | // Parametrization of the Bethe-Bloch-curve | |
734 | // The parametrization is the same as for the TPC and is taken from Lehrhaus. | |
735 | // | |
736 | ||
737 | // This parameters have been adjusted to averaged values from GEANT | |
738 | const Double_t kP1 = 7.17960e-02; | |
739 | const Double_t kP2 = 8.54196; | |
740 | const Double_t kP3 = 1.38065e-06; | |
741 | const Double_t kP4 = 5.30972; | |
742 | const Double_t kP5 = 2.83798; | |
743 | ||
744 | // This parameters have been adjusted to Xe-data found in: | |
745 | // Allison & Cobb, Ann. Rev. Nucl. Sci. (1980), 30, 253 | |
746 | //const Double_t kP1 = 0.76176E-1; | |
747 | //const Double_t kP2 = 10.632; | |
748 | //const Double_t kP3 = 3.17983E-6; | |
749 | //const Double_t kP4 = 1.8631; | |
750 | //const Double_t kP5 = 1.9479; | |
751 | ||
f73816f5 | 752 | // Lower cutoff of the Bethe-Bloch-curve to limit step sizes |
753 | const Double_t kBgMin = 0.8; | |
754 | const Double_t kBBMax = 6.83298; | |
755 | //const Double_t kBgMin = 0.6; | |
756 | //const Double_t kBBMax = 17.2809; | |
757 | //const Double_t kBgMin = 0.4; | |
758 | //const Double_t kBBMax = 82.0; | |
759 | ||
760 | if (bg > kBgMin) { | |
5c7f4665 | 761 | Double_t yy = bg / TMath::Sqrt(1. + bg*bg); |
762 | Double_t aa = TMath::Power(yy,kP4); | |
763 | Double_t bb = TMath::Power((1./bg),kP5); | |
764 | bb = TMath::Log(kP3 + bb); | |
765 | return ((kP2 - aa - bb)*kP1 / aa); | |
766 | } | |
f73816f5 | 767 | else { |
768 | return kBBMax; | |
769 | } | |
d3f347ff | 770 | |
fe4da5cc | 771 | } |
5c7f4665 | 772 | |
773 | //_____________________________________________________________________________ | |
774 | Double_t Ermilova(Double_t *x, Double_t *) | |
775 | { | |
776 | // | |
777 | // Calculates the delta-ray energy distribution according to Ermilova. | |
778 | // Logarithmic scale ! | |
779 | // | |
780 | ||
781 | Double_t energy; | |
782 | Double_t dpos; | |
783 | Double_t dnde; | |
784 | ||
785 | Int_t pos1, pos2; | |
786 | ||
8230f242 | 787 | const Int_t kNv = 31; |
5c7f4665 | 788 | |
8230f242 | 789 | Float_t vxe[kNv] = { 2.3026, 2.9957, 3.4012, 3.6889, 3.9120 |
790 | , 4.0943, 4.2485, 4.3820, 4.4998, 4.6052 | |
791 | , 4.7005, 5.0752, 5.2983, 5.7038, 5.9915 | |
792 | , 6.2146, 6.5221, 6.9078, 7.3132, 7.6009 | |
793 | , 8.0064, 8.5172, 8.6995, 8.9872, 9.2103 | |
794 | , 9.4727, 9.9035,10.3735,10.5966,10.8198 | |
795 | ,11.5129 }; | |
5c7f4665 | 796 | |
8230f242 | 797 | Float_t vye[kNv] = { 80.0 , 31.0 , 23.3 , 21.1 , 21.0 |
798 | , 20.9 , 20.8 , 20.0 , 16.0 , 11.0 | |
799 | , 8.0 , 6.0 , 5.2 , 4.6 , 4.0 | |
800 | , 3.5 , 3.0 , 1.4 , 0.67 , 0.44 | |
801 | , 0.3 , 0.18 , 0.12 , 0.08 , 0.056 | |
802 | , 0.04 , 0.023, 0.015, 0.011, 0.01 | |
803 | , 0.004 }; | |
5c7f4665 | 804 | |
805 | energy = x[0]; | |
806 | ||
807 | // Find the position | |
808 | pos1 = pos2 = 0; | |
809 | dpos = 0; | |
810 | do { | |
811 | dpos = energy - vxe[pos2++]; | |
812 | } | |
813 | while (dpos > 0); | |
814 | pos2--; | |
f73816f5 | 815 | if (pos2 > kNv) pos2 = kNv - 1; |
5c7f4665 | 816 | pos1 = pos2 - 1; |
817 | ||
818 | // Differentiate between the sampling points | |
819 | dnde = (vye[pos1] - vye[pos2]) / (vxe[pos2] - vxe[pos1]); | |
820 | ||
821 | return dnde; | |
822 | ||
823 | } |