]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/TFluka.cxx
Pemf generation option is obsolete. Removed.
[u/mrichter/AliRoot.git] / TFluka / TFluka.cxx
index 65213102fca9a242ea98be246dcb94e17c3d7002..80faf52a6d2ae68b56a0f1928c03592eb1943438 100644 (file)
@@ -133,7 +133,6 @@ TFluka::TFluka()
    fTrackIsExiting(kFALSE),
    fTrackIsNew(kFALSE),
    fFieldFlag(kTRUE),
-   fGeneratePemf(kFALSE),
    fDummyBoundary(kFALSE),
    fStopped(kFALSE),
    fStopEvent(kFALSE),
@@ -171,7 +170,6 @@ TFluka::TFluka(const char *title, Int_t verbosity, Bool_t isRootGeometrySupporte
    fTrackIsExiting(kFALSE),
    fTrackIsNew(kFALSE),
    fFieldFlag(kTRUE),
-   fGeneratePemf(kFALSE),
    fDummyBoundary(kFALSE),
    fStopped(kFALSE),
    fStopEvent(kFALSE),
@@ -256,8 +254,6 @@ void TFluka::Init() {
     //
      AddParticlesToPdgDataBase();
      //
-
-     
 }
 
 
@@ -299,13 +295,7 @@ void TFluka::BuildPhysics() {
         }
     }
     
-    //
-    // At this stage we have the information on materials and cuts available.
-    // Now create the pemf file
-    
-    if (fGeneratePemf) fGeom->CreatePemfFile();
-    
-    //
+
     // Prepare input file with the current physics settings
     
     InitPhysics(); 
@@ -990,7 +980,7 @@ Int_t TFluka::PDGFromId(Int_t id) const
   //
   // Return PDG code and pseudo ENDF code from Fluka code
   //                      Alpha     He3       Triton    Deuteron  gen. ion  opt. photon   
-    Int_t idSpecial[6] = {10020040, 10020030, 10010030, 10010020, 10000000, 50000050};
+    Int_t idSpecial[6] = {GetIonPdg(2,4), GetIonPdg(2, 3), GetIonPdg(1,3), GetIonPdg(1,2), GetIonPdg(0,0), 50000050};
   // IPTOKP array goes from official to internal
 
     if (id == kFLUKAoptical) {
@@ -1220,7 +1210,7 @@ void TFluka::InitPhysics()
 // Process Fluka specific scoring options
 //
     TFlukaScoringOption::SetStaticInfo(pFlukaVmcInp, fGeom);
-    Float_t loginp        = 49.0;
+    Float_t loginp        = -49.0;
     Int_t inp             = 0;
     Int_t nscore          = fUserScore->GetEntries();
     
@@ -1274,7 +1264,7 @@ void TFluka::InitPhysics()
 // Initialisation needed for Cerenkov photon production and transport
     TObjArray *matList = GetFlukaMaterials();
     Int_t nmaterial =  matList->GetEntriesFast();
-    fMaterials = new Int_t[nmaterial+3];
+    fMaterials = new Int_t[nmaterial+25];
     
     for (Int_t im = 0; im < nmaterial; im++)
     {
@@ -1623,7 +1613,7 @@ Int_t TFluka::CorrectFlukaId() const
                << " assign parent PDG=" << PDGFromId(TRACKR.ispusr[mkbmx2 - 3]) << endl;
       return TRACKR.ispusr[mkbmx2 - 3]; // assign parent identity
    }
-   if (TRACKR.jtrack <= 64) {
+   if (TRACKR.jtrack <= 64){
        return TRACKR.jtrack;
    } else {
        return TRACKR.j0trck;
@@ -1650,6 +1640,7 @@ Double_t TFluka::TrackCharge() const
 // Return charge of the track currently transported
 // PAPROP.ichrge = electric charge of the particle
 // TRACKR.jtrack = identity number of the particle
+    
   FlukaCallerCode_t caller = GetCaller();
   if (caller != kEEDRAW) 
      return PAPROP.ichrge[CorrectFlukaId()+6];
@@ -2301,8 +2292,6 @@ void TFluka::AddParticlesToPdgDataBase() const
 
     TDatabasePDG *pdgDB = TDatabasePDG::Instance();
 
-    const Int_t kion=10000000;
-
     const Double_t kAu2Gev   = 0.9314943228;
     const Double_t khSlash   = 1.0545726663e-27;
     const Double_t kErg2Gev  = 1/1.6021773349e-3;
@@ -2311,15 +2300,14 @@ void TFluka::AddParticlesToPdgDataBase() const
 //
 // Ions
 //
-
   pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
-                     0,3,"Ion",kion+10020);
+                     0,3,"Ion",GetIonPdg(1,2));
   pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
-                     khShGev/(12.33*kYear2Sec),3,"Ion",kion+10030);
+                     khShGev/(12.33*kYear2Sec),3,"Ion",GetIonPdg(1,3));
   pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
-                     khShGev/(12.33*kYear2Sec),6,"Ion",kion+20040);
+                     khShGev/(12.33*kYear2Sec),6,"Ion",GetIonPdg(2,4));
   pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
-                     0,6,"Ion",kion+20030);
+                     0,6,"Ion",GetIonPdg(2,3));
 }
 
 //
@@ -2339,6 +2327,7 @@ Double_t TFluka::GetPrimaryElectronKineticEnergy(Int_t i) const
     // Returns kinetic energy of primary electron i
 
     Double_t ekin = -1.;
+    
     if (i >= 0 && i < ALLDLT.nalldl) {
         ekin =  ALLDLT.talldl[i];
     } else {
@@ -2366,4 +2355,33 @@ void TFluka::GetPrimaryElectronPosition(Int_t i, Double_t& x, Double_t& y, Doubl
        return;
 }
 
+Int_t TFluka::GetIonPdg(Int_t z, Int_t a, Int_t i) const
+{
+// Acording to
+// http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
 
+  return 1000000000 + 10*1000*z + 10*a + i;
+}  
+     
+void  TFluka::PrimaryIonisationStepping(Int_t nprim)
+{
+// Call Stepping for primary ionisation electrons
+    Int_t i;
+// Protection against nprim > mxalld
+
+// Multiple steps for nprim > 0
+    if (nprim > 0) {
+       for (i = 0; i < nprim; i++) {
+           SetCurrentPrimaryElectronIndex(i);
+           (TVirtualMCApplication::Instance())->Stepping();
+           if (i == 0) SetTrackIsNew(kFALSE);
+       }       
+    } else {
+       // No primary electron ionisation
+       // Call Stepping anyway but flag nprim = 0 as index = -2
+       SetCurrentPrimaryElectronIndex(-2);
+       (TVirtualMCApplication::Instance())->Stepping();
+    }
+    // Reset the index
+    SetCurrentPrimaryElectronIndex(-1);
+}