17 InDetTrackTruthOriginTool::InDetTrackTruthOriginTool(
const std::string& name) :
21#ifndef XAOD_STANDALONE
22 declareInterface<IInDetTrackTruthOriginTool>(
this);
25 declareProperty(
"matchingProbabilityCut", m_matchingProbabilityCut = 0.5);
27 declareProperty(
"truthParticleLinkName", m_truthParticleLinkName =
"truthParticleLink");
28 declareProperty(
"truthMatchProbabilityAuxName", m_truthMatchProbabilityAuxName =
"truthMatchProbability");
29 declareProperty(
"isFullPileUpTruth", m_isFullPileupTruth =
false);
33 InDetTrackTruthOriginTool::~InDetTrackTruthOriginTool() =
default;
37 return StatusCode::SUCCESS;
47 truthParticleLinkAcc (
"truthParticleLink");
53 const TruthLink &link = truthParticleLinkAcc(*track);
71 bool isFragmentation =
true;
76 isFragmentation =
false;
82 isFragmentation =
false;
88 isFragmentation =
false;
102 if(parent ==
nullptr) {
109 int pdgId = truth->
pdgId();
110 int parentId = parent->pdgId();
113 if(parent->isPhoton() && truth->
isElectron()) {
118 else if(parent->isStrangeMeson() && parent->nChildren() == 2) {
121 if (abs(pdgId) == 211 && parentId == 310) {
127 else if(parent->isStrangeBaryon() && parent->nChildren() == 2) {
136 else if(parent->isHadron() && parent->nChildren() == 2) {
141 else if(parent->nChildren() > 2) {
152 isFragmentation =
false;
156 if(isFragmentation) {
170 float truthProb = tmpAcc( *track );
182 if(
evtStore()->retrieve(truthEventContainer,
"TruthEvents").isFailure()){
183 ATH_MSG_ERROR(
"InDetTrackTruthOriginTool configured for full pile-up truth but could not retrieve TruthEvents container");
185 const xAOD::TruthEvent*
event = truthEventContainer ? truthEventContainer->
at(0) :
nullptr;
188 const auto& links =
event->truthParticleLinks();
190 bool isFromHSProdVtx =
false;
191 for (
const auto& link : links){
192 if(link.isValid() && truth == *link){
193 isFromHSProdVtx =
true;
221 if ( truth ==
nullptr )
return false;
223 if (
depth > 30 )
return false;
234 for(
unsigned int p=0; p<truth->
nParents(); p++) {
236 if(parent == truth ) continue ;
Helper class to provide constant type-safe access to aux data.
ATLAS-specific HepMC functions.
ServiceHandle< StoreGateSvc > & evtStore()
const T * at(size_type n) const
Access an element, as an rvalue.
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
bool isBottomHadron() const
Determine if the PID is that of a b-hadron.
int pdgId() const
PDG ID code.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
size_t nParents() const
Number of parents of this particle.
bool isElectron() const
Whether the particle is an electron (or positron)
bool isCharmHadron() const
Determine if the PID is that of a c-hadron.
std::string depth
tag string for intendation
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...
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthEvent_v1 TruthEvent
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.