1 #include "AliCallf77.h"
6 # define gudigi gudigi_
7 # define guhadr guhadr_
9 # define guphad guphad_
10 # define gudcay gudcay_
11 # define guiget guiget_
12 # define guinme guinme_
13 # define guinti guinti_
14 # define gunear gunear_
15 # define guskip guskip_
16 # define guview guview_
17 # define gupara gupara_
18 # define gudtim gudtim_
19 # define guplsh guplsh_
20 # define gutrev gutrev_
21 # define gutrak gutrak_
22 # define guswim guswim_
24 # define gustep gustep_
25 # define gukine gukine_
26 # define uglast uglast_
28 # define gheish gheish_
29 # define flufin flufin_
30 # define gfmfin gfmfin_
31 # define gpghei gpghei_
32 # define fldist fldist_
33 # define gfmdis gfmdis_
34 # define ghelx3 ghelx3_
35 # define ghelix ghelix_
36 # define grkuta grkuta_
37 # define gtrack gtrack_
38 # define gtreve_root gtreve_root_
42 # define gudigi GUDIGI
43 # define guhadr GUHADR
45 # define guphad GUPHAD
46 # define gudcay GUDCAY
47 # define guiget GUIGET
48 # define guinme GUINME
49 # define guinti GUINTI
50 # define gunear GUNEAR
51 # define guskip GUSKIP
52 # define guview GUVIEW
53 # define gupara GUPARA
54 # define gudtim GUDTIM
55 # define guplsh GUPLSH
56 # define gutrev GUTREV
57 # define gutrak GUTRAK
58 # define guswim GUSWIM
60 # define gustep GUSTEP
61 # define gukine GUKINE
62 # define uglast UGLAST
64 # define gheish GHEISH
65 # define flufin FLUFIN
66 # define gfmfin GFMFIN
67 # define gpghei GPGHEI
68 # define fldist FLDIST
69 # define gfmdis GFMDIS
70 # define ghelx3 GHELX3
71 # define ghelix GHELIX
72 # define grkuta GRKUTA
73 # define gtrack GTRACK
74 # define gtreve_root GTREVE_ROOT
79 extern "C" type_of_call void gheish();
80 extern "C" type_of_call void flufin();
81 extern "C" type_of_call void gfmfin();
82 extern "C" type_of_call void gpghei();
83 extern "C" type_of_call void fldist();
84 extern "C" type_of_call void gfmdis();
85 extern "C" type_of_call void ghelx3(Float_t&, Float_t&, Float_t*, Float_t*);
86 extern "C" type_of_call void ghelix(Float_t&, Float_t&, Float_t*, Float_t*);
87 extern "C" type_of_call void grkuta(Float_t&, Float_t&, Float_t*, Float_t*);
88 extern "C" type_of_call void gtrack();
89 extern "C" type_of_call void gtreve_root();
90 extern "C" type_of_call void glast();
93 extern "C" type_of_call {
95 //______________________________________________________________________
99 // ******************************************************************
101 // * User routine to digitize one event *
103 // * ==>Called by : GTRIG *
105 // ******************************************************************
110 //______________________________________________________________________
114 // ******************************************************************
116 // * User routine to generate one hadronic interaction *
118 // * ==>Called by : GTHADR,GTNEUT *
120 // ******************************************************************
123 // ------------------------------------------------------------------
125 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
126 Int_t ihadr=geant3->Gcphys()->ihadr;
127 if (ihadr<4) gheish();
128 else if (ihadr==4) flufin();
132 //______________________________________________________________________
136 // ******************************************************************
138 // * User routine called at the end of each event *
140 // * ==>Called by : GTRIG *
142 // ******************************************************************
145 // ------------------------------------------------------------------
149 //______________________________________________________________________
153 // ******************************************************************
155 // * User routine to compute Hadron. inter. probabilities *
157 // * ==>Called by : GTHADR,GTNEUT *
159 // ******************************************************************
162 // ------------------------------------------------------------------
164 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
165 Int_t ihadr=geant3->Gcphys()->ihadr;
166 if (ihadr<4) gpghei();
167 else if (ihadr==4) fldist();
171 //______________________________________________________________________
175 // ******************************************************************
177 // * User routine to decay particles *
179 // * ==>Called by : GDECAY *
181 // ******************************************************************
184 // ------------------------------------------------------------------
188 //______________________________________________________________________
189 void guiget(Int_t&, Int_t&, Int_t&)
192 // ******************************************************************
194 // * User routine for interactive control of GEANT *
196 // * ==>Called by : <GXINT>, GINCOM *
198 // ******************************************************************
201 // ------------------------------------------------------------------
205 //______________________________________________________________________
206 void guinme(Float_t*, Int_t&, Float_t*, Int_t& IYES)
209 // **********************************************
211 // * USER ROUTINE TO PROVIDE GINME FUNCTION *
212 // * FOR ALL USER SHAPES IDENTIFIED BY THE *
213 // * SHAPE NUMBER SH. POINT IS GIVEN IN X *
214 // * THE PARAMETERS ARE GIVEN IN P. IYES IS *
215 // * RETURNED 1 IF POINT IS IN, 0 IF POINT *
216 // * IS OUT AND LESS THAN ZERO IF SHAPE *
217 // * NUMBER IS NOT SUPPORTED. *
219 // * ==>Called by : GINME *
221 // **********************************************
226 //______________________________________________________________________
230 // ******************************************************************
232 // * User routine for interactive version *
234 // * ==>Called by : <GXINT>, GINTRI *
236 // ******************************************************************
239 // ------------------------------------------------------------------
243 //______________________________________________________________________
244 void gunear(Int_t&, Int_t&, Float_t*, Int_t&)
247 // ******************************************************************
250 // * ISEARC to identify the given volume *
251 // * ICALL to identify the calling routine *
254 // * X coordinates (+direction for ICALL=2) *
255 // * JNEAR address of default list of neighbours *
256 // * (list to be overwriten by user) *
258 // * Called by : GFTRAC, GINVOL, GTMEDI, GTNEXT, GNEXT, GMEDIA *
260 // ******************************************************************
263 // ------------------------------------------------------------------
267 //______________________________________________________________________
268 void guskip(Int_t& ISKIP)
271 // ******************************************************************
273 // * User routine to skip unwanted tracks *
275 // * Called by : GSSTAK *
276 // * Author : F.Bruyant *
278 // ******************************************************************
281 // ------------------------------------------------------------------
286 //______________________________________________________________________
287 void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT)
290 // ******************************************************************
292 // * User routine to control tracking of one track *
293 // * in a magnetic field *
295 // * ==>Called by : GTELEC,GTHADR,GTMUON *
297 // ******************************************************************
300 // ------------------------------------------------------------------
302 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
303 Int_t ifield=geant3->Gctmed()->ifield;
304 Float_t fieldm=geant3->Gctmed()->fieldm;
307 Float_t fldcharge = fieldm*CHARGE;
308 ghelx3(fldcharge,STEP,VECT,VOUT);
310 else if (ifield==2) ghelix(CHARGE,STEP,VECT,VOUT);
311 else grkuta(CHARGE,STEP,VECT,VOUT);
314 //______________________________________________________________________
315 void guview(Int_t&, Int_t&, DEFCHARD, Int_t& DEFCHARL)
318 // ******************************************************************
320 // * User routine for interactive version *
322 // * ==>Called by : <GXINT>, GINC1 *
324 // ******************************************************************
327 // ------------------------------------------------------------------
331 //______________________________________________________________________
335 // ******************************************************************
337 // * User routine called every time a particle falls below *
338 // * parametrization threshold. This routine should create *
339 // * the parametrization stack, and, when this is full, *
340 // * parametrize the shower and track the geantinos. *
342 // * ==>Called by : GTRACK *
344 // ******************************************************************
347 // ------------------------------------------------------------------
351 //______________________________________________________________________
352 Float_t gudtim(Float_t&, Float_t&, Int_t&, Int_t&)
355 // ******************************************************************
357 // * User function called by GCDRIF to return drift time *
359 // * ==>Called by : GCDRIF *
361 // ******************************************************************
364 // ------------------------------------------------------------------
370 //______________________________________________________________________
371 Float_t guplsh(Int_t&, Int_t&)
374 // ******************************************************************
377 // * ==>Called by : GLISUR *
379 // ******************************************************************
382 // ------------------------------------------------------------------
385 //*** By default this defines perfect smoothness
389 //______________________________________________________________________
393 // ******************************************************************
395 // * User routine to control tracking of one track *
397 // * ==>Called by : GTREVE *
399 // ******************************************************************
402 // ------------------------------------------------------------------
404 Int_t ndet = gAlice->Modules()->GetLast();
405 TObjArray &dets = *gAlice->Modules();
409 for(i=0; i<=ndet; i++)
410 if((module = (AliModule*)dets[i]))
415 for(i=0; i<=ndet; i++)
416 if((module = (AliModule*)dets[i]))
420 //______________________________________________________________________
424 // ******************************************************************
426 // * User routine to control tracking of one event *
428 // * ==>Called by : GTRIG *
430 // ******************************************************************
433 // ------------------------------------------------------------------
439 //______________________________________________________________________
440 void gufld(Float_t *x, Float_t *b)
442 if(gAlice->Field()) {
443 gAlice->Field()->Field(x,b);
445 printf("No mag field defined!\n");
450 //______________________________________________________________________
454 // ******************************************************************
456 // * User routine called at the end of each tracking step *
457 // * INWVOL is different from 0 when the track has reached *
458 // * a volume boundary *
459 // * ISTOP is different from 0 if the track has stopped *
461 // * ==>Called by : GTRACK *
463 // ******************************************************************
466 AliMC* pMC = AliMC::GetMC();
467 TGeant3 *geant3=(TGeant3*)pMC;
471 Int_t ipp, jk, id, nt;
472 Float_t polar[3]={0,0,0};
475 // --- Standard GEANT debug routine
476 if(geant3->Gcflag()->idebug) geant3->Gdebug();
478 // Stop particle if outside user defined tracking region
479 pMC->TrackPosition(x);
480 r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
481 if (r > gAlice->TrackingRmax() || TMath::Abs(x[2]) > gAlice->TrackingZmax()) {
484 // --- Add new created particles
485 if (pMC->NSecondaries() > 0) {
486 pMC->ProdProcess(chproc);
487 for (jk = 0; jk < geant3->Gcking()->ngkine; ++jk) {
488 ipp = Int_t (geant3->Gcking()->gkin[jk][4]+0.5);
489 // --- Skip neutrinos!
491 gAlice->SetTrack(1,gAlice->CurrentTrack(),ipp, geant3->Gcking()->gkin[jk],
492 geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt);
497 // --- Particle leaving the setup ?
498 if (!pMC->TrackOut())
499 if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id);
502 //______________________________________________________________________
506 // ******************************************************************
508 // * Read or Generates Kinematics for primary tracks *
510 // * ==>Called by : GTRIG *
512 // ******************************************************************
515 // ------------------------------------------------------------------
517 gAlice->Generator()->Generate();
521 //______________________________________________________________________
525 // ******************************************************************
527 // * User routine called at the end of the run *
529 // * ==>Called by : GRUN *
531 // ******************************************************************