ATLAS Offline Software
Loading...
Searching...
No Matches
G4RunAlg Class Reference

Primary Athena algorithm for ATLAS simulation. More...

#include <G4RunAlg.h>

Inheritance diagram for G4RunAlg:

Public Member Functions

virtual bool isClonable () const override
 this Alg is Clonable (for AthenaMT)
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override
 Initialize the algorithm.
virtual StatusCode execute () override
 Simulate one Athena event.
 AthAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Standard algorithm constructor.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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

void releaseGeoModel ()
 Releases the GeoModel geometry from memory once it has been used to build the G4 geometry and is no-longer required.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

DataObjIDColl m_extendedExtraObjects
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
Configurable Properties
Gaudi::Property< bool > m_flagAbortedEvents {this, "FlagAbortedEvents", false, ""}
Gaudi::Property< bool > m_killAbortedEvents {this, "KillAbortedEvents", false, ""}
Gaudi::Property< bool > m_releaseGeoModel {this, "ReleaseGeoModel", true, ""}
Gaudi::Property< bool > m_useShadowEvent {this, "UseShadowEvent", false, "New approach to selecting particles for simulation"}
Gaudi::Property< std::string > m_randomStreamName {this, "RandomStreamName", "Geant4", ""}
Gaudi::Property< std::string > m_simplifiedGeoPath {this, "SimplifiedGeoPath", "", "Path to the simplified geometry file"}
Gaudi::Property< std::map< std::string, std::string > > m_verbosities {this, "Verbosities", {}, "Map of G4 Verbosities to set for the simulation"}
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo key"}
SG::ReadHandleKey< McEventCollectionm_inputTruthCollectionKey {this, "InputTruthCollection", "BeamTruthEvent", "Input hard scatter collection"}
SG::WriteHandleKey< McEventCollectionm_outputTruthCollectionKey {this, "OutputTruthCollection", "TruthEvent", "Output hard scatter truth collection"}
ServiceHandle< ISF::IGeoIDSvcm_geoIDSvc {this, "GeoIDSvc", "ISF_GeoIDSvc", ""}
 Geo ID Service.
ServiceHandle< ISF::IInputConverterm_inputConverter {this, "InputConverter", "ISF_InputConverter", ""}
 Service to convert ISF_Particles into a G4Event.
ServiceHandle< ISF::ITruthSvcm_truthRecordSvc {this, "TruthRecordService", "ISF_TruthRecordSvc", ""}
 Central Truth Service.
ServiceHandle< Simulation::IZeroLifetimePatcherm_qspatcher {this, "QuasiStablePatcher", "", "Quasi-Stable Particle Simulation Patcher"}
 Quasi-Stable Particle Simulation Patcher.
ServiceHandle< IAthRNGSvcm_rndmGenSvc {this, "AtRndmGenSvc", "AthRNGSvc", ""}
 Random number service.
ServiceHandle< G4UA::IUserActionSvcm_userActionSvc {this, "UserActionSvc", "G4UA::UserActionSvc", ""}
 User Action Service.
PublicToolHandle< IFastSimulationMasterToolm_fastSimTool {this, "FastSimMasterTool", "FastSimulationMasterTool", ""}
 Fast Simulation Master Tool.
PublicToolHandle< IG4RunToolm_g4RunTool {this, "G4RunTool", "G4RunTool", ""}
 G4Atlas Tool for thread management and data interface.
PublicToolHandle< ISensitiveDetectorMasterToolm_senDetTool {this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""}
 Sensitive Detector Master Tool.
ToolHandle< ISF::IGenEventFilterm_truthPreselectionTool {this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"}
 Tool for filtering out quasi-stable particle daughters.

Detailed Description

Primary Athena algorithm for ATLAS simulation.

This algorithm setup a Geant Run (through G4RunTool) which executes in a separate thread pool managed by the G4RunManager.

In contrast to G4AtlasAlg, in which execute() runs the actual transport loop of the event, G4RunAlg will only prepare the event, and push it to the G4 worker using a shared queue. Condition variables are used to synchronize the Athena worker thread with the G4 worker thread in execute.

Definition at line 50 of file G4RunAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ AthAlgorithm()

AthAlgorithm::AthAlgorithm ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard algorithm constructor.

Definition at line 51 of file AthAlgorithm.cxx.

25 :
27{
28 // Set up to run AthAlgorithmDHUpdate in sysInitialize before
29 // merging dependency lists. This extends the output dependency
30 // list with any symlinks implied by inheritance relations.
31 m_updateDataHandles =
32 std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
34 std::move (m_updateDataHandles));
35}
DataObjIDColl m_extendedExtraObjects
AthCommonDataStore(const std::string &name, T... args)

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode initialize G4RunAlg::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

