ATLAS Offline Software
Loading...
Searching...
No Matches
xAODMaker::xAODTruthCnvAlg Class Reference

Algorithm creating xAOD truth from HepMC. More...

#include <xAODTruthCnvAlg.h>

Inheritance diagram for xAODMaker::xAODTruthCnvAlg:

Classes

struct  MetadataFields
class  MetaDataWriter
 Factor out the pieces dealing with writing to meta data. More...
struct  VertexParticles
 Type for tracking particles connected to a single vertex. More...

Public Member Functions

 xAODTruthCnvAlg (const std::string &name, ISvcLocator *svcLoc)
 Regular algorithm constructor.
virtual StatusCode initialize () override
 Function initialising the algorithm.
virtual StatusCode execute (const EventContext &ctx) const override
 Function executing the algorithm.
virtual void handle (const Incident &incident) override
 Incident handler.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
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 std::map< HepMC::ConstGenVertexPtr, VertexParticlesVertexMap
 Convenience handle for a map of vtx ptrs -> connected particles.
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void fillVertex (xAOD::TruthVertex *tv, const HepMC::ConstGenVertexPtr &gv)
 These functions do not set up ELs, just the other variables.
static void fillParticle (xAOD::TruthParticle *tp, const HepMC::ConstGenParticlePtr &gp)

Private Attributes

SG::ReadHandleKey< McEventCollectionm_aodContainerKey
 The key of the input AOD truth container.
SG::WriteHandleKey< xAOD::TruthEventContainerm_xaodTruthEventContainerKey
 The key for the output xAOD truth containers.
SG::WriteHandleKey< xAOD::TruthPileupEventContainerm_xaodTruthPUEventContainerKey
SG::WriteHandleKey< xAOD::TruthParticleContainerm_xaodTruthParticleContainerKey
SG::WriteHandleKey< xAOD::TruthVertexContainerm_xaodTruthVertexContainerKey
SG::WriteHandleKey< xAODTruthParticleLinkVectorm_truthLinkContainerKey
SG::WriteHandleKey< xAOD::TruthParticleContainerm_lheTruthParticleContainerKey
Gaudi::Property< bool > m_doAllPileUp {this, "WriteAllPileUpTruth", false}
 Pile-up options.
Gaudi::Property< bool > m_doInTimePileUp {this, "WriteInTimePileUpTruth", false}
MetaDataWriter m_meta ATLAS_THREAD_SAFE
 Helper for writing to the meta data store.
ServiceHandle< StoreGateSvcm_metaStore
 Connection to the metadata store.
std::string m_metaName
 SG key and name for meta data.
Gaudi::Property< bool > m_writeMetaData {this, "WriteTruthMetaData", true}
 option to disable writing of metadata (e.g. if running a filter on xAOD in generators)
SG::ReadHandleKey< xAOD::EventInfom_evtInfo {this, "EventInfo", "EventInfo", "" }
 Event Info.
bool m_firstBeginRun
 Tag Info.
MetadataFields m_metaFields
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

Detailed Description

Algorithm creating xAOD truth from HepMC.

This algorithm can be used to translate the HepMC coming from an AOD, and create xAOD truth objects out of them for an output xAOD.

Author
James Catmore James.nosp@m..Cat.nosp@m.more@.nosp@m.cern.nosp@m..ch
Jovan Mitreski Jovan.nosp@m..Mit.nosp@m.reski.nosp@m.@cer.nosp@m.n.ch
Andy Buckley Andy..nosp@m.Buck.nosp@m.ley@c.nosp@m.ern..nosp@m.ch

Definition at line 45 of file xAODTruthCnvAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ VertexMap

Convenience handle for a map of vtx ptrs -> connected particles.

Definition at line 104 of file xAODTruthCnvAlg.h.

Constructor & Destructor Documentation

◆ xAODTruthCnvAlg()

xAODMaker::xAODTruthCnvAlg::xAODTruthCnvAlg ( const std::string & name,
ISvcLocator * svcLoc )

Regular algorithm constructor.

Definition at line 54 of file xAODTruthCnvAlg.cxx.

