]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TFluka/endraw.cxx
Quantum efficiency implemented by setting energy deposition to zero to flag inefficiency.
[u/mrichter/AliRoot.git] / TFluka / endraw.cxx
index 0841634b5016ef4597b5ea367fdea375d339a4e5..ab33cb1d827c7990cb2760eb2a100aab198fe078 100644 (file)
@@ -1,5 +1,8 @@
 #include <Riostream.h>
 #include "TVirtualMCApplication.h"
+#include "TGeoMaterial.h"
+#include "TGeoManager.h"
+#include "TFlukaCerenkov.h"
 
 #ifndef WITH_ROOT
 #include "TFluka.h"
@@ -29,6 +32,20 @@ void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t&
     cout << " For icode=" << icode << " Stepping is NOT called" << endl;
     return;
   }
+  if (TRACKR.jtrack == -1) {
+// Handle quantum efficiency the G3 way
+      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));
+         if (gRandom->Rndm() > eff) {
+             rull = 0.;
+             fluka->SetRull(rull);
+         }
+      }
+  }
   (TVirtualMCApplication::Instance())->Stepping();
   fluka->SetTrackIsNew(kFALSE);
 } // end of endraw