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 gtreve_
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 GTREVE
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();
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 // ------------------------------------------------------------------
148 Int_t ndet = gAlice->Modules()->GetLast();
149 TObjArray &dets = *gAlice->Modules();
152 for(i=0; i<=ndet; i++)
153 if((module = (AliModule*)dets[i]))
154 module->FinishEvent();
157 //______________________________________________________________________
161 // ******************************************************************
163 // * User routine to compute Hadron. inter. probabilities *
165 // * ==>Called by : GTHADR,GTNEUT *
167 // ******************************************************************
170 // ------------------------------------------------------------------
172 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
173 Int_t ihadr=geant3->Gcphys()->ihadr;
174 if (ihadr<4) gpghei();
175 else if (ihadr==4) fldist();
179 //______________________________________________________________________
183 // ******************************************************************
185 // * User routine to decay particles *
187 // * ==>Called by : GDECAY *
189 // ******************************************************************
192 // ------------------------------------------------------------------
196 //______________________________________________________________________
197 void guiget(Int_t&, Int_t&, Int_t&)
200 // ******************************************************************
202 // * User routine for interactive control of GEANT *
204 // * ==>Called by : <GXINT>, GINCOM *
206 // ******************************************************************
209 // ------------------------------------------------------------------
213 //______________________________________________________________________
214 void guinme(Float_t*, Int_t&, Float_t*, Int_t& IYES)
217 // **********************************************
219 // * USER ROUTINE TO PROVIDE GINME FUNCTION *
220 // * FOR ALL USER SHAPES IDENTIFIED BY THE *
221 // * SHAPE NUMBER SH. POINT IS GIVEN IN X *
222 // * THE PARAMETERS ARE GIVEN IN P. IYES IS *
223 // * RETURNED 1 IF POINT IS IN, 0 IF POINT *
224 // * IS OUT AND LESS THAN ZERO IF SHAPE *
225 // * NUMBER IS NOT SUPPORTED. *
227 // * ==>Called by : GINME *
229 // **********************************************
234 //______________________________________________________________________
238 // ******************************************************************
240 // * User routine for interactive version *
242 // * ==>Called by : <GXINT>, GINTRI *
244 // ******************************************************************
247 // ------------------------------------------------------------------
251 //______________________________________________________________________
252 void gunear(Int_t&, Int_t&, Float_t*, Int_t&)
255 // ******************************************************************
258 // * ISEARC to identify the given volume *
259 // * ICALL to identify the calling routine *
262 // * X coordinates (+direction for ICALL=2) *
263 // * JNEAR address of default list of neighbours *
264 // * (list to be overwriten by user) *
266 // * Called by : GFTRAC, GINVOL, GTMEDI, GTNEXT, GNEXT, GMEDIA *
268 // ******************************************************************
271 // ------------------------------------------------------------------
275 //______________________________________________________________________
276 void guskip(Int_t& ISKIP)
279 // ******************************************************************
281 // * User routine to skip unwanted tracks *
283 // * Called by : GSSTAK *
284 // * Author : F.Bruyant *
286 // ******************************************************************
289 // ------------------------------------------------------------------
294 //______________________________________________________________________
295 void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT)
298 // ******************************************************************
300 // * User routine to control tracking of one track *
301 // * in a magnetic field *
303 // * ==>Called by : GTELEC,GTHADR,GTMUON *
305 // ******************************************************************
308 // ------------------------------------------------------------------
310 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
311 Int_t ifield=geant3->Gctmed()->ifield;
312 Float_t fieldm=geant3->Gctmed()->fieldm;
315 Float_t fldcharge = fieldm*CHARGE;
316 ghelx3(fldcharge,STEP,VECT,VOUT);
318 else if (ifield==2) ghelix(CHARGE,STEP,VECT,VOUT);
319 else grkuta(CHARGE,STEP,VECT,VOUT);
322 //______________________________________________________________________
323 void guview(Int_t&, Int_t&, DEFCHARD, Int_t& DEFCHARL)
326 // ******************************************************************
328 // * User routine for interactive version *
330 // * ==>Called by : <GXINT>, GINC1 *
332 // ******************************************************************
335 // ------------------------------------------------------------------
339 //______________________________________________________________________
343 // ******************************************************************
345 // * User routine called every time a particle falls below *
346 // * parametrization threshold. This routine should create *
347 // * the parametrization stack, and, when this is full, *
348 // * parametrize the shower and track the geantinos. *
350 // * ==>Called by : GTRACK *
352 // ******************************************************************
355 // ------------------------------------------------------------------
359 //______________________________________________________________________
360 Float_t gudtim(Float_t&, Float_t&, Int_t&, Int_t&)
363 // ******************************************************************
365 // * User function called by GCDRIF to return drift time *
367 // * ==>Called by : GCDRIF *
369 // ******************************************************************
372 // ------------------------------------------------------------------
378 //______________________________________________________________________
379 Float_t guplsh(Int_t&, Int_t&)
382 // ******************************************************************
385 // * ==>Called by : GLISUR *
387 // ******************************************************************
390 // ------------------------------------------------------------------
393 //*** By default this defines perfect smoothness
397 //______________________________________________________________________
401 // ******************************************************************
403 // * User routine to control tracking of one track *
405 // * ==>Called by : GTREVE *
407 // ******************************************************************
410 // ------------------------------------------------------------------
412 Int_t ndet = gAlice->Modules()->GetLast();
413 TObjArray &dets = *gAlice->Modules();
417 for(i=0; i<=ndet; i++)
418 if((module = (AliModule*)dets[i]))
423 for(i=0; i<=ndet; i++)
424 if((module = (AliModule*)dets[i]))
428 //______________________________________________________________________
432 // ******************************************************************
434 // * User routine to control tracking of one event *
436 // * ==>Called by : GTRIG *
438 // ******************************************************************
441 // ------------------------------------------------------------------
447 //______________________________________________________________________
448 void gufld(Float_t *x, Float_t *b)
450 if(gAlice->Field()) {
451 gAlice->Field()->Field(x,b);
453 printf("No mag field defined!\n");
458 //______________________________________________________________________
462 // ******************************************************************
464 // * User routine called at the end of each tracking step *
465 // * INWVOL is different from 0 when the track has reached *
466 // * a volume boundary *
467 // * ISTOP is different from 0 if the track has stopped *
469 // * ==>Called by : GTRACK *
471 // ******************************************************************
474 AliMC* pMC = AliMC::GetMC();
475 TGeant3 *geant3=(TGeant3*)pMC;
479 Int_t ipp, jk, id, nt;
480 Float_t polar[3]={0,0,0};
483 // --- Standard GEANT debug routine
484 if(geant3->Gcflag()->idebug) geant3->Gdebug();
486 // Stop particle if outside user defined tracking region
487 pMC->TrackPosition(x);
488 r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
489 if (r > gAlice->TrackingRmax() || TMath::Abs(x[2]) > gAlice->TrackingZmax()) {
492 // --- Add new created particles
493 if (pMC->NSecondaries() > 0) {
494 pMC->ProdProcess(chproc);
495 for (jk = 0; jk < geant3->Gcking()->ngkine; ++jk) {
496 ipp = Int_t (geant3->Gcking()->gkin[jk][4]+0.5);
497 // --- Skip neutrinos!
499 gAlice->SetTrack(1,gAlice->CurrentTrack(),ipp, geant3->Gcking()->gkin[jk],
500 geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt);
505 // --- Particle leaving the setup ?
506 if (!pMC->TrackOut())
507 if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id);
510 //______________________________________________________________________
514 // ******************************************************************
516 // * Read or Generates Kinematics for primary tracks *
518 // * ==>Called by : GTRIG *
520 // ******************************************************************
523 // ------------------------------------------------------------------
525 gAlice->Generator()->Generate();
529 //______________________________________________________________________
533 // ******************************************************************
535 // * User routine called at the end of the run *
537 // * ==>Called by : GRUN *
539 // ******************************************************************