2 #include "TVirtualMCApplication.h"
3 #include "TGeoMaterial.h"
4 #include "TGeoManager.h"
5 #include "TFlukaCerenkov.h"
9 #include "Fdimpar.h" //(DIMPAR) fluka include
10 #include "Ftrackr.h" //(TRACKR) fluka common
12 # define endraw endraw_
14 # define endraw ENDRAW
17 void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t& ysco, Double_t& zsco)
19 TFluka* fluka = (TFluka*) gMC;
20 Int_t verbosityLevel = fluka->GetVerbosityLevel();
21 Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
32 if (debug) cout << " For icode=" << icode << " Stepping is NOT called" << endl;
35 if (TRACKR.jtrack == -1) {
36 // Handle quantum efficiency the G3 way
37 if (debug) printf("endraw: Cerenkov photon depositing energy: %d %e\n", mreg, rull);
38 TGeoMaterial* material = (gGeoManager->GetCurrentVolume())->GetMaterial();
39 // Int_t nmat = material->GetIndex();
40 TFlukaCerenkov* cerenkov = dynamic_cast<TFlukaCerenkov*> (material->GetCerenkovProperties());
42 Double_t eff = (cerenkov->GetQuantumEfficiency(rull));
43 if (gRandom->Rndm() > eff) {
48 if (debug) printf("endraw: Depositing energy for : %d %e icode: %d \n", TRACKR.ispusr[mkbmx2-1], rull, icode);
50 if (icode != 21 && icode != 22) {
52 (TVirtualMCApplication::Instance())->Stepping();
55 // for icode 21,22 the particle has fallen below thresshold
56 // This has to be signalled to the StepManager()
59 (TVirtualMCApplication::Instance())->Stepping();
60 fluka->SetTrackIsNew(kFALSE);
61 fluka->SetIcode(icode);
63 (TVirtualMCApplication::Instance())->Stepping();
66 } // end of extern "C"