 |
ATLAS Offline Software
|
#include <TruthBornLeptonCollectionMaker.h>
|
SG::ReadHandleKey< xAOD::TruthParticleContainer > | m_particlesKey {this, "ParticlesKey", "TruthParticles", "Name of TruthParticle key for input"} |
| < Input particle collection key More...
|
|
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > | m_originAccessorKey {this, "Input_classifierParticleOrigin", m_particlesKey, "classifierParticleOrigin", "Particle origin decoration"} |
|
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > | m_typeAccessorKey {this, "Input_classifierParticleType",m_particlesKey, "classifierParticleType", "Particle type decoration"} |
|
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > | m_outcomeAccessorKey {this, "Input_classifierParticleOutCome", m_particlesKey, "classifierParticleOutCome", "Particle outcome decoration"} |
|
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > | m_classificationAccessorKey {this, "Input_Classification", m_particlesKey, "Classification", "Classification code decoration"} |
| Output particle collection key. More...
|
|
SG::WriteHandleKey< xAOD::TruthParticleContainer > | m_collectionName {this, "NewCollectionName", "", "Name of TruthParticle key for output"} |
|
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > | m_originDecoratorKey {this, "classifierParticleOrigin", m_collectionName, "classifierParticleOrigin", "Particle origin decoration"} |
|
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > | m_typeDecoratorKey {this, "classifierParticleType",m_collectionName, "classifierParticleType", "Particle type decoration"} |
|
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > | m_outcomeDecoratorKey {this, "classifierParticleOutCome", m_collectionName, "classifierParticleOutCome", "Particle outcome decoration"} |
|
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > | m_classificationDecoratorKey {this, "Classification", m_collectionName, "Classification", "Classification code decoration"} |
|
ServiceHandle< StoreGateSvc > | m_metaStore |
| Handle on the metadata store for init. More...
|
|
◆ TruthBornLeptonCollectionMaker()
DerivationFramework::TruthBornLeptonCollectionMaker::TruthBornLeptonCollectionMaker |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ ~TruthBornLeptonCollectionMaker()
DerivationFramework::TruthBornLeptonCollectionMaker::~TruthBornLeptonCollectionMaker |
( |
| ) |
|
◆ addBranches()
StatusCode DerivationFramework::TruthBornLeptonCollectionMaker::addBranches |
( |
| ) |
const |
|
virtual |
Definition at line 76 of file TruthBornLeptonCollectionMaker.cxx.
79 const EventContext& ctx = Gaudi::Hive::currentContext();
82 static const bool is_sherpa = [
this]() {
83 bool is_sherpa =
false;
93 if (
m_metaStore->retrieve(truthMetaData).isSuccess() && !truthMetaData->empty()){
95 const std::string gens = truthMetaData->at(0)->generators();
96 is_sherpa = (gens.find(
"sherpa")==std::string::npos &&
97 gens.find(
"Sherpa")==std::string::npos &&
98 gens.find(
"SHERPA")==std::string::npos) ?
false :
true;
101 ATH_MSG_WARNING(
"Found xAODTruthMetaDataContainer empty! Configuring to be NOT Sherpa.");
103 ATH_MSG_INFO(
"From metadata configured: Sherpa? " << is_sherpa);
106 ATH_MSG_WARNING(
"Could not find metadata container in storegate; assuming NOT Sherpa");
113 if (!truthParticles.isValid()) {
115 return StatusCode::FAILURE;
120 ATH_CHECK(newParticlesWriteHandle.record(std::make_unique<xAOD::TruthParticleContainer>(),
121 std::make_unique<xAOD::TruthParticleAuxContainer>()));
136 for (
unsigned int i=0;
i<truthParticles->size(); ++
i) {
139 if (!theParticle)
continue;
140 if (!theParticle->
isLepton())
continue;
149 bool has_parent_of_same_flavour =
false;
151 for (
size_t p = 0;
p < theParticle->
prodVtx()->nIncomingParticles(); ++
p){
152 if (theParticle->
parent(
p)->
pdg_id() == theParticle->
pdg_id()) has_parent_of_same_flavour =
true;
154 if (has_parent_of_same_flavour)
continue;
157 bool physical =
false, has_V =
false;
187 size_t bad_parent = 0;
189 if (!theParticle->
parent(
p)) { bad_parent++;
continue;}
192 if (bad_parent != 0)
continue;
199 newParticlesWriteHandle->push_back( xTruthParticle );
201 *xTruthParticle=*theParticle;
203 typeDecorator(*xTruthParticle) = typeAccessor.withDefault(*theParticle, 0);
204 originDecorator(*xTruthParticle) = originAccessor.withDefault(*theParticle, 0);
205 outcomeDecorator(*xTruthParticle) = outcomeAccessor.withDefault(*theParticle, 0);
206 classificationDecorator(*xTruthParticle) = classificationAccessor.withDefault(*theParticle, 0);
209 return StatusCode::SUCCESS;
◆ hasBareDescendent()
Helper function for finding bare descendents of born leptons.
Definition at line 213 of file TruthBornLeptonCollectionMaker.cxx.
216 if (!
p)
return false;
220 for (
size_t c=0;
c<
p->nChildren();++
c){
221 if (!
p->child(
c))
continue;
222 if (
p->pdgId()!=
p->child(
c)->pdgId())
continue;
◆ initialize()
StatusCode DerivationFramework::TruthBornLeptonCollectionMaker::initialize |
( |
| ) |
|
◆ m_classificationAccessorKey
◆ m_classificationDecoratorKey
◆ m_collectionName
◆ m_metaStore
◆ m_originAccessorKey
◆ m_originDecoratorKey
◆ m_outcomeAccessorKey
◆ m_outcomeDecoratorKey
◆ m_particlesKey
◆ m_typeAccessorKey
◆ m_typeDecoratorKey
The documentation for this class was generated from the following files:
size_t nOutgoingParticles() const
Get the number of outgoing particles.
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeAccessorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_originDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeDecoratorKey
bool isW() const
Check if this particle is a W boson.
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_typeAccessorKey
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
int pdg_id() const
PDG ID code.
bool isZ() const
Check if this particle is a Z boson.
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
bool isLepton() const
Whether the particle is a lepton.
Handle class for reading a decoration on an object.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Class describing a truth particle in the MC record.
Handle class for adding a decoration to an object.
TruthParticle_v1 TruthParticle
Typedef to implementation.
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_collectionName
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Class describing a truth vertex in the MC record.
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_typeDecoratorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_classificationAccessorKey
Output particle collection key.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
bool isHiggs() const
Check if this particle is a Higgs boson.
#define ATH_MSG_WARNING(x)
size_t nIncomingParticles() const
Get the number of incoming particles.
bool hasBareDescendent(const xAOD::TruthParticle *p) const
Helper function for finding bare descendents of born leptons.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_classificationDecoratorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_originAccessorKey
bool isConditionB(const T &p)
ServiceHandle< StoreGateSvc > m_metaStore
Handle on the metadata store for init.
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
< Input particle collection key