This class determines the truth origin of a track.
More...
#include <InDetTrackTruthOriginTool.h>
|
| virtual void | print () const |
| | Print the state of the tool.
|
| ServiceHandle< StoreGateSvc > & | evtStore () |
| | The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
|
| const ServiceHandle< StoreGateSvc > & | detStore () const |
| | The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
|
| virtual StatusCode | sysInitialize () override |
| | Perform system initialization for an algorithm.
|
| virtual StatusCode | sysStart () override |
| | Handle START transition.
|
| virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| | Return this algorithm's input handles.
|
| virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| | Return this algorithm's output handles.
|
| Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T, V, H > &t) |
| void | updateVHKA (Gaudi::Details::PropertyBase &) |
| MsgStream & | msg () const |
| bool | msgLvl (const MSG::Level lvl) const |
| template<class T> |
| const T * | getProperty (const std::string &name) const |
| | Get one of the tool's properties.
|
| const std::string & | msg_level_name () const __attribute__((deprecated)) |
| | A deprecated function for getting the message level's name.
|
| const std::string & | getName (const void *ptr) const |
| | Get the name of an object that is / should be in the event store.
|
| SG::sgkey_t | getKey (const void *ptr) const |
| | Get the (hashed) key of an object that is in the event store.
|
|
| virtual ASG_TOOL_CLASS2(InDetTrackTruthOriginTool, asg::IAsgTool, InDet::IInDetTrackTruthOriginTool) public | ~InDetTrackTruthOriginTool () |
| virtual StatusCode | initialize () override |
| virtual const xAOD::TruthParticle * | getTruth (const xAOD::TrackParticle *track) const override |
| | Safely access a track's linked truth particle, if available.
|
| virtual int | getTruthOrigin (const xAOD::TruthParticle *truth) const override |
| | Computes the truth particle origin.
|
| virtual int | getTrackOrigin (const xAOD::TrackParticle *track) const override |
| | Computes the track origin.
|
| virtual bool | isFrom (const xAOD::TruthParticle *truth, int flav) const override |
| | Check if a truth particle is from the specified origin (from B or D hadron, or tau)
|
| virtual bool | isFromRec (const xAOD::TruthParticle *truth, int flav, int depth=0) const |
| | recursion-safe(r) version of isFrom
|
| Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &) |
| | specialization for handling Gaudi::Property<SG::VarHandleKey>
|
◆ StoreGateSvc_t
◆ declareGaudiProperty()
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
158 {
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
◆ declareProperty()
Definition at line 145 of file AthCommonDataStore.h.
145 {
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
◆ detStore()
◆ evtStore()
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ getKey()
| SG::sgkey_t asg::AsgTool::getKey |
( |
const void * | ptr | ) |
const |
|
inherited |
Get the (hashed) key of an object that is in the event store.
This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.
In order to allow tools to efficiently perform this operation, they can use this helper function.
- See also
- asg::AsgTool::getName
- Parameters
-
| ptr | The bare pointer to the object that the event store should know about |
- Returns
- The hashed key of the object in the store. If not found, an invalid (zero) key.
Definition at line 119 of file AsgTool.cxx.
119 {
120
121#ifdef XAOD_STANDALONE
122
123
124 return evtStore()->event()->getKey( ptr );
125#else
127 return ( proxy ==
nullptr ? 0 :
proxy->sgkey() );
128#endif
129 }
ServiceHandle< StoreGateSvc > & evtStore()
◆ getName()
| const std::string & asg::AsgTool::getName |
( |
const void * | ptr | ) |
const |
|
inherited |
Get the name of an object that is / should be in the event store.
This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.
In order to allow tools to efficiently perform this operation, they can use this helper function.
- See also
- asg::AsgTool::getKey
- Parameters
-
| ptr | The bare pointer to the object that the event store should know about |
- Returns
- The string name of the object in the store. If not found, an empty string.
Definition at line 106 of file AsgTool.cxx.
106 {
107
108#ifdef XAOD_STANDALONE
109
110
111 return evtStore()->event()->getName( ptr );
112#else
114 static const std::string
dummy =
"";
115 return ( proxy ==
nullptr ? dummy :
proxy->name() );
116#endif
117 }
◆ getProperty()
template<class T>
| const T * asg::AsgTool::getProperty |
( |
const std::string & | name | ) |
const |
|
inherited |
Get one of the tool's properties.
◆ getTrackOrigin()
| int InDet::InDetTrackTruthOriginTool::getTrackOrigin |
( |
const xAOD::TrackParticle * | track | ) |
const |
|
overrideprivatevirtual |
Computes the track origin.
Implements InDet::IInDetTrackTruthOriginTool.
Definition at line 163 of file InDetTrackTruthOriginTool.cxx.
163 {
164
165
167
168
170 float truthProb = tmpAcc( *track );
171
172 int origin = 0;
173
174
175 if (!truth){
177 }
178
179
183 ATH_MSG_ERROR(
"InDetTrackTruthOriginTool configured for full pile-up truth but could not retrieve TruthEvents container");
184 }
185 const xAOD::TruthEvent*
event = truthEventContainer ? truthEventContainer->at(0) :
nullptr;
186
187 if(event){
188 const auto&
links =
event->truthParticleLinks();
189
190 bool isFromHSProdVtx = false;
191 for (const auto& link : links){
192 if(link.isValid() && truth == *link){
193 isFromHSProdVtx = true;
194 break;
195 }
196 }
197
199 }
200 }
201
202
205 }
206
207
208 if (truth) {
210 }
211
212 return origin;
213 }
retrieve(aClass, aKey=None)
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.
TruthEvent_v1 TruthEvent
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.
◆ getTruth()
Safely access a track's linked truth particle, if available.
Implements InDet::IInDetTrackTruthOriginTool.
Definition at line 40 of file InDetTrackTruthOriginTool.cxx.
40 {
41
42
43
44
45 typedef ElementLink<xAOD::TruthParticleContainer>
TruthLink;
46 static const SG::ConstAccessor<TruthLink>
47 truthParticleLinkAcc ("truthParticleLink");
48 if ( !truthParticleLinkAcc.isAvailable(*track) ) {
49 return nullptr;
50 }
51
52
53 const TruthLink &link = truthParticleLinkAcc(*track);
54
55
56
57
59 return nullptr;
60 }
61
62
63 return *link;
64 }
bool isValid() const
Test to see if the link can be dereferenced.
◆ getTruthOrigin()
| int InDet::InDetTrackTruthOriginTool::getTruthOrigin |
( |
const xAOD::TruthParticle * | truth | ) |
const |
|
overrideprivatevirtual |
Computes the truth particle origin.
Implements InDet::IInDetTrackTruthOriginTool.
Definition at line 66 of file InDetTrackTruthOriginTool.cxx.
66 {
67
68 int origin = 0;
69
70
72
73
77 }
78
79
83 }
84
85
89 }
90
91
93
94
97 }
98
99 else {
101
102 if(parent == nullptr) {
104 }
105
106
107 else {
108
111
112
115 }
116
117
118 else if(
parent->isStrangeMeson() &&
parent->nChildren() == 2) {
120
121 if (abs(pdgId) == 211 && parentId == 310) {
123 }
124 }
125
126
127 else if(
parent->isStrangeBaryon() &&
parent->nChildren() == 2) {
129
132 }
133 }
134
135
136 else if(
parent->isHadron() &&
parent->nChildren() == 2) {
138 }
139
140
141 else if(
parent->nChildren() > 2) {
143 }
144
145
146 else {
148 }
149 }
150 }
151
153 }
154
155
156 if(isFragmentation) {
158 }
159
160 return origin;
161 }
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 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 isFragmentation(int origin)
not from B, D, or any secondary
◆ initialize()
| StatusCode InDet::InDetTrackTruthOriginTool::initialize |
( |
void | | ) |
|
|
overrideprivatevirtual |
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ isFrom()
| bool InDet::InDetTrackTruthOriginTool::isFrom |
( |
const xAOD::TruthParticle * | truth, |
|
|
int | flav ) const |
|
overrideprivatevirtual |
◆ isFromRec()
| bool InDet::InDetTrackTruthOriginTool::isFromRec |
( |
const xAOD::TruthParticle * | truth, |
|
|
int | flav, |
|
|
int | depth = 0 ) const |
|
privatevirtual |
recursion-safe(r) version of isFrom
Definition at line 219 of file InDetTrackTruthOriginTool.cxx.
219 {
220
221 if ( truth == nullptr ) return false;
222
223 if (
depth > 30 )
return false;
224
226
228
230
232
233
234 for(
unsigned int p=0;
p<truth->
nParents();
p++) {
236 if(parent == truth ) continue ;
238 }
239
240 return false;
241 }
bool isBottomHadron() const
Determine if the PID is that of a b-hadron.
bool isCharmHadron() const
Determine if the PID is that of a c-hadron.
std::string depth
tag string for intendation
◆ msg()
◆ msg_level_name()
| const std::string & asg::AsgTool::msg_level_name |
( |
| ) |
const |
|
inherited |
A deprecated function for getting the message level's name.
Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:
MSG::name( msg().level() )
This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.
- Returns
- The string name of the current minimum message level that's printed
Definition at line 101 of file AsgTool.cxx.
101 {
102
104 }
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
◆ msgLvl()
| bool AthCommonMsg< AlgTool >::msgLvl |
( |
const MSG::Level | lvl | ) |
const |
|
inlineinherited |
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ print()
| void asg::AsgTool::print |
( |
| ) |
const |
|
virtualinherited |
Print the state of the tool.
Implements asg::IAsgTool.
Reimplemented in AsgHelloTool, HI::HIPileupTool, JetBottomUpSoftDrop, JetConstituentsRetriever, JetDumper, JetFinder, JetFromPseudojet, JetModifiedMassDrop, JetPileupLabelingTool, JetPruner, JetPseudojetRetriever, JetReclusterer, JetReclusteringTool, JetRecTool, JetRecursiveSoftDrop, JetSoftDrop, JetSplitter, JetSubStructureMomentToolsBase, JetToolRunner, JetTrimmer, JetTruthLabelingTool, KtDeltaRTool, and LundVariablesTool.
Definition at line 131 of file AsgTool.cxx.
131 {
132
134 return;
135 }
◆ renounce()
Definition at line 380 of file AthCommonDataStore.h.
381 {
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
Definition at line 308 of file AthCommonDataStore.h.
308 {
309
310
313 for (
auto k :
keys) {
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka
◆ ~InDetTrackTruthOriginTool()
| InDet::InDetTrackTruthOriginTool::~InDetTrackTruthOriginTool |
( |
| ) |
|
|
privatevirtualdefault |
◆ m_detStore
◆ m_evtStore
◆ m_isFullPileupTruth
| bool InDet::InDetTrackTruthOriginTool::m_isFullPileupTruth |
|
private |
◆ m_matchingProbabilityCut
| float InDet::InDetTrackTruthOriginTool::m_matchingProbabilityCut |
|
private |
◆ m_truthMatchProbabilityAuxName
| std::string InDet::InDetTrackTruthOriginTool::m_truthMatchProbabilityAuxName |
|
private |
◆ m_truthParticleLinkName
| std::string InDet::InDetTrackTruthOriginTool::m_truthParticleLinkName |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files: