//Virutal MC
#include "TFluka.h"
#include "TVirtualMCStack.h"
+#include "TVirtualMCApplication.h"
#include "TParticle.h"
#include "TVector3.h"
# define soevsv SOEVSV
#endif
-
extern "C" {
//
// Prototypes for FLUKA functions
lfirst = false;
EPISOR.lussrc = true;
/*| *** User initialization ***/
+ } else {
+ TVirtualMCApplication::Instance()->PostTrack();
+ TVirtualMCApplication::Instance()->FinishPrimary();
}
+
+
/* |
* +-------------------------------------------------------------------*
* Push one source particle to the stack. Note that you could as well
TVirtualMCStack* cppstack = fluka->GetStack();
//Get next particle
Int_t itrack = -1;
- TParticle* particle = cppstack->GetNextTrack(itrack);
+ TParticle* particle = cppstack->PopNextTrack(itrack);
//Exit if itrack is negative (-1). Set lsouit to false to mark last track for
//this event
cout << "\t\t+ Name = " << particle->GetName() << endl;
cout << "\t\t+ PDG/Fluka code = " << particle->GetPdgCode()
<< " / " << fluka->IdFromPDG(particle->GetPdgCode()) << endl;
- cout << "\t\t+ E = " << particle->Energy() << " GeV" << endl;
cout << "\t\t+ P = ("
<< particle->Px() << " , "
<< particle->Py() << " , "
<< particle->Pz() << " ) --> "
<< particle->P() << " GeV" << endl;
- cout << "\t\t+ M = " << particle->GetMass() << " GeV" << endl;
- cout << "\t\t+ Initial point = ( "
- << particle->Vx() << " , "
- << particle->Vy() << " , "
- << particle->Vz() << " )"
- << endl;
- cout << "\t\t+ Polarisation = ( "
- << polarisation.Px() << " , "
- << polarisation.Py() << " , "
- << polarisation.Pz() << " )"
- << endl;
/* Lstack is the stack counter: of course any time source is called it
* must be =0
*/
+
STACK.lstack++;
- cout << "\t* Storing particle parameters in the stack, lstack = "
- << STACK.lstack << endl;
+ //cout << "\t* Storing particle parameters in the stack, lstack = "
+ // << STACK.lstack << endl;
/* Wt is the weight of the particle*/
STACK.wt[STACK.lstack] = oneone;
STARS.weipri += STACK.wt[STACK.lstack];
/* User dependent flag:*/
STACK.louse[STACK.lstack] = 0;
/* User dependent spare variables:*/
- for (Int_t ispr = 0; ispr < mkbmx1; ispr++)
+ Int_t ispr = 0;
+ for (ispr = 0; ispr < mkbmx1; ispr++)
STACK.sparek[STACK.lstack][ispr] = zerzer;
/* User dependent spare flags:*/
- for (Int_t ispr = 0; ispr < mkbmx2; ispr++)
+ for (ispr = 0; ispr < mkbmx2; ispr++)
STACK.ispark[STACK.lstack][ispr] = 0;
/* Save the track number of the stack particle:*/
- STACK.ispark[STACK.lstack][mkbmx2-1] = STACK.lstack;
+ STACK.ispark[STACK.lstack][mkbmx2-1] = itrack;
STACK.nparma++;
STACK.numpar[STACK.lstack] = STACK.nparma;
STACK.nevent[STACK.lstack] = 0;
//STACK.tz [STACK.lstack] = BEAM.tinz;
Double_t cosx = particle->Px()/particle->P();
Double_t cosy = particle->Py()/particle->P();
- Double_t cosz = sqrt(oneone - cosx*cosx - cosy*cosy);
+ Double_t cosz = TMath::Sqrt(oneone - cosx*cosx - cosy*cosy);
+ if (particle->Pz() < 0.) cosz = -cosz;
STACK.tx [STACK.lstack] = cosx;
STACK.ty [STACK.lstack] = cosy;
STACK.tz [STACK.lstack] = cosz;
STACK.ya [STACK.lstack] = particle->Vy();
STACK.za [STACK.lstack] = particle->Vz();
- // Some printout
- cout << "\t* Particle information transfered to stack..." << endl;
-
/* Calculate the total kinetic energy of the primaries: don't change*/
Int_t st_ilo = STACK.ilo[STACK.lstack];
if ( st_ilo != 0 )
geohsm ( STACK.nhspnt[STACK.lstack], igeohsm1, igeohsm2, LTCLCM.mlattc );
STACK.nlattc[STACK.lstack] = LTCLCM.mlattc;
soevsv();
-
- cout << "\t* EPISOR.lsouit = " << (EPISOR.lsouit?'T':'F') << endl;
- cout << "\t* " << STACK.lstack << " particles in the event" << endl;
-
+ TVirtualMCApplication::Instance()->BeginPrimary();
+ TVirtualMCApplication::Instance()->PreTrack();
#ifdef METHODDEBUG
cout << "<== source(" << nomore << ")" << endl;
#endif