]>
Commit | Line | Data |
---|---|---|
fa3d1cc7 | 1 | #include <Riostream.h> |
a7bb59a2 | 2 | |
fa3d1cc7 | 3 | #include "TFluka.h" |
d566901f | 4 | #include "TFlukaCodes.h" |
5 | #include "TFlukaMCGeometry.h" | |
a1f42b9c | 6 | #include "Fdimpar.h" //(DIMPAR) fluka include |
7 | #include "Ftrackr.h" //(TRACKR) fluka common | |
d566901f | 8 | #include "Fltclcm.h" //(LTCLCM) fluka common |
87ad3c3e | 9 | #include "Fopphst.h" //(OPPHST) fluka common |
10 | ||
fa3d1cc7 | 11 | #ifndef WIN32 |
12 | # define bxdraw bxdraw_ | |
13 | #else | |
14 | # define bxdraw BXDRAW | |
15 | #endif | |
4aba9d66 | 16 | |
17 | ||
18 | #include "TGeoManager.h" | |
19 | ||
20 | ||
fa3d1cc7 | 21 | extern "C" { |
22 | void bxdraw(Int_t& icode, Int_t& mreg, Int_t& newreg, | |
23 | Double_t& xsco, Double_t& ysco, Double_t& zsco) | |
24 | { | |
a1f42b9c | 25 | TFluka* fluka = (TFluka*) gMC; |
4aba9d66 | 26 | Int_t oldlttc = TRACKR.lt1trk; //LTCLCM.mlatm1; |
d566901f | 27 | Int_t newlttc = LTCLCM.newlat; |
28 | fluka->SetIcode((FlukaProcessCode_t)icode); | |
4aba9d66 | 29 | // fluka->SetNewreg(newreg,newlttc); |
a1f42b9c | 30 | fluka->SetXsco(xsco); |
31 | fluka->SetYsco(ysco); | |
32 | fluka->SetZsco(zsco); | |
2bc4c610 | 33 | Int_t verbosityLevel = fluka->GetVerbosityLevel(); |
34 | Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE; | |
4aba9d66 | 35 | // nothing to do if particle is crossing a dummy region |
36 | if (mreg == fluka->GetDummyRegion() || | |
37 | newreg == fluka->GetDummyRegion() || | |
38 | oldlttc == TFlukaMCGeometry::kLttcVirtual || | |
39 | newlttc == TFlukaMCGeometry::kLttcVirtual | |
40 | ) return; | |
41 | ||
a1f42b9c | 42 | // |
43 | // Double step for boundary crossing | |
44 | // | |
4d286778 | 45 | fluka->SetTrackIsNew(kFALSE); // has to be called BEFORE Stepping() |
4aba9d66 | 46 | if (mreg != fluka->GetDummyRegion() && newreg != fluka->GetDummyRegion()) { |
87ad3c3e | 47 | if (debug) printf("bxdraw (ex) \n"); |
48 | fluka->SetTrackIsExiting(); | |
49 | fluka->SetCaller(kBXExiting); | |
50 | fluka->SetMreg(mreg,oldlttc); | |
51 | ||
52 | // check region lattice consistency (debug Ernesto) | |
53 | // ***************************************************** | |
54 | Int_t nodeId; | |
55 | Int_t volId = fluka->CurrentVolID(nodeId); | |
56 | Int_t crtlttc = gGeoManager->GetCurrentNodeId()+1; | |
57 | if(debug && mreg != volId && !gGeoManager->IsOutside()) { | |
58 | cout << " bxdraw: track=" << TRACKR.ispusr[mkbmx2-1]<< " pdg=" << fluka->PDGFromId(TRACKR.jtrack) | |
59 | << " icode=" << icode << " gNstep=" << fluka->GetNstep() << endl | |
60 | << " fluka mreg=" << mreg << " oldlttc=" << oldlttc << " newreg=" << newreg << " newlttc=" << newlttc << endl | |
61 | << " TGeo volId=" << volId << " crtlttc=" << crtlttc << endl | |
62 | << " common TRACKR lt1trk=" << TRACKR.lt1trk << " lt2trk=" << TRACKR.lt2trk << endl | |
63 | << " common LTCLCM newlat=" << LTCLCM.newlat << " mlatld=" << LTCLCM.mlatld << endl | |
64 | << " mlatm1=" << LTCLCM.mlatm1 << " mltsen=" << LTCLCM.mltsen << endl | |
65 | << " mltsm1=" << LTCLCM.mltsm1 << " mlattc=" << LTCLCM.mlattc << endl; | |
66 | if( oldlttc == crtlttc ) cout << " **************************** Exit *********************************" << endl; | |
67 | } | |
68 | // ***************************************************** | |
69 | ||
70 | ||
71 | ||
72 | TVirtualMCStack* cppstack = fluka->GetStack(); | |
73 | ||
74 | if (TRACKR.jtrack == -1) { | |
75 | cppstack->SetCurrentTrack(OPPHST.louopp[OPPHST.lstopp]); | |
76 | } else { | |
77 | cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-1] ); | |
78 | } | |
79 | ||
80 | (TVirtualMCApplication::Instance())->Stepping(); | |
d566901f | 81 | } |
82 | if (newreg != fluka->GetDummyRegion()) { | |
87ad3c3e | 83 | if (debug) printf("bxdraw (en) \n"); |
84 | fluka->SetCaller(kBXEntering); | |
85 | fluka->SetTrackIsEntering(); | |
86 | if (fluka->GetDummyBoundary() == 1) fluka->SetDummyBoundary(2); | |
87 | fluka->SetMreg(newreg,newlttc); | |
88 | ||
89 | // check region lattice consistency (debug Ernesto) | |
90 | // ***************************************************** | |
91 | Int_t nodeId; | |
92 | Int_t volId = fluka->CurrentVolID(nodeId); | |
93 | Int_t crtlttc = gGeoManager->GetCurrentNodeId()+1; | |
94 | if(debug && newreg != volId && !gGeoManager->IsOutside()) { | |
95 | cout << " bxdraw: track=" << TRACKR.ispusr[mkbmx2-1] << " pdg=" << fluka->PDGFromId(TRACKR.jtrack) | |
96 | << " icode=" << icode << " gNstep=" << fluka->GetNstep() << endl | |
97 | << " fluka mreg=" << mreg << " oldlttc=" << oldlttc << " newreg=" << newreg << " newlttc=" << newlttc << endl | |
98 | << " TGeo volId=" << volId << " crtlttc=" << crtlttc << endl | |
99 | << " common TRACKR lt1trk=" << TRACKR.lt1trk << " lt2trk=" << TRACKR.lt2trk << endl | |
100 | << " common LTCLCM newlat=" << LTCLCM.newlat << " mlatld=" << LTCLCM.mlatld << endl | |
101 | << " mlatm1=" << LTCLCM.mlatm1 << " mltsen=" << LTCLCM.mltsen << endl | |
102 | << " mltsm1=" << LTCLCM.mltsm1 << " mlattc=" << LTCLCM.mlattc << endl; | |
103 | if( newlttc == crtlttc ) cout << " ******************************** Enter *****************************" << endl; | |
104 | } | |
105 | // ***************************************************** | |
106 | ||
107 | TVirtualMCStack* cppstack = fluka->GetStack(); | |
108 | if (TRACKR.jtrack == -1) { | |
109 | cppstack->SetCurrentTrack(OPPHST.louopp[OPPHST.lstopp]); | |
110 | } else { | |
111 | cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-1] ); | |
112 | } | |
113 | ||
114 | (TVirtualMCApplication::Instance())->Stepping(); | |
18e0cabb | 115 | } |
4d286778 | 116 | |
fa3d1cc7 | 117 | } // end of bxdraw |
118 | } // end of extern "C" | |
119 |