|
ATLAS Offline Software
|
Core Athena algorithm for the Integrated Simulation Framework.
More...
#include <SimKernelMT.h>
|
| SimKernelMT (const std::string &name, ISvcLocator *pSvcLocator) |
| Implements standard AthAlgorithm constructor. More...
|
|
virtual | ~SimKernelMT () |
| Implements empty destructor. More...
|
|
StatusCode | initialize () override |
| Check user configuration and configure the algorithm state accordingly. More...
|
|
StatusCode | execute () override |
| Check the validity of the MC truth event in the current Athena event. More...
|
|
StatusCode | finalize () override |
| Implements empty finalize (implementation required by AthAlgorithm) More...
|
|
bool | isClonable () const override |
|
virtual StatusCode | sysInitialize () override |
| Override sysInitialize. More...
|
|
virtual const DataObjIDColl & | extraOutputDeps () const override |
| Return the list of extra output dependencies. More...
|
|
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 |
|
|
SG::ReadHandleKey< McEventCollection > | m_inputEvgenKey {this, "InputEvgenCollection", "", "Input EVGEN collection."} |
| Input Generator Truth collection. More...
|
|
SG::WriteHandleKey< McEventCollection > | m_outputTruthKey {this, "OutputTruthCollection", "", "Output Truth collection."} |
| Output Simulation Truth collection. More...
|
|
SG::WriteHandleKey< TrackRecordCollection > | m_caloEntryLayerKey {this, "CaloEntryLayerKey", "CaloEntryLayer", ""} |
| Output TrackRecordCollections. More...
|
|
SG::WriteHandleKey< TrackRecordCollection > | m_muonEntryLayerKey {this, "MuonEntryLayerKey", "MuonEntryLayer", ""} |
|
SG::WriteHandleKey< TrackRecordCollection > | m_muonExitLayerKey {this, "MuonExitLayerKey", "MuonExitLayer", ""} |
|
BooleanProperty | m_useShadowEvent {this, "UseShadowEvent", false, "New approach to selecting particles for simulation" } |
|
Gaudi::Property< bool > | m_forceGeoIDSvc {this, "AlwaysUseGeoIDSvc", false, "Force geoID recalculation for each particle" } |
| Force geoID recalculation for each particle. More...
|
|
ToolHandle< IGenEventFilter > | m_truthPreselectionTool {this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"} |
|
ServiceHandle< IInputConverter > | m_inputConverter {this, "InputConverter", "", "Input McEventCollection->ISFParticleContainer conversion service."} |
| Input converter service (from Generator->ISF particle types) More...
|
|
ServiceHandle< ITruthSvc > | m_truthRecordSvc {this,"TruthRecordService", "ISF_MC15aPlusTruthService", ""} |
| Central truth service. More...
|
|
ServiceHandle< Simulation::IZeroLifetimePatcher > | m_qspatcher {this, "QuasiStablePatcher", "", "Quasi-Stable Particle Simulation Patcher"} |
| Quasi-Stable Particle Simulation Patcher. More...
|
|
ToolHandleArray< ISimulatorTool > | m_simulationTools {this, "SimulationTools", {}, ""} |
| Simulation Tools. More...
|
|
ISimulatorTool * | m_particleKillerTool {} |
| When no appropriate simulator can be found for a given particle, the particle is sent to this "particle killer": More...
|
|
PublicToolHandle< IEntryLayerTool > | m_entryLayerTool {this, "EntryLayerTool", "ISF_EntryLayerToolMT", ""} |
| AthenaTool responsible for writing Calo/Muon Entry/Exit Layer collection. More...
|
|
ServiceHandle< IGeoIDSvc > | m_geoIDSvc {this, "GeoIDSvc", "", "Service to set particle GeoIDs"} |
| Service to set particle GeoIDs. More...
|
|
ToolHandle< IParticleOrderingTool > | m_orderingTool {this, "ParticleOrderingTool", "", "Tool to set order of particles"} |
| Tool to set particle ordering. More...
|
|
std::array< ToolHandleArray< ISimulationSelector >, AtlasDetDescr::fNumAtlasRegions > | m_simSelectors |
| The simulation selectors defining the "routing chain". More...
|
|
std::map< ISF::SimulationFlavor, ISimulatorTool * > | m_simToolMap |
| Map of the simulation flavours used in this job to the corresponding Simulation Services. More...
|
|
size_t | m_maxParticleVectorSize {10240} |
| Number of particles simultaneously sent to simulator. More...
|
|
DataObjIDColl | m_extendedExtraObjects |
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
Core Athena algorithm for the Integrated Simulation Framework.
This Athena algorithm dispatches all selected particles from the input collection to the attached simulators.
Definition at line 61 of file SimKernelMT.h.
◆ StoreGateSvc_t
◆ SimKernelMT()
ISF::SimKernelMT::SimKernelMT |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~SimKernelMT()
ISF::SimKernelMT::~SimKernelMT |
( |
| ) |
|
|
virtual |
◆ 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);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ 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.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ 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.
338 return PBASE::declareProperty(
name, property,
doc);
◆ 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]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode ISF::SimKernelMT::execute |
( |
| ) |
|
|
override |
Check the validity of the MC truth event in the current Athena event.
- Return values
-
StatusCode::SUCCESS | all HepMC::GenEvents of the current Athena event are valid |
StatusCode::FAILURE | the MC truth collection could not be read |
StatusCode::FAILURE | the MC truth collection does not have a valid tree structure |
Definition at line 132 of file SimKernelMT.cxx.
134 const EventContext& ctx = Gaudi::Hive::currentContext();
139 ATH_MSG_DEBUG(
"Event setup done for " << curSimTool->name() );
144 if (!inputEvgen.isValid()) {
145 ATH_MSG_FATAL(
"Unable to read input GenEvent collection '" << inputEvgen.key() <<
"'");
146 return StatusCode::FAILURE;
151 std::unique_ptr<McEventCollection> shadowTruth{};
153 outputTruth = std::make_unique<McEventCollection>();
155 shadowTruth = std::make_unique<McEventCollection>(*inputEvgen);
156 for (HepMC::GenEvent* currentGenEvent : *shadowTruth ) {
163 outputTruth->push_back(outputEvent.release());
168 outputTruth = std::make_unique<McEventCollection>(*inputEvgen);
171 for (HepMC::GenEvent* currentGenEvent : *outputTruth ) {
186 caloEntryLayer = std::make_unique<TrackRecordCollection>(caloEntryLayer.name());
189 muonEntryLayer = std::make_unique<TrackRecordCollection>(muonEntryLayer.name());
192 muonExitLayer = std::make_unique<TrackRecordCollection>(muonExitLayer.name());
201 for (
auto&
particle : simParticles ) {
205 particle->setOrder( -particleQueue.size() );
213 unsigned int loopCounter{0};
216 ISimulatorTool* lastSimulator{};
218 while ( particleQueue.size() ) {
221 ATH_MSG_VERBOSE(
"Queue starts with " << particleQueue.size() <<
" particles.");
224 while ( particleQueue.size() ) {
225 auto particlePtr = particleQueue.top();
226 ISFParticle& curParticle( *particlePtr );
231 m_geoIDSvc->identifyAndRegNextGeoID( curParticle );
241 lastSimulator=&simTool;
245 tempQueue.push(particlePtr);
251 particleQueue = std::move(tempQueue);
253 if (loopCounter>100 &&
particles.size()<3) {
255 ATH_MSG_INFO(
"Selected " <<
particles.size() <<
" particles to be processed by " << lastSimulator->name());
264 ATH_CHECK( lastSimulator->simulateVector( ctx,
particles, newSecondaries, outputTruth.ptr(), shadowTruth.get() ) );
265 ATH_MSG_VERBOSE(lastSimulator->name() <<
" returned " << newSecondaries.size() <<
" new particles to be added to the queue." );
267 for (
auto* secondary : newSecondaries ) {
272 m_geoIDSvc->identifyAndRegNextGeoID( *secondary );
277 secondary->setOrder( -particleQueue.size() );
282 particleQueue.push( secondary );
284 newSecondaries.clear();
292 ATH_MSG_VERBOSE(
"Final status: queue contains " << particleQueue.size() <<
" particles.");
297 ATH_CHECK(curSimTool->releaseEvent(ctx));
298 ATH_MSG_DEBUG(
"releaseEvent() completed for " << curSimTool->name() );
304 for (HepMC::GenEvent* currentGenEvent : *outputTruth ) {
309 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 & AthAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 50 of file AthAlgorithm.cxx.
57 return Algorithm::extraOutputDeps();
◆ finalize()
StatusCode ISF::SimKernelMT::finalize |
( |
| ) |
|
|
override |
◆ identifySimulator()
Returns the simulator to use for the given particle.
Definition at line 319 of file SimKernelMT.cxx.
323 for (
auto&
selector: localSelectors) {
◆ initialize()
StatusCode ISF::SimKernelMT::initialize |
( |
| ) |
|
|
override |
Check user configuration and configure the algorithm state accordingly.
Definition at line 44 of file SimKernelMT.cxx.
51 const auto flavor = curSimTool->simFlavor();
55 ATH_MSG_FATAL(
"Two ISimulatorTool instances (" << itr->second->name() <<
"," << curSimTool->name() <<
") with the same flavor in this job!\n Check your configuration!");
56 return StatusCode::FAILURE;
67 ATH_MSG_FATAL(
"No fallback ParticleKiller Simulator Tool provided in SimulationTools, the job will bail out now.");
68 return StatusCode::FAILURE;
75 ATH_CHECK( selectorsToolHandleArray.retrieve() );
79 ATH_MSG_INFO(
"The following routing chains are defined:" );
85 for (
auto&
selector : localSelectors )
87 const auto flavor =
selector->simFlavor();
96 ATH_MSG_FATAL(
"No SimulationTool with flavor " << flavor <<
" expected by " <<
selector->name() <<
" found in this job!\n Check your configuration!" );
97 return StatusCode::FAILURE;
128 return StatusCode::SUCCESS;
◆ 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 ISF::SimKernelMT::isClonable |
( |
| ) |
const |
|
inlineoverride |
◆ 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()
◆ sysInitialize()
StatusCode AthAlgorithm::sysInitialize |
( |
| ) |
|
|
overridevirtualinherited |
◆ 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()
◆ ISFTesting::SimKernelMT_test
friend class ISFTesting::SimKernelMT_test |
|
friend |
Allow the test class access to all methods.
Definition at line 64 of file SimKernelMT.h.
◆ m_caloEntryLayerKey
Output TrackRecordCollections.
Definition at line 96 of file SimKernelMT.h.
◆ m_detStore
◆ m_entryLayerTool
PublicToolHandle<IEntryLayerTool> ISF::SimKernelMT::m_entryLayerTool {this, "EntryLayerTool", "ISF_EntryLayerToolMT", ""} |
|
private |
AthenaTool responsible for writing Calo/Muon Entry/Exit Layer collection.
Definition at line 122 of file SimKernelMT.h.
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_forceGeoIDSvc
Gaudi::Property<bool> ISF::SimKernelMT::m_forceGeoIDSvc {this, "AlwaysUseGeoIDSvc", false, "Force geoID recalculation for each particle" } |
|
private |
Force geoID recalculation for each particle.
Definition at line 102 of file SimKernelMT.h.
◆ m_geoIDSvc
ServiceHandle<IGeoIDSvc> ISF::SimKernelMT::m_geoIDSvc {this, "GeoIDSvc", "", "Service to set particle GeoIDs"} |
|
private |
◆ m_inputConverter
Input converter service (from Generator->ISF particle types)
Definition at line 107 of file SimKernelMT.h.
◆ m_inputEvgenKey
◆ m_maxParticleVectorSize
size_t ISF::SimKernelMT::m_maxParticleVectorSize {10240} |
|
private |
Number of particles simultaneously sent to simulator.
Definition at line 137 of file SimKernelMT.h.
◆ m_muonEntryLayerKey
◆ m_muonExitLayerKey
◆ m_orderingTool
ToolHandle<IParticleOrderingTool> ISF::SimKernelMT::m_orderingTool {this, "ParticleOrderingTool", "", "Tool to set order of particles"} |
|
private |
◆ m_outputTruthKey
◆ m_particleKillerTool
When no appropriate simulator can be found for a given particle, the particle is sent to this "particle killer":
Definition at line 119 of file SimKernelMT.h.
◆ m_qspatcher
◆ m_simSelectors
The simulation selectors defining the "routing chain".
Definition at line 131 of file SimKernelMT.h.
◆ m_simToolMap
Map of the simulation flavours used in this job to the corresponding Simulation Services.
Definition at line 134 of file SimKernelMT.h.
◆ m_simulationTools
ToolHandleArray<ISimulatorTool> ISF::SimKernelMT::m_simulationTools {this, "SimulationTools", {}, ""} |
|
private |
◆ m_truthPreselectionTool
ToolHandle<IGenEventFilter> ISF::SimKernelMT::m_truthPreselectionTool {this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"} |
|
private |
◆ m_truthRecordSvc
ServiceHandle<ITruthSvc> ISF::SimKernelMT::m_truthRecordSvc {this,"TruthRecordService", "ISF_MC15aPlusTruthService", ""} |
|
private |
◆ m_useShadowEvent
BooleanProperty ISF::SimKernelMT::m_useShadowEvent {this, "UseShadowEvent", false, "New approach to selecting particles for simulation" } |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
ToolHandleArray< ISimulatorTool > m_simulationTools
Simulation Tools.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
ServiceHandle< IInputConverter > m_inputConverter
Input converter service (from Generator->ISF particle types)
SG::WriteHandleKey< TrackRecordCollection > m_muonExitLayerKey
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
SG::WriteHandleKey< McEventCollection > m_outputTruthKey
Output Simulation Truth collection.
std::priority_queue< ISF::ISFParticle *, ISF::ISFParticleVector, ISF::ISFParticleOrdering > ISFParticleOrderedQueue
the actual particle priority_queue
int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent)
Get the maximal absolute value of barcode of vertex present in the event. Returns a negative number.
std::array< ToolHandleArray< ISimulationSelector >, AtlasDetDescr::fNumAtlasRegions > m_simSelectors
The simulation selectors defining the "routing chain".
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
#define ATH_MSG_VERBOSE(x)
static const char * getName(int region)
ISimulatorTool & identifySimulator(const ISF::ISFParticle &particle)
Returns the simulator to use for the given particle.
virtual void setOwner(IDataHandleHolder *o)=0
ISimulatorTool * m_particleKillerTool
When no appropriate simulator can be found for a given particle, the particle is sent to this "partic...
BooleanProperty m_useShadowEvent
ServiceHandle< ITruthSvc > m_truthRecordSvc
Central truth service.
virtual StatusCode sysInitialize() override
Override sysInitialize.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
size_t m_maxParticleVectorSize
Number of particles simultaneously sent to simulator.
::StatusCode StatusCode
StatusCode definition for legacy code.
ServiceHandle< Simulation::IZeroLifetimePatcher > m_qspatcher
Quasi-Stable Particle Simulation Patcher.
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
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.
virtual void renounce()=0
constexpr int UNDEFINED_ID
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
PublicToolHandle< IEntryLayerTool > m_entryLayerTool
AthenaTool responsible for writing Calo/Muon Entry/Exit Layer collection.
ServiceHandle< IGeoIDSvc > m_geoIDSvc
Service to set particle GeoIDs.
SG::WriteHandleKey< TrackRecordCollection > m_caloEntryLayerKey
Output TrackRecordCollections.
DataObjIDColl m_extendedExtraObjects
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Get the maximal value of barcode of particle present in the event.
#define ATH_MSG_WARNING(x)
Gaudi::Property< bool > m_forceGeoIDSvc
Force geoID recalculation for each particle.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
AthAlgorithm()
Default constructor:
std::map< ISF::SimulationFlavor, ISimulatorTool * > m_simToolMap
Map of the simulation flavours used in this job to the corresponding Simulation Services.
bool validAtlasRegion(AtlasDetDescr::AtlasRegion region)
Check a given AtlasRegion for its validity.
SG::ReadHandleKey< McEventCollection > m_inputEvgenKey
Input Generator Truth collection.
ToolHandle< IParticleOrderingTool > m_orderingTool
Tool to set particle ordering.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
ToolHandle< IGenEventFilter > m_truthPreselectionTool
SG::WriteHandleKey< TrackRecordCollection > m_muonEntryLayerKey