Initialize the algorithm.

Here we setup several things for simulation, including:

  • force intialization of the UserActionSvc
  • apply custom G4 UI commands (like custom physics list)
  • configure the particle generator and random generator svc

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< 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< 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>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< 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< 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 G4RunAlg::execute ( )
overridevirtual

Simulate one Athena event.

Definition at line 96 of file G4RunAlg.cxx.

97{
98 static std::atomic<unsigned int> n_Event=0;
99 ATH_MSG_DEBUG("++++++++++++ G4RunAlg execute ++++++++++++");
100
101 n_Event += 1;
102
103 if (n_Event<=10 || (n_Event%100) == 0) {
104 ATH_MSG_ALWAYS("Event num. " << n_Event << " start processing");
105 }
106
107 // Release GeoModel Geometry if necessary
108 // TODO: should be moved to Geant4 main thread after run initialization
109 if (m_releaseGeoModel) {
110 try {
112 }
113 catch(const std::exception& e) {
114 ATH_MSG_ERROR("Failure in G4RunAlg::releaseGeoModel: " << e.what());
115 return StatusCode::FAILURE;
116 }
117 }
118
119 const EventContext& ctx = Gaudi::Hive::currentContext();
120 // Set the RNG to use for this event. We need to reset it for MT jobs
121 // because of the mismatch between Gaudi slot-local and G4 thread-local RNG.
122 ATHRNG::RNGWrapper* rngWrapper = m_rndmGenSvc->getEngine(this, m_randomStreamName);
123 rngWrapper->setSeed( m_randomStreamName, ctx);
124
125 SG::ReadHandle<McEventCollection> inputTruthCollection(m_inputTruthCollectionKey);
126 if (!inputTruthCollection.isValid()) {
127 ATH_MSG_FATAL("Unable to read input GenEvent collection " << inputTruthCollection.name() << " in store " << inputTruthCollection.store());
128 return StatusCode::FAILURE;
129 }
130 ATH_MSG_DEBUG("Found input GenEvent collection " << inputTruthCollection.name() << " in store " << inputTruthCollection.store());
131 // create the output Truth collection
132 SG::WriteHandle<McEventCollection> outputTruthCollection(m_outputTruthCollectionKey);
133 std::unique_ptr<McEventCollection> shadowTruth{};
134 if (m_useShadowEvent) {
135 outputTruthCollection = std::make_unique<McEventCollection>();
136 // copy input Evgen collection to shadow Truth collection
137 shadowTruth = std::make_unique<McEventCollection>(*inputTruthCollection);
138 for (HepMC::GenEvent* currentGenEvent : *shadowTruth ) {
139 // Apply QS patch if required
140 if ( not m_qspatcher.empty() ) {
141 ATH_CHECK(m_qspatcher->applyWorkaround(*currentGenEvent));
142 }
143 // Copy GenEvent and remove daughters of quasi-stable particles to be simulated
144 std::unique_ptr<HepMC::GenEvent> outputEvent = m_truthPreselectionTool->filterGenEvent(*currentGenEvent);
145 outputTruthCollection->push_back(outputEvent.release());
146 }
147 }
148 else {
149 // copy input Evgen collection to output Truth collection
150 outputTruthCollection = std::make_unique<McEventCollection>(*inputTruthCollection);
151 // empty shadow Truth collection
152 shadowTruth = std::make_unique<McEventCollection>();
153 // Apply QS patch if required
154 if ( not m_qspatcher.empty() ) {
155 for (HepMC::GenEvent* currentGenEvent : *outputTruthCollection ) {
156 ATH_CHECK(m_qspatcher->applyWorkaround(*currentGenEvent));
157 }
158 }
159 }
160
161 ATH_MSG_DEBUG("Recorded output GenEvent collection " << outputTruthCollection.name() << " in store " << outputTruthCollection.store());
162
163 const int largestGeneratedParticleBC = (outputTruthCollection->empty()) ? HepMC::UNDEFINED_ID
164 : HepMC::maxGeneratedParticleBarcode(outputTruthCollection->at(0)); // TODO make this more robust
165 const int largestGeneratedVertexBC = (outputTruthCollection->empty()) ? HepMC::UNDEFINED_ID
166 : HepMC::maxGeneratedVertexBarcode(outputTruthCollection->at(0)); // TODO make this more robust
167 {
168
169 // called by the Geant4 PrimaryGeneratorAction because primary vertices must be instantiated by Geant4 threads
170 auto prepare_event = [this, &outputTruthCollection, &shadowTruth, largestGeneratedParticleBC, largestGeneratedVertexBC](G4Event& event, std::unique_ptr<AtlasG4SyncEventUserInfo> g4eventInfo) -> StatusCode {
171 // tell TruthService we're starting a new event
172 ATH_CHECK( m_truthRecordSvc->initializeTruthCollection(largestGeneratedParticleBC, largestGeneratedVertexBC) );
173 event.SetEventID(g4eventInfo->AthenaEventID());
174 event.SetUserInformation(g4eventInfo.release());
175 ATH_CHECK(m_inputConverter->convertHepMCToG4Event(
176 *outputTruthCollection, event, *shadowTruth));
177 return StatusCode::SUCCESS;
178 };
179
180 auto eventInfo = std::make_unique<AtlasG4SyncEventUserInfo>(rngWrapper->getEngine(ctx), std::move(prepare_event), ctx);
181
182 // get a shared pointer to the hit collection map because we will need it after the G4Event is destroyed
183 std::shared_ptr<HitCollectionMap> hitCollections = eventInfo->GetHitCollectionMap();
184
185 ATH_CHECK(m_senDetTool->BeginOfAthenaEvent(*hitCollections));
186 ATH_CHECK(m_userActionSvc->BeginOfAthenaEvent(*hitCollections));
187 ATH_CHECK(m_fastSimTool->BeginOfAthenaEvent());
188
189 auto syncInterface = eventInfo->SyncInterface();
190
191 ATH_MSG_DEBUG("Pushing Athena event " << ctx.eventID().event_number() << " onto event buffer");
192 m_g4RunTool->PushEvent(std::move(eventInfo));
193 ATH_MSG_DEBUG("Buffer size=" << m_g4RunTool->Size() << ", waiting for event to finish");
194 //G4 should tell Athena in an EndOfEventAction that the simulation of the event is done
195 syncInterface->WaitStatusDone();
196
197 if (syncInterface->EventAborted()) {
198 ATH_MSG_WARNING("Event was aborted !! ");
199 ATH_MSG_WARNING("Simulation will now go on to the next event ");
201 ATH_MSG_WARNING("setFilterPassed is now False");
202 setFilterPassed(false);
203 }
205 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey, ctx);
206 if (!eventInfo.isValid()) {
208 "Failed to retrieve xAOD::EventInfo while trying to update the "
209 "error state!");
210 return StatusCode::FAILURE;
211 } else {
212 eventInfo->updateErrorState(xAOD::EventInfo::Core,
214 ATH_MSG_WARNING("Set error state in xAOD::EventInfo!");
215 }
216 }
217 }
218
219 ATH_CHECK(m_senDetTool->EndOfAthenaEvent(*hitCollections));
220 ATH_CHECK(m_userActionSvc->EndOfAthenaEvent(*hitCollections));
221 ATH_CHECK(m_fastSimTool->EndOfAthenaEvent());
222
223 ATH_CHECK(m_truthRecordSvc->releaseEvent());
224 }
225 // Remove QS patch if required
226 if(!m_qspatcher.empty()) {
227 for (HepMC::GenEvent* currentGenEvent : *outputTruthCollection ) {
228 ATH_CHECK(m_qspatcher->removeWorkaround(*currentGenEvent));
229 }
230 }
231
232 return StatusCode::SUCCESS;
233}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_ALWAYS(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static std::once_flag releaseGeoModelOnceFlag
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
Gaudi::Property< bool > m_releaseGeoModel
Definition G4RunAlg.h:80
ToolHandle< ISF::IGenEventFilter > m_truthPreselectionTool
Tool for filtering out quasi-stable particle daughters.
Definition G4RunAlg.h:110
ServiceHandle< Simulation::IZeroLifetimePatcher > m_qspatcher
Quasi-Stable Particle Simulation Patcher.
Definition G4RunAlg.h:97
ServiceHandle< IAthRNGSvc > m_rndmGenSvc
Random number service.
Definition G4RunAlg.h:99
PublicToolHandle< IG4RunTool > m_g4RunTool
G4Atlas Tool for thread management and data interface.
Definition G4RunAlg.h:106
void releaseGeoModel()
Releases the GeoModel geometry from memory once it has been used to build the G4 geometry and is no-l...
Definition G4RunAlg.cxx:237
Gaudi::Property< bool > m_useShadowEvent
Definition G4RunAlg.h:81
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition G4RunAlg.h:86
PublicToolHandle< ISensitiveDetectorMasterTool > m_senDetTool
Sensitive Detector Master Tool.
Definition G4RunAlg.h:108
ServiceHandle< G4UA::IUserActionSvc > m_userActionSvc
User Action Service.
Definition G4RunAlg.h:101
ServiceHandle< ISF::ITruthSvc > m_truthRecordSvc
Central Truth Service.
Definition G4RunAlg.h:95
Gaudi::Property< bool > m_killAbortedEvents
Definition G4RunAlg.h:79
Gaudi::Property< std::string > m_randomStreamName
Definition G4RunAlg.h:82
PublicToolHandle< IFastSimulationMasterTool > m_fastSimTool
Fast Simulation Master Tool.
Definition G4RunAlg.h:104
SG::WriteHandleKey< McEventCollection > m_outputTruthCollectionKey
Definition G4RunAlg.h:88
ServiceHandle< ISF::IInputConverter > m_inputConverter
Service to convert ISF_Particles into a G4Event.
Definition G4RunAlg.h:93
SG::ReadHandleKey< McEventCollection > m_inputTruthCollectionKey
Definition G4RunAlg.h:87
Gaudi::Property< bool > m_flagAbortedEvents
Definition G4RunAlg.h:78
@ Core
Core flags describing the event.
@ Error
The sub-detector issued an error.
int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent)
Get the maximal absolute value of barcode of vertex present in the event. Returns a negative number.
constexpr int UNDEFINED_ID
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Get the maximal value of barcode of particle present in the event.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< 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 & 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.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< 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()

