]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/endraw.cxx
Code clean-up. (Andrei Gheata).
[u/mrichter/AliRoot.git] / TFluka / endraw.cxx
1 #include <Riostream.h>
2 #include "TVirtualMCApplication.h"
3 #include "TGeoMaterial.h"
4 #include "TGeoManager.h"
5 #include "TFlukaCerenkov.h"
6
7 #ifndef WITH_ROOT
8 #include "TFluka.h"
9 #else
10 #include "TFlukaGeo.h"
11 #endif
12
13 #include "Fdimpar.h"  //(DIMPAR) fluka include
14 #include "Ftrackr.h"  //(TRACKR) fluka common
15 #ifndef WIN32
16 # define endraw endraw_
17 #else
18 # define endraw ENDRAW
19 #endif
20 extern "C" {
21 void endraw(Int_t& icode, Int_t& mreg, Double_t& rull, Double_t& xsco, Double_t& ysco, Double_t& zsco)
22 {
23   TFluka* fluka = (TFluka*) gMC;
24   Int_t verbosityLevel = fluka->GetVerbosityLevel();
25   Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE;
26   fluka->SetCaller(3);
27   fluka->SetIcode(icode);
28   fluka->SetRull(rull);
29   fluka->SetXsco(xsco);
30   fluka->SetYsco(ysco);
31   fluka->SetZsco(zsco);
32   fluka->SetMreg(mreg);
33   if (icode == 11) {
34     if (debug) cout << " For icode=" << icode << " Stepping is NOT called" << endl;
35     return;
36   }
37   if (TRACKR.jtrack == -1) {
38 // Handle quantum efficiency the G3 way
39       if (debug) printf("endraw: Cerenkov photon depositing energy: %d %e\n", mreg, rull);
40       TGeoMaterial* material = (gGeoManager->GetCurrentVolume())->GetMaterial();
41       // Int_t nmat = material->GetIndex();
42       TFlukaCerenkov*  cerenkov = dynamic_cast<TFlukaCerenkov*> (material->GetCerenkovProperties());
43       if (cerenkov) {
44           Double_t eff = (cerenkov->GetQuantumEfficiency(rull));
45           if (gRandom->Rndm() > eff) {
46               rull = 0.;
47               fluka->SetRull(rull);
48           }
49       }
50   }
51   (TVirtualMCApplication::Instance())->Stepping();
52   fluka->SetTrackIsNew(kFALSE);
53 } // end of endraw
54 } // end of extern "C"
55