]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/bxdraw.cxx
Track points are moved according to vertex position so vertex is in (0,0,0)
[u/mrichter/AliRoot.git] / TFluka / bxdraw.cxx
index 29db5c154ebdad01115e212a417f82d589ac3ee5..cba83ed4f8c34ae5065d853eb42ee8d687bc422c 100644 (file)
@@ -1,6 +1,13 @@
 #include <Riostream.h>
-#include "TVirtualMCApplication.h"
+
+#ifndef WITH_ROOT
 #include "TFluka.h"
+#else
+#include "TFlukaGeo.h"
+#endif
+
+#include "Fdimpar.h"  //(DIMPAR) fluka include
+#include "Ftrackr.h"  //(TRACKR) fluka common
 #ifndef WIN32
 # define bxdraw bxdraw_
 #else
@@ -10,15 +17,32 @@ extern "C" {
 void bxdraw(Int_t& icode, Int_t& mreg, Int_t& newreg,
             Double_t& xsco, Double_t& ysco, Double_t& zsco)
 {
-  ((TFluka*) gMC)->SetIcode(icode);
-  ((TFluka*) gMC)->SetMreg(mreg);
-  ((TFluka*) gMC)->SetNewreg(newreg);
-  ((TFluka*) gMC)->SetXsco(xsco);
-  ((TFluka*) gMC)->SetYsco(ysco);
-  ((TFluka*) gMC)->SetZsco(zsco);
-  cout << endl << " !!! I am in bxdraw - calling Stepping()" << endl;
-  ((TFluka*) gMC)->FutoTest();
-  (TVirtualMCApplication::Instance())->Stepping();
+    TFluka* fluka = (TFluka*) gMC;
+    
+    fluka->SetIcode(icode);
+    fluka->SetNewreg(newreg);
+    fluka->SetXsco(xsco);
+    fluka->SetYsco(ysco);
+    fluka->SetZsco(zsco);
+    Int_t verbosityLevel = fluka->GetVerbosityLevel();
+    Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
+//
+// Double step for boundary crossing
+//
+    fluka->SetTrackIsNew(kFALSE); // has to be called BEFORE Stepping()
+    if (debug) printf("bxdraw (ex) \n");
+    fluka->SetTrackIsExiting();
+    fluka->SetCaller(12);
+    fluka->SetMreg(mreg);
+    (TVirtualMCApplication::Instance())->Stepping(); 
+
+    if (debug) printf("bxdraw (en) \n");
+    fluka->SetCaller(11);
+    fluka->SetTrackIsEntering();
+    if (fluka->GetDummyBoundary() == 1) fluka->SetDummyBoundary(2);
+    fluka->SetMreg(newreg);
+    (TVirtualMCApplication::Instance())->Stepping();
+
 } // end of bxdraw
 } // end of extern "C"