55 : AthReentrantAlgorithm( name, svcLoc )
56 , m_metaStore( "StoreGateSvc/MetaDataStore", name )
57 , m_firstBeginRun(true)
58 {
59 // leaving metadata alone for now--to be updated
60 declareProperty( "MetaObjectName", m_metaName = "TruthMetaData" );
61 declareProperty( "MetaDataStore", m_metaStore );
62 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > m_metaStore
Connection to the metadata store.
std::string m_metaName
SG key and name for meta data.

Member Function Documentation

◆ declareGaudiProperty()

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

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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 xAODMaker::xAODTruthCnvAlg::execute ( const EventContext & ctx) const
overridevirtual

Function executing the algorithm.

Definition at line 111 of file xAODTruthCnvAlg.cxx.

111 {
112
113 SG::WriteHandle<xAODTruthParticleLinkVector> truthLinkVec(m_truthLinkContainerKey, ctx);
114 ATH_CHECK(truthLinkVec.record(std::make_unique<xAODTruthParticleLinkVector>()));
115
116 // Retrieve the HepMC truth:
117 SG::ReadHandle<McEventCollection> mcColl(m_aodContainerKey, ctx);
118 // validity check is only really needed for serial running. Remove when MT is only way.
119 if (!mcColl.isValid()) {
120 ATH_MSG_ERROR("Could not retrieve HepMC with key:" << m_aodContainerKey.key());
121 return StatusCode::FAILURE;
122 } else {
123 ATH_MSG_DEBUG( "Retrieved HepMC with key: " << m_aodContainerKey.key() );
124 }
125
126 // **************************************************************
127 // Create the xAOD containers and their auxiliary stores:
128 // **************************************************************
129 // Signal event
130 SG::WriteHandle<xAOD::TruthEventContainer> xTruthEventContainer(m_xaodTruthEventContainerKey, ctx);
131 ATH_CHECK(xTruthEventContainer.record(std::make_unique<xAOD::TruthEventContainer>(),
132 std::make_unique<xAOD::TruthEventAuxContainer>()));
133 ATH_MSG_DEBUG( "Recorded TruthEventContainer with key: " << m_xaodTruthEventContainerKey.key() );
134
135 // Pile-up events
136 SG::WriteHandle<xAOD::TruthPileupEventContainer> xTruthPileupEventContainer;
138 xTruthPileupEventContainer = SG::WriteHandle<xAOD::TruthPileupEventContainer>(m_xaodTruthPUEventContainerKey, ctx);
139 ATH_CHECK(xTruthPileupEventContainer.record(std::make_unique<xAOD::TruthPileupEventContainer>(),
140 std::make_unique<xAOD::TruthPileupEventAuxContainer>()));
141 ATH_MSG_DEBUG( "Recorded TruthPileupEventContainer with key: " << m_xaodTruthPUEventContainerKey.key() );
142 }
143
144 // Particles
145 SG::WriteHandle<xAOD::TruthParticleContainer> xTruthParticleContainer(m_xaodTruthParticleContainerKey, ctx);
146 ATH_CHECK(xTruthParticleContainer.record(std::make_unique<xAOD::TruthParticleContainer>(),
147 std::make_unique<xAOD::TruthParticleAuxContainer>()));
148 ATH_MSG_DEBUG( "Recorded TruthParticleContainer with key: " << m_xaodTruthParticleContainerKey.key() );
149 // Vertices
150 SG::WriteHandle<xAOD::TruthVertexContainer> xTruthVertexContainer(m_xaodTruthVertexContainerKey, ctx);
151 ATH_CHECK(xTruthVertexContainer.record(std::make_unique<xAOD::TruthVertexContainer>(),
152 std::make_unique<xAOD::TruthVertexAuxContainer>()));
153 ATH_MSG_DEBUG( "Recorded TruthVertexContainer with key: " << m_xaodTruthVertexContainerKey.key() );
154
155 // To keep track of whether we wrote an LHE event already or not
156 bool hadLHERecord = false;
157
158 // ***********************************************************************************
159 // Create the xAOD objects
160 // This consists of three parts:
161 // (1) For each Athena event, loop over the GenEvents and build TruthEvent collections
162 // In principle there can be more than one GenEvent per event
163 // (2) For each GenEvent, loop over the GenParticles. For each GenParticle:
164 // (a) Create a TruthParticle.
165 // (b) Call fillParticle
166 // (c) Add the TruthParticle to the TruthParticle container, and add
167 // an EL to this TruthParticle to the truthParticles in TruthEvent
168 // (call this EL eltp)
169 // (d) For the GenVertex * that's this particle's production vertex,
170 // (i) see if it is in tempMap. If not, add it.
171 // (ii) add a copy of eltp (the EL to this truth particle) to map[gv].second
172 // (e) For the GenVertex * that's this particle's decay vertex,
173 // (i) see if it is in tempMap. If not, add it.
174 // (ii) add a copy of eltp (the EL to this truth particle) to map[gv].first
175 // (3) Iterate over tempMap. For each GenVertex *:
176 // (a) Create a TruthVertex
177 // (b) Call fillVertex
178 // (c) Add the TruthVertex to the TruthTruth container, and add an EL to this TruthVertex
179 // to the truthVertices in TruthEvent. (call this EL eltv)
180 // (d) call tv->setIncomingParticles(mapiter.second.first) <- I think mapiter.second.first is the first of the pair
181 // (e) call tv->setOutgoingParticles(mapiter.second.second)
182 // (f) Iterate through the incomingParticles, and set the decay vertex EL as eltv.
183 // (g) Iterate through the outgoingParticles, and set the incoming vertex EL as eltv.
184 //
185 // Comment lines below follow this recipe
186 // ************************************************************************************
187
188 // (1) Build TruthEvents
189 ATH_MSG_DEBUG("Number of GenEvents in this Athena event = " << mcColl->size());
190 bool newAttributesPresent(false);
191 for (unsigned int cntr = 0; cntr < mcColl->size(); ++cntr) {
192 const HepMC::GenEvent* genEvt = (*mcColl)[cntr];
193 bool isSignalProcess(false);
194 if (cntr==0) {
195 isSignalProcess=true;
196 auto bunchCrossingTime = genEvt->attribute<HepMC3::IntAttribute>(HepMCStr::BunchCrossingTime);
197 if (bunchCrossingTime) {
198 newAttributesPresent = true;
199 ATH_MSG_VERBOSE("New attributes present.");
200 }
201 else {
202 ATH_MSG_VERBOSE("New attributes missing.");
203 }
204 }
205 if (cntr>0) {
206 // Handle pile-up events
207 if (!m_doInTimePileUp && !m_doAllPileUp) break;
208 isSignalProcess=false;
209 auto bunchCrossingTime = genEvt->attribute<HepMC3::IntAttribute>(HepMCStr::BunchCrossingTime);
210 if (bunchCrossingTime) {
211 // New approach based on checking the bunch crossing
212 // time directly.
213 if (m_doInTimePileUp && std::abs(bunchCrossingTime->value()) > 0) {
214 // Skip out-of-time pile-up events
215 continue;
216 }
217 }
218 else {
219 // Old approach based on McEventCollection structure. If
220 // in-time pileup only is requested, loop stops when the
221 // separator GenEvent between out-of-time and in-time is
222 // reached
223 if (m_doInTimePileUp && isSeparatorGenEvent(genEvt)) {
224 if (newAttributesPresent) {
225 // Old structure with new Attributes?! Check all
226 // GenEvents just in case.
227 ATH_MSG_VERBOSE("New-style, but seeing separator GenEvents");
228 continue;
229 }
230 // Old structure - stop at the first separator
231 // GenEvent.
232 break;
233 }
234 }
235 }
236
237 xAOD::TruthEvent* xTruthEvent = nullptr;
238 xAOD::TruthPileupEvent* xTruthPileupEvent = nullptr;
239
240
241 if (isSignalProcess) {
242 xTruthEvent = xTruthEventContainer->push_back( std::make_unique<xAOD::TruthEvent>() );
243 // Cross-section
244 auto crossSection = genEvt->cross_section();
245 xTruthEvent->setCrossSection(crossSection ? (float)crossSection->xsec() : -1);
246 xTruthEvent->setCrossSectionError(crossSection ? (float)crossSection->xsec_err() : -1);
247
248 if (m_writeMetaData) {
249 //The mcChannelNumber is used as a unique identifier for which truth meta data belongs to
251 SG::ReadHandle<xAOD::EventInfo> evtInfo (m_evtInfo,ctx);
252 if (evtInfo.isValid()) {
253 mcChannelNumber = evtInfo->mcChannelNumber();
254 if (mcChannelNumber==0) mcChannelNumber = evtInfo->runNumber();
255 }
256 else {
257 ATH_MSG_FATAL("Faied to retrieve EventInfo");
258 return StatusCode::FAILURE;
259 }
260
261 ATH_CHECK( m_meta.maybeWrite (mcChannelNumber, *genEvt, m_metaFields) );
262 }
263 // Event weights
264 vector<float> weights;
265 for (const double& w : genEvt->weights()) weights.push_back((float)(w));
266 //AV This to be decided. It is always a good idea to have a default weight 1.0.
267 //if (weights.empty()) weights.push_back(1.0);
268 xTruthEvent->setWeights(weights);
269
270 // Heavy ion info
271 auto const hiInfo = genEvt->heavy_ion();
272 if (hiInfo) {
273 /* Please note HepMC3 as well as more recent HePMC2 versions have more Hi parameters */
274 xTruthEvent->setHeavyIonParameter(hiInfo->Ncoll_hard, xAOD::TruthEvent::NCOLLHARD);
275 xTruthEvent->setHeavyIonParameter(hiInfo->Npart_proj, xAOD::TruthEvent::NPARTPROJ);
276 xTruthEvent->setHeavyIonParameter(hiInfo->Npart_targ, xAOD::TruthEvent::NPARTTARG);
277 xTruthEvent->setHeavyIonParameter(hiInfo->Ncoll, xAOD::TruthEvent::NCOLL);
278 xTruthEvent->setHeavyIonParameter(hiInfo->spectator_neutrons, xAOD::TruthEvent::SPECTATORNEUTRONS);
279 xTruthEvent->setHeavyIonParameter(hiInfo->spectator_protons, xAOD::TruthEvent::SPECTATORPROTONS);
280 xTruthEvent->setHeavyIonParameter(hiInfo->N_Nwounded_collisions, xAOD::TruthEvent::NNWOUNDEDCOLLISIONS);
281 xTruthEvent->setHeavyIonParameter(hiInfo->Nwounded_N_collisions, xAOD::TruthEvent::NWOUNDEDNCOLLISIONS);
282 xTruthEvent->setHeavyIonParameter(hiInfo->Nwounded_Nwounded_collisions, xAOD::TruthEvent::NWOUNDEDNWOUNDEDCOLLISIONS);
283 xTruthEvent->setHeavyIonParameter((float)hiInfo->impact_parameter, xAOD::TruthEvent::IMPACTPARAMETER);
284 xTruthEvent->setHeavyIonParameter((float)hiInfo->event_plane_angle, xAOD::TruthEvent::EVENTPLANEANGLE);
285 xTruthEvent->setHeavyIonParameter((float)hiInfo->eccentricity, xAOD::TruthEvent::ECCENTRICITY);
286 xTruthEvent->setHeavyIonParameter((float)hiInfo->sigma_inel_NN, xAOD::TruthEvent::SIGMAINELNN);
287 // This doesn't yet exist in our version of HepMC
288 // xTruthEvent->setHeavyIonParameter(hiInfo->centrality(),xAOD::TruthEvent::CENTRALITY);
289 }
290
291 // Parton density info
292 // This will exist 99% of the time, except for e.g. cosmic or particle gun simulation
293 auto const pdfInfo = genEvt->pdf_info();
294 if (pdfInfo) {
295 xTruthEvent->setPdfInfoParameter(pdfInfo->parton_id[0], xAOD::TruthEvent::PDGID1);
296 xTruthEvent->setPdfInfoParameter(pdfInfo->parton_id[1], xAOD::TruthEvent::PDGID2);
297 xTruthEvent->setPdfInfoParameter(pdfInfo->pdf_id[1], xAOD::TruthEvent::PDFID1);
298 xTruthEvent->setPdfInfoParameter(pdfInfo->pdf_id[1], xAOD::TruthEvent::PDFID2);
299
300 xTruthEvent->setPdfInfoParameter((float)pdfInfo->x[0], xAOD::TruthEvent::X1);
301 xTruthEvent->setPdfInfoParameter((float)pdfInfo->x[1], xAOD::TruthEvent::X2);
302 xTruthEvent->setPdfInfoParameter((float)pdfInfo->scale, xAOD::TruthEvent::Q);
303 xTruthEvent->setPdfInfoParameter((float)pdfInfo->xf[0], xAOD::TruthEvent::XF1);
304 xTruthEvent->setPdfInfoParameter((float)pdfInfo->xf[1], xAOD::TruthEvent::XF2);
305 }
306
307 // Handle LHE event record
308 auto lhe_record_attribute = genEvt->attribute<HepMC::ShortEventAttribute>(HepMCStr::LHERecord);
309
310 if (lhe_record_attribute && !hadLHERecord && !m_lheTruthParticleContainerKey.empty()){
311 hadLHERecord=true;
312 // The event had an LHE record, so let's record it. This will only happen once per event.
313 SG::WriteHandle<xAOD::TruthParticleContainer> xTruthLHEParticleContainer(m_lheTruthParticleContainerKey, ctx);
314 ATH_CHECK(xTruthLHEParticleContainer.record(std::make_unique<xAOD::TruthParticleContainer>(),
315 std::make_unique<xAOD::TruthParticleAuxContainer>()));
316 ATH_MSG_DEBUG( "Recorded TruthLHEParticleContainer with key: " << m_lheTruthParticleContainerKey.key() );
317 // The LHE record is stored in a struct with old-style LHE format, so we have to re-encode it
318 for (int nPart=0;nPart<lhe_record_attribute->NUP;++nPart) {
319 // Create TruthParticle
320 xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
321 // Put particle into container;
322 xTruthLHEParticleContainer->push_back( xTruthParticle );
323 // Copy LHE info into the new particle; good description is in https://arxiv.org/abs/hep-ph/0609017
324 xTruthParticle->setPdgId( lhe_record_attribute->IDUP[nPart] );
325 xTruthParticle->setUid( nPart+1 );
326 xTruthParticle->setStatus( lhe_record_attribute->ISTUP[nPart] );
327 xTruthParticle->setPx( lhe_record_attribute->PUP[nPart][0] );
328 xTruthParticle->setPy( lhe_record_attribute->PUP[nPart][1] );
329 xTruthParticle->setPz( lhe_record_attribute->PUP[nPart][2] );
330 xTruthParticle->setE( lhe_record_attribute->PUP[nPart][3] );
331 xTruthParticle->setM( lhe_record_attribute->PUP[nPart][4] );
332 } // End of loop over particles
333 } // End of if we found the LHE record attribute
334 else if (hadLHERecord){
335 ATH_MSG_WARNING("Truth record appeared to have two LHE records; this should not be possible");
336 }
337 }else{//not isSignalProcess
338 xTruthPileupEvent = xTruthPileupEventContainer->push_back( std::make_unique<xAOD::TruthPileupEvent>() );
339 }
340
341 // (2) Build particles and vertices
342 // Map for building associations between particles and vertices
343 // The pair in the map is the (incomingParticles . outgoingParticles) of the given vertex
344 // If signal process vertex is a disconnected vertex (no incoming/outgoing particles), add it manually
345 VertexMap vertexMap;
346 VertexMap::iterator mapItr;
347 vector<HepMC::ConstGenVertexPtr> vertices;
348
349 // Check signal process vertex
350 // If this is a disconnected vertex, add it manually or won't be added from the loop over particles below.
351 auto disconnectedSignalProcessVtx = HepMC::signal_process_vertex(genEvt); // Get the signal process vertex
352 if (disconnectedSignalProcessVtx) {
353 if (disconnectedSignalProcessVtx->particles_in_size() == 0 && disconnectedSignalProcessVtx->particles_out_size() == 0 ) {
354 //This is a disconnected vertex, add it manually
355 vertices.push_back (std::move(disconnectedSignalProcessVtx));
356 }
357 } else {
358 ATH_MSG_WARNING("Signal process vertex pointer not valid in HepMC Collection for GenEvent #" << cntr << " / " << mcColl->size());
359 }
360
361 // Get the beam particles
362 pair<HepMC::ConstGenParticlePtr,HepMC::ConstGenParticlePtr> beamParticles;
363 bool genEvt_valid_beam_particles=false;
364 auto beamParticles_vec = genEvt->beams();
365 genEvt_valid_beam_particles=(beamParticles_vec.size()>1);
366 if (genEvt_valid_beam_particles){beamParticles.first=beamParticles_vec[0]; beamParticles.second=beamParticles_vec[1]; }
367 // We want to process particles in barcode order.
368 auto bcmapatt = genEvt->attribute<HepMC::GenEventBarcodes>(HepMCStr::barcodes); // FIXME barcode-based
369 if (!bcmapatt) {
370 ATH_MSG_ERROR("TruthParticleCnvTool.cxx: Event does not contain barcodes attribute");
371 return StatusCode::FAILURE;
372 }
373 std::map<int, HepMC3::ConstGenParticlePtr> bcmap = bcmapatt->barcode_to_particle_map();
374 xTruthParticleContainer->reserve(bcmap.size());
375 for (const auto &[genPartBarcode,part]: bcmap) {
376 int genPartUniqueID = HepMC::uniqueID(part);
377 // (a) create TruthParticle
378 xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
379 // (b) Put particle into container;
380 xTruthParticleContainer->push_back( xTruthParticle );
381 fillParticle(xTruthParticle, part); // (c) Copy HepMC info into the new particle
382 // (d) Build Event<->Particle element link
383 const ElementLink<xAOD::TruthParticleContainer> eltp(*xTruthParticleContainer, xTruthParticleContainer->size()-1);
384 if (isSignalProcess) xTruthEvent->addTruthParticleLink(eltp);
385 if (!isSignalProcess) xTruthPileupEvent->addTruthParticleLink(eltp);
386
387 // Create link between HepMC and xAOD truth
388 if (isSignalProcess) truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink(genPartUniqueID,0,HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_ID), eltp));
389 if (!isSignalProcess) truthLinkVec->push_back(new xAODTruthParticleLink(HepMcParticleLink(genPartUniqueID,genEvt->event_number(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_ID), eltp));
390
391 // Is this one of the beam particles?
392 if (genEvt_valid_beam_particles) {
393 if (isSignalProcess) {
394 if (part == beamParticles.first) xTruthEvent->setBeamParticle1Link(eltp);
395 if (part == beamParticles.second) xTruthEvent->setBeamParticle2Link(eltp);
396 }
397 }
398 // (e) Particle's production vertex
399 auto productionVertex = part->production_vertex();
400 // Skip the dummy vertex that HepMC3 adds
401 // Can distinguish it from real vertices because it has
402 // a null event pointer.
403 if (productionVertex && productionVertex->parent_event() != nullptr) {
404 VertexParticles& parts = vertexMap[productionVertex];
405 if (parts.incoming.empty() && parts.outgoing.empty())
406 vertices.push_back (std::move(productionVertex));
407 parts.outgoingEL.push_back(eltp);
408 parts.outgoing.push_back(xTruthParticle);
409 }
410 //
411 // else maybe want to keep track that this is the production vertex
412 //
413 // (f) Particle's decay vertex
414 auto decayVertex = part->end_vertex();
415 if (decayVertex) {
416 VertexParticles& parts = vertexMap[decayVertex];
417 if (parts.incoming.empty() && parts.outgoing.empty())
418 vertices.push_back (std::move(decayVertex));
419 parts.incomingEL.push_back(eltp);
420 parts.incoming.push_back(xTruthParticle);
421 }
422
423 } // end of loop over particles
424
425 // (3) Loop over the map
426 auto signalProcessVtx = HepMC::signal_process_vertex(genEvt); // Get the signal process vertex
427 xTruthVertexContainer->reserve(vertices.size());
428 for (const auto& vertex : vertices) {
429 const auto& parts = vertexMap[vertex];
430 // (a) create TruthVertex
431 xAOD::TruthVertex* xTruthVertex = new xAOD::TruthVertex();
432 // (b) Put particle into container (so has store)
433 xTruthVertexContainer->push_back( xTruthVertex );
434 fillVertex(xTruthVertex, vertex); // (c) Copy HepMC info into the new vertex
435 // (d) Build Event<->Vertex element link
436 ElementLink<xAOD::TruthVertexContainer> eltv(*xTruthVertexContainer, xTruthVertexContainer->size()-1);
437 // Mark if this is the signal process vertex
438 if (vertex == signalProcessVtx && isSignalProcess) xTruthEvent->setSignalProcessVertexLink(eltv);
439 if (isSignalProcess) xTruthEvent->addTruthVertexLink(eltv);
440 if (!isSignalProcess) xTruthPileupEvent->addTruthVertexLink(eltv);
441 // (e) Assign incoming particles to the vertex, from the map
442 xTruthVertex->setIncomingParticleLinks( parts.incomingEL );
443 // (f) Assign outgoing particles to the vertex, from the map
444 xTruthVertex->setOutgoingParticleLinks( parts.outgoingEL );
445 // (g) Set Particle<->Vertex links for incoming particles
446 for (xAOD::TruthParticle* p : parts.incoming) p->setDecayVtxLink(eltv);
447 // (h) Set Particle<->Vertex links for incoming particles
448 for (xAOD::TruthParticle* p : parts.outgoing) p->setProdVtxLink(eltv);
449 } //end of loop over vertices
450
451 } // end of loop over McEventCollection
452
453
454 std::stable_sort(truthLinkVec->begin(), truthLinkVec->end(), SortTruthParticleLink());
455 ATH_MSG_VERBOSE("Summarizing truth link size: " << truthLinkVec->size() );
456
457 return StatusCode::SUCCESS;
458 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandleKey< xAOD::TruthVertexContainer > m_xaodTruthVertexContainerKey
Gaudi::Property< bool > m_doAllPileUp
Pile-up options.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_lheTruthParticleContainerKey
SG::WriteHandleKey< xAODTruthParticleLinkVector > m_truthLinkContainerKey
SG::ReadHandleKey< McEventCollection > m_aodContainerKey
The key of the input AOD truth container.
static void fillVertex(xAOD::TruthVertex *tv, const HepMC::ConstGenVertexPtr &gv)
These functions do not set up ELs, just the other variables.
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerKey
Gaudi::Property< bool > m_writeMetaData
option to disable writing of metadata (e.g. if running a filter on xAOD in generators)
std::map< HepMC::ConstGenVertexPtr, VertexParticles > VertexMap
Convenience handle for a map of vtx ptrs -> connected particles.
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfo
Event Info.
Gaudi::Property< bool > m_doInTimePileUp
static void fillParticle(xAOD::TruthParticle *tp, const HepMC::ConstGenParticlePtr &gp)
SG::WriteHandleKey< xAOD::TruthEventContainer > m_xaodTruthEventContainerKey
The key for the output xAOD truth containers.
SG::WriteHandleKey< xAOD::TruthPileupEventContainer > m_xaodTruthPUEventContainerKey
void addTruthVertexLink(const TruthVertexLink_t &vlink)
Add one truth vertex.
void addTruthParticleLink(const TruthParticleLink_t &plink)
Add one truth particle.
void setWeights(const std::vector< float > &weights)
Set the event weights.
void setSignalProcessVertexLink(const TruthVertexLink_t &link)
Set pointer to a vertex representing the primary beam interaction point.
void setCrossSectionError(float value)
Set the cross-section error.
void setCrossSection(float value)
Set the cross-section.
bool setHeavyIonParameter(int value, HIParam parameter)
Set an integer HI parameter.
bool setPdfInfoParameter(int value, PdfParam parameter)
Set an integer PDF info parameter.
@ NWOUNDEDNWOUNDEDCOLLISIONS
[int]
void setBeamParticle1Link(const TruthParticleLink_t &pcl1)
Set one incoming beam particle.
void setBeamParticle2Link(const TruthParticleLink_t &pcl2)
Set one incoming beam particle.
void setPy(float value)
Set the y component of the particle's momentum.
void setUid(int value)
Set unique ID.
void setM(float value)
Also store the mass.
void setE(float value)
Set the energy of the particle.
void setPz(float value)
Set the z component of the particle's momentum.
void setStatus(int value)
Set status code.
void setPdgId(int pid)
Set PDG ID code.
void setPx(float value)
Set the x component of the particle's momentum.
void setOutgoingParticleLinks(const TPLinks_t &links)
Set all the outgoing particles.
void setIncomingParticleLinks(const TPLinks_t &links)
Set all the incoming particles.
const std::string weights
const std::string BunchCrossingTime
const std::string barcodes
const std::string LHERecord
int uniqueID(const T &p)
ConstGenVertexPtr signal_process_vertex(const GenEvent *e)
Definition GenEvent.h:597
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
TruthEvent_v1 TruthEvent
Typedef to implementation.
Definition TruthEvent.h:17
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthPileupEvent_v1 TruthPileupEvent
Typedef to implementation.
setEventNumber uint32_t
Type for tracking particles connected to a single vertex.
bool isSeparatorGenEvent(const HepMC::GenEvent *genEvt)

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ fillParticle()

void xAODMaker::xAODTruthCnvAlg::fillParticle ( xAOD::TruthParticle * tp,
const HepMC::ConstGenParticlePtr & gp )
staticprivate

Definition at line 522 of file xAODTruthCnvAlg.cxx.

522 {
523 tp->setPdgId(gp->pdg_id());
524 tp->setUid(HepMC::uniqueID(gp)); // FIXME set xAOD::TruthParticle function name appropriately
525 tp->setStatus(HepMC::status(gp)); // For now convert the status back to the old scheme
526
527 auto pol = HepMC::polarization(gp);
528 if (pol.is_defined()) {
531 }
532
533 tp->setM(gp->generated_mass());
534 tp->setPx(gp->momentum().px());
535 tp->setPy(gp->momentum().py());
536 tp->setPz(gp->momentum().pz());
537 tp->setE(gp->momentum().e());
538 }
bool setPolarizationParameter(float value, PolParam parameter)
Set method for polarization parameter values.
@ polarizationPhi
Polarization in ( ).
@ polarizationTheta
Polarization in ( ).
int status(const T &p)
Polarization polarization(const T &a)

◆ fillVertex()

void xAODMaker::xAODTruthCnvAlg::fillVertex ( xAOD::TruthVertex * tv,
const HepMC::ConstGenVertexPtr & gv )
staticprivate

