|
ATLAS Offline Software
|
#include <SimKernel.h>
|
| SimKernel (const std::string &name, ISvcLocator *pSvcLocator) |
| Constructor with parameters. More...
|
|
virtual | ~SimKernel () |
| Destructor. More...
|
|
StatusCode | initialize () |
| Athena algorithm's interface method initialize() More...
|
|
StatusCode | execute () |
| Athena algorithm's interface method execute() More...
|
|
StatusCode | finalize () |
| Athena algorithm's interface method finalize() More...
|
|
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 |
|
This is the purely sequential simulation kernel, executed once per event. The ISF::SimKernel is configured by providing:
- one particle stack service (ISF::IParticleMgr )
- one truth record service (ISF::ITruthSvc)
- n simulation services for the subdetector geometries ( ISF::ISimulationSvc )
The AthAlgorithm::initialize() framework call triggers:
- retrieval of the given components, and subsequent inialize() calls on them
- translation of the ServiceHandleArray<ISF::ISimulationSvc> into a std::vector<ISF::ISimulationSvc*> for fast access of the geometry service
The AthAlgorithm::execute() framework call triggers the following sequence of calls :
- (1) the stack filling call to the ParticleMgr
- (2) the setupEvent() calls to the provided components
- (3) the loop over the particle stack
- (4) the releaseEvent() calls to the provided components
- Author
- Andreas.Salzburger -at- cern.ch , Elmar.Ritsch -at- cern.ch
Definition at line 68 of file SimKernel.h.
◆ StoreGateSvc_t
◆ SimKernel()
ISF::SimKernel::SimKernel |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
Constructor with parameters.
Definition at line 35 of file SimKernel.cxx.
61 "Input Hard Scatter EVGEN collection.");
64 "Input Pileup EVGEN collection.");
67 "Output Hard Scatter Truth collection.");
70 "Output Pileup Truth collection.");
73 "Input McEventCollection->ISFParticleContainer conversion service.");
◆ ~SimKernel()
ISF::SimKernel::~SimKernel |
( |
| ) |
|
|
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::SimKernel::execute |
( |
| ) |
|
Athena algorithm's interface method execute()
Definition at line 325 of file SimKernel.cxx.
332 m_memMon->dumpCurrent(
"before 1st event",
false );
333 m_memMon->recordCurrent(
"before 1st event");
339 std::unique_ptr<McEventCollection> shadowTruth{};
340 std::unique_ptr<McEventCollection> shadowPileUpTruth{};
365 for ( ; fSimSvcIter != fSimSvcIterEnd; ++fSimSvcIter ){
366 ISimulationSvc *curSimSvc = (*fSimSvcIter);
370 if( curSimSvc->setupEvent().isFailure() ) {
372 << curSimSvc->simSvcDescriptor() );
375 << curSimSvc->simSvcDescriptor() );
386 unsigned int loopCounter{0};
394 const unsigned int numParticlesLeftInBroker =
m_particleBroker->numParticles();
398 if (numParticles==0)
break;
404 const ISFParticle *firstP =
particles.front();
412 if (loopCounter>100 && numParticles<3) {
423 if (
particle->nextSimID() != simID ) {
424 ATH_MSG_WARNING(
"Particle with SimID " <<
particle->nextSimID() <<
" found in vector with expected ID " << simID );
455 ATH_MSG_WARNING(
"ParticleBroker returned with an error in event finalization." );
461 for ( ; fSimSvcIter != fSimSvcIterEnd; ++fSimSvcIter ){
462 ISimulationSvc *curSimSvc = (*fSimSvcIter);
466 if( curSimSvc->releaseEvent().isFailure() ) {
468 << curSimSvc->simSvcDescriptor() );
471 << curSimSvc->simSvcDescriptor() );
478 ATH_MSG_FATAL(
"Event finalize failed for TruthService. Abort." );
479 return StatusCode::FAILURE;
492 while (eventFilter != endOfEventFilters) {
493 if (!((**eventFilter).eventPassesFilter())) {
494 setFilterPassed(
false);
495 ATH_MSG_INFO(
"This event failed the " << (**eventFilter).name() <<
" Filter. Therefore it will not be recorded.");
507 std::string
descr(
"after event " + evtStr);
521 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::SimKernel::finalize |
( |
| ) |
|
Athena algorithm's interface method finalize()
Definition at line 191 of file SimKernel.cxx.
201 ATH_MSG_INFO(
" ========================= ISF Timing Stats =========================");
204 ATH_MSG_INFO(
"Breakdown of simulation loop by SimulatorID:");
213 <<
"\t\tn="<<
count<<
"\t\tt=" <<time_ms<<
" ms\t\tt/n="<<time_ms/
count<<
" ms"
214 <<std::setprecision(-1) );
263 ATH_MSG_INFO(
" ====================== ISF Memory Usage Stats =======================");
264 m_memMon->dumpSummary(
"end of ISF event");
267 ATH_MSG_INFO(
" =====================================================================");
269 return StatusCode::SUCCESS;
◆ initialize()
StatusCode ISF::SimKernel::initialize |
( |
| ) |
|
Athena algorithm's interface method initialize()
Definition at line 103 of file SimKernel.cxx.
106 ATH_MSG_VERBOSE (
"--------------------------------------------------------" );
115 m_memMon->recordCurrent(
"at beginning of SimKernel initialize()");
154 ATH_MSG_INFO(
"The following Event Filters are defined:");
161 ATH_MSG_INFO (
"The following SimulationSvc are registered to ISF:");
172 ATH_MSG_INFO(
"The following routing chains are defined:");
187 return StatusCode::SUCCESS;
◆ initSimSvcs()
Definition at line 273 of file SimKernel.cxx.
276 if ( simSelectorTools.retrieve().isFailure() ) {
277 ATH_MSG_FATAL(
"Could not retrieve SimulatorSelector Tool Array. Abort." );
278 return StatusCode::FAILURE;
284 for ( ; fSimSelectorIter != fSimSelectorIterEnd; ++fSimSelectorIter ) {
289 if ( (*curSimulator).retrieve().isFailure() ){
290 ATH_MSG_FATAL(
"Could not retrieve SimulatorSelector Tool. Abort." );
291 return StatusCode::FAILURE;
293 ATH_MSG_INFO(
"- SimulationSelector : " << fSimSelectorIter->typeAndName() );
297 ATH_MSG_FATAL(
"Unable to register ParticleService to SimulationService "
299 return StatusCode::FAILURE;
303 SimSvcID curID = (*curSimulator)->simSvcID();
321 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.
◆ 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.
◆ prepareInput()
Convert input generator particles to ISFParticles and copy input generator truth collection into output simulation truth collection.
Definition at line 527 of file SimKernel.cxx.
533 ATH_MSG_FATAL(
"Unable to read input GenEvent collection '" << inputTruth.
key() <<
"'");
534 return StatusCode::FAILURE;
538 outputTruth = std::make_unique<McEventCollection>();
540 shadowTruth = std::make_unique<McEventCollection>(*inputTruth);
541 for (HepMC::GenEvent* currentGenEvent : *shadowTruth ) {
548 outputTruth->
push_back(outputEvent.release());
553 outputTruth = std::make_unique<McEventCollection>(*inputTruth);
557 for (HepMC::GenEvent* currentGenEvent : *outputTruth ) {
564 return StatusCode::SUCCESS;
◆ 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()
◆ m_benchSimID
◆ m_detStore
◆ m_doCPUMon
bool ISF::SimKernel::m_doCPUMon |
|
private |
◆ m_doMemMon
bool ISF::SimKernel::m_doMemMon |
|
private |
◆ m_eventFilters
◆ m_evtStore
◆ m_extendedExtraObjects
DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_inputConverter
◆ m_inputHardScatterEvgen
Input/output truth collections and input conversion.
input hard scatter collection
Definition at line 96 of file SimKernel.h.
◆ m_inputPileupEvgen
input pileup collection
Definition at line 97 of file SimKernel.h.
◆ m_maxParticleVectorSize
size_t ISF::SimKernel::m_maxParticleVectorSize |
|
private |
tuning
number of particles simultaneously sent to simulator
Definition at line 143 of file SimKernel.h.
◆ m_memMon
◆ m_memUsageEvts
unsigned int ISF::SimKernel::m_memUsageEvts |
|
private |
◆ m_numISFEvents
unsigned int ISF::SimKernel::m_numISFEvents |
|
private |
keep track of the number of events processed
Definition at line 131 of file SimKernel.h.
◆ m_numParticles
long int ISF::SimKernel::m_numParticles |
|
private |
Statistics.
total number of particles handled by ISF
Definition at line 140 of file SimKernel.h.
◆ m_numSimSvcs
total number of SimSvcs used
Definition at line 128 of file SimKernel.h.
◆ m_outputHardScatterTruth
output hard scatter truth collection
Definition at line 98 of file SimKernel.h.
◆ m_outputPileupTruth
output pileup truth collection
Definition at line 99 of file SimKernel.h.
◆ m_particleBroker
Central particle broker service.
Definition at line 107 of file SimKernel.h.
◆ m_qspatcher
◆ m_simSelectors
◆ m_simSvcNames
std::vector<std::string> ISF::SimKernel::m_simSvcNames |
|
private |
◆ m_simSvcs
Simulators to be used.
SimSvc handles
Definition at line 126 of file SimKernel.h.
◆ m_truthPreselectionTool
ToolHandle<IGenEventFilter> ISF::SimKernel::m_truthPreselectionTool {this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"} |
|
private |
◆ m_truthRecordSvc
◆ m_useShadowEvent
BooleanProperty ISF::SimKernel::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:
ServiceHandle< Simulation::IZeroLifetimePatcher > m_qspatcher
Quasi-Stable Particle Simulation Patcher.
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
JetConstituentVector::iterator iterator
SG::WriteHandle< McEventCollection > m_outputPileupTruth
output pileup truth collection
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
ServiceHandle< ITruthSvc > m_truthRecordSvc
Central truth service.
ISF::SimSvcID m_numSimSvcs
total number of SimSvcs used
unsigned int m_numISFEvents
keep track of the number of events processed
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
bool m_doCPUMon
CPU Benchmarking.
int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent)
Get the maximal absolute value of barcode of vertex present in the event. Returns a negative number.
BooleanProperty m_useShadowEvent
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
const T * get(size_type n) const
Access an element, as an rvalue.
std::vector< ISimulationSvc * > m_simSvcs
Simulators to be used.
#define ATH_MSG_VERBOSE(x)
SG::ReadHandle< McEventCollection > m_inputHardScatterEvgen
Input/output truth collections and input conversion.
static const char * getName(int region)
std::vector< std::string > m_simSvcNames
SimSvc names.
ToolHandleArray< ISimulationSelector > m_simSelectors[AtlasDetDescr::fNumAtlasRegions]
The Simulation Selector Chains.
virtual void setOwner(IDataHandleHolder *o)=0
unsigned int m_memUsageEvts
virtual StatusCode sysInitialize() override
Override sysInitialize.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
std::vector< ISF::ISFParticle * > ISFParticleVector
ISFParticle vector.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
long int m_numParticles
Statistics.
StatusCode prepareInput(SG::ReadHandle< McEventCollection > &inputTruth, SG::WriteHandle< McEventCollection > &outputTruth, std::unique_ptr< McEventCollection > &shadowTruth, ISFParticleContainer &simParticles) const
Convert input generator particles to ISFParticles and copy input generator truth collection into outp...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void getData(unsigned id, uint64_t &count, double &time_ms) const
virtual void renounce()=0
constexpr int UNDEFINED_ID
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
SG::ReadHandle< McEventCollection > m_inputPileupEvgen
input pileup collection
std::string to_string(const DetectorType &type)
ToolHandle< IMonitoringTool > m_memMon
value_type push_back(value_type pElem)
Add an element to the end of the collection.
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
DataObjIDColl m_extendedExtraObjects
ToolHandle< IGenEventFilter > m_truthPreselectionTool
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Get the maximal value of barcode of particle present in the event.
uint8_t SimSvcID
Simulation service ID datatype.
#define ATH_MSG_WARNING(x)
StatusCode initialize(bool used=true)
Verify that the handle has been configured properly.
size_t m_maxParticleVectorSize
tuning
SG::WriteHandle< McEventCollection > m_outputHardScatterTruth
output hard scatter truth collection
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
ToolHandleArray< IEventFilterTool > m_eventFilters
The Event Filters.
AthAlgorithm()
Default constructor:
ServiceHandle< IParticleBroker > m_particleBroker
Central particle broker service.
const T * at(size_type n) const
Access an element, as an rvalue.
ServiceHandle< IInputConverter > m_inputConverter
input->ISFParticle converter
StatusCode initSimSvcs(SimSelectorToolArray &simSelectorTools)
PMonUtils::CustomBenchmark * m_benchSimID
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
bool empty() const noexcept
Returns true if the collection is empty.
bool m_doMemMon
The Memory Info Tool.