18 G4VDiscreteProcess(aName, aType)
20 enablePostStepDoIt =
true;
21 const G4RunManager *pRunManager = G4RunManager::GetRunManager();
41 const G4DynamicParticle *pDef = aTrack.GetDynamicParticle();
42 const int pId = pDef->GetDefinition()->GetPDGEncoding();
44 const double totalP = pDef->GetTotalMomentum();
46 if (oldTrInfo->
GetPFFlag() == 1)
return 0;
54 G4ThreeVector aNewPos(stepData.GetPostStepPoint()->GetPosition());
58 aNewPos[2] += 1.*CLHEP::mm;
59 const double phi = std::atan2(aNewPos[1], aNewPos[0]);
60 aNewPos[0] += std::cos(phi)*1.*CLHEP::mm;
61 aNewPos[1] += std::sin(phi)*1.*CLHEP::mm;
67 G4ThreeVector aNewP(0., 0., totalP);
68 G4DynamicParticle *aNewPart =
new G4DynamicParticle(pDef->GetDefinition(), aNewP);
69 G4Track *aNewTrack =
new G4Track(aNewPart, aTrack.GetLocalTime(), aNewPos);
93 G4ForceCondition *condition)
96 *condition = NotForced;
103 return this->
GetFreePath(aTrack, previousStepSize);
115 if (previousStepSize < -999999) std::cerr <<
" LBNEPerfectFocusProcess::GetFreePath, crazy prev step size.. " <<
std::endl;
121 const G4ThreeVector posT = aTrack.GetPosition();
122 const double radSq= posT[0]*posT[0] + posT[1]*posT[1];
128 return 1.0e-5*CLHEP::mm;
145 int pid = pDef.GetPDGEncoding();
146 if (
std::abs(pid) == 211)
return true;
147 if (
std::abs(pid) == 321)
return true;
156 const G4ThreeVector posT = aTrack->GetPosition();
double GetRCoordOutOfTarget() const
LBNEPerfectFocusProcess(const G4String &aName="pFocus", G4ProcessType aType=fGeneral)
double fRCoordOutOfTargetSq
virtual ~LBNEPerfectFocusProcess()
LBNEPerfectFocusParticleChange()
double GetZCoordForPerfectFocusing() const
void StartTracking(G4Track *aTrack)
bool IsApplicable(const G4ParticleDefinition &)
double fZCoordForPerfectFocusing
G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
double GetFreePath(const G4Track &track, G4double previousStepSize)
~LBNEPerfectFocusParticleChange()
LBNEPerfectFocusParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
LBNEPerfectFocusParticleChange * fParticleChange
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *)
QTextStream & endl(QTextStream &s)