1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.9 1999/09/29 09:24:31 fca
19 Introduction of the Copyright and cvs Log
23 #include "AliCallf77.h"
28 # define gudigi gudigi_
29 # define guhadr guhadr_
31 # define guphad guphad_
32 # define gudcay gudcay_
33 # define guiget guiget_
34 # define guinme guinme_
35 # define guinti guinti_
36 # define gunear gunear_
37 # define guskip guskip_
38 # define guview guview_
39 # define gupara gupara_
40 # define gudtim gudtim_
41 # define guplsh guplsh_
42 # define gutrev gutrev_
43 # define gutrak gutrak_
44 # define guswim guswim_
46 # define gustep gustep_
47 # define gukine gukine_
48 # define uglast uglast_
50 # define gheish gheish_
51 # define flufin flufin_
52 # define gfmfin gfmfin_
53 # define gpghei gpghei_
54 # define fldist fldist_
55 # define gfmdis gfmdis_
56 # define ghelx3 ghelx3_
57 # define ghelix ghelix_
58 # define grkuta grkuta_
59 # define gtrack gtrack_
60 # define gtreve_root gtreve_root_
64 # define gudigi GUDIGI
65 # define guhadr GUHADR
67 # define guphad GUPHAD
68 # define gudcay GUDCAY
69 # define guiget GUIGET
70 # define guinme GUINME
71 # define guinti GUINTI
72 # define gunear GUNEAR
73 # define guskip GUSKIP
74 # define guview GUVIEW
75 # define gupara GUPARA
76 # define gudtim GUDTIM
77 # define guplsh GUPLSH
78 # define gutrev GUTREV
79 # define gutrak GUTRAK
80 # define guswim GUSWIM
82 # define gustep GUSTEP
83 # define gukine GUKINE
84 # define uglast UGLAST
86 # define gheish GHEISH
87 # define flufin FLUFIN
88 # define gfmfin GFMFIN
89 # define gpghei GPGHEI
90 # define fldist FLDIST
91 # define gfmdis GFMDIS
92 # define ghelx3 GHELX3
93 # define ghelix GHELIX
94 # define grkuta GRKUTA
95 # define gtrack GTRACK
96 # define gtreve_root GTREVE_ROOT
101 extern "C" type_of_call void gheish();
102 extern "C" type_of_call void flufin();
103 extern "C" type_of_call void gfmfin();
104 extern "C" type_of_call void gpghei();
105 extern "C" type_of_call void fldist();
106 extern "C" type_of_call void gfmdis();
107 extern "C" type_of_call void ghelx3(Float_t&, Float_t&, Float_t*, Float_t*);
108 extern "C" type_of_call void ghelix(Float_t&, Float_t&, Float_t*, Float_t*);
109 extern "C" type_of_call void grkuta(Float_t&, Float_t&, Float_t*, Float_t*);
110 extern "C" type_of_call void gtrack();
111 extern "C" type_of_call void gtreve_root();
112 extern "C" type_of_call void glast();
114 extern "C" type_of_call {
116 //______________________________________________________________________
120 // ******************************************************************
122 // * User routine to digitize one event *
124 // * ==>Called by : GTRIG *
126 // ******************************************************************
131 //______________________________________________________________________
135 // ******************************************************************
137 // * User routine to generate one hadronic interaction *
139 // * ==>Called by : GTHADR,GTNEUT *
141 // ******************************************************************
144 // ------------------------------------------------------------------
146 TGeant3* geant3 = (TGeant3*) gMC;
147 Int_t ihadr=geant3->Gcphys()->ihadr;
148 if (ihadr<4) gheish();
149 else if (ihadr==4) flufin();
153 //______________________________________________________________________
157 // ******************************************************************
159 // * User routine called at the end of each event *
161 // * ==>Called by : GTRIG *
163 // ******************************************************************
166 // ------------------------------------------------------------------
170 //______________________________________________________________________
174 // ******************************************************************
176 // * User routine to compute Hadron. inter. probabilities *
178 // * ==>Called by : GTHADR,GTNEUT *
180 // ******************************************************************
183 // ------------------------------------------------------------------
185 TGeant3* geant3 = (TGeant3*) gMC;
186 Int_t ihadr=geant3->Gcphys()->ihadr;
187 if (ihadr<4) gpghei();
188 else if (ihadr==4) fldist();
192 //______________________________________________________________________
196 // ******************************************************************
198 // * User routine to decay particles *
200 // * ==>Called by : GDECAY *
202 // ******************************************************************
205 // ------------------------------------------------------------------
209 //______________________________________________________________________
210 void guiget(Int_t&, Int_t&, Int_t&)
213 // ******************************************************************
215 // * User routine for interactive control of GEANT *
217 // * ==>Called by : <GXINT>, GINCOM *
219 // ******************************************************************
222 // ------------------------------------------------------------------
226 //______________________________________________________________________
227 void guinme(Float_t*, Int_t&, Float_t*, Int_t& IYES)
230 // **********************************************
232 // * USER ROUTINE TO PROVIDE GINME FUNCTION *
233 // * FOR ALL USER SHAPES IDENTIFIED BY THE *
234 // * SHAPE NUMBER SH. POINT IS GIVEN IN X *
235 // * THE PARAMETERS ARE GIVEN IN P. IYES IS *
236 // * RETURNED 1 IF POINT IS IN, 0 IF POINT *
237 // * IS OUT AND LESS THAN ZERO IF SHAPE *
238 // * NUMBER IS NOT SUPPORTED. *
240 // * ==>Called by : GINME *
242 // **********************************************
247 //______________________________________________________________________
251 // ******************************************************************
253 // * User routine for interactive version *
255 // * ==>Called by : <GXINT>, GINTRI *
257 // ******************************************************************
260 // ------------------------------------------------------------------
264 //______________________________________________________________________
265 void gunear(Int_t&, Int_t&, Float_t*, Int_t&)
268 // ******************************************************************
271 // * ISEARC to identify the given volume *
272 // * ICALL to identify the calling routine *
275 // * X coordinates (+direction for ICALL=2) *
276 // * JNEAR address of default list of neighbours *
277 // * (list to be overwriten by user) *
279 // * Called by : GFTRAC, GINVOL, GTMEDI, GTNEXT, GNEXT, GMEDIA *
281 // ******************************************************************
284 // ------------------------------------------------------------------
288 //______________________________________________________________________
289 void guskip(Int_t& ISKIP)
292 // ******************************************************************
294 // * User routine to skip unwanted tracks *
296 // * Called by : GSSTAK *
297 // * Author : F.Bruyant *
299 // ******************************************************************
302 // ------------------------------------------------------------------
307 //______________________________________________________________________
308 void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT)
311 // ******************************************************************
313 // * User routine to control tracking of one track *
314 // * in a magnetic field *
316 // * ==>Called by : GTELEC,GTHADR,GTMUON *
318 // ******************************************************************
321 // ------------------------------------------------------------------
323 TGeant3* geant3 = (TGeant3*) gMC;
324 Int_t ifield=geant3->Gctmed()->ifield;
325 Float_t fieldm=geant3->Gctmed()->fieldm;
328 Float_t fldcharge = fieldm*CHARGE;
329 ghelx3(fldcharge,STEP,VECT,VOUT);
331 else if (ifield==2) ghelix(CHARGE,STEP,VECT,VOUT);
332 else grkuta(CHARGE,STEP,VECT,VOUT);
335 //______________________________________________________________________
336 void guview(Int_t&, Int_t&, DEFCHARD, Int_t& DEFCHARL)
339 // ******************************************************************
341 // * User routine for interactive version *
343 // * ==>Called by : <GXINT>, GINC1 *
345 // ******************************************************************
348 // ------------------------------------------------------------------
352 //______________________________________________________________________
356 // ******************************************************************
358 // * User routine called every time a particle falls below *
359 // * parametrization threshold. This routine should create *
360 // * the parametrization stack, and, when this is full, *
361 // * parametrize the shower and track the geantinos. *
363 // * ==>Called by : GTRACK *
365 // ******************************************************************
368 // ------------------------------------------------------------------
372 //______________________________________________________________________
373 Float_t gudtim(Float_t&, Float_t&, Int_t&, Int_t&)
376 // ******************************************************************
378 // * User function called by GCDRIF to return drift time *
380 // * ==>Called by : GCDRIF *
382 // ******************************************************************
385 // ------------------------------------------------------------------
391 //______________________________________________________________________
392 Float_t guplsh(Int_t&, Int_t&)
395 // ******************************************************************
398 // * ==>Called by : GLISUR *
400 // ******************************************************************
403 // ------------------------------------------------------------------
406 //*** By default this defines perfect smoothness
410 //______________________________________________________________________
414 // ******************************************************************
416 // * User routine to control tracking of one track *
418 // * ==>Called by : GTREVE *
420 // ******************************************************************
423 // ------------------------------------------------------------------
425 Int_t ndet = gAlice->Modules()->GetLast();
426 TObjArray &dets = *gAlice->Modules();
430 for(i=0; i<=ndet; i++)
431 if((module = (AliModule*)dets[i]))
436 for(i=0; i<=ndet; i++)
437 if((module = (AliModule*)dets[i]))
441 //______________________________________________________________________
445 // ******************************************************************
447 // * User routine to control tracking of one event *
449 // * ==>Called by : GTRIG *
451 // ******************************************************************
454 // ------------------------------------------------------------------
460 //______________________________________________________________________
461 void gufld(Float_t *x, Float_t *b)
463 if(gAlice->Field()) {
464 gAlice->Field()->Field(x,b);
466 printf("No mag field defined!\n");
471 //______________________________________________________________________
475 // ******************************************************************
477 // * User routine called at the end of each tracking step *
478 // * INWVOL is different from 0 when the track has reached *
479 // * a volume boundary *
480 // * ISTOP is different from 0 if the track has stopped *
482 // * ==>Called by : GTRACK *
484 // ******************************************************************
490 Int_t ipp, jk, id, nt;
491 Float_t polar[3]={0,0,0};
495 // --- Standard GEANT debug routine
496 TGeant3* geant3 = (TGeant3*) gMC;
497 if(geant3->Gcflag()->idebug) geant3->Gdebug();
499 // Stop particle if outside user defined tracking region
500 gMC->TrackPosition(x);
501 r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
502 if (r > gAlice->TrackingRmax() || TMath::Abs(x[2]) > gAlice->TrackingZmax()) {
505 // --- Add new created particles
506 if (gMC->NSecondaries() > 0) {
507 chproc=gMC->ProdProcess();
508 for (jk = 0; jk < geant3->Gcking()->ngkine; ++jk) {
509 ipp = Int_t (geant3->Gcking()->gkin[jk][4]+0.5);
510 // --- Skip neutrinos!
512 gAlice->SetTrack(1,gAlice->CurrentTrack(),gMC->PDGFromId(ipp), geant3->Gcking()->gkin[jk],
513 geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt);
517 // Cherenkov photons here
518 if ( geant3->Gckin2()->ngphot ) {
519 for (jk = 0; jk < geant3->Gckin2()->ngphot; ++jk) {
520 mom[0]=geant3->Gckin2()->xphot[jk][3]*geant3->Gckin2()->xphot[jk][6];
521 mom[1]=geant3->Gckin2()->xphot[jk][4]*geant3->Gckin2()->xphot[jk][6];
522 mom[2]=geant3->Gckin2()->xphot[jk][5]*geant3->Gckin2()->xphot[jk][6];
523 gAlice->SetTrack(1, gAlice->CurrentTrack(), gMC->PDGFromId(50),
525 geant3->Gckin2()->xphot[jk], //position
526 &geant3->Gckin2()->xphot[jk][7], //polarisation
527 geant3->Gckin2()->xphot[jk][10], //time of flight
531 // --- Particle leaving the setup ?
532 if (!gMC->IsTrackOut())
533 if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id);
536 //______________________________________________________________________
540 // ******************************************************************
542 // * Read or Generates Kinematics for primary tracks *
544 // * ==>Called by : GTRIG *
546 // ******************************************************************
549 // ------------------------------------------------------------------
551 gAlice->Generator()->Generate();
555 //______________________________________________________________________
559 // ******************************************************************
561 // * User routine called at the end of the run *
563 // * ==>Called by : GRUN *
565 // ******************************************************************