X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TFluka%2Fsource.cxx;h=d81b8b570d1c4b1edf5492d35684a9764e2e543e;hb=159a9e4eb5e68a379ede452b5df9c27dee6694ab;hp=7720669332a4c84966d8a3a3119e91108ea686ed;hpb=ce60a1360da75d567bf1e946e5d24c7a5eb668e2;p=u%2Fmrichter%2FAliRoot.git diff --git a/TFluka/source.cxx b/TFluka/source.cxx index 7720669332a..d81b8b570d1 100644 --- a/TFluka/source.cxx +++ b/TFluka/source.cxx @@ -1,5 +1,3 @@ -#define METHODDEBUG - // Fortran #include "TCallf77.h" @@ -15,9 +13,20 @@ //#include "Fcaslim.h" //(CASLIM) fluka common //Virutal MC +#ifndef WITH_ROOT #include "TFluka.h" +#else +#include "TFlukaGeo.h" +#endif + #include "TVirtualMCStack.h" -#include "TVirtualMCApplication.h" +//#include "TVirtualMCApplication.h" +#ifndef WITH_ROOT +#include "TFluka.h" +#else +#include "TFlukaGeo.h" +#endif + #include "TParticle.h" #include "TVector3.h" @@ -65,23 +74,24 @@ extern "C" { *----------------------------------------------------------------------*/ void source(Int_t& nomore) { -#ifdef METHODDEBUG + // Get the pointer to TFluka + TFluka* fluka = (TFluka*)gMC; + Int_t verbosityLevel = fluka->GetVerbosityLevel(); + Bool_t debug = (verbosityLevel>=3)?kTRUE:kFALSE; + if (debug) { cout << "==> source(" << nomore << ")" << endl; -#endif - cout << "\t* EPISOR.lsouit = " << (EPISOR.lsouit?'T':'F') << endl; + } - static Bool_t lfirst = true; - static Bool_t particleIsPrimary = true; - static Bool_t lastParticleWasPrimary = true; + static Bool_t lfirst = true; + static Bool_t particleIsPrimary = true; + static Bool_t lastParticleWasPrimary = true; /* +-------------------------------------------------------------------* * First call initializations for FLUKA: */ nomore = 0; - // Get the pointer to the VMC - TVirtualMC* fluka = TFluka::GetMC(); // Get the stack TVirtualMCStack* cppstack = fluka->GetStack(); TParticle* particle; @@ -89,6 +99,7 @@ extern "C" { Int_t nprim = cppstack->GetNprimary(); // Get the next particle from the stack particle = cppstack->PopNextTrack(itrack); + fluka->SetTrackIsNew(kTRUE); // Is this a secondary not handled by Fluka, i.e. a particle added by user action ? lastParticleWasPrimary = particleIsPrimary; @@ -112,6 +123,7 @@ extern "C" { if (particleIsPrimary) { TVirtualMCApplication::Instance()->PostTrack(); TVirtualMCApplication::Instance()->FinishPrimary(); + if ((itrack%10)==0) printf("=== TRACKING PRIMARY %d ===\n", itrack); } } @@ -121,11 +133,11 @@ extern "C" { if (itrack<0) { nomore = 1; EPISOR.lsouit = false; - cout << "\t* EPISOR.lsouit = " << (EPISOR.lsouit?'T':'F') << endl; - cout << "\t* No more particles. Exiting..." << endl; -#ifdef METHODDEBUG - cout << "<== source(" << nomore << ")" << endl; -#endif + if (debug) { + cout << "\t* EPISOR.lsouit = " << (EPISOR.lsouit?'T':'F') << endl; + cout << "\t* No more particles. Exiting..." << endl; + cout << "<== source(" << nomore << ")" << endl; + } return; } @@ -136,15 +148,17 @@ extern "C" { TVector3 polarisation; particle->GetPolarisation(polarisation); - cout << "\t* Particle " << itrack << " retrieved..." << endl; - cout << "\t\t+ Name = " << particle->GetName() << endl; - cout << "\t\t+ PDG/Fluka code = " << pdg - << " / " << fluka->IdFromPDG(pdg) << endl; - cout << "\t\t+ P = (" - << particle->Px() << " , " - << particle->Py() << " , " - << particle->Pz() << " ) --> " - << particle->P() << " GeV" << endl; + if (debug) { + cout << "\t* Particle " << itrack << " retrieved..." << endl; + cout << "\t\t+ Name = " << particle->GetName() << endl; + cout << "\t\t+ PDG/Fluka code = " << pdg + << " / " << fluka->IdFromPDG(pdg) << endl; + cout << "\t\t+ P = (" + << particle->Px() << " , " + << particle->Py() << " , " + << particle->Pz() << " ) --> " + << particle->P() << " GeV" << endl; + } /* Lstack is the stack counter: of course any time source is called it * must be =0 */ @@ -283,9 +297,6 @@ extern "C" { } // - -#ifdef METHODDEBUG - cout << "<== source(" << nomore << ")" << endl; -#endif + if (debug) cout << "<== source(" << nomore << ")" << endl; } }