These functions do not set up ELs, just the other variables.

Definition at line 510 of file xAODTruthCnvAlg.cxx.

510 {
511 // id was renamed to status in HepMC3.
512 tv->setStatus(HepMC::status(gv)); // For now convert the status back to the old scheme
513 tv->setUid(HepMC::uniqueID(gv)); // FIXME set xAOD::TruthVertex function name appropriately
514 tv->setX(gv->position().x());
515 tv->setY(gv->position().y());
516 tv->setZ(gv->position().z());
517 tv->setT(gv->position().t());
518 }
void setStatus(int value)
Set the vertex status.
void setZ(float value)
Set the vertex's longitudinal distance from the origin.
void setUid(int value)
Set the vertex unique ID.
void setT(float value)
Set the vertex time.
void setX(float value)
Set the x displacement of the vertex.
void setY(float value)
Set the y displacement of the vertex.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ handle()

void xAODMaker::xAODTruthCnvAlg::handle ( const Incident & incident)
overridevirtual

Incident handler.

Definition at line 460 of file xAODTruthCnvAlg.cxx.

460 {
461 if (m_firstBeginRun && incident.type()==IncidentType::BeginRun) {
462 m_firstBeginRun = false;
463 ServiceHandle<StoreGateSvc> inputStore("StoreGateSvc/InputMetaDataStore", name());
464 if(inputStore.retrieve().isFailure()) {
465 ATH_MSG_ERROR("Failed to retrieve Input Metadata Store");
466 return;
467 }
468 const IOVMetaDataContainer* tagInfo{nullptr};
469 if(inputStore->retrieve(tagInfo,"/TagInfo").isFailure()) {
470 ATH_MSG_WARNING("Failed to retrieve /TagInfo metadata from the input store");
471 return;
472 }
473 if(tagInfo->payloadContainer()->size()>0) {
474 CondAttrListCollection* tagInfoPayload = tagInfo->payloadContainer()->at(0);
475 if(tagInfoPayload->size()>0) {
476 const CondAttrListCollection::AttributeList& al = tagInfoPayload->attributeList(0);
477 if (al.exists("lhefGenerator")){
478 m_metaFields.lhefGenerator = al["lhefGenerator"].data<std::string>();
479 }
480
481 if (al.exists("generators")){
482 m_metaFields.generators = al["generators"].data<std::string>();
483 }
484
485 if (al.exists("evgenProcess")){
486 m_metaFields.evgenProcess = al["evgenProcess"].data<std::string>();
487 }
488
489 if (al.exists("evgenTune")){
490 m_metaFields.evgenTune = al["evgenTune"].data<std::string>();
491 }
492
493 if (al.exists("hardPDF")){
494 m_metaFields.hardPDF = al["hardPDF"].data<std::string>();
495 }
496
497 if (al.exists("softPDF")){
498 m_metaFields.softPDF = al["softPDF"].data<std::string>();
499 }
500 }
501 }
502 else {
503 ATH_MSG_WARNING("Empty Tag Info metadata!");
504 }
505 }
506 }
static Double_t al
const AttributeList & attributeList(ChanNum chanNum) const
attribute list for a given channel number
size_type size() const
number of Chan/AttributeList pairs
coral::AttributeList AttributeList
const IOVPayloadContainer * payloadContainer() const
Access to payload container.
size_type size() const
size of payload vector
CondAttrListCollection * at(unsigned int i) const
Element access.

