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