virtual bool G4RunAlg::isClonable ( ) const
inlineoverridevirtual

this Alg is Clonable (for AthenaMT)

Definition at line 58 of file G4RunAlg.h.

58{ return true; }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< 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< 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.

◆ releaseGeoModel()

void G4RunAlg::releaseGeoModel ( )
private

Releases the GeoModel geometry from memory once it has been used to build the G4 geometry and is no-longer required.

Definition at line 237 of file G4RunAlg.cxx.

238{
239 SmartIF<IGeoModelSvc> geoModel{Gaudi::svcLocator()->service("GeoModelSvc")};
240 if (!geoModel) {
241 ATH_MSG_WARNING( " ----> Unable to retrieve GeoModelSvc" );
242 }
243 else {
244 if (geoModel->clear().isFailure()) {
245 ATH_MSG_WARNING( " ----> GeoModelSvc::clear() failed" );
246 }
247 else {
248 ATH_MSG_INFO( " ----> GeoModelSvc::clear() succeeded " );
249 }
250 }
251 m_releaseGeoModel=false; // Don't do that again...
252 return;
253}
#define ATH_MSG_INFO(x)

◆ 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< 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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::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< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< 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< 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 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> G4RunAlg::m_eventInfoKey {this, "EventInfo", "EventInfo", "EventInfo key"}
private

