Skip to content
Snippets Groups Projects
Commit c05d395a authored by Miha Muskinja's avatar Miha Muskinja
Browse files

add functionality to filter by PdgID in the VerboseSelector

parent 2144960a
No related branches found
No related tags found
No related merge requests found
......@@ -127,12 +127,22 @@ namespace G4UA{
bool p1=m_config.targetTrack<0 && m_config.targetBarcode<0;
bool p2=trackID==m_config.targetTrack ;
bool p3=currentBarcode==m_config.targetBarcode;
bool p4 = false;
for (auto& pdgID : m_config.targetPdgIDs) {
if (fabs(aTrack->GetParticleDefinition()->GetPDGEncoding()) == pdgID ) {
p4 = true;
break;
}
}
if(p1 || p2 || p3)
if(p1 || p2 || p3 || p4)
{
ATH_MSG_INFO(std::endl<<"---------> Dumping now track #"<<trackID<<" barcode "
<<currentBarcode<<" in event "<<m_evtCount<<std::endl);
ATH_MSG_INFO(std::endl << "---------> Dumping now track #"
<< trackID << " barcode " << currentBarcode
<< " pdgID " << aTrack->GetParticleDefinition()->GetPDGEncoding()
<< " in event " << m_evtCount);
G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(m_config.verboseLevel);
}
}
......@@ -143,7 +153,13 @@ namespace G4UA{
if(m_evtCount==(uint64_t)m_config.targetEvent||m_config.targetEvent<0){
if(aTrack->GetTrackID()==m_config.targetTrack||m_config.targetTrack<0)
G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(0);
}
for (auto& pdgID : m_config.targetPdgIDs) {
if (fabs(aTrack->GetParticleDefinition()->GetPDGEncoding()) == pdgID ) {
G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(0);
break;
}
}
}
}
......
......@@ -35,7 +35,8 @@ class VerboseSelector:
double Xmin=0, Xmax=0;
double Ymin=0, Ymax=0;
double Zmin=0, Zmax=0;
std::vector<double> targetPdgIDs = {};
};
VerboseSelector(const Config& config);
......
......@@ -24,7 +24,9 @@ namespace G4UA{
declareProperty("Zmin",m_config.Zmin);
declareProperty("Zmax",m_config.Zmax);
// target pdgIDs of tracks to printout
declareProperty("TargetPdgIDs", m_config.targetPdgIDs);
}
std::unique_ptr<VerboseSelector> VerboseSelectorTool::makeAction(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment