#include <GflashHadronWrapperProcess.h>
Public Member Functions | |
G4String | GetName () |
GflashHadronWrapperProcess (G4String processName) | |
G4VParticleChange * | PostStepDoIt (const G4Track &track, const G4Step &step) |
void | Print (const G4Step &astep) |
virtual | ~GflashHadronWrapperProcess () |
Private Attributes | |
G4VProcess * | fProcess |
G4ProcessVector * | fProcessVector |
G4VParticleChange * | particleChange |
G4ProcessManager * | pmanager |
G4String | theProcessName |
Definition at line 14 of file GflashHadronWrapperProcess.h.
GflashHadronWrapperProcess::GflashHadronWrapperProcess | ( | G4String | processName | ) |
Definition at line 13 of file GflashHadronWrapperProcess.cc.
References theProcessName.
: particleChange(0), pmanager(0), fProcessVector(0), fProcess(0) { theProcessName = processName; }
GflashHadronWrapperProcess::~GflashHadronWrapperProcess | ( | ) | [virtual] |
Definition at line 22 of file GflashHadronWrapperProcess.cc.
{ }
G4String GflashHadronWrapperProcess::GetName | ( | ) | [inline] |
Definition at line 26 of file GflashHadronWrapperProcess.h.
References theProcessName.
{ return theProcessName; };
G4VParticleChange * GflashHadronWrapperProcess::PostStepDoIt | ( | const G4Track & | track, |
const G4Step & | step | ||
) |
Definition at line 25 of file GflashHadronWrapperProcess.cc.
References fProcess, fProcessVector, particleChange, pmanager, and launcher::step.
{ // process PostStepDoIt for the original process particleChange = pRegProcess->PostStepDoIt(track, step); // specific actions of the wrapper process // update step/track information after PostStep of the original process is done // these steps will be repeated again without additional conflicts even if the // parameterized physics process doesn't take over the original process particleChange->UpdateStepForPostStep(const_cast<G4Step *> (&step)); // we may not want to update G4Track during this wrapper process if // G4Track accessors are not used in the G4VFastSimulationModel model // (const_cast<G4Step *> (&step))->UpdateTrack(); // update safety after each invocation of PostStepDoIts // G4double safety = std::max(endpointSafety - (endpointSafOrigin - fPostStepPoint->GetPosition()).mag(),0.); // step.GetPostStepPoint()->SetSafety(safety); // the secondaries from the original process are also created at the wrapper // process, but they must be deleted whether the parameterized physics is // an 'ExclusivelyForced' process or not. Normally the secondaries will be // created after this wrapper process in G4SteppingManager::InvokePSDIP // store the secondaries from ParticleChange to SecondaryList G4TrackVector* fSecondary = (const_cast<G4Step *> (&step))->GetfSecondary(); G4int nSecondarySave = fSecondary->size(); G4int num2ndaries = particleChange->GetNumberOfSecondaries(); G4Track* tempSecondaryTrack; for(G4int DSecLoop=0 ; DSecLoop< num2ndaries; DSecLoop++){ tempSecondaryTrack = particleChange->GetSecondary(DSecLoop); // Set the process pointer which created this track tempSecondaryTrack->SetCreatorProcess( pRegProcess ); //add secondaries from this wrapper process to the existing list fSecondary->push_back( tempSecondaryTrack ); } //end of loop on secondary // Now we can still impose conditions on the secondaries from ModelTrigger, // such as the number of secondaries produced by the original process as well as // those by other continuous processes - for the hadronic inelastic interaction, // it is always true that particleChange->GetNumberOfSecondaries() > 0 // at this stage, updated step information after all processes involved // should be available // Print(step); // call ModelTrigger for the second time - the primary loop of PostStepGPIL // is inside G4SteppingManager::DefinePhysicalStepLength(). pmanager = track.GetDefinition()->GetProcessManager(); G4double testGPIL = DBL_MAX; G4double fStepLength = 0.0; G4ForceCondition fForceCondition = InActivated; fStepLength = step.GetStepLength(); fProcessVector = pmanager->GetPostStepProcessVector(typeDoIt); // keep the current status of track, use fPostponeToNextEvent word for // this particular PostStep GPIL and then restore G4TrackStatus if the // paramterized physics doesn't meet trigger conditions in ModelTrigger const G4TrackStatus keepStatus = track.GetTrackStatus(); (const_cast<G4Track *> (&track))->SetTrackStatus(fPostponeToNextEvent); for(G4int ipm = 0 ; ipm < fProcessVector->entries() ; ipm++) { fProcess = (*fProcessVector)(ipm); if ( fProcess->GetProcessType() == fParameterisation ) { // test ModelTrigger via PostStepGPIL testGPIL = fProcess->PostStepGPIL(track,fStepLength,&fForceCondition ); // if G4FastSimulationModel:: ModelTrigger is true, then the parameterized // physics process takes over the current process if( fForceCondition == ExclusivelyForced) { // clean up memory for changing the process - counter clean up for // the secondaries created by new G4Track in G4HadronicProcess::FillTotalResult G4int nsec = particleChange->GetNumberOfSecondaries(); for(G4int DSecLoop=0 ; DSecLoop< nsec ; DSecLoop++){ G4Track* tempSecondaryTrack = particleChange->GetSecondary(DSecLoop); delete tempSecondaryTrack; } particleChange->Clear(); // updating G4Step between PostStepGPIL and PostStepDoIt for the parameterized // process may not be necessary, but do it anyway (const_cast<G4Step *> (&step))->SetStepLength(testGPIL); (const_cast<G4Track *> (&track))->SetStepLength(testGPIL); step.GetPostStepPoint()->SetStepStatus(fExclusivelyForcedProc);; step.GetPostStepPoint()->SetProcessDefinedStep(fProcess); step.GetPostStepPoint()->SetSafety(0.0); // invoke PostStepDoIt: equivalent steps for G4SteppingManager::InvokePSDIP particleChange = fProcess->PostStepDoIt(track,step); // update PostStepPoint of Step according to ParticleChange particleChange->UpdateStepForPostStep(const_cast<G4Step *> (&step)); // update G4Track according to ParticleChange after each PostStepDoIt (const_cast<G4Step *> (&step))->UpdateTrack(); // update safety after each invocation of PostStepDoIts - acutally this // is not necessary for the parameterized physics process, but do it anyway step.GetPostStepPoint()->SetSafety(0.0); // additional nullification (const_cast<G4Track *> (&track))->SetTrackStatus( particleChange->GetTrackStatus() ); } else { //restore TrackStatus if fForceCondition != ExclusivelyForced (const_cast<G4Track *> (&track))->SetTrackStatus(keepStatus); } // assume that there is one and only one parameterized physics break; } } // remove secondaries of this wrapper process that were added to the secondary list // since they will be added in the normal stepping procedure after this->PostStepDoIt // in G4SteppingManager::InvokePSDIP //move the iterator to the (nSecondarySave+1)th element in the secondary list G4TrackVector::iterator itv = fSecondary->begin(); itv += nSecondarySave; //delete next num2ndaries tracks from the secondary list fSecondary->erase(itv,itv+num2ndaries); //end of specific actions of this wrapper process return particleChange; }
void GflashHadronWrapperProcess::Print | ( | const G4Step & | astep | ) |
Definition at line 175 of file GflashHadronWrapperProcess.cc.
References gather_cfg::cout, and particleChange.
{ std::cout << " GflashHadronWrapperProcess ProcessName, PreStepPosition, preStepPoint KE, PostStepPoint KE, DeltaEnergy Nsec \n " << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() << " " << step.GetPostStepPoint()->GetPosition() << " " << step.GetPreStepPoint()->GetKineticEnergy()/GeV << " " << step.GetPostStepPoint()->GetKineticEnergy()/GeV << " " << step.GetDeltaEnergy()/GeV << " " << particleChange->GetNumberOfSecondaries() << std::endl; }
G4VProcess* GflashHadronWrapperProcess::fProcess [private] |
Definition at line 36 of file GflashHadronWrapperProcess.h.
Referenced by PostStepDoIt().
G4ProcessVector* GflashHadronWrapperProcess::fProcessVector [private] |
Definition at line 35 of file GflashHadronWrapperProcess.h.
Referenced by PostStepDoIt().
G4VParticleChange* GflashHadronWrapperProcess::particleChange [private] |
Definition at line 33 of file GflashHadronWrapperProcess.h.
Referenced by PostStepDoIt(), and Print().
G4ProcessManager* GflashHadronWrapperProcess::pmanager [private] |
Definition at line 34 of file GflashHadronWrapperProcess.h.
Referenced by PostStepDoIt().
G4String GflashHadronWrapperProcess::theProcessName [private] |
Definition at line 31 of file GflashHadronWrapperProcess.h.
Referenced by GetName(), and GflashHadronWrapperProcess().