 |
ATLAS Offline Software
|
#include <MenuTruthThinning.h>
Definition at line 27 of file MenuTruthThinning.h.
◆ MenuTruthThinning()
DerivationFramework::MenuTruthThinning::MenuTruthThinning |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
Definition at line 30 of file MenuTruthThinning.cxx.
38 declareProperty (
"WritePartons",
42 declareProperty (
"WriteHadrons",
46 declareProperty (
"WriteBHadrons",
50 declareProperty (
"WriteCHadrons",
54 declareProperty (
"WriteGeant",
56 "Keep Geant particles?");
58 declareProperty (
"GeantPhotonPtThresh",
60 "Write Geant photons with Pt above this threshold. "
61 "Set to < 0 to not write any.");
63 declareProperty (
"WriteTauHad",
65 "Keep hadronic taus?");
67 declareProperty (
"PartonPtThresh",
69 "Write partons with Pt above this threshold.");
71 declareProperty (
"WriteBSM",
73 "Keep BSM particles?");
75 declareProperty (
"WriteBosons",
79 declareProperty (
"PhotonPtThresh",
81 "Photon pt cut with WriteBosons");
83 declareProperty (
"WriteBSMProducts",
85 "Keep BSM particle decay products?");
87 declareProperty (
"WriteBosonProducts",
89 "Keep boson decay products?");
91 declareProperty (
"WriteTopAndDecays",
93 "Keep top partons and immediate decay products?");
95 declareProperty(
"WriteEverything",
97 "Keep absolutely everything (overrides all other flags)");
99 declareProperty(
"WriteAllLeptons",
101 "Keep absolutely all leptons");
103 declareProperty(
"WriteLeptonsNotFromHadrons",
105 "Keep leptons not from hadron decays");
107 declareProperty(
"WriteAllStable",
109 "Keep all stable particles");
111 declareProperty(
"WriteNotPhysical",
113 "Save also non-physical particles");
115 declareProperty(
"WriteFirstN",
117 "Keep first N particles in record");
119 declareProperty(
"PreserveDescendants",
121 "Preserve descendants of retained particles");
123 declareProperty(
"PreserveGeneratorDescendants",
125 "Preserve descendants of retained particles excluding Geant particles");
127 declareProperty(
"PreserveAncestors",
129 "Preserve ancestors of retained particles");
131 declareProperty (
"PreserveParentsSiblingsChildren",
133 "Preserve the parents, siblings and children of retained particles");
135 declareProperty (
"PreserveHadronizationVertices",
137 "Preserve hadronization vertices with parents/children.");
139 declareProperty (
"WritettHFHadrons",
141 "Keep tt+HF hadrons?");
143 declareProperty (
"PDGIDsToKeep",
145 "List of PDG IDs to always keep");
147 declareProperty (
"LongLivedPDGIDs",
149 "List of PDG IDs of long lived particles so that one can store their children");
◆ ~MenuTruthThinning()
DerivationFramework::MenuTruthThinning::~MenuTruthThinning |
( |
| ) |
|
|
virtual |
◆ doThinning()
StatusCode DerivationFramework::MenuTruthThinning::doThinning |
( |
| ) |
const |
|
overridevirtual |
Definition at line 185 of file MenuTruthThinning.cxx.
187 const EventContext& ctx = Gaudi::Hive::currentContext();
192 m_totpart += importedTruthParticles->size();
204 std::vector<bool> particleMask, vertexMask;
205 int nTruthParticles = importedTruthParticles->size();
206 int nTruthVertices = importedTruthVertices->size();
207 particleMask.assign(nTruthParticles,
true);
208 vertexMask.assign(nTruthVertices,
false);
211 for (
int particleCounter = 0; particleCounter < nTruthParticles; ++particleCounter) {
216 particleMask[particleCounter] =
false;
228 std::unordered_set<int> encounteredUniqueIDs;
230 for (
int i=0;
i<nTruthParticles; ++
i) {
231 bool toKeep = particleMask[
i];
232 if (!toKeep)
continue;
234 encounteredUniqueIDs.clear();
236 encounteredUniqueIDs.clear();
238 encounteredUniqueIDs.clear();
240 encounteredUniqueIDs.clear();
248 std::vector<bool> particleMaskCopy = particleMask;
249 for (
int i=0;
i<nTruthParticles; ++
i) {
250 bool toKeep = particleMask[
i];
251 if (!toKeep)
continue;
256 particleMask = particleMaskCopy;
260 importedTruthParticles.keep (particleMask);
261 importedTruthVertices.keep (vertexMask);
263 return StatusCode::SUCCESS;
◆ finalize()
StatusCode DerivationFramework::MenuTruthThinning::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
StatusCode DerivationFramework::MenuTruthThinning::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 157 of file MenuTruthThinning.cxx.
160 ATH_MSG_FATAL(
"You are asking to keep both all descendants, and only those from the event generator. Please check your job options.");
161 return StatusCode::FAILURE;
164 ATH_MSG_FATAL(
"You are asking to preserve only parents/children/siblings of retained states, and also more distant relatives. Please check your job options.");
165 return StatusCode::FAILURE;
173 return StatusCode::SUCCESS;
◆ isAccepted()
Definition at line 267 of file MenuTruthThinning.cxx.
271 int pdg_id =
p->absPdgId();
308 int motherPDGID = 999999999;
315 if (mother) motherPDGID = mother->
pdgId();
330 std::unordered_set<int> uniqueID_trace;
361 for(
unsigned int itr=0; itr<nIncoming; ++itr) {
363 if (!incomingParticle)
continue;
376 if (pdg_id==
id) ok=
true;
◆ isFromTau()
bool DerivationFramework::MenuTruthThinning::isFromTau |
( |
const xAOD::TruthParticle * |
part, |
|
|
std::unordered_set< int > & |
barcode_trace |
|
) |
| const |
Definition at line 540 of file MenuTruthThinning.cxx.
543 int pdg =
part->pdgId();
546 if(!prod)
return false;
549 if (prod==
part->decayVtx())
return false;
552 std::unordered_set<int>::const_iterator foundVtx = uniqueID_trace.find(
HepMC::uniqueID(prod) );
553 if( foundVtx != uniqueID_trace.end() ) {
554 ATH_MSG_DEBUG(
"Found a loop (a la Sherpa sample). Backing out." );
561 for (
unsigned int pitr = 0; pitr<nIncoming; ++pitr){
563 if (!itrParent)
continue;
569 bool has_fsr =
false;
572 for (
unsigned int citr = 0; citr<nChildren; ++citr) {
574 if (!itrChild)
continue;
581 if (has_fsr)
return false;
582 ATH_MSG_DEBUG(
"Particle with pdgId = " << pdg <<
", matched to tau");
587 if(
isFromTau(itrParent, uniqueID_trace)) {
◆ isFsrFromLepton()
Definition at line 616 of file MenuTruthThinning.cxx.
617 int pdg =
part->pdgId();
621 if(!prod)
return false;
623 if (prod==
part->decayVtx())
return false;
626 for(
unsigned int pitr=0; pitr<nIncoming; ++pitr){
◆ isLeptonFromTau()
Definition at line 506 of file MenuTruthThinning.cxx.
508 int pdg =
part->pdgId();
513 if(!prod)
return false;
516 if (prod==
part->decayVtx())
return false;
520 for(
unsigned int itr = 0; itr<nIncoming; ++itr){
523 ATH_MSG_DEBUG(
"Particle with pdgId = " << pdg <<
", matched to tau");
◆ isOrphanIncTau()
Definition at line 398 of file MenuTruthThinning.cxx.
405 if (!
part->hasProdVtx())
return true;
409 unsigned int itrParent = 0;
412 if (prodVtx==
part->decayVtx())
return false;
415 if(nIncoming == 0)
return true;
417 unsigned int nParents = 0;
418 while(nParents==0 && itrParent<nIncoming) {
433 return (nParents==0);
◆ isttHFHadron()
Definition at line 597 of file MenuTruthThinning.cxx.
599 int ttHFClassification=6;
602 if (TopHadronOriginFlagAcc.isAvailable(*
part)){
603 ttHFClassification = TopHadronOriginFlagAcc(*
part);
609 if (ttHFClassification < 6 )
◆ matchGenParticle()
bool DerivationFramework::MenuTruthThinning::matchGenParticle |
( |
const xAOD::TruthParticle * |
part, |
|
|
std::vector< int > & |
targetIDs, |
|
|
std::vector< int > & |
intermediateIDs, |
|
|
bool |
targetsAreRange |
|
) |
| const |
Definition at line 436 of file MenuTruthThinning.cxx.
446 std::vector<int>::const_iterator itrPdgId, itrPdgIdEnd;
448 if (!
part->hasProdVtx())
return false;
455 if (prodVtx==
part->decayVtx())
return false;
457 unsigned int itrParent = 0;
458 while(!
found && itrParent<nIncoming) {
461 if(!targetsAreRange) {
464 itrPdgId = targetPdgIds.begin();
465 itrPdgIdEnd = targetPdgIds.end();
466 for(;itrPdgId != itrPdgIdEnd; ++itrPdgId) {
467 if(incomingParticle->
pdgId() == (*itrPdgId))
return true;
471 int absPdgId = incomingParticle->
absPdgId();
474 if(targetPdgIds.size() == 1) {
475 if(absPdgId >= targetPdgIds.at(0))
return true;
477 else if(targetPdgIds.size() >= 2) {
478 if(absPdgId >= targetPdgIds.at(0) &&
479 absPdgId <= targetPdgIds.at(1))
return true;
489 itrPdgId = intermediatePdgIds.begin();
490 itrPdgIdEnd = intermediatePdgIds.end();
491 bool foundIntermediate =
false;
492 while(!foundIntermediate && itrPdgId != itrPdgIdEnd) {
493 if(incomingParticle->
pdgId() == (*itrPdgId)) foundIntermediate =
true;
496 if(foundIntermediate) {
◆ matchHadronIncTau()
Definition at line 382 of file MenuTruthThinning.cxx.
385 std::vector<int>
hadrons = std::vector<int>{111};
386 std::vector<int> taus = std::vector<int>{15,-15};
◆ matchQuarkIncTau()
Definition at line 390 of file MenuTruthThinning.cxx.
393 std::vector<int> quarks = std::vector<int>{1,6};
394 std::vector<int> taus = std::vector<int>{15,-15};
◆ parentIsLongLived()
Definition at line 643 of file MenuTruthThinning.cxx.
646 for(
size_t parent_itr = 0; parent_itr <
part->nParents(); parent_itr++){
647 if(!
part->parent(parent_itr))
continue;
649 const int parent_abs_pdgid = abs(
parent->pdgId());
◆ m_eventCount
std::atomic<int> DerivationFramework::MenuTruthThinning::m_eventCount {} |
|
mutableprivate |
◆ m_geantPhotonPtThresh
float DerivationFramework::MenuTruthThinning::m_geantPhotonPtThresh |
|
private |
Parameter: Write Geant photons with Pt above this threshold.
Set to < 0 to not write any.
Definition at line 77 of file MenuTruthThinning.h.
◆ m_longLivedPdgIds
std::vector<int> DerivationFramework::MenuTruthThinning::m_longLivedPdgIds |
|
private |
Parameter: List of PDG IDs of long lived particles so that one can keep their children.
Definition at line 133 of file MenuTruthThinning.h.
◆ m_particlesKey
◆ m_partonPtThresh
float DerivationFramework::MenuTruthThinning::m_partonPtThresh |
|
private |
Parameter: Write partons with Pt above this threshold.
Definition at line 90 of file MenuTruthThinning.h.
◆ m_pdgIdsToKeep
std::vector<int> DerivationFramework::MenuTruthThinning::m_pdgIdsToKeep |
|
private |
◆ m_photonPtCut
float DerivationFramework::MenuTruthThinning::m_photonPtCut |
|
private |
◆ m_preserveAncestors
bool DerivationFramework::MenuTruthThinning::m_preserveAncestors |
|
private |
◆ m_preserveDescendants
bool DerivationFramework::MenuTruthThinning::m_preserveDescendants |
|
private |
Parameter: preserve descendant/ancestor graph completeness.
Definition at line 123 of file MenuTruthThinning.h.
◆ m_preserveGeneratorDescendants
bool DerivationFramework::MenuTruthThinning::m_preserveGeneratorDescendants |
|
private |
◆ m_preserveHadVtx
bool DerivationFramework::MenuTruthThinning::m_preserveHadVtx |
|
private |
◆ m_preserveImmediate
bool DerivationFramework::MenuTruthThinning::m_preserveImmediate |
|
private |
◆ m_removedpart
std::atomic<unsigned int> DerivationFramework::MenuTruthThinning::m_removedpart |
|
mutableprivate |
◆ m_streamName
StringProperty DerivationFramework::MenuTruthThinning::m_streamName { this, "StreamName", "", "Name of the stream being thinned" } |
|
private |
◆ m_totpart
std::atomic<unsigned int> DerivationFramework::MenuTruthThinning::m_totpart |
|
mutableprivate |
◆ m_verticesKey
◆ m_writeAllLeptons
bool DerivationFramework::MenuTruthThinning::m_writeAllLeptons |
|
private |
◆ m_writeAllStable
bool DerivationFramework::MenuTruthThinning::m_writeAllStable |
|
private |
◆ m_writeBHadrons
bool DerivationFramework::MenuTruthThinning::m_writeBHadrons |
|
private |
◆ m_writeBosonProducts
bool DerivationFramework::MenuTruthThinning::m_writeBosonProducts |
|
private |
◆ m_writeBosons
bool DerivationFramework::MenuTruthThinning::m_writeBosons |
|
private |
◆ m_writeBSM
bool DerivationFramework::MenuTruthThinning::m_writeBSM |
|
private |
◆ m_writeBSMProducts
bool DerivationFramework::MenuTruthThinning::m_writeBSMProducts |
|
private |
◆ m_writeCHadrons
bool DerivationFramework::MenuTruthThinning::m_writeCHadrons |
|
private |
◆ m_writeEverything
bool DerivationFramework::MenuTruthThinning::m_writeEverything |
|
private |
◆ m_writeFirstN
int DerivationFramework::MenuTruthThinning::m_writeFirstN |
|
private |
◆ m_writeGeant
bool DerivationFramework::MenuTruthThinning::m_writeGeant |
|
private |
◆ m_writeHadrons
bool DerivationFramework::MenuTruthThinning::m_writeHadrons |
|
private |
◆ m_writeLeptonsNotFromHadrons
bool DerivationFramework::MenuTruthThinning::m_writeLeptonsNotFromHadrons |
|
private |
◆ m_writeNotPhysical
bool DerivationFramework::MenuTruthThinning::m_writeNotPhysical |
|
private |
◆ m_writePartons
bool DerivationFramework::MenuTruthThinning::m_writePartons |
|
private |
◆ m_writeTauHad
bool DerivationFramework::MenuTruthThinning::m_writeTauHad |
|
private |
◆ m_writeTopAndDecays
bool DerivationFramework::MenuTruthThinning::m_writeTopAndDecays |
|
private |
◆ m_writettHFHadrons
bool DerivationFramework::MenuTruthThinning::m_writettHFHadrons |
|
private |
The documentation for this class was generated from the following files:
size_t nOutgoingParticles() const
Get the number of outgoing particles.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
int absPdgId() const
Absolute PDG ID code (often useful)
std::string find(const std::string &s)
return a remapped string
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
#define ATH_MSG_VERBOSE(x)
bool isBottomHadron(const T &p)
Handle for requesting thinning for a data object.
bool isSMLepton(const T &p)
APID: the fourth generation leptons are not standard model leptons.
void immediateRelatives(const xAOD::TruthParticle *pHead, std::vector< bool > &particleMask, std::vector< bool > &vertexMask, bool keepHadVtx)
bool isHiggs(const T &p)
APID: HIGGS boson is only one particle.
void descendants(const xAOD::TruthParticle *pHead, std::vector< int > &particleList, std::unordered_set< int > &encounteredUniqueIDs)
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
bool hasDecayVtx() const
Check for a decay vertex on this particle.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Class describing a truth particle in the MC record.
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
Class describing a truth vertex in the MC record.
void ancestors(const xAOD::TruthParticle *pHead, std::vector< bool > &particleMask, std::vector< bool > &vertexMask, std::unordered_set< int > &encounteredUniqueIDs)
bool isHadron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
size_t nIncomingParticles() const
Get the number of incoming particles.
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
bool isCharmHadron(const T &p)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
int pdgId() const
PDG ID code.
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.