]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- Use of enum constants instead of litteral constants
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 23 Jan 2006 17:18:42 +0000 (17:18 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 23 Jan 2006 17:18:42 +0000 (17:18 +0000)
  for processes, callers, particles
- Changes needed for improved TFlukaMCGeometry (A. Gheata)

TFluka/bxdraw.cxx
TFluka/eedraw.cxx
TFluka/endraw.cxx
TFluka/mgdraw.cxx
TFluka/sodraw.cxx
TFluka/stupre.cxx
TFluka/usdraw.cxx

index d40c1395dd4d8b6fd2db923de8b6848da5de5dbd..56e211b0d1d31b5a8dee81b3748b03170d0d4afc 100644 (file)
@@ -1,8 +1,11 @@
 #include <Riostream.h>
 
 #include "TFluka.h"
+#include "TFlukaCodes.h"
+#include "TFlukaMCGeometry.h"
 #include "Fdimpar.h"  //(DIMPAR) fluka include
 #include "Ftrackr.h"  //(TRACKR) fluka common
+#include "Fltclcm.h"  //(LTCLCM) fluka common
 #ifndef WIN32
 # define bxdraw bxdraw_
 #else
@@ -13,9 +16,10 @@ void bxdraw(Int_t& icode, Int_t& mreg, Int_t& newreg,
             Double_t& xsco, Double_t& ysco, Double_t& zsco)
 {
     TFluka* fluka = (TFluka*) gMC;
-    
-    fluka->SetIcode(icode);
-    fluka->SetNewreg(newreg);
+    Int_t oldlttc = LTCLCM.mlatm1;
+    Int_t newlttc = LTCLCM.newlat;
+    fluka->SetIcode((FlukaProcessCode_t)icode);
+    fluka->SetNewreg(newreg,newlttc);
     fluka->SetXsco(xsco);
     fluka->SetYsco(ysco);
     fluka->SetZsco(zsco);
@@ -25,18 +29,21 @@ void bxdraw(Int_t& icode, Int_t& mreg, Int_t& newreg,
 // 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();
+    if (mreg != fluka->GetDummyRegion()) {
+       if (debug) printf("bxdraw (ex) \n");
+       fluka->SetTrackIsExiting();
+       fluka->SetCaller(kBXExiting);
+       fluka->SetMreg(mreg,oldlttc);
+       (TVirtualMCApplication::Instance())->Stepping(); 
+    }
+    if (newreg != fluka->GetDummyRegion()) {
+       if (debug) printf("bxdraw (en) \n");
+       fluka->SetCaller(kBXEntering);
+       fluka->SetTrackIsEntering();
+       if (fluka->GetDummyBoundary() == 1) fluka->SetDummyBoundary(2);
+       fluka->SetMreg(newreg,newlttc);
+       (TVirtualMCApplication::Instance())->Stepping();
+    }      
 
 } // end of bxdraw
 } // end of extern "C"
index 0dcb3b75e1e054a63467ed77c8b9dbedeab967f4..038820bead92d8aa3d5168591ec7e09df0f4589d 100644 (file)
@@ -2,6 +2,7 @@
 #include "TVirtualMCApplication.h"
 
 #include "TFluka.h"
+#include "TFlukaCodes.h"
 
 #ifndef WIN32
 # define eedraw eedraw_
@@ -11,8 +12,8 @@
 extern "C" {
 void eedraw(Int_t& icode)
 {
-  ((TFluka*) gMC)->SetCaller(2);
-  ((TFluka*) gMC)->SetIcode(icode);
+  ((TFluka*) gMC)->SetCaller(kEEDRAW);
+  ((TFluka*) gMC)->SetIcode((FlukaProcessCode_t) icode);
 } // end of eedraw
 } // end of extern "C"
 
index 0498c9f5a2b3e309ee4b14db4b81333823b198a2..5a1610de37d246c707254239e439c15e45abdc81 100644 (file)
@@ -5,9 +5,12 @@
 #include "TFlukaCerenkov.h"
 
 #include "TFluka.h"
+#include "TFlukaCodes.h"
 
 #include "Fdimpar.h"  //(DIMPAR) fluka include
 #include "Ftrackr.h"  //(TRACKR) fluka common
+#include "Fltclcm.h"  //(LTCLCM) fluka common
+#include "Fpaprop.h"  //(PAPROP) fluka common
 #ifndef WIN32
 # define endraw endraw_
 #else
@@ -17,26 +20,29 @@ extern "C" {
 void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t& ysco, Double_t& zsco)
 {
   TFluka* fluka = (TFluka*) gMC;
+  // nothing to do if particle in dummy region
+  if (mreg == fluka->GetDummyRegion()) return;
   Int_t verbosityLevel = fluka->GetVerbosityLevel();
   Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
-  fluka->SetCaller(3);
+  Int_t mlttc = LTCLCM.mlatm1;
+  fluka->SetCaller(kENDRAW);
   fluka->SetRull(rull);
   fluka->SetXsco(xsco);
   fluka->SetYsco(ysco);
   fluka->SetZsco(zsco);
-  fluka->SetMreg(mreg);
+  fluka->SetMreg(mreg, mlttc);
   
   Float_t edep = rull;
   
-  if (icode == 11) {
+  if (icode == kKASKADinelarecoil) {
     if (debug) cout << " For icode=" << icode << " Stepping is NOT called" << endl;
     return;
   }
+
   if (TRACKR.jtrack == -1) {
 // Handle quantum efficiency the G3 way
       if (debug) printf("endraw: Cerenkov photon depositing energy: %d %e\n", mreg, rull);
       TGeoMaterial* material = (gGeoManager->GetCurrentVolume())->GetMaterial();
-      // Int_t nmat = material->GetIndex();
       TFlukaCerenkov*  cerenkov = dynamic_cast<TFlukaCerenkov*> (material->GetCerenkovProperties());
       if (cerenkov) {
          Double_t eff = (cerenkov->GetQuantumEfficiency(rull));
@@ -45,22 +51,21 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
          }
       }
   }
-  if (debug) printf("endraw: Depositing energy for : %d %e icode: %d \n", TRACKR.ispusr[mkbmx2-1], rull, icode);
 
-  if (icode != 21 && icode != 22) {
-      fluka->SetIcode(icode);
+  if (icode != kEMFSCOstopping1 && icode != kEMFSCOstopping2) {
+      fluka->SetIcode((FlukaProcessCode_t)icode);
       fluka->SetRull(edep);
       (TVirtualMCApplication::Instance())->Stepping();
   } else {
   //
-  // for icode 21,22 the particle has fallen below thresshold 
+  // For icode 21,22 the particle has fallen below thresshold.
   // This has to be signalled to the StepManager() 
   //
       fluka->SetRull(edep);
-      fluka->SetIcode(20);
+      fluka->SetIcode((FlukaProcessCode_t) icode);
       (TVirtualMCApplication::Instance())->Stepping();
       fluka->SetTrackIsNew(kFALSE);
-      fluka->SetIcode(icode);
+      fluka->SetIcode((FlukaProcessCode_t)icode);
       fluka->SetRull(0.);
       (TVirtualMCApplication::Instance())->Stepping();
   }
index f2ef1cb1e44ae0e4ad1f1ca446b8537916ba3106..221596b56640dfc8378e1a80662ba82b227473ff 100644 (file)
@@ -3,13 +3,15 @@
 #include "TVirtualMCStack.h"
 
 #include "TFluka.h"
-
+#include "TFlukaCodes.h"
 // Fluka include
 #include "Fdimpar.h"  //(DIMPAR) fluka include
 #include "Fdblprc.h"  //(DBLPRC) fluka common
 #include "Ftrackr.h"  //(TRACKR) fluka common
 #include "Fopphst.h"  //(OPPHST) fluka common
 #include "Fflkstk.h"  //(FLKSTK) fluka common
+#include "Fltclcm.h"  //(LTCLCM) fluka common
+#include "Fpaprop.h"  //(PAPROP) fluka common
 
 #ifndef WIN32
 # define mgdraw mgdraw_
@@ -21,6 +23,7 @@ extern "C" {
 void mgdraw(Int_t& icode, Int_t& mreg)
 {
     TFluka* fluka =  (TFluka*) gMC;
+    if (mreg == fluka->GetDummyRegion()) return;
     Int_t verbosityLevel = fluka->GetVerbosityLevel();
 //
 //  Make sure that stack has currrent track Id
@@ -40,23 +43,18 @@ void mgdraw(Int_t& icode, Int_t& mreg)
     cppstack->SetCurrentTrack(trackId);
 //
 //    
-    fluka->SetMreg(mreg);
-    fluka->SetNewreg(mreg);
-    fluka->SetIcode(icode);
-    fluka->SetCaller(4);
+    Int_t mlttc = LTCLCM.mlatm1;
+    fluka->SetMreg(mreg, mlttc);
+    fluka->SetNewreg(mreg, mlttc);
+    fluka->SetIcode((FlukaProcessCode_t) icode);
+    fluka->SetCaller(kMGDRAW);
 
     if (!TRACKR.ispusr[mkbmx2 - 2]) {
        //
        // Single step
-       if (TRACKR.jtrack == -1 && trackId == 109340) {
-           cout << endl << " !!! I am in mgdraw - calling Stepping(): " << icode << endl;
-           cout << endl << " Track Id = " << trackId << " region = " << mreg << endl;
-           printf("Stepsize %13.5e \n", fluka->TrackStep());
+       if (verbosityLevel >= 3) {
+           cout << endl << "mgdraw: energy deposition for:" << trackId << endl;
        }
-
-
-
-      
        (TVirtualMCApplication::Instance())->Stepping();
        fluka->SetTrackIsNew(kFALSE);
     } else {
@@ -64,11 +62,11 @@ void mgdraw(Int_t& icode, Int_t& mreg)
        // Tracking is being resumed after secondary tracking
        //
        if (verbosityLevel >= 3) {
-           cout << endl << " !!! I am in mgdraw - resuming Stepping(): " << trackId << endl;
+           cout << endl << "mgdraw: resuming Stepping(): " << trackId << endl;
        }
-       
+
        fluka->SetTrackIsNew(kTRUE);
-       fluka->SetCaller(40);
+       fluka->SetCaller(kMGResumedTrack);
        (TVirtualMCApplication::Instance())->Stepping();
 
        // Reset flag and stored values
@@ -82,11 +80,9 @@ void mgdraw(Int_t& icode, Int_t& mreg)
        }
 
        fluka->SetTrackIsNew(kFALSE);
-       fluka->SetCaller(4);
+       fluka->SetCaller(kMGDRAW);
        (TVirtualMCApplication::Instance())->Stepping();
     }
-    
-    
 } // end of mgdraw
 } // end of extern "C"
 
index 94287cf6cf2e2b883563c71b05e9c11422f257a6..f4d0ae4b55b1cd5c2776898500afe3bfdd0eae0b 100644 (file)
@@ -2,6 +2,7 @@
 #include "TVirtualMCApplication.h"
 
 #include "TFluka.h"
+#include "TFlukaCodes.h"
 
 #ifndef WIN32
 # define sodraw sodraw_
@@ -11,8 +12,8 @@
 extern "C" {
 void sodraw()
 {
-  ((TFluka*) gMC)->SetCaller(5);
-  ((TFluka*) gMC)->SetIcode(0);
+  ((TFluka*) gMC)->SetCaller(kSODRAW);
+  ((TFluka*) gMC)->SetIcode((FlukaProcessCode_t)0);
 } // end of sodraw
 } // end of extern "C"
 
index 82972695880a41268c0d3c3915af6c73d14456e9..937c2368ba718d1b5203bec9ac90b9a73de5d455 100644 (file)
@@ -18,6 +18,7 @@
 
 //Virtual MC
 #include "TFluka.h"
+#include "TFlukaCodes.h"
 #include "TVirtualMCStack.h"
 #include "TVirtualMCApplication.h"
 #include "TParticle.h"
@@ -31,13 +32,15 @@ void stupre()
 //*  SeT User PRoperties for Emf particles                               *
 //*                                                                      *
 //*----------------------------------------------------------------------*
-  static Double_t emassmev = PAPROP.am[9] * 1000.;
+// Get the pointer to the VMC
+  TFluka* fluka =  (TFluka*) gMC;
+  static Double_t emassmev = PAPROP.am[kFLUKAelectron + 6] * 1000.;
     
   Int_t lbhabh = 0;
   if (EVTFLG.ldltry == 1) {
     if (EMFSTK.ichemf[EMFSTK.npemf-1] * EMFSTK.ichemf[EMFSTK.npemf-2] < 0) lbhabh = 1;
   }
-  
+
 // mkbmx1         = dimension for kwb real spare array in fluka stack in DIMPAR
 // mkbmx2         = dimension for kwb int. spare array in fluka stack in DIMPAR
 // EMFSTK.espark  = spare real variables available for 
@@ -49,18 +52,17 @@ void stupre()
 
   Int_t npnw, ispr;
   for (npnw = EMFSTK.npstrt-1; npnw <= EMFSTK.npemf-1; npnw++) {
-
-    for (ispr = 0; ispr <= mkbmx1-1; ispr++) 
-      EMFSTK.espark[npnw][ispr] = TRACKR.spausr[ispr];
+      
+      for (ispr = 0; ispr <= mkbmx1-1; ispr++) 
+         EMFSTK.espark[npnw][ispr] = TRACKR.spausr[ispr];
+      
+      for (ispr = 0; ispr <= mkbmx2-1; ispr++) 
+         EMFSTK.iespak[npnw][ispr] = TRACKR.ispusr[ispr];
     
-    for (ispr = 0; ispr <= mkbmx2-1; ispr++) 
-      EMFSTK.iespak[npnw][ispr] = TRACKR.ispusr[ispr];
-    
-    EMFSTK.louemf[npnw] = TRACKR.llouse;
+      EMFSTK.louemf[npnw] = TRACKR.llouse;
   }
 
-// Get the pointer to the VMC
-  TFluka* fluka =  (TFluka*) gMC;
+
   Int_t verbosityLevel = fluka->GetVerbosityLevel();
   Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
   fluka->SetTrackIsNew(kTRUE);
@@ -76,8 +78,8 @@ void stupre()
   for (kp = EMFSTK.npstrt - 1; kp <= EMFSTK.npemf - 1; kp++) {
     
 // Ckeck transport cut first
-    Int_t ireg = EMFSTK.iremf[kp];
-    Double_t cut = (TMath::Abs(EMFSTK.ichemf[kp]) == 1) ? EMFRGN.elethr[ireg-1] :  EMFRGN.phothr[ireg-1];
+    Int_t    ireg   = EMFSTK.iremf[kp];
+    Double_t cut    = (TMath::Abs(EMFSTK.ichemf[kp]) == 1) ? EMFRGN.elethr[ireg-1] :  EMFRGN.phothr[ireg-1];
     Double_t e      = EMFSTK.etemf[kp];
 
     if ((e < cut) 
@@ -93,18 +95,18 @@ void stupre()
        continue;
     }
 
-//* save the parent track number and reset it at each loop
+// Save the parent track number and reset it at each loop
     Int_t done = 0;
     Int_t parent =  TRACKR.ispusr[mkbmx2-1];
     Int_t flukaid = 0;
     
 // Identify particle type
-    if      (EMFSTK.ichemf[kp] == -1)  flukaid = 3;
-    else if (EMFSTK.ichemf[kp] ==  0)  flukaid = 7;
-    else if (EMFSTK.ichemf[kp] ==  1)  flukaid = 4;
+    if      (EMFSTK.ichemf[kp] == -1)  flukaid = kFLUKAelectron;
+    else if (EMFSTK.ichemf[kp] ==  0)  flukaid = kFLUKAphoton;
+    else if (EMFSTK.ichemf[kp] ==  1)  flukaid = kFLUKApositron;
     
 
-    e      *= emvgev;
+    e *= emvgev;
     Int_t    pdg    = fluka->PDGFromId(flukaid);
     Double_t p      = sqrt(e * e - PAPROP.am[flukaid+6] * PAPROP.am[flukaid+6]);
     Double_t px     = p * EMFSTK.uemf[kp];
index 1f4afd97f6ae13543fdb4e329e9b3e973c7c72f5..ea9422db75e527818d2e712d0ef7a1e631c9d389 100644 (file)
@@ -1,9 +1,11 @@
 #include <Riostream.h>
 #include "TVirtualMCApplication.h"
 #include "TFluka.h"
+#include "TFlukaCodes.h"
 #include <TLorentzVector.h>
 #include "Fdimpar.h"  //(DIMPAR) fluka include
 #include "Ftrackr.h"  //(TRACKR) fluka common
+#include "Fltclcm.h"  //(LTCLCM) fluka common
 #include "Femfstk.h"  //(EMFSTK) fluka common
 #ifndef WIN32
 # define usdraw usdraw_
@@ -15,12 +17,14 @@ void usdraw(Int_t& icode, Int_t& mreg,
             Double_t& xsco, Double_t& ysco, Double_t& zsco)
 {
   TFluka *fluka = (TFluka*)gMC;
+  // nothing to do if particle inside dummy region
+  if (mreg == fluka->GetDummyRegion()) return;
   Int_t verbosityLevel = fluka->GetVerbosityLevel();
   Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
-  fluka->SetCaller(6);
-  fluka->SetIcode(icode);
+  fluka->SetCaller(kUSDRAW);
+  fluka->SetIcode((FlukaProcessCode_t) icode);
 
-  if (icode/100 == 2) {
+  if (icode/100 == kEMFSCO) {
       for (Int_t npnw = EMFSTK.npstrt-1; npnw <= EMFSTK.npemf-1; npnw++) {
          if (EMFSTK.iespak[npnw][mkbmx2-1] ==  TRACKR.ispusr[mkbmx2 - 1] ) {
              EMFSTK.iespak[npnw][mkbmx2 - 2] = 1;
@@ -42,7 +46,8 @@ void usdraw(Int_t& icode, Int_t& mreg,
   
 
 
-  fluka->SetMreg(mreg);
+  Int_t mlttc = LTCLCM.mlatm1;
+  fluka->SetMreg(mreg, mlttc);
   fluka->SetXsco(xsco);
   fluka->SetYsco(ysco);
   fluka->SetZsco(zsco);