Definition at line 86 of file G4RunAlg.h.

86{this, "EventInfo", "EventInfo", "EventInfo key"};

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_fastSimTool

PublicToolHandle<IFastSimulationMasterTool> G4RunAlg::m_fastSimTool {this, "FastSimMasterTool", "FastSimulationMasterTool", ""}
private

Fast Simulation Master Tool.

Definition at line 104 of file G4RunAlg.h.

104{this, "FastSimMasterTool", "FastSimulationMasterTool", ""};

◆ m_flagAbortedEvents

Gaudi::Property<bool> G4RunAlg::m_flagAbortedEvents {this, "FlagAbortedEvents", false, ""}
private

Definition at line 78 of file G4RunAlg.h.

78{this, "FlagAbortedEvents", false, ""};

◆ m_g4RunTool

PublicToolHandle<IG4RunTool> G4RunAlg::m_g4RunTool {this, "G4RunTool", "G4RunTool", ""}
private

G4Atlas Tool for thread management and data interface.

Definition at line 106 of file G4RunAlg.h.

106{this, "G4RunTool", "G4RunTool", ""};

◆ m_geoIDSvc

ServiceHandle<ISF::IGeoIDSvc> G4RunAlg::m_geoIDSvc {this, "GeoIDSvc", "ISF_GeoIDSvc", ""}
private

Geo ID Service.

Definition at line 91 of file G4RunAlg.h.

91{this, "GeoIDSvc", "ISF_GeoIDSvc", ""};

◆ m_inputConverter

ServiceHandle<ISF::IInputConverter> G4RunAlg::m_inputConverter {this, "InputConverter", "ISF_InputConverter", ""}
private

Service to convert ISF_Particles into a G4Event.

Definition at line 93 of file G4RunAlg.h.

93{this, "InputConverter", "ISF_InputConverter", ""};

◆ m_inputTruthCollectionKey

