2 #include "TVirtualMCApplication.h"
4 #include "TFlukaCodes.h"
5 #include <TLorentzVector.h>
6 #include "Fdimpar.h" //(DIMPAR) fluka include
7 #include "Ftrackr.h" //(TRACKR) fluka common
8 #include "Fltclcm.h" //(LTCLCM) fluka common
9 #include "Femfstk.h" //(EMFSTK) fluka common
11 # define usdraw usdraw_
13 # define usdraw USDRAW
16 void usdraw(Int_t& icode, Int_t& mreg,
17 Double_t& xsco, Double_t& ysco, Double_t& zsco)
19 TFluka *fluka = (TFluka*)gMC;
20 // nothing to do if particle inside dummy region
21 if (mreg == fluka->GetDummyRegion()) return;
22 Int_t verbosityLevel = fluka->GetVerbosityLevel();
23 Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
24 fluka->SetCaller(kUSDRAW);
25 fluka->SetIcode((FlukaProcessCode_t) icode);
27 if (icode/100 == kEMFSCO) {
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;
31 // Save properties at point where particle disappears in case this is only an interruption
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
47 Int_t mlttc = LTCLCM.mlatm1;
48 fluka->SetMreg(mreg, mlttc);
53 if (debug) printf("USDRAW: Number of track segments:%6d %6d icode=%d tof=%10.3e track=%d pdg=%d\n",
54 TRACKR.ntrack, TRACKR.mtrack, icode, TRACKR.atrack, TRACKR.ispusr[mkbmx2-1], fluka->PDGFromId(TRACKR.jtrack) );
56 TVirtualMCStack* cppstack = fluka->GetStack();
57 cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-1] );
59 (TVirtualMCApplication::Instance())->Stepping();
60 fluka->SetTrackIsNew(kFALSE);
64 } // end of extern "C"