90 G4ThreeVector posTmp = aTrack->GetPosition();
91 G4ThreeVector momTmp = aTrack->GetMomentum();
92 for (
size_t k=0;
k != 3;
k++) {
93 if (std::isnan(posTmp[
k])) {
94 std::cerr <<
" LBNEStackingAction::ClassifyNewTrack, position has NaN, rejected " <<
std::endl;
97 if (std::isnan(momTmp[k])) {
98 std::cerr <<
" LBNEStackingAction::ClassifyNewTrack, momentum has NaN, rejected " <<
std::endl;
102 if (std::isnan(aTrack->GetTotalEnergy()) || std::isnan(aTrack->GetKineticEnergy())) {
103 std::cerr <<
" LBNEStackingAction::ClassifyNewTrack, Energy is NaN, rejected " <<
std::endl;
108 int myPid = aTrack->GetParticleDefinition()->GetPDGEncoding();
109 if ((
std::abs(myPid) == 211) || (myPid == 2212) ||
112 double pTotSq = 0;
for (
int k=0; k != 3; k++) pTotSq += aTrack->GetMomentum()[
k]*aTrack->GetMomentum()[
k];
113 double pTot = std::sqrt(pTotSq)/CLHEP::GeV;
115 if ((myPid == 2212) || ((pTot > 0.001) && (pTot < 50.))) {
116 int evtId = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
119 for (
int k=0; k != 3; k++)
fOutHadronAtVectex <<
" " << (aTrack->GetMomentum()[
k])/CLHEP::GeV;
130 G4ClassificationOfNewTrack classification = fUrgent;
131 G4ParticleDefinition * particleType = aTrack->GetDefinition();
133 int verboseLevel = G4EventManager::GetEventManager()->GetTrackingManager()->GetVerboseLevel();
136 G4int evtno =
pRunManager->GetCurrentEvent()->GetEventID();
137 std::cout <<
"Event " << evtno <<
": LBNEStackingAction::ClassifyNewTrack for Particle " 138 <<
"\"" << particleType->GetParticleName() <<
"\"" <<
" Called." <<
std::endl;
141 int sign = (particleType->GetPDGEncoding() > 0) ? 1 : -1;
144 const LBNERunAction *runUserAction =
reinterpret_cast<const LBNERunAction *
>(G4RunManager::GetRunManager()->GetUserRunAction());
149 const std::string vName = aTrack->GetVolume()->GetName();
150 if(vName.find(
"Target") != std::string::npos)
return classification;
153 if (aTrack->GetPosition()[2] < 9900.)
return classification;
165 int myPid = aTrack->GetParticleDefinition()->GetPDGEncoding();
167 double pTotSq = 0;
for (
int k=0; k != 3; k++) pTotSq += aTrack->GetMomentum()[
k]*aTrack->GetMomentum()[
k];
168 double pTot = std::sqrt(pTotSq)/CLHEP::GeV;
170 int evtId = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
192 return classification;
void UnKillMuonAlcoveParticles(G4ClassificationOfNewTrack &classification, const G4Track *aTrack)
bool GetDoComputeEDepInGraphite() const
bool GetDoComputeEDepInArgonGas() const
std::ofstream fOutHadronAtVectexCl
LBNERunManager * pRunManager
void KillUnimportantParticles(G4ClassificationOfNewTrack &classification, const G4Track *aTrack)
double fStackingKillingThreshold
static LBNEQuickPiToNuVect * Instance()
std::ofstream fOutHadronAtVectex
void KillEMParticles(G4ClassificationOfNewTrack &classification, const G4Track *aTrack)
void KillThresholdParticles(G4ClassificationOfNewTrack &classification, const G4Track *aTrack)
void addPion(int trNum1, int sign1, double e, G4ThreeVector p)
QTextStream & endl(QTextStream &s)