]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/usdraw.cxx
stars replaced by sumcou common.
[u/mrichter/AliRoot.git] / TFluka / usdraw.cxx
1 #include <Riostream.h>
2 #include "TVirtualMCApplication.h"
3 #include "TFluka.h"
4 #include <TLorentzVector.h>
5 #include "Fdimpar.h"  //(DIMPAR) fluka include
6 #include "Ftrackr.h"  //(TRACKR) fluka common
7 #ifndef WIN32
8 # define usdraw usdraw_
9 #else
10 # define usdraw USDRAW
11 #endif
12 extern "C" {
13 void usdraw(Int_t& icode, Int_t& mreg, 
14             Double_t& xsco, Double_t& ysco, Double_t& zsco)
15 {
16   TFluka *fluka = (TFluka*)gMC;
17   Int_t verbosityLevel = fluka->GetVerbosityLevel();
18   Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
19   fluka->SetCaller(6);
20   fluka->SetIcode(icode);
21
22   if (fluka->IsTrackDisappeared()) {
23       TRACKR.ispusr[mkbmx2 - 2] = 1;
24 // Save properties at point where particle disappears in case this is only an interruption
25       TLorentzVector p;
26       gMC->TrackMomentum(p);
27       
28       TRACKR.spausr[0] = xsco;               // x
29       TRACKR.spausr[1] = ysco;               // y
30       TRACKR.spausr[2] = zsco;               // z
31       TRACKR.spausr[3] = gMC->TrackTime();   // t
32       TRACKR.spausr[4] = p[0];               // px
33       TRACKR.spausr[5] = p[1];               // py
34       TRACKR.spausr[6] = p[2];               // pz
35       TRACKR.spausr[7] = p[3];               // e
36       TRACKR.spausr[8] = gMC->TrackLength(); // Length 
37   }
38
39   fluka->SetMreg(mreg);
40   fluka->SetXsco(xsco);
41   fluka->SetYsco(ysco);
42   fluka->SetZsco(zsco);
43
44   if (debug) printf("USDRAW: Number of track segments:%6d %6d %6d %10.3e\n", TRACKR.ntrack, TRACKR.mtrack, icode, TRACKR.atrack);
45
46   (TVirtualMCApplication::Instance())->Stepping();
47   fluka->SetTrackIsNew(kFALSE);
48   
49 } // end of usdraw
50 } // end of extern "C"
51