SG::ReadHandleKey<McEventCollection> G4RunAlg::m_inputTruthCollectionKey {this, "InputTruthCollection", "BeamTruthEvent", "Input hard scatter collection"}
private

Definition at line 87 of file G4RunAlg.h.

87{this, "InputTruthCollection", "BeamTruthEvent", "Input hard scatter collection"};

◆ m_killAbortedEvents

Gaudi::Property<bool> G4RunAlg::m_killAbortedEvents {this, "KillAbortedEvents", false, ""}
private

Definition at line 79 of file G4RunAlg.h.

79{this, "KillAbortedEvents", false, ""};

◆ m_outputTruthCollectionKey

SG::WriteHandleKey<McEventCollection> G4RunAlg::m_outputTruthCollectionKey {this, "OutputTruthCollection", "TruthEvent", "Output hard scatter truth collection"}
private

Definition at line 88 of file G4RunAlg.h.

88{this, "OutputTruthCollection", "TruthEvent", "Output hard scatter truth collection"};

◆ m_qspatcher

ServiceHandle<Simulation::IZeroLifetimePatcher> G4RunAlg::m_qspatcher {this, "QuasiStablePatcher", "", "Quasi-Stable Particle Simulation Patcher"}
private

Quasi-Stable Particle Simulation Patcher.

Definition at line 97 of file G4RunAlg.h.

97{this, "QuasiStablePatcher", "", "Quasi-Stable Particle Simulation Patcher"};

◆ m_randomStreamName

Gaudi::Property<std::string> G4RunAlg::m_randomStreamName {this, "RandomStreamName", "Geant4", ""}
private

Definition at line 82 of file G4RunAlg.h.

82{this, "RandomStreamName", "Geant4", ""};

◆ m_releaseGeoModel

Gaudi::Property<bool> G4RunAlg::m_releaseGeoModel {this, "ReleaseGeoModel", true, ""}
private

Definition at line 80 of file G4RunAlg.h.

80{this, "ReleaseGeoModel", true, ""};

◆ m_rndmGenSvc

ServiceHandle<IAthRNGSvc> G4RunAlg::m_rndmGenSvc {this, "AtRndmGenSvc", "AthRNGSvc", ""}
private

Random number service.

Definition at line 99 of file G4RunAlg.h.

99{this, "AtRndmGenSvc", "AthRNGSvc", ""};

◆ m_senDetTool

PublicToolHandle<ISensitiveDetectorMasterTool> G4RunAlg::m_senDetTool {this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""}
private

Sensitive Detector Master Tool.

Definition at line 108 of file G4RunAlg.h.

108{this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""};

◆ m_simplifiedGeoPath

Gaudi::Property<std::string> G4RunAlg::m_simplifiedGeoPath {this, "SimplifiedGeoPath", "", "Path to the simplified geometry file"}
private

Definition at line 83 of file G4RunAlg.h.

83{this, "SimplifiedGeoPath", "", "Path to the simplified geometry file"};

◆ m_truthPreselectionTool

ToolHandle<ISF::IGenEventFilter> G4RunAlg::m_truthPreselectionTool {this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"}
private

Tool for filtering out quasi-stable particle daughters.

Definition at line 110 of file G4RunAlg.h.

110{this, "TruthPreselectionTool", "", "Tool for filtering out quasi-stable particle daughters"};

◆ m_truthRecordSvc

ServiceHandle<ISF::ITruthSvc> G4RunAlg::m_truthRecordSvc {this, "TruthRecordService", "ISF_TruthRecordSvc", ""}
private

Central Truth Service.

Definition at line 95 of file G4RunAlg.h.

95{this, "TruthRecordService", "ISF_TruthRecordSvc", ""};

◆ m_userActionSvc

ServiceHandle<G4UA::IUserActionSvc> G4RunAlg::m_userActionSvc {this, "UserActionSvc", "G4UA::UserActionSvc", ""}
private

User Action Service.

Definition at line 101 of file G4RunAlg.h.

101{this, "UserActionSvc", "G4UA::UserActionSvc", ""};

◆ m_useShadowEvent

Gaudi::Property<bool> G4RunAlg::m_useShadowEvent {this, "UseShadowEvent", false, "New approach to selecting particles for simulation"}
private

Definition at line 81 of file G4RunAlg.h.

81{this, "UseShadowEvent", false, "New approach to selecting particles for simulation"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_verbosities

Gaudi::Property<std::map<std::string, std::string> > G4RunAlg::m_verbosities {this, "Verbosities", {}, "Map of G4 Verbosities to set for the simulation"}
private

Definition at line 84 of file G4RunAlg.h.

84{this, "Verbosities", {}, "Map of G4 Verbosities to set for the simulation"};

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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