]>
Commit | Line | Data |
---|---|---|
b13db077 | 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$ | |
5bd6a80e | 18 | Revision 1.4 2000/04/26 10:17:32 fca |
19 | Changes in Lego for G4 compatibility | |
20 | ||
dffd31ef | 21 | Revision 1.3 2000/04/07 11:12:35 fca |
22 | G4 compatibility changes | |
23 | ||
875c717b | 24 | Revision 1.2 2000/02/29 19:11:17 fca |
25 | Move gucode into AliGeant3.cxx | |
26 | ||
d7067e4f | 27 | Revision 1.1 2000/02/23 16:25:25 fca |
28 | AliVMC and AliGeant3 classes introduced | |
29 | ReadEuclid moved from AliRun to AliModule | |
30 | ||
b13db077 | 31 | */ |
32 | ||
33 | #include <TParticle.h> | |
34 | ||
35 | #include "AliGeant3.h" | |
36 | #include "AliRun.h" | |
37 | #include "TGeant3.h" | |
38 | #include "AliCallf77.h" | |
39 | ||
40 | #ifndef WIN32 | |
41 | ||
42 | # define rxgtrak rxgtrak_ | |
43 | # define rxstrak rxstrak_ | |
44 | # define rxkeep rxkeep_ | |
45 | # define rxouth rxouth_ | |
46 | #else | |
47 | ||
48 | # define rxgtrak RXGTRAK | |
49 | # define rxstrak RXSTRAK | |
50 | # define rxkeep RXKEEP | |
51 | # define rxouth RXOUTH | |
52 | #endif | |
53 | ||
54 | ClassImp(AliGeant3) | |
55 | ||
875c717b | 56 | AliGeant3::AliGeant3(const char *title) : |
57 | TGeant3(title) {} | |
58 | ||
59 | void AliGeant3::FinishGeometry() | |
b13db077 | 60 | { |
875c717b | 61 | TGeant3::FinishGeometry(); |
62 | //Create the color table | |
63 | SetColors(); | |
b13db077 | 64 | } |
65 | ||
dffd31ef | 66 | //____________________________________________________________________________ |
875c717b | 67 | void AliGeant3::Init() |
b13db077 | 68 | { |
875c717b | 69 | // |
70 | //=================Create Materials and geometry | |
71 | TObjArray *modules = gAlice->Modules(); | |
72 | TIter next(modules); | |
73 | AliModule *detector; | |
74 | while((detector = (AliModule*)next())) { | |
75 | // Initialise detector materials and geometry | |
76 | detector->CreateMaterials(); | |
77 | detector->CreateGeometry(); | |
78 | detector->BuildGeometry(); | |
79 | detector->Init(); | |
80 | } | |
81 | ||
82 | //Terminate building of geometry | |
83 | FinishGeometry(); | |
b13db077 | 84 | } |
85 | ||
875c717b | 86 | //____________________________________________________________________________ |
87 | void AliGeant3::ProcessRun(Int_t nevent) | |
b13db077 | 88 | { |
875c717b | 89 | Int_t todo = TMath::Abs(nevent); |
90 | for (Int_t i=0; i<todo; i++) { | |
91 | // Process one run (one run = one event) | |
dffd31ef | 92 | gAlice->BeginEvent(); |
875c717b | 93 | ProcessEvent(); |
94 | gAlice->FinishEvent(); | |
95 | } | |
b13db077 | 96 | } |
97 | ||
875c717b | 98 | void AliGeant3::ProcessEvent() |
b13db077 | 99 | { |
875c717b | 100 | Gtrigi(); |
101 | Gtrigc(); | |
102 | Gtrig(); | |
b13db077 | 103 | } |
104 | ||
875c717b | 105 | //_____________________________________________________________________________ |
106 | void AliGeant3::SetColors() | |
b13db077 | 107 | { |
875c717b | 108 | // |
109 | // Set the colors for all the volumes | |
110 | // this is done sequentially for all volumes | |
111 | // based on the number of their medium | |
112 | // | |
113 | Int_t kv, icol; | |
114 | Int_t jvolum=fGclink->jvolum; | |
115 | //Int_t jtmed=fGclink->jtmed; | |
116 | //Int_t jmate=fGclink->jmate; | |
117 | Int_t nvolum=fGcnum->nvolum; | |
118 | char name[5]; | |
119 | // | |
120 | // Now for all the volumes | |
121 | for(kv=1;kv<=nvolum;kv++) { | |
122 | // Get the tracking medium | |
123 | Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]); | |
124 | // Get the material | |
125 | //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]); | |
126 | // Get z | |
127 | //Float_t z=fZq[fZlq[jmate-ima]+7]; | |
128 | // Find color number | |
129 | //icol = Int_t(z)%6+2; | |
130 | //icol = 17+Int_t(z*150./92.); | |
131 | //icol = kv%6+2; | |
132 | icol = itm%6+2; | |
133 | strncpy(name,(char*)&fZiq[jvolum+kv],4); | |
134 | name[4]='\0'; | |
135 | Gsatt(name,"COLO",icol); | |
136 | } | |
b13db077 | 137 | } |
138 | ||
139 | //_____________________________________________________________________________ | |
140 | // | |
141 | // Interfaces to Fortran | |
142 | // | |
143 | //_____________________________________________________________________________ | |
144 | ||
145 | extern "C" void type_of_call rxgtrak (Int_t &mtrack, Int_t &ipart, Float_t *pmom, | |
146 | Float_t &e, Float_t *vpos, Float_t *polar, | |
147 | Float_t &tof) | |
148 | { | |
149 | // | |
150 | // Fetches next track from the ROOT stack for transport. Called by the | |
151 | // modified version of GTREVE. | |
152 | // | |
153 | // Track number in the ROOT stack. If MTRACK=0 no | |
154 | // mtrack more tracks are left in the stack to be | |
155 | // transported. | |
156 | // ipart Particle code in the GEANT conventions. | |
157 | // pmom[3] Particle momentum in GeV/c | |
158 | // e Particle energy in GeV | |
159 | // vpos[3] Particle position | |
160 | // tof Particle time of flight in seconds | |
161 | // | |
162 | Int_t pdg; | |
163 | gAlice->GetNextTrack(mtrack, pdg, pmom, e, vpos, polar, tof); | |
164 | ipart = gMC->IdFromPDG(pdg); | |
165 | mtrack++; | |
166 | } | |
167 | ||
168 | //_____________________________________________________________________________ | |
169 | extern "C" void type_of_call | |
170 | #ifndef WIN32 | |
171 | rxstrak (Int_t &keep, Int_t &parent, Int_t &ipart, Float_t *pmom, | |
172 | Float_t *vpos, Float_t &tof, const char* cmech, Int_t &ntr, const int cmlen) | |
173 | #else | |
174 | rxstrak (Int_t &keep, Int_t &parent, Int_t &ipart, Float_t *pmom, | |
175 | Float_t *vpos, Float_t &tof, const char* cmech, const int cmlen, | |
176 | Int_t &ntr) | |
177 | #endif | |
178 | { | |
179 | // | |
180 | // Fetches next track from the ROOT stack for transport. Called by GUKINE | |
181 | // and GUSTEP. | |
182 | // | |
183 | // Status of the track. If keep=0 the track is put | |
184 | // keep on the ROOT stack but it is not fetched for | |
185 | // transport. | |
186 | // parent Parent track. If parent=0 the track is a primary. | |
187 | // In GUSTEP the routine is normally called to store | |
188 | // secondaries generated by the current track whose | |
189 | // ROOT stack number is MTRACK (common SCKINE. | |
190 | // ipart Particle code in the GEANT conventions. | |
191 | // pmom[3] Particle momentum in GeV/c | |
192 | // vpos[3] Particle position | |
193 | // tof Particle time of flight in seconds | |
194 | // | |
195 | // cmech (CHARACTER*10) Particle origin. This field is user | |
196 | // defined and it is not used inside the GALICE code. | |
197 | // ntr Number assigned to the particle in the ROOT stack. | |
198 | // | |
199 | char mecha[11]; | |
200 | Float_t polar[3]={0.,0.,0.}; | |
201 | for(int i=0; i<10 && i<cmlen; i++) mecha[i]=cmech[i]; | |
202 | mecha[10]=0; | |
203 | Int_t pdg=gMC->PDGFromId(ipart); | |
204 | gAlice->SetTrack(keep, parent-1, pdg, pmom, vpos, polar, tof, mecha, ntr); | |
205 | ntr++; | |
206 | } | |
207 | ||
208 | //_____________________________________________________________________________ | |
209 | extern "C" void type_of_call rxkeep(const Int_t &n) | |
210 | { | |
211 | if( NULL==gAlice ) exit(1); | |
212 | ||
213 | if( n<=0 || n>gAlice->Particles()->GetEntries() ) | |
214 | { | |
215 | printf(" Bad index n=%d must be 0<n<=%d\n", | |
216 | n,gAlice->Particles()->GetEntries()); | |
217 | exit(1); | |
218 | } | |
219 | ||
220 | ((TParticle*)(gAlice->Particles()->UncheckedAt(n-1)))->SetBit(Keep_Bit); | |
221 | } | |
222 | ||
223 | //_____________________________________________________________________________ | |
224 | extern "C" void type_of_call rxouth () | |
225 | { | |
226 | // | |
227 | // Called by Gtreve at the end of each primary track | |
228 | // | |
229 | gAlice->FinishPrimary(); | |
230 | } | |
231 | ||
d7067e4f | 232 | |
233 | #ifndef WIN32 | |
234 | # define gudigi gudigi_ | |
235 | # define guhadr guhadr_ | |
236 | # define guout guout_ | |
237 | # define guphad guphad_ | |
238 | # define gudcay gudcay_ | |
239 | # define guiget guiget_ | |
240 | # define guinme guinme_ | |
241 | # define guinti guinti_ | |
242 | # define gunear gunear_ | |
243 | # define guskip guskip_ | |
244 | # define guview guview_ | |
245 | # define gupara gupara_ | |
246 | # define gudtim gudtim_ | |
247 | # define guplsh guplsh_ | |
248 | # define gutrev gutrev_ | |
249 | # define gutrak gutrak_ | |
250 | # define guswim guswim_ | |
251 | # define gufld gufld_ | |
252 | # define gustep gustep_ | |
253 | # define gukine gukine_ | |
254 | # define uglast uglast_ | |
255 | ||
256 | # define gheish gheish_ | |
257 | # define flufin flufin_ | |
258 | # define gfmfin gfmfin_ | |
259 | # define gpghei gpghei_ | |
260 | # define fldist fldist_ | |
261 | # define gfmdis gfmdis_ | |
262 | # define ghelx3 ghelx3_ | |
263 | # define ghelix ghelix_ | |
264 | # define grkuta grkuta_ | |
265 | # define gtrack gtrack_ | |
266 | # define gtreve_root gtreve_root_ | |
267 | # define glast glast_ | |
268 | ||
269 | #else | |
270 | # define gudigi GUDIGI | |
271 | # define guhadr GUHADR | |
272 | # define guout GUOUT | |
273 | # define guphad GUPHAD | |
274 | # define gudcay GUDCAY | |
275 | # define guiget GUIGET | |
276 | # define guinme GUINME | |
277 | # define guinti GUINTI | |
278 | # define gunear GUNEAR | |
279 | # define guskip GUSKIP | |
280 | # define guview GUVIEW | |
281 | # define gupara GUPARA | |
282 | # define gudtim GUDTIM | |
283 | # define guplsh GUPLSH | |
284 | # define gutrev GUTREV | |
285 | # define gutrak GUTRAK | |
286 | # define guswim GUSWIM | |
287 | # define gufld GUFLD | |
288 | # define gustep GUSTEP | |
289 | # define gukine GUKINE | |
290 | # define uglast UGLAST | |
291 | ||
292 | # define gheish GHEISH | |
293 | # define flufin FLUFIN | |
294 | # define gfmfin GFMFIN | |
295 | # define gpghei GPGHEI | |
296 | # define fldist FLDIST | |
297 | # define gfmdis GFMDIS | |
298 | # define ghelx3 GHELX3 | |
299 | # define ghelix GHELIX | |
300 | # define grkuta GRKUTA | |
301 | # define gtrack GTRACK | |
302 | # define gtreve_root GTREVE_ROOT | |
303 | # define glast GLAST | |
304 | ||
305 | #endif | |
306 | ||
307 | extern "C" type_of_call void gheish(); | |
308 | extern "C" type_of_call void flufin(); | |
309 | extern "C" type_of_call void gfmfin(); | |
310 | extern "C" type_of_call void gpghei(); | |
311 | extern "C" type_of_call void fldist(); | |
312 | extern "C" type_of_call void gfmdis(); | |
313 | extern "C" type_of_call void ghelx3(Float_t&, Float_t&, Float_t*, Float_t*); | |
314 | extern "C" type_of_call void ghelix(Float_t&, Float_t&, Float_t*, Float_t*); | |
315 | extern "C" type_of_call void grkuta(Float_t&, Float_t&, Float_t*, Float_t*); | |
316 | extern "C" type_of_call void gtrack(); | |
317 | extern "C" type_of_call void gtreve_root(); | |
318 | extern "C" type_of_call void glast(); | |
319 | ||
320 | extern "C" type_of_call { | |
321 | ||
322 | //______________________________________________________________________ | |
323 | void gudigi() | |
324 | { | |
325 | // | |
326 | // ****************************************************************** | |
327 | // * * | |
328 | // * User routine to digitize one event * | |
329 | // * * | |
330 | // * ==>Called by : GTRIG * | |
331 | // * * | |
332 | // ****************************************************************** | |
333 | ||
334 | } | |
335 | ||
336 | ||
337 | //______________________________________________________________________ | |
338 | void guhadr() | |
339 | { | |
340 | // | |
341 | // ****************************************************************** | |
342 | // * * | |
343 | // * User routine to generate one hadronic interaction * | |
344 | // * * | |
345 | // * ==>Called by : GTHADR,GTNEUT * | |
346 | // * * | |
347 | // ****************************************************************** | |
348 | // | |
349 | // | |
350 | // ------------------------------------------------------------------ | |
351 | // | |
352 | TGeant3* geant3 = (TGeant3*) gMC; | |
353 | Int_t ihadr=geant3->Gcphys()->ihadr; | |
354 | if (ihadr<4) gheish(); | |
355 | else if (ihadr==4) flufin(); | |
356 | else gfmfin(); | |
357 | } | |
358 | ||
359 | //______________________________________________________________________ | |
360 | void guout() | |
361 | { | |
362 | // | |
363 | // ****************************************************************** | |
364 | // * * | |
365 | // * User routine called at the end of each event * | |
366 | // * * | |
367 | // * ==>Called by : GTRIG * | |
368 | // * * | |
369 | // ****************************************************************** | |
370 | // | |
371 | // | |
372 | // ------------------------------------------------------------------ | |
373 | // | |
374 | } | |
375 | ||
376 | //______________________________________________________________________ | |
377 | void guphad() | |
378 | { | |
379 | // | |
380 | // ****************************************************************** | |
381 | // * * | |
382 | // * User routine to compute Hadron. inter. probabilities * | |
383 | // * * | |
384 | // * ==>Called by : GTHADR,GTNEUT * | |
385 | // * * | |
386 | // ****************************************************************** | |
387 | // | |
388 | // | |
389 | // ------------------------------------------------------------------ | |
390 | // | |
391 | TGeant3* geant3 = (TGeant3*) gMC; | |
392 | Int_t ihadr=geant3->Gcphys()->ihadr; | |
393 | if (ihadr<4) gpghei(); | |
394 | else if (ihadr==4) fldist(); | |
395 | else gfmdis(); | |
396 | } | |
397 | ||
398 | //______________________________________________________________________ | |
399 | void gudcay() | |
400 | { | |
401 | // | |
402 | // ****************************************************************** | |
403 | // * * | |
404 | // * User routine to decay particles * | |
405 | // * * | |
406 | // * ==>Called by : GDECAY * | |
407 | // * * | |
408 | // ****************************************************************** | |
409 | // | |
410 | // | |
411 | // ------------------------------------------------------------------ | |
412 | // | |
413 | } | |
414 | ||
415 | //______________________________________________________________________ | |
416 | void guiget(Int_t&, Int_t&, Int_t&) | |
417 | { | |
418 | // | |
419 | // ****************************************************************** | |
420 | // * * | |
421 | // * User routine for interactive control of GEANT * | |
422 | // * * | |
423 | // * ==>Called by : <GXINT>, GINCOM * | |
424 | // * * | |
425 | // ****************************************************************** | |
426 | // | |
427 | // | |
428 | // ------------------------------------------------------------------ | |
429 | // | |
430 | } | |
431 | ||
432 | //______________________________________________________________________ | |
433 | void guinme(Float_t*, Int_t&, Float_t*, Int_t& IYES) | |
434 | { | |
435 | // | |
436 | // ********************************************** | |
437 | // * * | |
438 | // * USER ROUTINE TO PROVIDE GINME FUNCTION * | |
439 | // * FOR ALL USER SHAPES IDENTIFIED BY THE * | |
440 | // * SHAPE NUMBER SH. POINT IS GIVEN IN X * | |
441 | // * THE PARAMETERS ARE GIVEN IN P. IYES IS * | |
442 | // * RETURNED 1 IF POINT IS IN, 0 IF POINT * | |
443 | // * IS OUT AND LESS THAN ZERO IF SHAPE * | |
444 | // * NUMBER IS NOT SUPPORTED. * | |
445 | // * * | |
446 | // * ==>Called by : GINME * | |
447 | // * * | |
448 | // ********************************************** | |
449 | // | |
450 | IYES=-1; | |
451 | } | |
452 | ||
453 | //______________________________________________________________________ | |
454 | void guinti() | |
455 | { | |
456 | // | |
457 | // ****************************************************************** | |
458 | // * * | |
459 | // * User routine for interactive version * | |
460 | // * * | |
461 | // * ==>Called by : <GXINT>, GINTRI * | |
462 | // * * | |
463 | // ****************************************************************** | |
464 | // | |
465 | // | |
466 | // ------------------------------------------------------------------ | |
467 | // | |
468 | } | |
469 | ||
470 | //______________________________________________________________________ | |
471 | void gunear(Int_t&, Int_t&, Float_t*, Int_t&) | |
472 | { | |
473 | // | |
474 | // ****************************************************************** | |
475 | // * * | |
476 | // * User search * | |
477 | // * ISEARC to identify the given volume * | |
478 | // * ICALL to identify the calling routine * | |
479 | // * 1 GMEDIA like * | |
480 | // * 2 GNEXT like * | |
481 | // * X coordinates (+direction for ICALL=2) * | |
482 | // * JNEAR address of default list of neighbours * | |
483 | // * (list to be overwriten by user) * | |
484 | // * * | |
485 | // * Called by : GFTRAC, GINVOL, GTMEDI, GTNEXT, GNEXT, GMEDIA * | |
486 | // * * | |
487 | // ****************************************************************** | |
488 | // | |
489 | // | |
490 | // ------------------------------------------------------------------ | |
491 | // | |
492 | } | |
493 | ||
494 | //______________________________________________________________________ | |
495 | void guskip(Int_t& ISKIP) | |
496 | { | |
497 | // | |
498 | // ****************************************************************** | |
499 | // * * | |
500 | // * User routine to skip unwanted tracks * | |
501 | // * * | |
502 | // * Called by : GSSTAK * | |
503 | // * Author : F.Bruyant * | |
504 | // * * | |
505 | // ****************************************************************** | |
506 | // | |
507 | // | |
508 | // ------------------------------------------------------------------ | |
509 | // | |
510 | ISKIP = 0; | |
511 | } | |
512 | ||
513 | //______________________________________________________________________ | |
514 | void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT) | |
515 | { | |
516 | // | |
517 | // ****************************************************************** | |
518 | // * * | |
519 | // * User routine to control tracking of one track * | |
520 | // * in a magnetic field * | |
521 | // * * | |
522 | // * ==>Called by : GTELEC,GTHADR,GTMUON * | |
523 | // * * | |
524 | // ****************************************************************** | |
525 | // | |
526 | // | |
527 | // ------------------------------------------------------------------ | |
528 | // | |
529 | TGeant3* geant3 = (TGeant3*) gMC; | |
530 | Int_t ifield=geant3->Gctmed()->ifield; | |
531 | Float_t fieldm=geant3->Gctmed()->fieldm; | |
532 | ||
533 | if (ifield==3) { | |
534 | Float_t fldcharge = fieldm*CHARGE; | |
535 | ghelx3(fldcharge,STEP,VECT,VOUT); | |
536 | } | |
537 | else if (ifield==2) ghelix(CHARGE,STEP,VECT,VOUT); | |
538 | else grkuta(CHARGE,STEP,VECT,VOUT); | |
539 | } | |
540 | ||
541 | //______________________________________________________________________ | |
542 | void guview(Int_t&, Int_t&, DEFCHARD, Int_t& DEFCHARL) | |
543 | { | |
544 | // | |
545 | // ****************************************************************** | |
546 | // * * | |
547 | // * User routine for interactive version * | |
548 | // * * | |
549 | // * ==>Called by : <GXINT>, GINC1 * | |
550 | // * * | |
551 | // ****************************************************************** | |
552 | // | |
553 | // | |
554 | // ------------------------------------------------------------------ | |
555 | // | |
556 | } | |
557 | ||
558 | //______________________________________________________________________ | |
559 | void gupara() | |
560 | { | |
561 | // | |
562 | // ****************************************************************** | |
563 | // * * | |
564 | // * User routine called every time a particle falls below * | |
565 | // * parametrization threshold. This routine should create * | |
566 | // * the parametrization stack, and, when this is full, * | |
567 | // * parametrize the shower and track the geantinos. * | |
568 | // * * | |
569 | // * ==>Called by : GTRACK * | |
570 | // * * | |
571 | // ****************************************************************** | |
572 | // | |
573 | // | |
574 | // ------------------------------------------------------------------ | |
575 | // | |
576 | } | |
577 | ||
578 | //______________________________________________________________________ | |
579 | Float_t gudtim(Float_t&, Float_t&, Int_t&, Int_t&) | |
580 | { | |
581 | // | |
582 | // ****************************************************************** | |
583 | // * * | |
584 | // * User function called by GCDRIF to return drift time * | |
585 | // * * | |
586 | // * ==>Called by : GCDRIF * | |
587 | // * * | |
588 | // ****************************************************************** | |
589 | // | |
590 | // | |
591 | // ------------------------------------------------------------------ | |
592 | // | |
593 | return 0; | |
594 | } | |
595 | ||
596 | ||
597 | //______________________________________________________________________ | |
598 | Float_t guplsh(Int_t&, Int_t&) | |
599 | { | |
600 | // | |
601 | // ****************************************************************** | |
602 | // * * | |
603 | // * * | |
604 | // * ==>Called by : GLISUR * | |
605 | // * * | |
606 | // ****************************************************************** | |
607 | // | |
608 | // | |
609 | // ------------------------------------------------------------------ | |
610 | // | |
611 | // | |
612 | //*** By default this defines perfect smoothness | |
613 | return 1; | |
614 | } | |
615 | ||
616 | //______________________________________________________________________ | |
617 | void gutrak() | |
618 | { | |
619 | // | |
620 | // ****************************************************************** | |
621 | // * * | |
622 | // * User routine to control tracking of one track * | |
623 | // * * | |
624 | // * ==>Called by : GTREVE * | |
625 | // * * | |
626 | // ****************************************************************** | |
627 | // | |
628 | // | |
629 | // ------------------------------------------------------------------ | |
630 | // | |
631 | Int_t ndet = gAlice->Modules()->GetLast(); | |
632 | TObjArray &dets = *gAlice->Modules(); | |
633 | AliModule *module; | |
634 | Int_t i; | |
635 | ||
636 | for(i=0; i<=ndet; i++) | |
637 | if((module = (AliModule*)dets[i])) | |
638 | module->PreTrack(); | |
639 | ||
640 | gtrack(); | |
641 | ||
642 | for(i=0; i<=ndet; i++) | |
643 | if((module = (AliModule*)dets[i])) | |
644 | module->PostTrack(); | |
645 | } | |
646 | ||
647 | //______________________________________________________________________ | |
648 | void gutrev() | |
649 | { | |
650 | // | |
651 | // ****************************************************************** | |
652 | // * * | |
653 | // * User routine to control tracking of one event * | |
654 | // * * | |
655 | // * ==>Called by : GTRIG * | |
656 | // * * | |
657 | // ****************************************************************** | |
658 | // | |
659 | // | |
660 | // ------------------------------------------------------------------ | |
661 | // | |
662 | gtreve_root(); | |
663 | } | |
664 | ||
665 | ||
666 | //______________________________________________________________________ | |
667 | void gufld(Float_t *x, Float_t *b) | |
668 | { | |
669 | if(gAlice->Field()) { | |
670 | gAlice->Field()->Field(x,b); | |
671 | } else { | |
672 | printf("No mag field defined!\n"); | |
673 | b[0]=b[1]=b[2]=0; | |
674 | } | |
675 | } | |
676 | ||
677 | //______________________________________________________________________ | |
678 | void gustep() | |
679 | { | |
680 | // | |
681 | // ****************************************************************** | |
682 | // * * | |
683 | // * User routine called at the end of each tracking step * | |
684 | // * INWVOL is different from 0 when the track has reached * | |
685 | // * a volume boundary * | |
686 | // * ISTOP is different from 0 if the track has stopped * | |
687 | // * * | |
688 | // * ==>Called by : GTRACK * | |
689 | // * * | |
690 | // ****************************************************************** | |
691 | // | |
692 | ||
693 | ||
694 | TLorentzVector x; | |
695 | Float_t r; | |
696 | Int_t ipp, jk, id, nt; | |
697 | Float_t polar[3]={0,0,0}; | |
698 | Float_t mom[3]; | |
699 | const char *chproc; | |
700 | ||
d7067e4f | 701 | TGeant3* geant3 = (TGeant3*) gMC; |
d7067e4f | 702 | |
703 | // Stop particle if outside user defined tracking region | |
704 | gMC->TrackPosition(x); | |
705 | r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]); | |
706 | if (r > gAlice->TrackingRmax() || TMath::Abs(x[2]) > gAlice->TrackingZmax()) { | |
707 | gMC->StopTrack(); | |
708 | } | |
5bd6a80e | 709 | |
d7067e4f | 710 | // --- Add new created particles |
711 | if (gMC->NSecondaries() > 0) { | |
712 | chproc=gMC->ProdProcess(); | |
713 | for (jk = 0; jk < geant3->Gcking()->ngkine; ++jk) { | |
714 | ipp = Int_t (geant3->Gcking()->gkin[jk][4]+0.5); | |
715 | // --- Skip neutrinos! | |
716 | if (ipp != 4) { | |
717 | gAlice->SetTrack(1,gAlice->CurrentTrack(),gMC->PDGFromId(ipp), geant3->Gcking()->gkin[jk], | |
718 | geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt); | |
719 | } | |
720 | } | |
721 | } | |
722 | // Cherenkov photons here | |
723 | if ( geant3->Gckin2()->ngphot ) { | |
724 | for (jk = 0; jk < geant3->Gckin2()->ngphot; ++jk) { | |
725 | mom[0]=geant3->Gckin2()->xphot[jk][3]*geant3->Gckin2()->xphot[jk][6]; | |
726 | mom[1]=geant3->Gckin2()->xphot[jk][4]*geant3->Gckin2()->xphot[jk][6]; | |
727 | mom[2]=geant3->Gckin2()->xphot[jk][5]*geant3->Gckin2()->xphot[jk][6]; | |
728 | gAlice->SetTrack(1, gAlice->CurrentTrack(), gMC->PDGFromId(50), | |
729 | mom, //momentum | |
730 | geant3->Gckin2()->xphot[jk], //position | |
731 | &geant3->Gckin2()->xphot[jk][7], //polarisation | |
732 | geant3->Gckin2()->xphot[jk][10], //time of flight | |
733 | "Cherenkov", nt); | |
734 | } | |
735 | } | |
736 | // --- Particle leaving the setup ? | |
737 | if (!gMC->IsTrackOut()) | |
738 | if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id); | |
5bd6a80e | 739 | |
740 | // --- Standard GEANT debug routine | |
741 | if(geant3->Gcflag()->idebug) geant3->Gdebug(); | |
d7067e4f | 742 | } |
743 | ||
744 | //______________________________________________________________________ | |
745 | void gukine () | |
746 | { | |
747 | // | |
748 | // ****************************************************************** | |
749 | // * * | |
750 | // * Read or Generates Kinematics for primary tracks * | |
751 | // * * | |
752 | // * ==>Called by : GTRIG * | |
753 | // * * | |
754 | // ****************************************************************** | |
755 | // | |
756 | // | |
757 | // ------------------------------------------------------------------ | |
758 | // | |
759 | gAlice->Generator()->Generate(); | |
760 | } | |
761 | ||
762 | ||
763 | //______________________________________________________________________ | |
764 | void uglast() | |
765 | { | |
766 | // | |
767 | // ****************************************************************** | |
768 | // * * | |
769 | // * User routine called at the end of the run * | |
770 | // * * | |
771 | // * ==>Called by : GRUN * | |
772 | // * * | |
773 | // ****************************************************************** | |
774 | // | |
775 | // | |
776 | } | |
777 | } | |
778 |