 |
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, V, H > &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 |
|
|
StatusCode | initSimSvcs (SimSelectorToolArray &simSelectorTools) |
|
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 output simulation truth collection. More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
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 39 of file SimKernel.cxx.
65 "Input Hard Scatter EVGEN collection.");
68 "Input Pileup EVGEN collection.");
71 "Output Hard Scatter Truth collection.");
74 "Output Pileup Truth collection.");
77 "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 329 of file SimKernel.cxx.
336 m_memMon->dumpCurrent(
"before 1st event",
false );
337 m_memMon->recordCurrent(
"before 1st event");
340 auto hitCollections = std::make_shared<HitCollectionMap>();
345 std::unique_ptr<McEventCollection> shadowTruth{};
346 std::unique_ptr<McEventCollection> shadowPileUpTruth{};
371 for ( ; fSimSvcIter != fSimSvcIterEnd; ++fSimSvcIter ){
372 ISimulationSvc *curSimSvc = (*fSimSvcIter);
377 if (
auto* curSimSvcG4 =
380 return curSimSvcG4->setupEvent(*hitCollections);
382 return curSimSvc->setupEvent();
388 << curSimSvc->simSvcDescriptor());
391 << curSimSvc->simSvcDescriptor());
402 unsigned int loopCounter{0};
410 const unsigned int numParticlesLeftInBroker =
m_particleBroker->numParticles();
414 if (numParticles==0)
break;
420 const ISFParticle *firstP =
particles.front();
428 if (loopCounter>100 && numParticles<3) {
439 if (
particle->nextSimID() != simID ) {
440 ATH_MSG_WARNING(
"Particle with SimID " <<
particle->nextSimID() <<
" found in vector with expected ID " << simID );
456 if (
auto* curSimSvcG4 =
461 hitCollections, shadowTruth.
get())
484 ATH_MSG_WARNING(
"ParticleBroker returned with an error in event finalization." );
490 for ( ; fSimSvcIter != fSimSvcIterEnd; ++fSimSvcIter ){
491 ISimulationSvc *curSimSvc = (*fSimSvcIter);
496 if (
auto* curSimSvcG4 =
499 return curSimSvcG4->releaseEvent(*hitCollections);
501 return curSimSvc->releaseEvent();
507 << curSimSvc->simSvcDescriptor());
510 << curSimSvc->simSvcDescriptor());
517 ATH_MSG_FATAL(
"Event finalize failed for TruthService. Abort." );
518 return StatusCode::FAILURE;
531 while (eventFilter != endOfEventFilters) {
532 if (!((**eventFilter).eventPassesFilter())) {
533 setFilterPassed(
false);
534 ATH_MSG_INFO(
"This event failed the " << (**eventFilter).name() <<
" Filter. Therefore it will not be recorded.");
546 std::string
descr(
"after event " + evtStr);
560 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 195 of file SimKernel.cxx.
205 ATH_MSG_INFO(
" ========================= ISF Timing Stats =========================");
208 ATH_MSG_INFO(
"Breakdown of simulation loop by SimulatorID:");
217 <<
"\t\tn="<<
count<<
"\t\tt=" <<time_ms<<
" ms\t\tt/n="<<time_ms/
count<<
" ms"
218 <<std::setprecision(-1) );
267 ATH_MSG_INFO(
" ====================== ISF Memory Usage Stats =======================");
268 m_memMon->dumpSummary(
"end of ISF event");
271 ATH_MSG_INFO(
" =====================================================================");
273 return StatusCode::SUCCESS;
◆ initialize()
StatusCode ISF::SimKernel::initialize |
( |
| ) |
|
Athena algorithm's interface method initialize()
Definition at line 107 of file SimKernel.cxx.
110 ATH_MSG_VERBOSE (
"--------------------------------------------------------" );
119 m_memMon->recordCurrent(
"at beginning of SimKernel initialize()");
158 ATH_MSG_INFO(
"The following Event Filters are defined:");
165 ATH_MSG_INFO (
"The following SimulationSvc are registered to ISF:");
176 ATH_MSG_INFO(
"The following routing chains are defined:");
191 return StatusCode::SUCCESS;
◆ initSimSvcs()
Definition at line 277 of file SimKernel.cxx.
280 if ( simSelectorTools.retrieve().isFailure() ) {
281 ATH_MSG_FATAL(
"Could not retrieve SimulatorSelector Tool Array. Abort." );
282 return StatusCode::FAILURE;
288 for ( ; fSimSelectorIter != fSimSelectorIterEnd; ++fSimSelectorIter ) {
293 if ( (*curSimulator).retrieve().isFailure() ){
294 ATH_MSG_FATAL(
"Could not retrieve SimulatorSelector Tool. Abort." );
295 return StatusCode::FAILURE;
297 ATH_MSG_INFO(
"- SimulationSelector : " << fSimSelectorIter->typeAndName() );
301 ATH_MSG_FATAL(
"Unable to register ParticleService to SimulationService "
303 return StatusCode::FAILURE;
307 SimSvcID curID = (*curSimulator)->simSvcID();
325 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 566 of file SimKernel.cxx.
572 ATH_MSG_FATAL(
"Unable to read input GenEvent collection '" << inputTruth.
key() <<
"'");
573 return StatusCode::FAILURE;
577 outputTruth = std::make_unique<McEventCollection>();
579 shadowTruth = std::make_unique<McEventCollection>(*inputTruth);
580 for (HepMC::GenEvent* currentGenEvent : *shadowTruth ) {
587 outputTruth->
push_back(outputEvent.release());
592 outputTruth = std::make_unique<McEventCollection>(*inputTruth);
596 for (HepMC::GenEvent* currentGenEvent : *outputTruth ) {
603 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
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
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
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
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.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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
bool empty() const noexcept
Returns true if the collection is empty.
bool m_doMemMon
The Memory Info Tool.