X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=TFluka%2Fsource.cxx;h=ccb3dc73f6e6f165531c3ee9c7701143ee57cf5a;hp=7b29e4b0cf22a329a218ed3ea5fb881c427849f7;hb=22229ba5378a46043500b86038d768de7799cac8;hpb=45dc600a196e6af031350de55d6a99933b34940f diff --git a/TFluka/source.cxx b/TFluka/source.cxx index 7b29e4b0cf2..ccb3dc73f6e 100644 --- a/TFluka/source.cxx +++ b/TFluka/source.cxx @@ -88,7 +88,12 @@ extern "C" { 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 @@ -101,12 +106,8 @@ extern "C" { // Get the stack produced from the generator TVirtualMCStack* cppstack = fluka->GetStack(); //Get next particle - if (STACK.lstack != 1) { - TVirtualMCApplication::Instance()->PostTrack(); - TVirtualMCApplication::Instance()->FinishPrimary(); - } 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 @@ -128,30 +129,18 @@ extern "C" { 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]; @@ -174,7 +163,7 @@ extern "C" { 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; @@ -206,7 +195,8 @@ extern "C" { //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; @@ -239,9 +229,6 @@ extern "C" { 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 ) @@ -272,9 +259,7 @@ extern "C" { 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;