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