- Use of enum constants instead of litteral constants
[u/mrichter/AliRoot.git] / TFluka / usdraw.cxx
CommitLineData
fa3d1cc7 1#include <Riostream.h>
7dac99f1 2#include "TVirtualMCApplication.h"
a7bb59a2 3#include "TFluka.h"
d566901f 4#include "TFlukaCodes.h"
5d80a015 5#include <TLorentzVector.h>
a1f42b9c 6#include "Fdimpar.h" //(DIMPAR) fluka include
7#include "Ftrackr.h" //(TRACKR) fluka common
d566901f 8#include "Fltclcm.h" //(LTCLCM) fluka common
7c1c1ebd 9#include "Femfstk.h" //(EMFSTK) fluka common
fa3d1cc7 10#ifndef WIN32
11# define usdraw usdraw_
12#else
13# define usdraw USDRAW
14#endif
15extern "C" {
16void usdraw(Int_t& icode, Int_t& mreg,
17 Double_t& xsco, Double_t& ysco, Double_t& zsco)
18{
fbf08100 19 TFluka *fluka = (TFluka*)gMC;
d566901f 20 // nothing to do if particle inside dummy region
21 if (mreg == fluka->GetDummyRegion()) return;
bcf1cd9c 22 Int_t verbosityLevel = fluka->GetVerbosityLevel();
57dc5a4a 23 Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
d566901f 24 fluka->SetCaller(kUSDRAW);
25 fluka->SetIcode((FlukaProcessCode_t) icode);
57dc5a4a 26
d566901f 27 if (icode/100 == kEMFSCO) {
7c1c1ebd 28 for (Int_t npnw = EMFSTK.npstrt-1; npnw <= EMFSTK.npemf-1; npnw++) {
29 if (EMFSTK.iespak[npnw][mkbmx2-1] == TRACKR.ispusr[mkbmx2 - 1] ) {
30 EMFSTK.iespak[npnw][mkbmx2 - 2] = 1;
5d80a015 31// Save properties at point where particle disappears in case this is only an interruption
7c1c1ebd 32 TLorentzVector p;
33 gMC->TrackMomentum(p);
34 EMFSTK.espark[npnw][0] = xsco; // x
35 EMFSTK.espark[npnw][1] = ysco; // y
36 EMFSTK.espark[npnw][2] = zsco; // z
37 EMFSTK.espark[npnw][3] = gMC->TrackTime(); // t
38 EMFSTK.espark[npnw][4] = p[0]; // px
39 EMFSTK.espark[npnw][5] = p[1]; // py
40 EMFSTK.espark[npnw][6] = p[2]; // pz
41 EMFSTK.espark[npnw][7] = p[3]; // e
42 EMFSTK.espark[npnw][8] = gMC->TrackLength(); // Length
43 } // Track found in stack
44 } // Loop over emf stack
45 } // Electromagnetic process
46
47
57dc5a4a 48
d566901f 49 Int_t mlttc = LTCLCM.mlatm1;
50 fluka->SetMreg(mreg, mlttc);
fbf08100 51 fluka->SetXsco(xsco);
52 fluka->SetYsco(ysco);
53 fluka->SetZsco(zsco);
57dc5a4a 54
5d80a015 55 if (debug) printf("USDRAW: Number of track segments:%6d %6d %6d %10.3e\n", TRACKR.ntrack, TRACKR.mtrack, icode, TRACKR.atrack);
cad96957 56
a1f42b9c 57 (TVirtualMCApplication::Instance())->Stepping();
fbf08100 58 fluka->SetTrackIsNew(kFALSE);
59
fa3d1cc7 60} // end of usdraw
61} // end of extern "C"
62