]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/usdraw.cxx
Flag interrupted track in EMSTK instead of TRACKR.
[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 #include "Femfstk.h"  //(EMFSTK) fluka common
8 #ifndef WIN32
9 # define usdraw usdraw_
10 #else
11 # define usdraw USDRAW
12 #endif
13 extern "C" {
14 void usdraw(Int_t& icode, Int_t& mreg, 
15             Double_t& xsco, Double_t& ysco, Double_t& zsco)
16 {
17   TFluka *fluka = (TFluka*)gMC;
18   Int_t verbosityLevel = fluka->GetVerbosityLevel();
19   Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
20   fluka->SetCaller(6);
21   fluka->SetIcode(icode);
22
23   if (icode/100 == 2) {
24       for (Int_t npnw = EMFSTK.npstrt-1; npnw <= EMFSTK.npemf-1; npnw++) {
25           if (EMFSTK.iespak[npnw][mkbmx2-1] ==  TRACKR.ispusr[mkbmx2 - 1] ) {
26               EMFSTK.iespak[npnw][mkbmx2 - 2] = 1;
27 // Save properties at point where particle disappears in case this is only an interruption
28               TLorentzVector p;
29               gMC->TrackMomentum(p);
30               EMFSTK.espark[npnw][0] = xsco;               // x
31               EMFSTK.espark[npnw][1] = ysco;               // y
32               EMFSTK.espark[npnw][2] = zsco;               // z
33               EMFSTK.espark[npnw][3] = gMC->TrackTime();   // t
34               EMFSTK.espark[npnw][4] = p[0];               // px
35               EMFSTK.espark[npnw][5] = p[1];               // py
36               EMFSTK.espark[npnw][6] = p[2];               // pz
37               EMFSTK.espark[npnw][7] = p[3];               // e
38               EMFSTK.espark[npnw][8] = gMC->TrackLength(); // Length 
39           } // Track found in stack
40       } // Loop over emf stack 
41   } // Electromagnetic process
42   
43
44
45   fluka->SetMreg(mreg);
46   fluka->SetXsco(xsco);
47   fluka->SetYsco(ysco);
48   fluka->SetZsco(zsco);
49
50   if (debug) printf("USDRAW: Number of track segments:%6d %6d %6d %10.3e\n", TRACKR.ntrack, TRACKR.mtrack, icode, TRACKR.atrack);
51
52   (TVirtualMCApplication::Instance())->Stepping();
53   fluka->SetTrackIsNew(kFALSE);
54   
55 } // end of usdraw
56 } // end of extern "C"
57