ATLAS Offline Software
Loading...
Searching...
No Matches
ThinGeantTruthAlg Class Referencefinal

#include <ThinGeantTruthAlg.h>

Inheritance diagram for ThinGeantTruthAlg:
Collaboration diagram for ThinGeantTruthAlg:

Public Member Functions

virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual StatusCode execute (const EventContext &ctx) const override final
void ancestors (const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
 Inline method.
void descendants (const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
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 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

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StringProperty m_streamName
Gaudi::Property< float > m_etaMaxEgTruth
Gaudi::Property< bool > m_keepMuons { this, "keepMuons", true }
Gaudi::Property< bool > m_keepEGamma { this, "keepEGamma", true }
Gaudi::Property< std::string > m_truthLinkDecor {this, "TruthLinkDecor", "truthParticleLink"}
 Truth particle link decorations.
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainerm_readDecorKeys {this, "DecorKeys", {}}
 Schedule the algorithm's dependency on the truth particle link.
Gaudi::Property< std::vector< int > > m_longlived
SG::ThinningHandleKey< xAOD::TruthParticleContainerm_truthParticlesKey
SG::ThinningHandleKey< xAOD::TruthVertexContainerm_truthVerticesKey
SG::ReadHandleKey< xAOD::ElectronContainerm_electronsKey
SG::ReadHandleKey< xAOD::ElectronContainerm_fwdElectronsKey
SG::ReadHandleKey< xAOD::PhotonContainerm_photonsKey
SG::ReadHandleKey< xAOD::MuonContainerm_muonsKey { this, "MuonsKey", "Muons", "Name of the input muon container" }
SG::ReadHandleKey< xAOD::TruthParticleContainerm_egammaTruthKey
std::atomic< unsigned long > m_nEventsProcessed {}
 Counters.
std::atomic< unsigned long > m_nParticlesProcessed {}
std::atomic< unsigned long > m_nVerticesProcessed {}
std::atomic< unsigned long > m_nParticlesThinned {}
std::atomic< unsigned long > m_nVerticesThinned {}
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 30 of file ThinGeantTruthAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ ancestors()

void ThinGeantTruthAlg::ancestors ( const xAOD::TruthParticle * pHead,
std::vector< bool > & particleMask,
std::unordered_set< int > & encounteredUniqueIDs ) const

Inline method.

Definition at line 324 of file ThinGeantTruthAlg.cxx.

327{
328
329 // Check that this uniqueID hasn't been seen before (e.g. we are in a loop)
330 std::unordered_set<int>::const_iterator found =
331 encounteredUniqueIDs.find(HepMC::uniqueID(pHead));
332 if (found != encounteredUniqueIDs.end())
333 return;
334 encounteredUniqueIDs.insert(HepMC::uniqueID(pHead));
335
336 // Save particle position in the mask
337 int headIndex = pHead->index();
338 particleMask[headIndex] = true;
339
340 // Get the production vertex
341 const xAOD::TruthVertex* prodVtx(nullptr);
342 if (pHead->hasProdVtx()) {
343 prodVtx = pHead->prodVtx();
344 } else {
345 return;
346 }
347
348 // Get children particles and self-call
349 int nParents = prodVtx->nIncomingParticles();
350 for (int i = 0; i < nParents; ++i)
351 ancestors(prodVtx->incomingParticle(i), particleMask, encounteredUniqueIDs);
352}
size_t index() const
Return the index of this element within its container.
void ancestors(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
Inline method.
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
int uniqueID(const T &p)
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ descendants()

void ThinGeantTruthAlg::descendants ( const xAOD::TruthParticle * pHead,
std::vector< bool > & particleMask,
std::unordered_set< int > & encounteredUniqueIDs ) const

Definition at line 359 of file ThinGeantTruthAlg.cxx.

363{
364 // Check that this unique ID hasn't been seen before (e.g. we are in a loop)
365 std::unordered_set<int>::const_iterator found =
366 encounteredUniqueIDs.find(HepMC::uniqueID(pHead));
367 if (found != encounteredUniqueIDs.end())
368 return;
369 encounteredUniqueIDs.insert(HepMC::uniqueID(pHead));
370
371 // Save the particle position in the mask
372 int headIndex = pHead->index();
373 particleMask[headIndex] = true;
374
375 // Get the decay vertex
376 const xAOD::TruthVertex* decayVtx(nullptr);
377 if (pHead->hasDecayVtx()) {
378 decayVtx = pHead->decayVtx();
379 } else {
380 return;
381 }
382
383 // Get children particles and self-call
384 int nChildren = decayVtx->nOutgoingParticles();
385 for (int i = 0; i < nChildren; ++i) {
387 decayVtx->outgoingParticle(i), particleMask, encounteredUniqueIDs);
388 }
389
390 }
void descendants(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
bool hasDecayVtx() const
Check for a decay vertex on this particle.

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode ThinGeantTruthAlg::execute ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 85 of file ThinGeantTruthAlg.cxx.

86{
87 // Increase the event counter
89
90 // Retrieve truth and vertex containers
91 SG::ThinningHandle truthParticles{m_truthParticlesKey, ctx};
92 SG::ThinningHandle truthVertices{m_truthVerticesKey, ctx};
93 if (!truthParticles.isValid()) {
94 ATH_MSG_FATAL("No TruthParticleContainer with key " << m_truthParticlesKey.key() << " found.");
95 return StatusCode::FAILURE;
96 }
97 if (!truthVertices.isValid()) {
98 ATH_MSG_FATAL("No TruthVertexContainer with key " << m_truthVerticesKey.key() << " found.");
99 return StatusCode::FAILURE;
100 }
101
102 // Loop over photons, electrons and muons and get the associated truth
103 // particles Retain the associated index number
104 std::vector<int> recoParticleTruthIndices;
105 std::vector<int> egammaTruthIndices{};
106
107 // Muons
108 if (m_keepMuons) {
109 const xAOD::MuonContainer* muons{nullptr};
110 ATH_CHECK(SG::get(muons, m_muonsKey, ctx));
111 for (const xAOD::Muon* muon : *muons) {
113 if (truthMuon) {
115 if (truthMuon) {
116 recoParticleTruthIndices.push_back(truthMuon->index());
117 }
118 }
119 }
120 }
121
122 // Electrons and photons
123 if (m_keepEGamma) {
124
125 // Electrons
126 const xAOD::ElectronContainer* electrons{nullptr};
127 ATH_CHECK(SG::get(electrons, m_electronsKey, ctx));
128
129 for (const xAOD::Electron* electron : *electrons) {
130 const xAOD::TruthParticle* truthElectron =
132 if (truthElectron) {
133 recoParticleTruthIndices.push_back(truthElectron->index());
134 }
135 }
136
137 // Forward Electrons
138 const xAOD::ElectronContainer* fwdElectrons{nullptr};
139 ATH_CHECK(SG::get(fwdElectrons, m_fwdElectronsKey, ctx));
140 if (fwdElectrons) {
141
142 for (const xAOD::Electron* electron : *fwdElectrons) {
143 const xAOD::TruthParticle* truthElectron =
145 if (truthElectron) {
146 recoParticleTruthIndices.push_back(truthElectron->index());
147 }
148 }
149 }
150
151 // Photons
152 const xAOD::PhotonContainer* photons{nullptr};
153 ATH_CHECK(SG::get(photons, m_photonsKey, ctx));
154 for (const xAOD::Photon* photon : *photons) {
155 const xAOD::TruthParticle* truthPhoton =
157 if (truthPhoton) {
158 recoParticleTruthIndices.push_back(truthPhoton->index());
159 }
160 }
161
162 // egamma Truth Particles
163 const xAOD::TruthParticleContainer* egammaTruthParticles{nullptr};
164 ATH_CHECK(SG::get(egammaTruthParticles, m_egammaTruthKey, ctx));
165
166 for (const xAOD::TruthParticle* egTruthParticle : *egammaTruthParticles) {
167
168 static const SG::AuxElement::ConstAccessor<int> accType("truthType");
169
170 if (!accType.isAvailable(*egTruthParticle) ||
171 accType(*egTruthParticle) != MCTruthPartClassifier::IsoElectron ||
172 std::abs(egTruthParticle->eta()) > m_etaMaxEgTruth) {
173 continue;
174 }
175 // Only isolated true electrons
176 using TruthLink_t = ElementLink<xAOD::TruthParticleContainer>;
177 static const SG::AuxElement::ConstAccessor<TruthLink_t> linkToTruth(
178 "truthParticleLink");
179 if (!linkToTruth.isAvailable(*egTruthParticle)) {
180 continue;
181 }
182
183 const TruthLink_t& truthegamma = linkToTruth(*egTruthParticle);
184 if (!truthegamma.isValid()) {
185 continue;
186 }
187 egammaTruthIndices.push_back((*truthegamma)->index());
188 }
189 }
190
191 // Set up masks
192 std::vector<bool> particleMask, vertexMask;
193 int nTruthParticles = truthParticles->size();
194 int nTruthVertices = truthVertices->size();
195 m_nParticlesProcessed.fetch_add(nTruthParticles, std::memory_order_relaxed);
196 m_nVerticesProcessed.fetch_add(nTruthVertices, std::memory_order_relaxed);
197 particleMask.assign(nTruthParticles, false);
198 vertexMask.assign(nTruthVertices, false);
199
200 // Vector of pairs keeping track of how many incoming/outgoing particles each
201 // vertex has
202 std::vector<std::pair<int, int>> vertexLinksCounts;
203 for (const auto *vertex : *truthVertices) {
204 std::pair<int, int> tmpPair;
205 tmpPair.first = vertex->nIncomingParticles();
206 tmpPair.second = vertex->nOutgoingParticles();
207 vertexLinksCounts.push_back(tmpPair);
208 }
209
210 // Loop over truth particles and update mask
211 std::unordered_set<int> encounteredUniqueIDs; // for loop protection
212 for (int i = 0; i < nTruthParticles; ++i) {
213 encounteredUniqueIDs.clear();
214 const xAOD::TruthParticle* particle = (*truthParticles)[i];
215 // Retain status 1 BSM particles and descendants
216 if (MC::isBSM(particle) && MC::isStable(particle)) {
217 descendants(particle, particleMask, encounteredUniqueIDs);
218 encounteredUniqueIDs.clear();
219 }
220 // Retain children of longer-lived generator particles
221 if (MC::isStable(particle)) {
222 int pdgId = abs(particle->pdgId());
223 if (std::find(m_longlived.begin(), m_longlived.end(), pdgId) !=
224 m_longlived.end()) {
225 const xAOD::TruthVertex* decayVtx(nullptr);
226 if (particle->hasDecayVtx()) {
227 decayVtx = particle->decayVtx();
228 }
229 int nChildren = 0;
230 if (decayVtx)
231 nChildren = decayVtx->nOutgoingParticles();
232 for (int i = 0; i < nChildren; ++i) {
233 particleMask[decayVtx->outgoingParticle(i)->index()] = true;
234 }
235 }
236 }
237
238 // Retain particles and their descendants/ancestors associated with the
239 // reconstructed objects
240 if (std::find(recoParticleTruthIndices.begin(),
241 recoParticleTruthIndices.end(),
242 i) != recoParticleTruthIndices.end()) {
243 if (HepMC::is_simulation_particle(particle)) { // only need to do this for Geant particles since
244 // non-Geant are kept anyway
245 ancestors(particle, particleMask, encounteredUniqueIDs);
246 encounteredUniqueIDs.clear();
247 descendants(particle, particleMask, encounteredUniqueIDs);
248 encounteredUniqueIDs.clear();
249 }
250 }
251
252 // Retain particles and their descendants associated with the egamma Truth
253 // Particles
254 if (std::find(egammaTruthIndices.begin(), egammaTruthIndices.end(), i) !=
255 egammaTruthIndices.end()) {
256 descendants(particle, particleMask, encounteredUniqueIDs);
257 encounteredUniqueIDs.clear();
258 }
259
260 if (!HepMC::is_simulation_particle(particle)) {
261 particleMask[i] = true;
262 }
263 else {
264 // deal with the products of interactions of quasi-stable
265 // particles
266 if (particle->hasProdVtx()) {
267 const xAOD::TruthVertex* prodVtx = particle->prodVtx();
268 const int nParents = prodVtx->nIncomingParticles();
269 for (int parent = 0; parent < nParents; ++parent) {
270 if (MC::isDecayed(prodVtx->incomingParticle(parent))) {
271 // "simulation particle" with a parent with status==2 was
272 // produced via the interaction of a quasi-stable particle
273 // with the detector material. Such particles should be kept.
274 particleMask[i] = true;
275 break;
276 }
277 }
278 }
279 }
280 }
281
282 // Loop over the mask and update vertex association counters
283 for (int i = 0; i < nTruthParticles; ++i) {
284 if (!particleMask[i]) {
286 const xAOD::TruthParticle* particle = (*truthParticles)[i];
287 if (particle->hasProdVtx()) {
288 const auto *prodVertex = particle->prodVtx();
289 --vertexLinksCounts[prodVertex->index()].second;
290 }
291 if (particle->hasDecayVtx()) {
292 const auto *decayVertex = particle->decayVtx();
293 --vertexLinksCounts[decayVertex->index()].first;
294 }
295 }
296 }
297
298 // Loop over truth vertices and update mask
299 // Those for which all incoming and outgoing particles are to be thinned, will
300 // be thinned as well
301 unsigned int nVerticesThinned = 0;
302 for (int i = 0; i < nTruthVertices; ++i) {
303 if (vertexLinksCounts[i].first != 0 || vertexLinksCounts[i].second != 0) {
304 vertexMask[i] = true;
305 } else {
306 ++nVerticesThinned;
307 }
308 }
309 m_nVerticesThinned.fetch_add(nVerticesThinned, std::memory_order_relaxed);
310 // Apply masks to thinning
311 truthParticles.keep(particleMask);
312 truthVertices.keep(vertexMask);
313
314 return StatusCode::SUCCESS;
315}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
ElementLink< xAOD::TruthParticleContainer > TruthLink_t
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsKey
std::atomic< unsigned long > m_nParticlesThinned
std::atomic< unsigned long > m_nVerticesProcessed
std::atomic< unsigned long > m_nVerticesThinned
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_egammaTruthKey
SG::ThinningHandleKey< xAOD::TruthVertexContainer > m_truthVerticesKey
Gaudi::Property< std::vector< int > > m_longlived
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey
std::atomic< unsigned long > m_nEventsProcessed
Counters.
Gaudi::Property< bool > m_keepMuons
Gaudi::Property< bool > m_keepEGamma
std::atomic< unsigned long > m_nParticlesProcessed
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticlesKey
Gaudi::Property< float > m_etaMaxEgTruth
SG::ReadHandleKey< xAOD::ElectronContainer > m_fwdElectronsKey
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
size_t nIncomingParticles() const
Get the number of incoming particles.
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 isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isDecayed(const T &p)
Identify if the particle decayed.
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Electron_v1 Electron
Definition of the current "egamma version".

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

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

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ finalize()

StatusCode ThinGeantTruthAlg::finalize ( )
overridevirtual

Definition at line 73 of file ThinGeantTruthAlg.cxx.

74{
75 ATH_MSG_INFO("Processed " << m_nEventsProcessed << " events containing "
76 << m_nParticlesProcessed << " truth particles and "
77 << m_nVerticesProcessed << " truth vertices ");
79 << " Geant truth particles and " << m_nVerticesThinned
80 << " corresponding truth vertices ");
81 return StatusCode::SUCCESS;
82}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode ThinGeantTruthAlg::initialize ( )
overridevirtual

Definition at line 41 of file ThinGeantTruthAlg.cxx.

42{
43 if (m_streamName.empty()) {
44 ATH_MSG_ERROR("StreamName property was not initialized.");
45 return StatusCode::FAILURE;
46 }
47
53 ATH_CHECK(m_muonsKey.initialize(m_keepMuons));
55 if (m_keepEGamma) {
58 if (!m_fwdElectronsKey.empty()){
60 }
61 }
62 if (!m_muonsKey.empty()){
64 }
65
66 ATH_CHECK(m_readDecorKeys.initialize());
67
68
69 return StatusCode::SUCCESS;
70}
#define ATH_MSG_ERROR(x)
Gaudi::Property< std::string > m_truthLinkDecor
Truth particle link decorations.
StringProperty m_streamName
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_readDecorKeys
Schedule the algorithm's dependency on the truth particle link.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

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.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

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.

◆ renounce()

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 > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
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()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_WARNING(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_egammaTruthKey

SG::ReadHandleKey<xAOD::TruthParticleContainer> ThinGeantTruthAlg::m_egammaTruthKey
private
Initial value:
{
this,
"EGammaTruthKey",
"egammaTruthParticles",
"Name of the input egammaTruth container"
}

Definition at line 111 of file ThinGeantTruthAlg.h.

111 {
112 this,
113 "EGammaTruthKey",
114 "egammaTruthParticles",
115 "Name of the input egammaTruth container"
116 };

◆ m_electronsKey

SG::ReadHandleKey<xAOD::ElectronContainer> ThinGeantTruthAlg::m_electronsKey
private
Initial value:
{
this,
"ElectronsKey",
"Electrons",
"Name of the input electron container"
}

Definition at line 87 of file ThinGeantTruthAlg.h.

87 {
88 this,
89 "ElectronsKey",
90 "Electrons",
91 "Name of the input electron container"
92 };

◆ m_etaMaxEgTruth

Gaudi::Property<float> ThinGeantTruthAlg::m_etaMaxEgTruth
private
Initial value:
{ this,
"EtaMaxEGammaTruth",
2.525,
"Max eta value for e-gamma truth particles" }

Definition at line 52 of file ThinGeantTruthAlg.h.

52 { this,
53 "EtaMaxEGammaTruth",
54 2.525,
55 "Max eta value for e-gamma truth particles" };

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_fwdElectronsKey

SG::ReadHandleKey<xAOD::ElectronContainer> ThinGeantTruthAlg::m_fwdElectronsKey
private
Initial value:
{
this,
"FwdElectronsKey",
"",
"Name of the input forward electron container"
}

Definition at line 94 of file ThinGeantTruthAlg.h.

94 {
95 this,
96 "FwdElectronsKey",
97 "",
98 "Name of the input forward electron container"
99 };

◆ m_keepEGamma

Gaudi::Property<bool> ThinGeantTruthAlg::m_keepEGamma { this, "keepEGamma", true }
private

Definition at line 58 of file ThinGeantTruthAlg.h.

58{ this, "keepEGamma", true };

◆ m_keepMuons

Gaudi::Property<bool> ThinGeantTruthAlg::m_keepMuons { this, "keepMuons", true }
private

Definition at line 57 of file ThinGeantTruthAlg.h.

57{ this, "keepMuons", true };

◆ m_longlived

Gaudi::Property<std::vector<int> > ThinGeantTruthAlg::m_longlived
private
Initial value:
{
this,
"LongLivedParticleList",
{ 310, 3122, 3222, 3112, 3322, 3312 },
"List of long lifetime particles which are likely to be decayed by "
"Geant but whose children must be kept"
}

Definition at line 65 of file ThinGeantTruthAlg.h.

65 {
66 this,
67 "LongLivedParticleList",
68 { 310, 3122, 3222, 3112, 3322, 3312 },
69 "List of long lifetime particles which are likely to be decayed by "
70 "Geant but whose children must be kept"
71 };

◆ m_muonsKey

SG::ReadHandleKey<xAOD::MuonContainer> ThinGeantTruthAlg::m_muonsKey { this, "MuonsKey", "Muons", "Name of the input muon container" }
private

Definition at line 109 of file ThinGeantTruthAlg.h.

109{ this, "MuonsKey", "Muons", "Name of the input muon container" };

◆ m_nEventsProcessed

std::atomic<unsigned long> ThinGeantTruthAlg::m_nEventsProcessed {}
mutableprivate

Counters.

Definition at line 119 of file ThinGeantTruthAlg.h.

119{};

◆ m_nParticlesProcessed

std::atomic<unsigned long> ThinGeantTruthAlg::m_nParticlesProcessed {}
mutableprivate

Definition at line 120 of file ThinGeantTruthAlg.h.

120{};

◆ m_nParticlesThinned

std::atomic<unsigned long> ThinGeantTruthAlg::m_nParticlesThinned {}
mutableprivate

Definition at line 122 of file ThinGeantTruthAlg.h.

122{};

◆ m_nVerticesProcessed

std::atomic<unsigned long> ThinGeantTruthAlg::m_nVerticesProcessed {}
mutableprivate

Definition at line 121 of file ThinGeantTruthAlg.h.

121{};

◆ m_nVerticesThinned

std::atomic<unsigned long> ThinGeantTruthAlg::m_nVerticesThinned {}
mutableprivate

Definition at line 123 of file ThinGeantTruthAlg.h.

123{};

◆ m_photonsKey

SG::ReadHandleKey<xAOD::PhotonContainer> ThinGeantTruthAlg::m_photonsKey
private
Initial value:
{
this,
"PhotonsKey",
"Photons",
"Name of the input photon container"
}

Definition at line 101 of file ThinGeantTruthAlg.h.

101 {
102 this,
103 "PhotonsKey",
104 "Photons",
105 "Name of the input photon container"
106 };

◆ m_readDecorKeys

SG::ReadDecorHandleKeyArray<xAOD::IParticleContainer> ThinGeantTruthAlg::m_readDecorKeys {this, "DecorKeys", {}}
private

Schedule the algorithm's dependency on the truth particle link.

Definition at line 63 of file ThinGeantTruthAlg.h.

63{this, "DecorKeys", {}};

◆ m_streamName

StringProperty ThinGeantTruthAlg::m_streamName
private
Initial value:
{ this,
"StreamName",
"",
"Stream for which thinning is to be done." }

Definition at line 47 of file ThinGeantTruthAlg.h.

47 { this,
48 "StreamName",
49 "",
50 "Stream for which thinning is to be done." };

◆ m_truthLinkDecor

Gaudi::Property<std::string> ThinGeantTruthAlg::m_truthLinkDecor {this, "TruthLinkDecor", "truthParticleLink"}
private

Truth particle link decorations.

Definition at line 61 of file ThinGeantTruthAlg.h.

61{this, "TruthLinkDecor", "truthParticleLink"};

◆ m_truthParticlesKey

SG::ThinningHandleKey<xAOD::TruthParticleContainer> ThinGeantTruthAlg::m_truthParticlesKey
private
Initial value:
{
this,
"TruthParticlesKey",
"TruthParticles",
"Name of the input Truth Particle container"
}

Definition at line 73 of file ThinGeantTruthAlg.h.

73 {
74 this,
75 "TruthParticlesKey",
76 "TruthParticles",
77 "Name of the input Truth Particle container"
78 };

◆ m_truthVerticesKey

SG::ThinningHandleKey<xAOD::TruthVertexContainer> ThinGeantTruthAlg::m_truthVerticesKey
private
Initial value:
{
this,
"TruthVerticesKey",
"TruthVertices",
"Name of the input Truth Vertices container"
}

Definition at line 80 of file ThinGeantTruthAlg.h.

80 {
81 this,
82 "TruthVerticesKey",
83 "TruthVertices",
84 "Name of the input Truth Vertices container"
85 };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: