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