]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant3/gucode.cxx
Dummy definition of Gftmat, Gbrelm and Gprelm added.
[u/mrichter/AliRoot.git] / TGeant3 / gucode.cxx
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$
18 Revision 1.9  1999/09/29 09:24:31  fca
19 Introduction of the Copyright and cvs Log
20
21 */
22
23 #include "AliCallf77.h"
24 #include "TGeant3.h"
25 #include "AliRun.h"
26
27 #ifndef WIN32
28 #  define gudigi gudigi_
29 #  define guhadr guhadr_
30 #  define guout  guout_
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_
45 #  define gufld  gufld_
46 #  define gustep gustep_
47 #  define gukine gukine_
48 #  define uglast uglast_
49
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_
61 #  define glast  glast_
62
63 #else
64 #  define gudigi GUDIGI
65 #  define guhadr GUHADR
66 #  define guout  GUOUT
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
81 #  define gufld  GUFLD
82 #  define gustep GUSTEP
83 #  define gukine GUKINE
84 #  define uglast UGLAST
85
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
97 #  define glast  GLAST
98
99 #endif
100
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();
113
114 extern "C" type_of_call {
115
116 //______________________________________________________________________
117 void gudigi() 
118 {
119 //
120 //    ******************************************************************
121 //    *                                                                *
122 //    *       User routine to digitize one event                       *
123 //    *                                                                *
124 //    *    ==>Called by : GTRIG                                        *
125 //    *                                                                *
126 //    ******************************************************************
127
128 }
129
130
131 //______________________________________________________________________
132 void guhadr()
133 {
134 //
135 //    ******************************************************************
136 //    *                                                                *
137 //    *       User routine to generate one hadronic interaction        *
138 //    *                                                                *
139 //    *    ==>Called by : GTHADR,GTNEUT                                *
140 //    *                                                                *
141 //    ******************************************************************
142 //
143 //
144 //    ------------------------------------------------------------------
145 //
146       TGeant3* geant3 = (TGeant3*) gMC;
147       Int_t ihadr=geant3->Gcphys()->ihadr;
148       if (ihadr<4)       gheish();
149       else if (ihadr==4) flufin();
150       else               gfmfin();
151 }
152
153 //______________________________________________________________________
154 void guout()
155 {
156 //
157 //    ******************************************************************
158 //    *                                                                *
159 //    *       User routine called at the end of each event             *
160 //    *                                                                *
161 //    *    ==>Called by : GTRIG                                        *
162 //    *                                                                *
163 //    ******************************************************************
164 //
165 //
166 //    ------------------------------------------------------------------
167 //
168 }
169
170 //______________________________________________________________________
171 void guphad()
172 {
173 //
174 //    ******************************************************************
175 //    *                                                                *
176 //    *       User routine to compute Hadron. inter. probabilities     *
177 //    *                                                                *
178 //    *    ==>Called by : GTHADR,GTNEUT                                *
179 //    *                                                                *
180 //    ******************************************************************
181 //
182 //
183 //    ------------------------------------------------------------------
184 //
185       TGeant3* geant3 = (TGeant3*) gMC;
186       Int_t ihadr=geant3->Gcphys()->ihadr;
187       if (ihadr<4)       gpghei();
188       else if (ihadr==4) fldist();
189       else               gfmdis();
190 }
191
192 //______________________________________________________________________
193 void gudcay()
194 {
195 //
196 //    ******************************************************************
197 //    *                                                                *
198 //    *       User routine to decay particles                          *
199 //    *                                                                *
200 //    *    ==>Called by : GDECAY                                       *
201 //    *                                                                *
202 //    ******************************************************************
203 //
204 //
205 //    ------------------------------------------------------------------
206 //
207 }
208
209 //______________________________________________________________________
210 void guiget(Int_t&, Int_t&, Int_t&)
211 {
212 //
213 //    ******************************************************************
214 //    *                                                                *
215 //    *       User routine for interactive control of GEANT            *
216 //    *                                                                *
217 //    *    ==>Called by : <GXINT>, GINCOM                              *
218 //    *                                                                *
219 //    ******************************************************************
220 //
221 //
222 //    ------------------------------------------------------------------
223 //
224 }
225
226 //______________________________________________________________________
227 void guinme(Float_t*, Int_t&, Float_t*, Int_t& IYES)
228 {
229 //
230 //    **********************************************
231 //    *                                            *
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.                *
239 //    *                                            *
240 //    *    ==>Called by : GINME                    *
241 //    *                                            *
242 //    **********************************************
243 //
244       IYES=-1;
245 }
246
247 //______________________________________________________________________
248 void guinti()
249 {
250 //
251 //    ******************************************************************
252 //    *                                                                *
253 //    *       User routine for interactive version                     *
254 //    *                                                                *
255 //    *    ==>Called by : <GXINT>,  GINTRI                             *
256 //    *                                                                *
257 //    ******************************************************************
258 //
259 //
260 //    ------------------------------------------------------------------
261 //
262 }
263
264 //______________________________________________________________________
265 void gunear(Int_t&, Int_t&, Float_t*, Int_t&)
266 {
267 //
268 //    ******************************************************************
269 //    *                                                                *
270 //    *    User search                                                 *
271 //    *       ISEARC to identify the given volume                      *
272 //    *       ICALL  to identify the calling routine                   *
273 //    *              1 GMEDIA like                                     *
274 //    *              2 GNEXT like                                      *
275 //    *       X      coordinates (+direction for ICALL=2)              *
276 //    *       JNEAR  address of default list of neighbours             *
277 //    *              (list to be overwriten by user)                   *
278 //    *                                                                *
279 //    *    Called by : GFTRAC, GINVOL, GTMEDI, GTNEXT, GNEXT, GMEDIA   *
280 //    *                                                                *
281 //    ******************************************************************
282 //
283 //
284 //    ------------------------------------------------------------------
285 //
286 }
287
288 //______________________________________________________________________
289 void guskip(Int_t& ISKIP)
290 {
291 //
292 //    ******************************************************************
293 //    *                                                                *
294 //    *   User routine to skip unwanted tracks                         *
295 //    *                                                                *
296 //    *   Called by : GSSTAK                                           *
297 //    *   Author    : F.Bruyant                                        *
298 //    *                                                                *
299 //    ******************************************************************
300 //
301 //
302 //    ------------------------------------------------------------------
303 //
304       ISKIP = 0;
305 }
306
307 //______________________________________________________________________
308 void guswim(Float_t& CHARGE, Float_t& STEP, Float_t* VECT, Float_t* VOUT)
309 {
310 //
311 //    ******************************************************************
312 //    *                                                                *
313 //    *       User routine to control tracking of one track            *
314 //    *       in a magnetic field                                      *
315 //    *                                                                *
316 //    *    ==>Called by : GTELEC,GTHADR,GTMUON                         *
317 //    *                                                                *
318 //    ******************************************************************
319 //
320 //
321 //    ------------------------------------------------------------------
322 //
323   TGeant3* geant3 = (TGeant3*) gMC;
324   Int_t ifield=geant3->Gctmed()->ifield;
325   Float_t fieldm=geant3->Gctmed()->fieldm;
326
327   if (ifield==3) {
328     Float_t fldcharge = fieldm*CHARGE;
329     ghelx3(fldcharge,STEP,VECT,VOUT);
330   }
331   else if (ifield==2) ghelix(CHARGE,STEP,VECT,VOUT);
332   else                grkuta(CHARGE,STEP,VECT,VOUT);
333 }
334
335 //______________________________________________________________________
336 void guview(Int_t&, Int_t&, DEFCHARD, Int_t& DEFCHARL)
337 {
338 //
339 //    ******************************************************************
340 //    *                                                                *
341 //    *       User routine for interactive version                     *
342 //    *                                                                *
343 //    *    ==>Called by : <GXINT>, GINC1                               *
344 //    *                                                                *
345 //    ******************************************************************
346 //
347 //
348 //    ------------------------------------------------------------------
349 //
350 }
351
352 //______________________________________________________________________
353 void gupara()
354 {
355 //
356 //    ******************************************************************
357 //    *                                                                *
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.          *
362 //    *                                                                *
363 //    *    ==>Called by : GTRACK                                       *
364 //    *                                                                *
365 //    ******************************************************************
366 //
367 //
368 //    ------------------------------------------------------------------
369 //
370 }
371
372 //______________________________________________________________________
373 Float_t gudtim(Float_t&, Float_t&, Int_t&, Int_t&)
374 {
375 //
376 //    ******************************************************************
377 //    *                                                                *
378 //    *       User function called by GCDRIF to return drift time      *
379 //    *                                                                *
380 //    *    ==>Called by : GCDRIF                                       *
381 //    *                                                                *
382 //    ******************************************************************
383 //
384 //
385 //    ------------------------------------------------------------------
386 //
387       return 0;
388 }
389
390
391 //______________________________________________________________________
392 Float_t guplsh(Int_t&, Int_t&)
393 {
394 //
395 //    ******************************************************************
396 //    *                                                                *
397 //    *                                                                *
398 //    *    ==>Called by : GLISUR                                       *
399 //    *                                                                *
400 //    ******************************************************************
401 //
402 //
403 //    ------------------------------------------------------------------
404 //
405 //
406 //*** By default this defines perfect smoothness
407       return 1;
408 }
409
410 //______________________________________________________________________
411 void gutrak()
412 {
413 //
414 //    ******************************************************************
415 //    *                                                                *
416 //    *       User routine to control tracking of one track            *
417 //    *                                                                *
418 //    *    ==>Called by : GTREVE                                       *
419 //    *                                                                *
420 //    ******************************************************************
421 //
422 //
423 //    ------------------------------------------------------------------
424 //
425      Int_t ndet = gAlice->Modules()->GetLast();
426      TObjArray &dets = *gAlice->Modules();
427      AliModule *module;
428      Int_t i;
429
430      for(i=0; i<=ndet; i++)
431        if((module = (AliModule*)dets[i]))
432          module->PreTrack();
433
434      gtrack();
435
436      for(i=0; i<=ndet; i++)
437        if((module = (AliModule*)dets[i]))
438          module->PostTrack();
439 }
440
441 //______________________________________________________________________
442 void gutrev()
443 {
444 //
445 //    ******************************************************************
446 //    *                                                                *
447 //    *       User routine to control tracking of one event            *
448 //    *                                                                *
449 //    *    ==>Called by : GTRIG                                        *
450 //    *                                                                *
451 //    ******************************************************************
452 //
453 //
454 //    ------------------------------------------------------------------
455 //
456   gtreve_root();
457 }
458
459
460 //______________________________________________________________________
461 void gufld(Float_t *x, Float_t *b)
462 {
463       if(gAlice->Field()) {
464          gAlice->Field()->Field(x,b);
465       } else {
466          printf("No mag field defined!\n");
467          b[0]=b[1]=b[2]=0;
468       }
469 }
470
471 //______________________________________________________________________
472 void gustep()
473 {
474 //
475 //    ******************************************************************
476 //    *                                                                *
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       *
481 //    *                                                                *
482 //    *    ==>Called by : GTRACK                                       *
483 //    *                                                                *
484 //    ******************************************************************
485 //
486
487
488   TLorentzVector x;
489   Float_t r;
490   Int_t ipp, jk, id, nt;
491   Float_t polar[3]={0,0,0};
492   Float_t mom[3];
493   const char *chproc;
494   
495   // --- Standard GEANT debug routine 
496   TGeant3* geant3 = (TGeant3*) gMC;
497   if(geant3->Gcflag()->idebug) geant3->Gdebug();
498
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()) {
503         gMC->StopTrack();
504   }
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! 
511       if (ipp != 4) {
512         gAlice->SetTrack(1,gAlice->CurrentTrack(),gMC->PDGFromId(ipp), geant3->Gcking()->gkin[jk], 
513                          geant3->Gckin3()->gpos[jk], polar,geant3->Gctrak()->tofg, chproc, nt);
514       }
515     }
516   }
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),
524                        mom,                             //momentum
525                        geant3->Gckin2()->xphot[jk],     //position
526                        &geant3->Gckin2()->xphot[jk][7], //polarisation
527                        geant3->Gckin2()->xphot[jk][10], //time of flight
528                        "Cherenkov", nt);
529       }
530   }
531   // --- Particle leaving the setup ?
532   if (!gMC->IsTrackOut()) 
533     if ((id=gAlice->DetFromMate(geant3->Gctmed()->numed)) >= 0) gAlice->StepManager(id);
534 }
535
536 //______________________________________________________________________
537 void gukine ()
538 {
539 //
540 //    ******************************************************************
541 //    *                                                                *
542 //    *       Read or Generates Kinematics for primary tracks          *
543 //    *                                                                *
544 //    *    ==>Called by : GTRIG                                        *
545 //    *                                                                *
546 //    ******************************************************************
547 //
548 //
549 //    ------------------------------------------------------------------
550 //
551   gAlice->Generator()->Generate();
552 }
553
554
555 //______________________________________________________________________
556 void uglast()
557 {
558 //
559 //    ******************************************************************
560 //    *                                                                *
561 //    *       User routine called at the end of the run                *
562 //    *                                                                *
563 //    *    ==>Called by : GRUN                                         *
564 //    *                                                                *
565 //    ******************************************************************
566 //
567 //
568 }
569 }