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