◆ initialize()

StatusCode xAODMaker::xAODTruthCnvAlg::initialize ( )
overridevirtual

Function initialising the algorithm.

Definition at line 65 of file xAODTruthCnvAlg.cxx.

65 {
67 ATH_MSG_FATAL( "Contradictory xAOD truth pile-up setting: all pile-up AND in-time alone requested simultaneously. Check settings." );
68 return StatusCode::FAILURE;
69 }
70
71 if (m_writeMetaData) {
72 ATH_CHECK( m_meta.initialize (m_metaStore, m_metaName) );
73 }
74
75 // initialize handles
77
78 // only if doing full truth
79 ATH_CHECK(m_aodContainerKey.initialize());
86 }
87
88 ATH_CHECK(m_evtInfo.initialize());
89
90 ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name());
91 ATH_CHECK(incSvc.retrieve());
92 incSvc->addListener( this, "BeginRun", 10);
93
94 ATH_MSG_DEBUG("AODContainerName = " << m_aodContainerKey.key() );
95 ATH_MSG_DEBUG("xAOD TruthEventContainer name = " << m_xaodTruthEventContainerKey.key() );
96 ATH_MSG_DEBUG("xAOD TruthPileupEventContainer name = " << m_xaodTruthPUEventContainerKey.key() );
97 ATH_MSG_DEBUG("xAOD TruthParticleContainer name = " << m_xaodTruthParticleContainerKey.key() );
98 ATH_MSG_DEBUG("xAOD TruthVertexContainer name = " << m_xaodTruthVertexContainerKey.key() );
100 ATH_MSG_DEBUG("xAOD TruthLHEParticleContainer name = " << m_lheTruthParticleContainerKey.key() );
101 }
102
103 if (m_doAllPileUp) ATH_MSG_INFO( "All pile-up truth (including out-of-time) will be written" );
104 if (m_doInTimePileUp) ATH_MSG_INFO( "In-time pile-up truth (but not out-of-time) will be written" );
105 if (!m_doAllPileUp && !m_doInTimePileUp) ATH_MSG_INFO( "No pile-up truth will be written" );
106
107 return StatusCode::SUCCESS;
108 }
#define ATH_MSG_INFO(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::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 AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

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

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::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 AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

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

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

