4 #include "TFlukaCodes.h"
5 #include "TFlukaMCGeometry.h"
6 #include "Fdimpar.h" //(DIMPAR) fluka include
7 #include "Ftrackr.h" //(TRACKR) fluka common
8 #include "Fltclcm.h" //(LTCLCM) fluka common
9 #include "Fopphst.h" //(OPPHST) fluka common
12 # define bxdraw bxdraw_
14 # define bxdraw BXDRAW
18 #include "TGeoManager.h"
22 void bxdraw(Int_t& icode, Int_t& mreg, Int_t& newreg,
23 Double_t& xsco, Double_t& ysco, Double_t& zsco)
25 TFluka* fluka = (TFluka*) gMC;
26 Int_t oldlttc = TRACKR.lt1trk; //LTCLCM.mlatm1;
27 Int_t newlttc = LTCLCM.newlat;
28 fluka->SetIcode((FlukaProcessCode_t)icode);
29 // fluka->SetNewreg(newreg,newlttc);
33 Int_t verbosityLevel = fluka->GetVerbosityLevel();
34 Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
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
43 // Double step for boundary crossing
45 fluka->SetTrackIsNew(kFALSE); // has to be called BEFORE Stepping()
46 if (mreg != fluka->GetDummyRegion() && newreg != fluka->GetDummyRegion()) {
47 if (debug) printf("bxdraw (ex) \n");
48 fluka->SetTrackIsExiting();
49 fluka->SetCaller(kBXExiting);
50 fluka->SetMreg(mreg,oldlttc);
52 // check region lattice consistency (debug Ernesto)
53 // *****************************************************
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;
68 // *****************************************************
72 TVirtualMCStack* cppstack = fluka->GetStack();
74 if (TRACKR.jtrack == -1) {
75 cppstack->SetCurrentTrack(OPPHST.louopp[OPPHST.lstopp]);
77 cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-1] );
80 (TVirtualMCApplication::Instance())->Stepping();
82 if (newreg != fluka->GetDummyRegion()) {
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);
89 // check region lattice consistency (debug Ernesto)
90 // *****************************************************
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;
105 // *****************************************************
107 TVirtualMCStack* cppstack = fluka->GetStack();
108 if (TRACKR.jtrack == -1) {
109 cppstack->SetCurrentTrack(OPPHST.louopp[OPPHST.lstopp]);
111 cppstack->SetCurrentTrack( TRACKR.ispusr[mkbmx2-1] );
114 (TVirtualMCApplication::Instance())->Stepping();
118 } // end of extern "C"