2 #include "TVirtualMCApplication.h"
3 #include "TGeoMaterial.h"
4 #include "TGeoManager.h"
5 #include "TFlukaCerenkov.h"
8 #include "TFlukaCodes.h"
10 #include "Fdimpar.h" //(DIMPAR) fluka include
11 #include "Ftrackr.h" //(TRACKR) fluka common
12 #include "Fltclcm.h" //(LTCLCM) fluka common
13 #include "Fpaprop.h" //(PAPROP) fluka common
15 # define endraw endraw_
17 # define endraw ENDRAW
20 void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t& ysco, Double_t& zsco)
22 TFluka* fluka = (TFluka*) gMC;
23 // nothing to do if particle in dummy region
24 if (mreg == fluka->GetDummyRegion()) return;
25 Int_t verbosityLevel = fluka->GetVerbosityLevel();
26 Bool_t debug = (verbosityLevel >= 3)? kTRUE : kFALSE;
27 Int_t mlttc = LTCLCM.mlatm1;
28 fluka->SetCaller(kENDRAW);
33 fluka->SetMreg(mreg, mlttc);
37 if (icode == kKASKADinelarecoil) {
38 if (debug) cout << " For icode=" << icode << " Stepping is NOT called" << endl;
42 if (TRACKR.jtrack == -1) {
43 // Handle quantum efficiency the G3 way
44 if (debug) printf("endraw: Cerenkov photon depositing energy: %d %e\n", mreg, rull);
45 TGeoMaterial* material = (gGeoManager->GetCurrentVolume())->GetMaterial();
46 TFlukaCerenkov* cerenkov = dynamic_cast<TFlukaCerenkov*> (material->GetCerenkovProperties());
48 Double_t eff = (cerenkov->GetQuantumEfficiency(rull));
49 if (gRandom->Rndm() > eff) {
55 if (icode != kEMFSCOstopping1 && icode != kEMFSCOstopping2) {
56 fluka->SetIcode((FlukaProcessCode_t)icode);
58 (TVirtualMCApplication::Instance())->Stepping();
61 // For icode 21,22 the particle has fallen below thresshold.
62 // This has to be signalled to the StepManager()
65 fluka->SetIcode((FlukaProcessCode_t) icode);
66 (TVirtualMCApplication::Instance())->Stepping();
67 fluka->SetTrackIsNew(kFALSE);
68 fluka->SetIcode((FlukaProcessCode_t)icode);
70 (TVirtualMCApplication::Instance())->Stepping();
73 } // end of extern "C"