|
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 32 of file MenuTruthThinning.cxx.
41 declareProperty (
"EventsKey",
43 "TruthEvent container name");
45 declareProperty (
"WritePartons",
49 declareProperty (
"WriteHadrons",
53 declareProperty (
"WriteBHadrons",
57 declareProperty (
"WriteCHadrons",
61 declareProperty (
"WriteGeant",
63 "Keep Geant particles?");
65 declareProperty (
"GeantPhotonPtThresh",
67 "Write Geant photons with Pt above this threshold. "
68 "Set to < 0 to not write any.");
70 declareProperty (
"WriteTauHad",
72 "Keep hadronic taus?");
74 declareProperty (
"PartonPtThresh",
76 "Write partons with Pt above this threshold.");
78 declareProperty (
"WriteBSM",
80 "Keep BSM particles?");
82 declareProperty (
"WriteBosons",
86 declareProperty (
"PhotonPtThresh",
88 "Photon pt cut with WriteBosons");
90 declareProperty (
"WriteBSMProducts",
92 "Keep BSM particle decay products?");
94 declareProperty (
"WriteBosonProducts",
96 "Keep boson decay products?");
98 declareProperty (
"WriteTopAndDecays",
100 "Keep top partons and immediate decay products?");
102 declareProperty(
"WriteEverything",
104 "Keep absolutely everything (overrides all other flags)");
106 declareProperty(
"WriteAllLeptons",
108 "Keep absolutely all leptons");
110 declareProperty(
"WriteLeptonsNotFromHadrons",
112 "Keep leptons not from hadron decays");
114 declareProperty(
"WriteAllStable",
116 "Keep all stable particles");
118 declareProperty(
"WriteNotPhysical",
120 "Save also non-physical particles");
122 declareProperty(
"WriteFirstN",
124 "Keep first N particles in record");
126 declareProperty(
"PreserveDescendants",
128 "Preserve descendants of retained particles");
130 declareProperty(
"PreserveGeneratorDescendants",
132 "Preserve descendants of retained particles excluding Geant particles");
134 declareProperty(
"PreserveAncestors",
136 "Preserve ancestors of retained particles");
138 declareProperty (
"PreserveParentsSiblingsChildren",
140 "Preserve the parents, siblings and children of retained particles");
142 declareProperty (
"PreserveHadronizationVertices",
144 "Preserve hadronization vertices with parents/children.");
146 declareProperty (
"WritettHFHadrons",
148 "Keep tt+HF hadrons?");
150 declareProperty (
"PDGIDsToKeep",
152 "List of PDG IDs to always keep");
154 declareProperty (
"LongLivedPDGIDs",
156 "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 192 of file MenuTruthThinning.cxx.
194 const EventContext& ctx = Gaudi::Hive::currentContext();
199 m_totpart += importedTruthParticles->size();
207 return StatusCode::FAILURE;
217 std::vector<bool> particleMask, vertexMask;
218 int nTruthParticles = importedTruthParticles->size();
219 int nTruthVertices = importedTruthVertices->size();
220 particleMask.assign(nTruthParticles,
true);
221 vertexMask.assign(nTruthVertices,
false);
224 for (
int particleCounter = 0; particleCounter < nTruthParticles; ++particleCounter) {
229 particleMask[particleCounter] =
false;
241 std::unordered_set<int> encounteredUniqueIDs;
243 for (
int i=0;
i<nTruthParticles; ++
i) {
244 bool toKeep = particleMask[
i];
245 if (!toKeep)
continue;
247 encounteredUniqueIDs.clear();
249 encounteredUniqueIDs.clear();
251 encounteredUniqueIDs.clear();
253 encounteredUniqueIDs.clear();
261 std::vector<bool> particleMaskCopy = particleMask;
262 for (
int i=0;
i<nTruthParticles; ++
i) {
263 bool toKeep = particleMask[
i];
264 if (!toKeep)
continue;
269 particleMask = particleMaskCopy;
273 importedTruthParticles.keep (particleMask);
274 importedTruthVertices.keep (vertexMask);
276 return StatusCode::SUCCESS;
◆ finalize()
StatusCode DerivationFramework::MenuTruthThinning::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
StatusCode DerivationFramework::MenuTruthThinning::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 164 of file MenuTruthThinning.cxx.
167 ATH_MSG_FATAL(
"You are asking to keep both all descendants, and only those from the event generator. Please check your job options.");
168 return StatusCode::FAILURE;
171 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.");
172 return StatusCode::FAILURE;
180 return StatusCode::SUCCESS;
◆ isAccepted()
Definition at line 280 of file MenuTruthThinning.cxx.
284 int pdg_id = std::abs(
p->pdgId());
321 int motherPDGID = 999999999;
328 if (mother) motherPDGID = mother->
pdgId();
343 std::unordered_set<int> uniqueID_trace;
374 for(
unsigned int itr=0; itr<nIncoming; ++itr) {
376 if (!incomingParticle)
continue;
389 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 553 of file MenuTruthThinning.cxx.
556 int pdg =
part->pdgId();
559 if(!prod)
return false;
562 if (prod==
part->decayVtx())
return false;
565 std::unordered_set<int>::const_iterator foundVtx = uniqueID_trace.find(
HepMC::uniqueID(prod) );
566 if( foundVtx != uniqueID_trace.end() ) {
567 ATH_MSG_DEBUG(
"Found a loop (a la Sherpa sample). Backing out." );
574 for (
unsigned int pitr = 0; pitr<nIncoming; ++pitr){
576 if (!itrParent)
continue;
583 bool has_fsr =
false;
586 for (
unsigned int citr = 0; citr<nChildren; ++citr) {
588 if (!itrChild)
continue;
589 if (abs(itrChild->
pdgId())==15){
595 if (has_fsr)
return false;
596 ATH_MSG_DEBUG(
"Particle with pdgId = " << pdg <<
", matched to tau");
601 if(
isFromTau(itrParent, uniqueID_trace)) {
◆ isFsrFromLepton()
Definition at line 630 of file MenuTruthThinning.cxx.
631 int pdg =
part->pdgId();
635 if(!prod)
return false;
637 if (prod==
part->decayVtx())
return false;
640 for(
unsigned int pitr=0; pitr<nIncoming; ++pitr){
◆ isLeptonFromTau()
Definition at line 519 of file MenuTruthThinning.cxx.
521 int pdg =
part->pdgId();
526 if(!prod)
return false;
529 if (prod==
part->decayVtx())
return false;
533 for(
unsigned int itr = 0; itr<nIncoming; ++itr){
536 ATH_MSG_DEBUG(
"Particle with pdgId = " << pdg <<
", matched to tau");
◆ isOrphanIncTau()
Definition at line 411 of file MenuTruthThinning.cxx.
416 int pdgId =
part->pdgId();
418 if (!(
part->hasProdVtx()))
return true;
422 unsigned int itrParent = 0;
425 if (prodVtx==
part->decayVtx())
return false;
428 if(nIncoming == 0)
return true;
430 unsigned int nParents = 0;
431 while(nParents==0 && itrParent<nIncoming) {
435 if(incomingParticle->
pdgId() == pdgId) {
438 else if(abs(incomingParticle->
pdgId()) == 15) {
446 return (nParents==0);
◆ isttHFHadron()
Definition at line 611 of file MenuTruthThinning.cxx.
613 int ttHFClassification=6;
616 if (TopHadronOriginFlagAcc.isAvailable(*
part)){
617 ttHFClassification = TopHadronOriginFlagAcc(*
part);
623 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 449 of file MenuTruthThinning.cxx.
454 int pdgId =
part->pdgId();
459 std::vector<int>::const_iterator itrPdgId, itrPdgIdEnd;
461 if (!(
part->hasProdVtx()))
return false;
468 if (prodVtx==
part->decayVtx())
return false;
470 unsigned int itrParent = 0;
471 while(!
found && itrParent<nIncoming) {
474 if(!targetsAreRange) {
477 itrPdgId = targetPdgIds.begin();
478 itrPdgIdEnd = targetPdgIds.end();
479 for(;itrPdgId != itrPdgIdEnd; ++itrPdgId) {
480 if(incomingParticle->
pdgId() == (*itrPdgId))
return true;
484 int absPdgId = abs(incomingParticle->
pdgId());
487 if(targetPdgIds.size() == 1) {
488 if(absPdgId >= targetPdgIds.at(0))
return true;
490 else if(targetPdgIds.size() >= 2) {
491 if(absPdgId >= targetPdgIds.at(0) &&
492 absPdgId <= targetPdgIds.at(1))
return true;
497 if(incomingParticle->
pdgId() == pdgId) {
502 itrPdgId = intermediatePdgIds.begin();
503 itrPdgIdEnd = intermediatePdgIds.end();
504 bool foundIntermediate =
false;
505 while(!foundIntermediate && itrPdgId != itrPdgIdEnd) {
506 if(incomingParticle->
pdgId() == (*itrPdgId)) foundIntermediate =
true;
509 if(foundIntermediate) {
◆ matchHadronIncTau()
Definition at line 395 of file MenuTruthThinning.cxx.
398 std::vector<int> hadrons = std::vector<int>{111};
399 std::vector<int> taus = std::vector<int>{15,-15};
◆ matchQuarkIncTau()
Definition at line 403 of file MenuTruthThinning.cxx.
406 std::vector<int> quarks = std::vector<int>{1,6};
407 std::vector<int> taus = std::vector<int>{15,-15};
◆ parentIsLongLived()
Definition at line 657 of file MenuTruthThinning.cxx.
660 for(
size_t parent_itr = 0; parent_itr <
part->nParents(); parent_itr++){
661 if(!
part->parent(parent_itr))
continue;
663 const int parent_abs_pdgid = abs(
parent->pdgId());
◆ m_eventCount
std::atomic<int> DerivationFramework::MenuTruthThinning::m_eventCount {} |
|
mutableprivate |
◆ m_eventsKey
std::string DerivationFramework::MenuTruthThinning::m_eventsKey |
|
private |
◆ 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 79 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 135 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 92 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 125 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:
def retrieve(aClass, aKey=None)
size_t nOutgoingParticles() const
Get the number of outgoing particles.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
std::string find(const std::string &s)
return a remapped string
#define ATH_MSG_VERBOSE(x)
bool isBottomHadron(const T &p)
Handle for requesting thinning for a data object.
bool isSMLepton(const T &p)
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...
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.