MetaDataWriter m_meta xAODMaker::xAODTruthCnvAlg::ATLAS_THREAD_SAFE
mutableprivate

Helper for writing to the meta data store.

This factors out the pieces that are non-const. It's declared mutable and protected with a mutex.

Definition at line 135 of file xAODTruthCnvAlg.h.

◆ m_aodContainerKey

SG::ReadHandleKey<McEventCollection> xAODMaker::xAODTruthCnvAlg::m_aodContainerKey
private
Initial value:
{
this, "AODContainerName", "GEN_AOD", "The input McEvenCollection"}

The key of the input AOD truth container.

Definition at line 111 of file xAODTruthCnvAlg.h.

111 {
112 this, "AODContainerName", "GEN_AOD", "The input McEvenCollection"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doAllPileUp

Gaudi::Property<bool> xAODMaker::xAODTruthCnvAlg::m_doAllPileUp {this, "WriteAllPileUpTruth", false}
private

Pile-up options.

Definition at line 129 of file xAODTruthCnvAlg.h.

129{this, "WriteAllPileUpTruth", false};

◆ m_doInTimePileUp

Gaudi::Property<bool> xAODMaker::xAODTruthCnvAlg::m_doInTimePileUp {this, "WriteInTimePileUpTruth", false}
private

Definition at line 130 of file xAODTruthCnvAlg.h.

130{this, "WriteInTimePileUpTruth", false};

◆ m_evtInfo

SG::ReadHandleKey<xAOD::EventInfo> xAODMaker::xAODTruthCnvAlg::m_evtInfo {this, "EventInfo", "EventInfo", "" }
private

Event Info.

Definition at line 146 of file xAODTruthCnvAlg.h.

146{this, "EventInfo", "EventInfo", "" };

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_firstBeginRun

bool xAODMaker::xAODTruthCnvAlg::m_firstBeginRun
private

Tag Info.

Definition at line 149 of file xAODTruthCnvAlg.h.

◆ m_lheTruthParticleContainerKey

SG::WriteHandleKey<xAOD::TruthParticleContainer> xAODMaker::xAODTruthCnvAlg::m_lheTruthParticleContainerKey
private
Initial value:
{
this, "xAODTruthLHEParticleContainerName", "", "Output TruthLHEParticles container"}

Definition at line 125 of file xAODTruthCnvAlg.h.

125 {
126 this, "xAODTruthLHEParticleContainerName", "", "Output TruthLHEParticles container"};

◆ m_metaFields

MetadataFields xAODMaker::xAODTruthCnvAlg::m_metaFields
private

Definition at line 150 of file xAODTruthCnvAlg.h.

◆ m_metaName

std::string xAODMaker::xAODTruthCnvAlg::m_metaName
private

SG key and name for meta data.

Definition at line 140 of file xAODTruthCnvAlg.h.

◆ m_metaStore

ServiceHandle< StoreGateSvc > xAODMaker::xAODTruthCnvAlg::m_metaStore
private

Connection to the metadata store.

Definition at line 138 of file xAODTruthCnvAlg.h.

◆ m_truthLinkContainerKey

SG::WriteHandleKey<xAODTruthParticleLinkVector> xAODMaker::xAODTruthCnvAlg::m_truthLinkContainerKey
private
Initial value:
{
this, "TruthLinks", "xAODTruthLinks", "Output xAODTruthLinks container"}

Definition at line 123 of file xAODTruthCnvAlg.h.

123 {
124 this, "TruthLinks", "xAODTruthLinks", "Output xAODTruthLinks container"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeMetaData

Gaudi::Property<bool> xAODMaker::xAODTruthCnvAlg::m_writeMetaData {this, "WriteTruthMetaData", true}
private

option to disable writing of metadata (e.g. if running a filter on xAOD in generators)

Definition at line 143 of file xAODTruthCnvAlg.h.

143{this, "WriteTruthMetaData", true};

◆ m_xaodTruthEventContainerKey

SG::WriteHandleKey<xAOD::TruthEventContainer> xAODMaker::xAODTruthCnvAlg::m_xaodTruthEventContainerKey
private
Initial value:
{
this, "xAODTruthEventContainerName", "TruthEvents", "Output TruthEvents container"}

The key for the output xAOD truth containers.

Definition at line 115 of file xAODTruthCnvAlg.h.

115 {
116 this, "xAODTruthEventContainerName", "TruthEvents", "Output TruthEvents container"};

◆ m_xaodTruthParticleContainerKey

SG::WriteHandleKey<xAOD::TruthParticleContainer> xAODMaker::xAODTruthCnvAlg::m_xaodTruthParticleContainerKey
private
Initial value:
{
this, "xAODTruthParticleContainerName", "TruthParticles", "Output TruthParticles container"}

Definition at line 119 of file xAODTruthCnvAlg.h.

119 {
120 this, "xAODTruthParticleContainerName", "TruthParticles", "Output TruthParticles container"};

◆ m_xaodTruthPUEventContainerKey

SG::WriteHandleKey<xAOD::TruthPileupEventContainer> xAODMaker::xAODTruthCnvAlg::m_xaodTruthPUEventContainerKey
private
Initial value:
{
this, "xAODTruthPileupEventContainerName", "TruthPileupEvents", "Output TruthPileupEvents container"}

Definition at line 117 of file xAODTruthCnvAlg.h.

117 {
118 this, "xAODTruthPileupEventContainerName", "TruthPileupEvents", "Output TruthPileupEvents container"};

◆ m_xaodTruthVertexContainerKey

SG::WriteHandleKey<xAOD::TruthVertexContainer> xAODMaker::xAODTruthCnvAlg::m_xaodTruthVertexContainerKey
private
Initial value:
{
this, "xAODTruthVertexContainerName", "TruthVertices", "Output TruthVertices container"}

Definition at line 121 of file xAODTruthCnvAlg.h.

121 {
122 this, "xAODTruthVertexContainerName", "TruthVertices", "Output TruthVertices container"};

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