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 **************************************************************************/
20 #include "AliCallf77.h"
25 # define gudigi gudigi_
26 # define guhadr guhadr_
28 # define guphad guphad_
29 # define gudcay gudcay_
30 # define guiget guiget_
31 # define guinme guinme_
32 # define guinti guinti_
33 # define gunear gunear_
34 # define guskip guskip_
35 # define guview guview_
36 # define gupara gupara_
37 # define gudtim gudtim_
38 # define guplsh guplsh_
39 # define gutrev gutrev_
40 # define gutrak gutrak_
41 # define guswim guswim_
43 # define gustep gustep_
44 # define gukine gukine_
45 # define uglast uglast_
47 # define gheish gheish_
48 # define flufin flufin_
49 # define gfmfin gfmfin_
50 # define gpghei gpghei_
51 # define fldist fldist_
52 # define gfmdis gfmdis_
53 # define ghelx3 ghelx3_
54 # define ghelix ghelix_
55 # define grkuta grkuta_
56 # define gtrack gtrack_
57 # define gtreve_root gtreve_root_
61 # define gudigi GUDIGI
62 # define guhadr GUHADR
64 # define guphad GUPHAD
65 # define gudcay GUDCAY
66 # define guiget GUIGET
67 # define guinme GUINME
68 # define guinti GUINTI
69 # define gunear GUNEAR
70 # define guskip GUSKIP
71 # define guview GUVIEW
72 # define gupara GUPARA
73 # define gudtim GUDTIM
74 # define guplsh GUPLSH
75 # define gutrev GUTREV
76 # define gutrak GUTRAK
77 # define guswim GUSWIM
79 # define gustep GUSTEP
80 # define gukine GUKINE
81 # define uglast UGLAST
83 # define gheish GHEISH
84 # define flufin FLUFIN
85 # define gfmfin GFMFIN
86 # define gpghei GPGHEI
87 # define fldist FLDIST
88 # define gfmdis GFMDIS
89 # define ghelx3 GHELX3
90 # define ghelix GHELIX
91 # define grkuta GRKUTA
92 # define gtrack GTRACK
93 # define gtreve_root GTREVE_ROOT
98 extern "C" type_of_call void gheish();
99 extern "C" type_of_call void flufin();
100 extern "C" type_of_call void gfmfin();
101 extern "C" type_of_call void gpghei();
102 extern "C" type_of_call void fldist();
103 extern "C" type_of_call void gfmdis();
104 extern "C" type_of_call void ghelx3(Float_t&, Float_t&, Float_t*, Float_t*);
105 extern "C" type_of_call void ghelix(Float_t&, Float_t&, Float_t*, Float_t*);
106 extern "C" type_of_call void grkuta(Float_t&, Float_t&, Float_t*, Float_t*);
107 extern "C" type_of_call void gtrack();
108 extern "C" type_of_call void gtreve_root();
109 extern "C" type_of_call void glast();
111 extern "C" type_of_call {
113 //______________________________________________________________________
117 // ******************************************************************
119 // * User routine to digitize one event *
121 // * ==>Called by : GTRIG *
123 // ******************************************************************
128 //______________________________________________________________________
132 // ******************************************************************
134 // * User routine to generate one hadronic interaction *
136 // * ==>Called by : GTHADR,GTNEUT *
138 // ******************************************************************
141 // ------------------------------------------------------------------
143 TGeant3* geant3 = (TGeant3*) gMC;
144 Int_t ihadr=geant3->Gcphys()->ihadr;
145 if (ihadr<4) gheish();
146 else if (ihadr==4) flufin();
150 //______________________________________________________________________
154 // ******************************************************************
156 // * User routine called at the end of each event *
158 // * ==>Called by : GTRIG *
160 // ******************************************************************
163 // ------------------------------------------------------------------
167 //______________________________________________________________________
171 // ******************************************************************
173 // * User routine to compute Hadron. inter. probabilities *
175 // * ==>Called by : GTHADR,GTNEUT *
177 // ******************************************************************
180 // ------------------------------------------------------------------
182 TGeant3* geant3 = (TGeant3*) gMC;
183 Int_t ihadr=geant3->Gcphys()->ihadr;
184 if (ihadr<4) gpghei();
185 else if (ihadr==4) fldist();
189 //______________________________________________________________________
193 // ******************************************************************
195 // * User routine to decay particles *
197 // * ==>Called by : GDECAY *
199 // ******************************************************************
202 // ------------------------------------------------------------------
206 //______________________________________________________________________
207 void guiget(Int_t&, Int_t&, Int_t&)
210 // ******************************************************************
212 // * User routine for interactive control of GEANT *
214 // * ==>Called by : <GXINT>, GINCOM *
216 // ******************************************************************
219 // ------------------------------------------------------------------
223 //______________________________________________________________________
224 void guinme(Float_t*, Int_t&, Float_t*, Int_t& IYES)
227 // **********************************************
229 // * USER ROUTINE TO PROVIDE GINME FUNCTION *
230 // * FOR ALL USER SHAPES IDENTIFIED BY THE *
231 // * SHAPE NUMBER SH. POINT IS GIVEN IN X *
232 // * THE PARAMETERS ARE GIVEN IN P. IYES IS *
233 // * RETURNED 1 IF POINT IS IN, 0 IF POINT *
234 // * IS OUT AND LESS THAN ZERO IF SHAPE *
235 // * NUMBER IS NOT SUPPORTED. *
237 // * ==>Called by : GINME *
239 // **********************************************
244 //______________________________________________________________________
248 // ******************************************************************
250 // * User routine for interactive version *
252 // * ==>Called by : <GXINT>, GINTRI *
254 // ******************************************************************
257 // ------------------------------------------------------------------
261 //______________________________________________________________________
262 void gunear(Int_t&, Int_t&, Float_t*, Int_t&)
265 // ******************************************************************
268 // * ISEARC to identify the given volume *
269 // * ICALL to identify the calling routine *
272 // * X coordinates (+direction for ICALL=2) *
273 // * JNEAR address of default list of neighbours *
274 // * (list to be overwriten by user) *
276 // * Called by : GFTRAC, GINVOL, GTMEDI, GTNEXT, GNEXT, GMEDIA *
278 // ******************************************************************
281 // ------------------------------------------------------------------
285 //______________________________________________________________________
286 void guskip(Int_t& ISKIP)
289 // ******************************************************************
291 // * User routine to skip unwanted tracks *
293 // * Called by : GSSTAK *
294 // * Author : F.Bruyant *
296 // ******************************************************************
299 // ------------------------------------------------------------------
304 //______________________________________________________________________
305 void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT)
308 // ******************************************************************
310 // * User routine to control tracking of one track *
311 // * in a magnetic field *
313 // * ==>Called by : GTELEC,GTHADR,GTMUON *
315 // ******************************************************************
318 // ------------------------------------------------------------------
320 TGeant3* geant3 = (TGeant3*) gMC;
321 Int_t ifield=geant3->Gctmed()->ifield;
322 Float_t fieldm=geant3->Gctmed()->fieldm;
325 Float_t fldcharge = fieldm*CHARGE;
326 ghelx3(fldcharge,STEP,VECT,VOUT);
328 else if (ifield==2) ghelix(CHARGE,STEP,VECT,VOUT);
329 else grkuta(CHARGE,STEP,VECT,VOUT);
332 //______________________________________________________________________
333 void guview(Int_t&, Int_t&, DEFCHARD, Int_t& DEFCHARL)
336 // ******************************************************************
338 // * User routine for interactive version *
340 // * ==>Called by : <GXINT>, GINC1 *
342 // ******************************************************************
345 // ------------------------------------------------------------------
349 //______________________________________________________________________
353 // ******************************************************************
355 // * User routine called every time a particle falls below *
356 // * parametrization threshold. This routine should create *
357 // * the parametrization stack, and, when this is full, *
358 // * parametrize the shower and track the geantinos. *
360 // * ==>Called by : GTRACK *
362 // ******************************************************************
365 // ------------------------------------------------------------------
369 //______________________________________________________________________
370 Float_t gudtim(Float_t&, Float_t&, Int_t&, Int_t&)
373 // ******************************************************************
375 // * User function called by GCDRIF to return drift time *
377 // * ==>Called by : GCDRIF *
379 // ******************************************************************
382 // ------------------------------------------------------------------
388 //______________________________________________________________________
389 Float_t guplsh(Int_t&, Int_t&)
392 // ******************************************************************
395 // * ==>Called by : GLISUR *
397 // ******************************************************************
400 // ------------------------------------------------------------------
403 //*** By default this defines perfect smoothness
407 //______________________________________________________________________
411 // ******************************************************************
413 // * User routine to control tracking of one track *
415 // * ==>Called by : GTREVE *
417 // ******************************************************************
420 // ------------------------------------------------------------------
422 Int_t ndet = gAlice->Modules()->GetLast();
423 TObjArray &dets = *gAlice->Modules();
427 for(i=0; i<=ndet; i++)
428 if((module = (AliModule*)dets[i]))
433 for(i=0; i<=ndet; i++)
434 if((module = (AliModule*)dets[i]))
438 //______________________________________________________________________
442 // ******************************************************************
444 // * User routine to control tracking of one event *
446 // * ==>Called by : GTRIG *
448 // ******************************************************************
451 // ------------------------------------------------------------------
457 //______________________________________________________________________
458 void gufld(Float_t *x, Float_t *b)
460 if(gAlice->Field()) {
461 gAlice->Field()->Field(x,b);
463 printf("No mag field defined!\n");
468 //______________________________________________________________________
472 // ******************************************************************
474 // * User routine called at the end of each tracking step *
475 // * INWVOL is different from 0 when the track has reached *
476 // * a volume boundary *
477 // * ISTOP is different from 0 if the track has stopped *
479 // * ==>Called by : GTRACK *
481 // ******************************************************************
487 Int_t ipp, jk, id, nt;
488 Float_t polar[3]={0,0,0};
492 // --- Standard GEANT debug routine
493 TGeant3* geant3 = (TGeant3*) gMC;
494 if(geant3->Gcflag()->idebug) geant3->Gdebug();
496 // Stop particle if outside user defined tracking region
497 gMC->TrackPosition(x);
498 r=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]);
499 if (r > gAlice->TrackingRmax() || TMath::Abs(x[2]) > gAlice->TrackingZmax()) {
502 // --- Add new created particles
503 if (gMC->NSecondaries() > 0) {
504 gMC->ProdProcess(chproc);
505 for (jk = 0; jk < geant3->Gcking()->ngkine; ++jk) {
506 ipp = Int_t (geant3->Gcking()->gkin[jk][4]+0.5);
507 // --- Skip neutrinos!
509 gAlice->SetTrack(1,gAlice->CurrentTrack(),gMC->PDGFromId(ipp), geant3->Gcking()->gkin[jk],
510 geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt);
514 // Cherenkov photons here
515 if ( geant3->Gckin2()->ngphot ) {
516 for (jk = 0; jk < geant3->Gckin2()->ngphot; ++jk) {
517 mom[0]=geant3->Gckin2()->xphot[jk][3]*geant3->Gckin2()->xphot[jk][6];
518 mom[1]=geant3->Gckin2()->xphot[jk][4]*geant3->Gckin2()->xphot[jk][6];
519 mom[2]=geant3->Gckin2()->xphot[jk][5]*geant3->Gckin2()->xphot[jk][6];
520 gAlice->SetTrack(1, gAlice->CurrentTrack(), gMC->PDGFromId(50),
522 geant3->Gckin2()->xphot[jk], //position
523 &geant3->Gckin2()->xphot[jk][7], //polarisation
524 geant3->Gckin2()->xphot[jk][10], //time of flight
528 // --- Particle leaving the setup ?
529 if (!gMC->IsTrackOut())
530 if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id);
533 //______________________________________________________________________
537 // ******************************************************************
539 // * Read or Generates Kinematics for primary tracks *
541 // * ==>Called by : GTRIG *
543 // ******************************************************************
546 // ------------------------------------------------------------------
548 gAlice->Generator()->Generate();
552 //______________________________________________________________________
556 // ******************************************************************
558 // * User routine called at the end of the run *
560 // * ==>Called by : GRUN *
562 // ******************************************************************