|
ATLAS Offline Software
|
#include <ThinGeantTruthAlg.h>
|
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. More...
|
|
void | descendants (const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const |
|
| AthReentrantAlgorithm (const std::string &name, ISvcLocator *pSvcLocator) |
| Constructor with parameters: More...
|
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual bool | isClonable () const override |
| Specify if the algorithm is clonable. More...
|
|
virtual unsigned int | cardinality () const override |
| Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant. More...
|
|
virtual StatusCode | sysExecute (const EventContext &ctx) override |
| Execute an algorithm. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
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 . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Definition at line 29 of file ThinGeantTruthAlg.h.
◆ StoreGateSvc_t
◆ ancestors()
void ThinGeantTruthAlg::ancestors |
( |
const xAOD::TruthParticle * |
pHead, |
|
|
std::vector< bool > & |
particleMask, |
|
|
std::unordered_set< int > & |
encounteredUniqueIDs |
|
) |
| const |
Inline method.
Definition at line 307 of file ThinGeantTruthAlg.cxx.
313 std::unordered_set<int>::const_iterator
found =
315 if (
found != encounteredUniqueIDs.end())
320 int headIndex = pHead->
index();
321 particleMask[headIndex] =
true;
333 for (
int i = 0;
i < nParents; ++
i)
334 ancestors(prodVtx->incomingParticle(
i), particleMask, encounteredUniqueIDs);
◆ AthReentrantAlgorithm()
AthReentrantAlgorithm::AthReentrantAlgorithm |
Constructor with parameters:
Definition at line 90 of file AthReentrantAlgorithm.cxx.
30 std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
32 std::move (m_updateDataHandles));
◆ cardinality()
unsigned int AthReentrantAlgorithm::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.
Override this to return 0 for reentrant algorithms.
Definition at line 55 of file AthReentrantAlgorithm.cxx.
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ descendants()
void ThinGeantTruthAlg::descendants |
( |
const xAOD::TruthParticle * |
pHead, |
|
|
std::vector< bool > & |
particleMask, |
|
|
std::unordered_set< int > & |
encounteredUniqueIDs |
|
) |
| const |
Definition at line 342 of file ThinGeantTruthAlg.cxx.
348 std::unordered_set<int>::const_iterator
found =
350 if (
found != encounteredUniqueIDs.end())
355 int headIndex = pHead->
index();
356 particleMask[headIndex] =
true;
368 for (
int i = 0;
i < nChildren; ++
i) {
370 decayVtx->outgoingParticle(
i), particleMask, encounteredUniqueIDs);
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode ThinGeantTruthAlg::execute |
( |
const EventContext & |
ctx | ) |
const |
|
finaloverridevirtual |
Definition at line 72 of file ThinGeantTruthAlg.cxx.
82 if (!truthParticles.isValid()) {
84 return StatusCode::FAILURE;
86 if (!truthVertices.isValid()) {
88 return StatusCode::FAILURE;
93 std::vector<int> recoParticleTruthIndices;
94 std::vector<int> egammaTruthIndices{};
100 if (!muons.isValid()) {
107 recoParticleTruthIndices.push_back(
truthMuon->index());
124 recoParticleTruthIndices.push_back(truthElectron->
index());
132 if (!fwdElectrons.isValid()) {
140 recoParticleTruthIndices.push_back(truthElectron->
index());
147 if (!photons.isValid()) {
155 recoParticleTruthIndices.push_back(truthPhoton->
index());
162 if (!egammaTruthParticles.isValid()) {
170 if (!accType.isAvailable(*egTruthParticle) ||
171 accType(*egTruthParticle) != MCTruthPartClassifier::IsoElectron ||
178 "truthParticleLink");
179 if (!linkToTruth.isAvailable(*egTruthParticle)) {
183 const TruthLink_t& truthegamma = linkToTruth(*egTruthParticle);
187 egammaTruthIndices.push_back((*truthegamma)->index());
192 std::vector<bool> particleMask, vertexMask;
193 int nTruthParticles = truthParticles->size();
194 int nTruthVertices = truthVertices->size();
197 particleMask.assign(nTruthParticles,
false);
198 vertexMask.assign(nTruthVertices,
false);
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);
211 std::unordered_set<int> encounteredUniqueIDs;
212 for (
int i = 0;
i < nTruthParticles; ++
i) {
213 encounteredUniqueIDs.clear();
218 encounteredUniqueIDs.clear();
231 nChildren = decayVtx->nOutgoingParticles();
232 for (
int i = 0;
i < nChildren; ++
i) {
233 particleMask[decayVtx->outgoingParticle(
i)->index()] =
true;
240 if (
std::find(recoParticleTruthIndices.begin(),
241 recoParticleTruthIndices.end(),
242 i) != recoParticleTruthIndices.end()) {
246 encounteredUniqueIDs.clear();
248 encounteredUniqueIDs.clear();
254 if (
std::find(egammaTruthIndices.begin(), egammaTruthIndices.end(),
i) !=
255 egammaTruthIndices.end()) {
257 encounteredUniqueIDs.clear();
261 particleMask[
i] =
true;
266 for (
int i = 0;
i < nTruthParticles; ++
i) {
267 if (!particleMask[
i]) {
271 const auto *prodVertex =
particle->prodVtx();
272 --vertexLinksCounts[prodVertex->index()].second;
275 const auto *decayVertex =
particle->decayVtx();
276 --vertexLinksCounts[decayVertex->index()].first;
284 unsigned int nVerticesThinned = 0;
285 for (
int i = 0;
i < nTruthVertices; ++
i) {
286 if (vertexLinksCounts[
i].
first != 0 || vertexLinksCounts[
i].
second != 0) {
287 vertexMask[
i] =
true;
294 truthParticles.keep(particleMask);
295 truthVertices.keep(vertexMask);
297 return StatusCode::SUCCESS;
◆ 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
◆ extraOutputDeps()
const DataObjIDColl & AthReentrantAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 79 of file AthReentrantAlgorithm.cxx.
86 return Algorithm::extraOutputDeps();
◆ filterPassed()
virtual bool AthReentrantAlgorithm::filterPassed |
( |
const EventContext & |
ctx | ) |
const |
|
inlinevirtualinherited |
◆ finalize()
StatusCode ThinGeantTruthAlg::finalize |
( |
| ) |
|
|
overridevirtual |
Definition at line 60 of file ThinGeantTruthAlg.cxx.
67 <<
" corresponding truth vertices ");
68 return StatusCode::SUCCESS;
◆ initialize()
StatusCode ThinGeantTruthAlg::initialize |
( |
| ) |
|
|
overridevirtual |
◆ 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.
◆ isClonable()
bool AthReentrantAlgorithm::isClonable |
( |
| ) |
const |
|
overridevirtualinherited |
Specify if the algorithm is clonable.
Reentrant algorithms are clonable.
Reimplemented in Simulation::BeamEffectsAlg, InDet::SiTrackerSpacePointFinder, InDet::SCT_Clusterization, InDet::SiSPSeededTrackFinder, SCTRawDataProvider, InDet::GNNSeedingTrackMaker, SCT_PrepDataToxAOD, RoIBResultToxAOD, SCT_CablingCondAlgFromCoraCool, SCT_ReadCalibDataTestAlg, SCT_CablingCondAlgFromText, InDet::SiSPGNNTrackMaker, SCT_ReadCalibChipDataTestAlg, SCT_TestCablingAlg, SCT_ConfigurationConditionsTestAlg, ITkPixelCablingAlg, ITkStripCablingAlg, SCTEventFlagWriter, SCT_ConditionsSummaryTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_TdaqEnabledTestAlg, SCT_SiliconConditionsTestAlg, SCTSiLorentzAngleTestAlg, SCT_ByteStreamErrorsTestAlg, SCT_ConditionsParameterTestAlg, SCT_FlaggedConditionTestAlg, SCT_StripVetoTestAlg, SCT_RawDataToxAOD, and SCTSiPropertiesTestAlg.
Definition at line 44 of file AthReentrantAlgorithm.cxx.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ 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.
◆ renounce()
◆ renounceArray()
◆ setFilterPassed()
virtual void AthReentrantAlgorithm::setFilterPassed |
( |
bool |
state, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
inlinevirtualinherited |
◆ sysExecute()
StatusCode AthReentrantAlgorithm::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 67 of file AthReentrantAlgorithm.cxx.
69 return Gaudi::Algorithm::sysExecute (ctx);
◆ sysInitialize()
StatusCode AthReentrantAlgorithm::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 InputMakerBase, and HypoBase.
Definition at line 96 of file AthReentrantAlgorithm.cxx.
107 if ( cs.retrieve().isFailure() ) {
109 return StatusCode::SUCCESS;
111 if (cs->regHandle(
this,*
h).isFailure()) {
112 sc = StatusCode::FAILURE;
113 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
◆ 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()
◆ m_detStore
◆ m_egammaTruthKey
Initial value:{
this,
"EGammaTruthKey",
"egammaTruthParticles",
"Name of the input egammaTruth container"
}
Definition at line 105 of file ThinGeantTruthAlg.h.
◆ m_electronsKey
Initial value:{
this,
"ElectronsKey",
"Electrons",
"Name of the input electron container"
}
Definition at line 81 of file ThinGeantTruthAlg.h.
◆ 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 51 of file ThinGeantTruthAlg.h.
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthReentrantAlgorithm::m_extendedExtraObjects |
|
privateinherited |
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
Empty if no symlinks were found.
Definition at line 153 of file AthReentrantAlgorithm.h.
◆ m_fwdElectronsKey
Initial value:{
this,
"FwdElectronsKey",
"",
"Name of the input forward electron container"
}
Definition at line 88 of file ThinGeantTruthAlg.h.
◆ m_keepEGamma
Gaudi::Property<bool> ThinGeantTruthAlg::m_keepEGamma { this, "keepEGamma", true } |
|
private |
◆ m_keepMuons
Gaudi::Property<bool> ThinGeantTruthAlg::m_keepMuons { this, "keepMuons", true } |
|
private |
◆ 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 59 of file ThinGeantTruthAlg.h.
◆ m_muonsKey
◆ m_nEventsProcessed
std::atomic<unsigned long> ThinGeantTruthAlg::m_nEventsProcessed {} |
|
mutableprivate |
◆ m_nParticlesProcessed
std::atomic<unsigned long> ThinGeantTruthAlg::m_nParticlesProcessed {} |
|
mutableprivate |
◆ m_nParticlesThinned
std::atomic<unsigned long> ThinGeantTruthAlg::m_nParticlesThinned {} |
|
mutableprivate |
◆ m_nVerticesProcessed
std::atomic<unsigned long> ThinGeantTruthAlg::m_nVerticesProcessed {} |
|
mutableprivate |
◆ m_nVerticesThinned
std::atomic<unsigned long> ThinGeantTruthAlg::m_nVerticesThinned {} |
|
mutableprivate |
◆ m_photonsKey
Initial value:{
this,
"PhotonsKey",
"Photons",
"Name of the input photon container"
}
Definition at line 95 of file ThinGeantTruthAlg.h.
◆ m_streamName
StringProperty ThinGeantTruthAlg::m_streamName |
|
private |
Initial value:{ this,
"StreamName",
"",
"Stream for which thinning is to be done." }
Definition at line 46 of file ThinGeantTruthAlg.h.
◆ m_truthParticlesKey
Initial value:{
this,
"TruthParticlesKey",
"TruthParticles",
"Name of the input Truth Particle container"
}
Definition at line 67 of file ThinGeantTruthAlg.h.
◆ m_truthVerticesKey
Initial value:{
this,
"TruthVerticesKey",
"TruthVertices",
"Name of the input Truth Vertices container"
}
Definition at line 74 of file ThinGeantTruthAlg.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
size_t nOutgoingParticles() const
Get the number of outgoing particles.
Gaudi::Property< float > m_etaMaxEgTruth
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
void descendants(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
std::string find(const std::string &s)
return a remapped string
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticlesKey
Helper class to provide constant type-safe access to aux data.
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronsKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonsKey
bool isValid() const
Test to see if the link can be dereferenced.
std::atomic< unsigned long > m_nParticlesThinned
Handle for requesting thinning for a data object.
virtual void setOwner(IDataHandleHolder *o)=0
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonsKey
bool hasDecayVtx() const
Check for a decay vertex on this particle.
void ancestors(const xAOD::TruthParticle *, std::vector< bool > &, std::unordered_set< int > &) const
Inline method.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
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...
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
bool hasProdVtx() const
Check for a production vertex on this particle.
Gaudi::Property< std::vector< int > > m_longlived
SG::ThinningHandleKey< xAOD::TruthVertexContainer > m_truthVerticesKey
Gaudi::Property< bool > m_keepEGamma
SG::ReadHandleKey< xAOD::ElectronContainer > m_fwdElectronsKey
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
size_t index() const
Return the index of this element within its container.
DataObjIDColl m_extendedExtraObjects
Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
ElementLink implementation for ROOT usage.
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Class describing a truth vertex in the MC record.
std::atomic< unsigned long > m_nVerticesProcessed
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
virtual StatusCode sysInitialize() override
Override sysInitialize.
std::atomic< unsigned long > m_nEventsProcessed
Counters.
std::atomic< unsigned long > m_nParticlesProcessed
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
#define ATH_MSG_WARNING(x)
size_t nIncomingParticles() const
Get the number of incoming particles.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_egammaTruthKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Gaudi::Property< bool > m_keepMuons
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
std::atomic< unsigned long > m_nVerticesThinned
StringProperty m_streamName