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