]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/TFluka.cxx
Bug in lun assignment for user scoring corrected.
[u/mrichter/AliRoot.git] / TFluka / TFluka.cxx
index 8dbcf46e023a44251c3072d8ae266c059b22865a..d55b2165cea127b0e77505291213f5450d5141f1 100644 (file)
@@ -64,6 +64,7 @@
 #ifndef WIN32 
 # define flukam  flukam_
 # define fluka_openinp fluka_openinp_
+# define fluka_openout fluka_openout_
 # define fluka_closeinp fluka_closeinp_
 # define mcihad mcihad_
 # define mpdgha mpdgha_
@@ -71,6 +72,7 @@
 #else 
 # define flukam  FLUKAM
 # define fluka_openinp FLUKA_OPENINP
+# define fluka_openout FLUKA_OPENOUT
 # define fluka_closeinp FLUKA_CLOSEINP
 # define mcihad MCIHAD
 # define mpdgha MPDGHA
@@ -85,6 +87,7 @@ extern "C"
   void type_of_call flukam(const int&);
   void type_of_call newplo();
   void type_of_call fluka_openinp(const int&, DEFCHARA);
+  void type_of_call fluka_openout(const int&, DEFCHARA);
   void type_of_call fluka_closeinp(const int&);
   int  type_of_call mcihad(const int&);
   int  type_of_call mpdgha(const int&);
@@ -153,6 +156,7 @@ TFluka::TFluka(const char *title, Int_t verbosity, Bool_t isRootGeometrySupporte
    fStopEvent = 0;
    fStopRun   = 0;
    fNEvent    = 0;
+   PrintHeader();
 }
 
 //______________________________________________________________________________ 
@@ -267,6 +271,7 @@ void TFluka::BuildPhysics() {
     const char* fname = fInputFileName;
     
     fluka_openinp(lunin, PASSCHARA(fname));
+    fluka_openout(11, PASSCHARA("fluka.out"));
     
     if (fVerbosityLevel >=2)
        cout << "\t* Calling flukam..." << endl;
@@ -739,14 +744,42 @@ void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Float_t* ppckov,
     medium->SetCerenkovProperties(cerenkovProperties);
 }  
 
+void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Float_t* ppckov,
+                        Float_t* absco, Float_t* effic, Float_t* rindex, Float_t* rfl) {
+//
+// Set Cerenkov properties for medium itmed
+//
+// npckov: number of sampling points
+// ppckov: energy values
+// absco:  absorption length
+// effic:  quantum efficiency
+// rindex: refraction index
+// rfl:    reflectivity for boundary to medium itmed
+//
+//  
+//  Create object holding Cerenkov properties
+//  
+    TFlukaCerenkov* cerenkovProperties = new TFlukaCerenkov(npckov, ppckov, absco, effic, rindex, rfl);
+//
+//  Pass object to medium
+    TGeoMedium* medium = gGeoManager->GetMedium(itmed);
+    medium->SetCerenkovProperties(cerenkovProperties);
+}  
+
+
 //______________________________________________________________________________ 
 void TFluka::SetCerenkov(Int_t /*itmed*/, Int_t /*npckov*/, Double_t * /*ppckov*/,
                         Double_t * /*absco*/, Double_t * /*effic*/, Double_t * /*rindex*/) {
 //
-// Not implemented with TGeo - what G4 did ? Any FLUKA card generated?
-   Warning("SetCerenkov", "Not implemented with TGeo");
+//  Double_t version not implemented
 }  
-    
+
+void TFluka::SetCerenkov(Int_t /*itmed*/, Int_t /*npckov*/, Double_t* /*ppckov*/,
+                        Double_t* /*absco*/, Double_t* /*effic*/, Double_t* /*rindex*/, Double_t* /*rfl*/) { 
+//
+// //  Double_t version not implemented
+}
+
 // Euclid
 //______________________________________________________________________________ 
 void TFluka::WriteEuclid(const char* /*fileName*/, const char* /*topVol*/, 
@@ -1021,7 +1054,9 @@ void TFluka::InitPhysics()
 //
 // Check if new output file has to be opened
        for (Int_t isci = 0; isci < isc; isci++) {
-           mopi = dynamic_cast<TFlukaScoringOption*> (fUserScore->At(isc));
+
+           
+           mopi = dynamic_cast<TFlukaScoringOption*> (fUserScore->At(isci));
            if(strncmp(mopi->GetFileName(), fileName, size)==0) {
                // 
                // No, the file already exists
@@ -1316,12 +1351,12 @@ Double_t TFluka::Edep() const
   if (caller == 11 || caller==12 || caller==6 || caller == 40) return 0.0;
   Double_t sum = 0;
   for ( Int_t j=0;j<TRACKR.mtrack;j++) {
-    sum +=TRACKR.dtrack[j];  
+      sum +=TRACKR.dtrack[j];  
   }
   if (TRACKR.ntrack == 0 && TRACKR.mtrack == 0)
-    return fRull + sum;
+      return fRull + sum;
   else {
-    return sum;
+      return sum;
   }
 }
 
@@ -1884,6 +1919,20 @@ void TFluka::Gfpart(Int_t pdg, char* name, Int_t& type, Float_t& mass, Float_t&
     tlife  = ParticleLifeTime(pdg);
 }
 
+void TFluka::PrintHeader()
+{
+    //
+    // Print a header
+    printf("\n");
+    printf("\n");    
+    printf("------------------------------------------------------------------------------\n");
+    printf("- You are using the TFluka Virtual Monte Carlo Interface to FLUKA.           -\n");    
+    printf("- Please see the file fluka.out for FLUKA output and licensing information.  -\n");    
+    printf("------------------------------------------------------------------------------\n");
+    printf("\n");
+    printf("\n");    
+}
+
 
 
 #define pushcerenkovphoton pushcerenkovphoton_
@@ -1921,7 +1970,7 @@ extern "C" {
        fluka->SetZsco(z);
        fluka->SetNCerenkov(nphot);
        fluka->SetCaller(50);
-       printf("userstepping ckv: %10d %10d %13.3f %13.3f %13.2f\n", nphot, mreg, x, y, z);
+       printf("userstepping ckv: %10d %10d %13.3f %13.3f %13.2f %s\n", nphot, mreg, x, y, z, fluka->CurrentVolName());
        (TVirtualMCApplication::Instance())->Stepping();
     }
 }