ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
FixHepMC Class Reference

A "fix-up" algorithm to correct weird event records. More...

#include <FixHepMC.h>

Inheritance diagram for FixHepMC:
Collaboration diagram for FixHepMC:

Public Member Functions

 FixHepMC (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
Event reduction functions
StatusCode execute ()
 
StatusCode finalize ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 
Classifiers for identifying particles to be removed
bool isPID0 (const HepMC::ConstGenParticlePtr &p) const
 
bool isNonTransportableInDecayChain (const HepMC::ConstGenParticlePtr &p) const
 
bool isSimpleLoop (const HepMC::ConstGenParticlePtr &p) const
 
bool fromDecay (const HepMC::ConstGenParticlePtr &p, std::shared_ptr< std::set< int > > &storage) const
 

Private Attributes

DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 
Config properties
bool m_killLoops
 
bool m_killPDG0
 
bool m_cleanDecays
 
Cleaned-particle counters
long m_loopKilled
 
long m_pdg0Killed
 
long m_decayCleaned
 
long m_totalSeen
 
long m_replacedPIDs
 
std::map< int, int > m_pidmap
 map of pids to change. More...
 
MC::Loops< HepMC::GenEvent, HepMC::ConstGenParticlePtr, HepMC::ConstGenVertexPtrm_looper
 member to detect loops More...
 

Utility event-mangling functions

Todo:
Replace with HepMC units when available
ServiceHandle< IPartPropSvc > m_ppSvc {this, "PartPropSvc", "PartPropSvc"}
 Handle on the particle property service. More...
 
SG::ReadHandleKey< McEventCollectionm_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
 Const handle to the MC event collection. More...
 
void GeVToMeV (HepMC::GenEvent *evt)
 Scale event energies/momenta by x 1000. More...
 
void MeVToGeV (HepMC::GenEvent *evt)
 Scale event energies/momenta by x 1/1000. More...
 
void cmTomm (HepMC::GenEvent *evt)
 Scale event lengths by x 10. More...
 
void mmTocm (HepMC::GenEvent *evt)
 Scale event lengths by x 1/10. More...
 

Detailed Description

A "fix-up" algorithm to correct weird event records.

FixHepMC is run in evgen production, after the chain of input, shower, hadronization, and afterburner generators, but before the TestHepMC check algorithm, any analysis algs, and the POOL event stream output. Its job is to "normalise" strange event features to allow greater consistency of MC event record use in ATLAS.

Examples of its features include removing dummy "padding" particles from event records, stripping parton and EW boson intermediates from hadron/tau decay chains, and ensuring that every event has at least one entry in its event weight vector.

Definition at line 31 of file FixHepMC.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ FixHepMC()

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

Definition at line 14 of file FixHepMC.cxx.

15  : GenBase(name, pSvcLocator)
16  , m_loopKilled(0)
17  , m_pdg0Killed(0)
18  , m_decayCleaned(0)
19  , m_totalSeen(0)
20  , m_replacedPIDs(0)
21 {
22  declareProperty("KillLoops", m_killLoops = true, "Remove particles in loops?");
23  declareProperty("KillPDG0", m_killPDG0 = true, "Remove particles with PDG ID 0?");
24  declareProperty("CleanDecays", m_cleanDecays = true, "Clean decay chains from non-propagating particles?");
25  declareProperty("PIDmap", m_pidmap = std::map<int,int>(), "Map of PDG IDs to replace");
26 }

Member Function Documentation

◆ ATLAS_NOT_CONST_THREAD_SAFE() [1/2]

HepMC::GenEvent* event GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inlineinherited

Access the current signal event (first in the McEventCollection)

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

Definition at line 76 of file GenBase.h.

76  {
77  if (events()->empty())
78  ATH_MSG_ERROR("McEventCollection is empty during first event access");
79  return *(events()->begin());
80  }

◆ ATLAS_NOT_CONST_THREAD_SAFE() [2/2]

McEventCollection* events GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inherited

Access the current event's McEventCollection.

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

◆ cmTomm()

void GenBase::cmTomm ( HepMC::GenEvent *  evt)
protectedinherited

Scale event lengths by x 10.

Definition at line 78 of file GenBase.cxx.

78  {
79  for (HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin(); vtx != evt->vertices_end(); ++vtx) {
80  const HepMC::FourVector fv((*vtx)->position().x() * 10,
81  (*vtx)->position().y() * 10,
82  (*vtx)->position().z() * 10,
83  (*vtx)->position().t() * 10);
84  (*vtx)->set_position(fv);
85  }
86 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ event_const()

const HepMC::GenEvent* GenBase::event_const ( ) const
inlineinherited

Access the current signal event (const)

Definition at line 83 of file GenBase.h.

83  {
84  if (events_const()->empty())
85  ATH_MSG_ERROR("Const McEventCollection is empty during first event access");
86  return *(events_const()->begin());
87  }

◆ events_const() [1/2]

const McEventCollection* GenBase::events_const ( ) const
inlineinherited

Access the current event's McEventCollection (const)

Definition at line 96 of file GenBase.h.

96  {
97  return events_const( getContext() );
98  }

◆ events_const() [2/2]

const McEventCollection* GenBase::events_const ( const EventContext &  ctx) const
inlineinherited

Definition at line 99 of file GenBase.h.

99  {
101  if (!ret.isValid())
102  ATH_MSG_ERROR("No McEventCollection found in StoreGate with key " << m_mcevents_const.key());
103  return ret.cptr();
104  }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode FixHepMC::execute ( )
virtual

Case 1: particles without production vertex, except beam particles (status 4)

Case 2: non-final-state particles without end vertex

AV: In case we have 3 particles, we try to add a vertex that correspond to 1->2 and 1->1 splitting. AV: we can try to do that for 4 particles as well.

The condition below will cover 1->1, 1->2 and 2->1 cases

Remove loops inside decay chains AV: Please note that this approach would distort some branching ratios. If some particle would have decay products with bad PDG ids, after the operation below the visible branching ratio of these decays would be zero.

Check the bad particles have prod and end vertices

Check that all particles coming into the decay vertex of bad particle cam from the same production vertex.

Reimplemented from GenBase.

Definition at line 91 of file FixHepMC.cxx.

91  {
92  for (McEventCollection::const_iterator ievt = events()->begin(); ievt != events()->end(); ++ievt) {
93  // FIXME: const_cast
94  HepMC::GenEvent* evt = const_cast<HepMC::GenEvent*>(*ievt);
95  m_looper.findLoops(evt,true);
96  /* AV: To understand why some algorithms fail one would have to request debug explicitly, but that is the reviwers consensus.*/
97  if (!m_looper.loop_particles().empty() || !m_looper.loop_vertices().empty()) {
98  ATH_MSG_DEBUG("Found " << m_looper.loop_vertices().size() << " vertices in loops");
99  ATH_MSG_DEBUG("Found " << m_looper.loop_particles().size() << " particles in loops");
100  ATH_MSG_DEBUG("Please use MC::Loops::findLoops for this event to obtain all particles and vertices in the loops");
101  }
102  if (!m_pidmap.empty()) {
103  for (auto ip: *evt) {
104  // Skip this particle if (somehow) its pointer is null
105  if (!ip) continue;
106  auto newpid = m_pidmap.find(ip->pdg_id());
107  if (newpid == m_pidmap.end()) continue;
108  ip->set_pdg_id(newpid->second);
109  }
110  }
111 #ifdef HEPMC3
112  // Add a unit entry to the event weight vector if it's currently empty
113  if (evt->weights().empty()) {
114  ATH_MSG_DEBUG("Adding a unit weight to empty event weight vector");
115  evt->weights().push_back(1);
116  }
117  // Set a (0,0,0) vertex to be the signal vertex if not already set
119  const HepMC::FourVector nullpos;
120  for (auto iv: evt->vertices()) {
121  if (iv->position() == nullpos) {
122  ATH_MSG_DEBUG("Setting representative event position vertex");
124  break;
125  }
126  }
127  }
128 
129  // Catch cases with more than 2 beam particles (16.11.2021)
130  std::vector<HepMC::GenParticlePtr> beams_t;
131  for (const HepMC::GenParticlePtr& p : evt->beams()) {
132  if (p->status() == 4) beams_t.push_back(p);
133  }
134  if (beams_t.size() > 2) {
135  ATH_MSG_INFO("Invalid number of beam particles " << beams_t.size() << ". Will try to fix.");
136  std::vector<HepMC::GenParticlePtr> bparttoremove;
137  for (const auto& bpart : beams_t) {
138  if (bpart->id() == 0 && bpart->production_vertex()) bparttoremove.push_back(bpart);
139  }
140  for (auto bpart: bparttoremove) {
141  bpart->production_vertex()->remove_particle_out(bpart);
142  }
143  }
144 
145  // Some heuristics to catch problematic cases
146  std::vector<HepMC::GenParticlePtr> semi_disconnected, decay_loop_particles;
147  for (auto ip : evt->particles()) {
148  // Skip this particle if (somehow) its pointer is null
149  if (!ip) continue;
150  bool particle_to_fix = false;
151  int abspid = std::abs(ip->pdg_id());
152  auto vProd = ip->production_vertex();
153  auto vEnd = ip->end_vertex();
155  if ( (!vProd || vProd->id() == 0) && vEnd && ip->status() != 4) {
156  particle_to_fix = true;
157  ATH_MSG_DEBUG("Found particle " << ip->pdg_id() << " without production vertex! HepMC status = " << ip->status());
158  }
160  if (vProd && !vEnd && ip->status() != 1) {
161  particle_to_fix = true;
162  ATH_MSG_DEBUG("Found particle " << ip->pdg_id() << " without decay vertex! HepMC status = " << ip->status());
163  }
164  if (particle_to_fix) semi_disconnected.push_back(ip);
165  // Case 3: keep track of loop particles inside decay chains (seen in H7+EvtGen)
166  if (abspid == 43 || abspid == 44 || abspid == 30353 || abspid == 30343) {
167  decay_loop_particles.push_back(ip);
168  }
169  }
170 
174  if ( semi_disconnected.size() == 4 || semi_disconnected.size() == 3 || semi_disconnected.size() == 2) {
175  size_t no_endv = 0;
176  size_t no_prov = 0;
177  HepMC::FourVector sum(0,0,0,0);
178  for (const auto& part : semi_disconnected) {
179  if (!part->production_vertex() || !part->production_vertex()->id()) {
180  no_prov++; sum += part->momentum();
181  }
182  if (!part->end_vertex()) {
183  no_endv++; sum -= part->momentum();
184  }
185  }
186  ATH_MSG_INFO("Heuristics: found " << semi_disconnected.size() << " semi-disconnected particles. Momentum sum is " << sum);
188  if (no_endv && no_prov && ( no_endv + no_prov == semi_disconnected.size() )) {
189  if (std::abs(sum.px()) < 1e-2 && std::abs(sum.py()) < 1e-2 && std::abs(sum.pz()) < 1e-2 ) {
190  ATH_MSG_INFO("Try " << no_endv << "->" << no_prov << " splitting/merging.");
191  auto v = HepMC::newGenVertexPtr();
192  for (auto part : semi_disconnected) {
193  if (!part->production_vertex() || part->production_vertex()->id() == 0) v->add_particle_out(part);
194  }
195  for (auto part : semi_disconnected) {
196  if (!part->end_vertex()) v->add_particle_in(part);
197  }
198  evt->add_vertex(v);
199  }
200  }
201  }
202 
207  for (auto part: decay_loop_particles) {
209  auto vend = part->end_vertex();
210  auto vprod = part->production_vertex();
211  if (!vprod || !vend) continue;
212  bool loop_in_decay = true;
215  auto sisters = vend->particles_in();
216  for (auto sister: sisters) {
217  if (vprod != sister->production_vertex()) loop_in_decay = false;
218  }
219  if (!loop_in_decay) continue;
220 
222  auto daughters = vend->particles_out();
223  for (auto p : daughters) vprod->add_particle_out(p);
224  for (auto sister : sisters) {
225  vprod->remove_particle_out(sister);
226  vend->remove_particle_in(sister);
227  evt->remove_particle(sister);
228  }
229  evt->remove_vertex(vend);
230 
231  }
232 
233  // Event particle content cleaning -- remove "bad" structures
234  std::vector<HepMC::GenParticlePtr> toremove;
235  for (auto ip: evt->particles()) {
236  // Skip this particle if (somehow) its pointer is null
237  if (!ip) continue;
238  m_totalSeen += 1;
239  // Flag to declare if a particle should be removed
240  bool bad_particle = false;
241  // Check for loops
242  if ( m_killLoops && isSimpleLoop(ip) ) {
243  bad_particle = true;
244  m_loopKilled += 1;
245  ATH_MSG_DEBUG( "Found a looper : " );
247  }
248  // Check on PDG ID 0
249  if ( m_killPDG0 && isPID0(ip) ) {
250  bad_particle = true;
251  m_pdg0Killed += 1;
252  ATH_MSG_DEBUG( "Found PDG ID 0 : " );
254  }
255  // Clean decays
256  int abs_pdg_id = std::abs(ip->pdg_id());
257  bool is_decayed_weak_boson = ( abs_pdg_id == 23 || abs_pdg_id == 24 || abs_pdg_id == 25 ) && ip->end_vertex();
258  if ( m_cleanDecays && isNonTransportableInDecayChain(ip) && !is_decayed_weak_boson ) {
259  bad_particle = true;
260  m_decayCleaned += 1;
261  ATH_MSG_DEBUG( "Found a bad particle in a decay chain : " );
263  }
264  // Only add to the toremove vector once, even if multiple tests match
265  if (bad_particle) toremove.push_back(ip);
266  }
267 
268  // Escape here if there's nothing more to do, otherwise do the cleaning
269  if (toremove.empty()) continue;
270  ATH_MSG_DEBUG("Cleaning event record of " << toremove.size() << " bad particles");
271  // Properties before cleaning
272  const int num_particles_orig = evt->particles().size();
273  for (auto part: toremove) evt->remove_particle(part);
274  const int num_particles_filt = evt->particles().size();
275  // Write out the change in the number of particles
276  ATH_MSG_INFO("Particles filtered: " << num_particles_orig << " -> " << num_particles_filt);
277  #else
278 
279  // Add a unit entry to the event weight vector if it's currently empty
280  if (evt->weights().empty()) {
281  ATH_MSG_DEBUG("Adding a unit weight to empty event weight vector");
282  evt->weights().push_back(1);
283  }
284 
285  // Set a (0,0,0) vertex to be the signal vertex if not already set
286  if (evt->signal_process_vertex() == NULL) {
287  const HepMC::FourVector nullpos;
288  for (HepMC::GenEvent::vertex_const_iterator iv = evt->vertices_begin(); iv != evt->vertices_end(); ++iv) {
289  if ((*iv)->position() == nullpos) {
290  ATH_MSG_DEBUG("Setting representative event position vertex");
291  evt->set_signal_process_vertex(const_cast<HepMC::GenVertex*>(*iv));
292  break;
293  }
294  }
295  }
296 
297 
298  // Some heuristics to catch problematic cases
299  std::vector<HepMC::GenParticlePtr> semi_disconnected, decay_loop_particles;
300  for (auto ip : *evt) {
301  // Skip this particle if (somehow) its pointer is null
302  if (!ip) continue;
303  bool particle_to_fix = false;
304  int abspid = std::abs(ip->pdg_id());
305  auto vProd = ip->production_vertex();
306  auto vEnd = ip->end_vertex();
308  if ( (!vProd || vProd->id() == 0) && vEnd && ip->status() != 4) {
309  particle_to_fix = true;
310  ATH_MSG_DEBUG("Found particle " << ip->pdg_id() << " without production vertex! HepMC status = " << ip->status());
311  }
313  if (vProd && !vEnd && ip->status() != 1) {
314  particle_to_fix = true;
315  ATH_MSG_DEBUG("Found particle " << ip->pdg_id() << " without decay vertex! HepMC status = " << ip->status());
316  }
317  if (particle_to_fix) semi_disconnected.push_back(ip);
318  // Case 3: keep track of loop particles inside decay chains (seen in H7+EvtGen)
319  if (abspid == 43 || abspid == 44 || abspid == 30353 || abspid == 30343) {
320  decay_loop_particles.push_back(ip);
321  }
322  }
323 
326  if (semi_disconnected.size() == 4 ||semi_disconnected.size() == 3 || semi_disconnected.size() == 2) {
327  size_t no_endv = 0;
328  size_t no_prov = 0;
329  double vsum[4] = {0,0,0,0};
330  for (auto part : semi_disconnected) {
331  if (!part->production_vertex() ) {
332  no_prov++;
333  vsum[0] += part->momentum().px();
334  vsum[1] += part->momentum().py();
335  vsum[2] += part->momentum().pz();
336  vsum[3] += part->momentum().e();
337  }
338  if (!part->end_vertex()) {
339  no_endv++;
340  vsum[0] -= part->momentum().px();
341  vsum[1] -= part->momentum().py();
342  vsum[2] -= part->momentum().pz();
343  vsum[3] -= part->momentum().e();
344  }
345  }
346  HepMC::FourVector sum(vsum[0],vsum[1],vsum[2],vsum[3]);
347  ATH_MSG_INFO("Heuristics: found " << semi_disconnected.size() << " semi-disconnected particles. Momentum sum is " << vsum[0] << " " << vsum[1] << " " << vsum[2] << " " << vsum[3]);
349  if (no_endv && no_prov && ( no_endv + no_prov == semi_disconnected.size() )) {
350  if (std::abs(sum.px()) < 1e-2 && std::abs(sum.py()) < 1e-2 && std::abs(sum.pz()) < 1e-2 ) {
351  ATH_MSG_INFO("Try " << no_endv << "->" << no_prov << " splitting/merging.");
352  auto v = HepMC::newGenVertexPtr();
353  for (auto part : semi_disconnected) {
354  if (!part->production_vertex()) v->add_particle_out(part);
355  }
356  for (auto part : semi_disconnected) {
357  if (!part->end_vertex()) v->add_particle_in(part);
358  }
359  evt->add_vertex(v);
360  }
361  }
362  }
363 
368  for (auto part: decay_loop_particles) {
370  auto vend = part->end_vertex();
371  auto vprod = part->production_vertex();
372  if (!vend || !vprod) continue;
373  bool loop_in_decay = true;
375  std::vector<HepMC::GenParticlePtr> sisters;
376  for (auto p = vend->particles_begin(HepMC::parents); p!= vend->particles_end(HepMC::parents); ++p) sisters.push_back(*p);
377  for (auto sister : sisters) {
378  if (vprod != sister->production_vertex()) loop_in_decay = false;
379  }
380  if (!loop_in_decay) continue;
381 
382  std::vector<HepMC::GenParticlePtr> daughters;
383  for (auto p = vend->particles_begin(HepMC::children); p!= vend->particles_end(HepMC::children); ++p) daughters.push_back(*p);
384  for (auto p : daughters) vprod->add_particle_out(p);
385  for (auto sister : sisters) {
386  vprod->remove_particle(sister);
387  vend->remove_particle(sister);
388  }
389  evt->remove_vertex(vend);
390 
391  }
392 
393 
394  // Event particle content cleaning -- remove "bad" structures
395  std::vector<HepMC::GenParticlePtr> toremove; toremove.reserve(10);
396  for (HepMC::GenEvent::particle_const_iterator ip = evt->particles_begin(); ip != evt->particles_end(); ++ip) {
397  // Skip this particle if (somehow) its pointer is null
398  if (*ip == NULL) continue;
399  m_totalSeen += 1;
400 
401  // Flag to declare if a particle should be removed
402  bool bad_particle = false;
403 
404  // Check for loops
405  if ( m_killLoops && isSimpleLoop(*ip) ) {
406  bad_particle = true;
407  m_loopKilled += 1;
408  ATH_MSG_DEBUG( "Found a looper : " );
409  if ( msgLvl( MSG::DEBUG ) ) (*ip)->print();
410  }
411 
412  // Check on PDG ID 0
413  if ( m_killPDG0 && isPID0(*ip) ) {
414  bad_particle = true;
415  m_pdg0Killed += 1;
416  ATH_MSG_DEBUG( "Found PDG ID 0 : " );
417  if ( msgLvl( MSG::DEBUG ) ) (*ip)->print();
418  }
419 
420  // Clean decays
421  int abs_pdg_id = std::abs((*ip)->pdg_id());
422  bool is_decayed_weak_boson = ( abs_pdg_id == 23 || abs_pdg_id == 24 || abs_pdg_id == 25 ) && (*ip)->end_vertex();
423  if ( m_cleanDecays && isNonTransportableInDecayChain(*ip) && !is_decayed_weak_boson ) {
424  bad_particle = true;
425  m_decayCleaned += 1;
426  ATH_MSG_DEBUG( "Found a bad particle in a decay chain : " );
427  if ( msgLvl( MSG::DEBUG ) ) (*ip)->print();
428  }
429 
430  // Only add to the toremove vector once, even if multiple tests match
431  if (bad_particle) toremove.push_back(*ip);
432  }
433 
434  // Escape here if there's nothing more to do, otherwise do the cleaning
435  if (toremove.empty()) continue;
436  ATH_MSG_DEBUG("Cleaning event record of " << toremove.size() << " bad particles");
437 
438  // Properties before cleaning
439  const int num_particles_orig = evt->particles_size();
440  int num_orphan_vtxs_orig = 0;
441  int num_noparent_vtxs_orig = 0;
442  int num_nochild_vtxs_orig = 0;
443  for (auto v = evt->vertices_begin(); v != evt->vertices_end(); ++v) {
444  if ((*v)->particles_in_size()==0&&(*v)->particles_out_size()==0) num_orphan_vtxs_orig++;
445  if ((*v)->particles_in_size()==0) num_noparent_vtxs_orig++;
446  if ((*v)->particles_out_size()==0) num_nochild_vtxs_orig++;
447  }
448  // Clean!
449  int signal_vertex_bc = evt->signal_process_vertex() ? evt->signal_process_vertex()->barcode() : 0;
450  //This is the only place where reduce is used.
451  reduce(evt , toremove);
452  if (evt->barcode_to_vertex (signal_vertex_bc) == nullptr) {
453  evt->set_signal_process_vertex (nullptr);
454  }
455 
456  // Properties after cleaning
457  const int num_particles_filt = evt->particles_size();
458  int num_orphan_vtxs_filt = 0;
459  int num_noparent_vtxs_filt = 0;
460  int num_nochild_vtxs_filt = 0;
461  for (auto v = evt->vertices_begin(); v != evt->vertices_end(); ++v) {
462  if ((*v)->particles_in_size()==0&&(*v)->particles_out_size()==0) num_orphan_vtxs_filt++;
463  if ((*v)->particles_in_size()==0) num_noparent_vtxs_filt++;
464  if ((*v)->particles_out_size()==0) num_nochild_vtxs_filt++;
465  }
466 
467  // Write out the change in the number of particles
468  ATH_MSG_INFO("Particles filtered: " << num_particles_orig << " -> " << num_particles_filt);
469  // Warn if the numbers of "strange" vertices have changed
470  if (num_orphan_vtxs_filt != num_orphan_vtxs_orig)
471  ATH_MSG_WARNING("Change in orphaned vertices: " << num_orphan_vtxs_orig << " -> " << num_orphan_vtxs_filt);
472  if (num_noparent_vtxs_filt != num_noparent_vtxs_orig)
473  ATH_MSG_WARNING("Change in no-parent vertices: " << num_noparent_vtxs_orig << " -> " << num_noparent_vtxs_filt);
474  if (num_nochild_vtxs_filt != num_nochild_vtxs_orig)
475  ATH_MSG_WARNING("Change in no-parent vertices: " << num_nochild_vtxs_orig << " -> " << num_nochild_vtxs_filt);
476 
477 #endif
478  }
479  return StatusCode::SUCCESS;
480 }

◆ 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 }

◆ finalize()

StatusCode FixHepMC::finalize ( )

Definition at line 483 of file FixHepMC.cxx.

483  {
484  if (m_killLoops ) ATH_MSG_INFO( "Removed " << m_loopKilled << " of " << m_totalSeen << " particles because of loops." );
485  if (m_killPDG0 ) ATH_MSG_INFO( "Removed " << m_pdg0Killed << " of " << m_totalSeen << " particles because of PDG ID 0." );
486  if (m_cleanDecays) ATH_MSG_INFO( "Removed " << m_decayCleaned << " of " << m_totalSeen << " particles while cleaning decay chains." );
487  if (!m_pidmap.empty()) ATH_MSG_INFO( "Replaced " << m_replacedPIDs << "PIDs of particles." );
488  return StatusCode::SUCCESS;
489 }

◆ fromDecay()

bool FixHepMC::fromDecay ( const HepMC::ConstGenParticlePtr p,
std::shared_ptr< std::set< int > > &  storage 
) const
private

Definition at line 501 of file FixHepMC.cxx.

501  {
502  if (!p) return false;
503  auto v=p->production_vertex();
504  if (!v) return false;
505 #ifdef HEPMC3
506  for ( const auto& anc: v->particles_in()) {
507  if (MC::isDecayed(anc) && (MC::isTau(anc->pdg_id()) || MC::isHadron(anc->pdg_id()))) return true;
508  }
509  if (storage->find(p->id()) != storage->end()) return false;
510  storage->insert(p->id());
511  for ( const auto& anc: v->particles_in()) {
512  if (fromDecay(anc, storage)) return true;
513  }
514 #else
515  for (auto anc=v->particles_in_const_begin(); anc != v->particles_in_const_end(); ++anc) {
516  if (MC::isDecayed((*anc)) && (MC::isTau((*anc)->pdg_id()) || MC::isHadron((*anc)->pdg_id()))) return true;
517  }
518  if (storage->find(p->barcode()) != storage->end()) return false;
519  storage->insert(p->barcode());
520  for (auto anc=v->particles_in_const_begin(); anc != v->particles_in_const_end(); ++anc){
521  if (fromDecay(*anc, storage)) return true;
522  }
523 #endif
524  return false;
525 }

◆ GeVToMeV()

void GenBase::GeVToMeV ( HepMC::GenEvent *  evt)
protectedinherited

Scale event energies/momenta by x 1000.

Todo:
Add HepMC units awareness and do it differently when HepMC provides this functionality directly (and reference-based FourVector accessors)

Definition at line 58 of file GenBase.cxx.

58  {
59  for (HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p) {
60  const HepMC::FourVector fv((*p)->momentum().px() * 1000,
61  (*p)->momentum().py() * 1000,
62  (*p)->momentum().pz() * 1000,
63  (*p)->momentum().e() * 1000);
64  (*p)->set_momentum(fv);
65  (*p)->set_generated_mass(1000 * (*p)->generated_mass());
66  }
67 }

◆ initialize()

StatusCode GenBase::initialize ( )
overridevirtualinherited

Reimplemented in CopyEventWeight, FillFilterValues, CountHepMC, HepMCReadFromFile, PrintMC, EvtInclusiveDecay, GenModule, GenFilter, TestHepMC, GenAnalysis, WriteHepMC, DumpMC, and PrintHijingPars.

Definition at line 17 of file GenBase.cxx.

17  {
20 
21  // Get the particle property service
22  ATH_CHECK(m_ppSvc.retrieve());
23  return StatusCode::SUCCESS;
24 }

◆ 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.

◆ isNonTransportableInDecayChain()

bool FixHepMC::isNonTransportableInDecayChain ( const HepMC::ConstGenParticlePtr p) const
private

Definition at line 528 of file FixHepMC.cxx.

528  {
529  auto storage = std::make_shared<std::set<int>>();
530  return !MC::isTransportable(p->pdg_id()) && fromDecay(p, storage);
531 }

◆ isPID0()

bool FixHepMC::isPID0 ( const HepMC::ConstGenParticlePtr p) const
private

Definition at line 496 of file FixHepMC.cxx.

496  {
497  return p->pdg_id() == 0;
498 }

◆ isSimpleLoop()

bool FixHepMC::isSimpleLoop ( const HepMC::ConstGenParticlePtr p) const
private

Definition at line 534 of file FixHepMC.cxx.

534  {
535  return (p->production_vertex() == p->end_vertex() && p->end_vertex() != nullptr);
536 }

◆ MeVToGeV()

void GenBase::MeVToGeV ( HepMC::GenEvent *  evt)
protectedinherited

Scale event energies/momenta by x 1/1000.

Definition at line 68 of file GenBase.cxx.

68  {
69  for (HepMC::GenEvent::particle_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p) {
70  const HepMC::FourVector fv((*p)->momentum().px() / 1000,
71  (*p)->momentum().py() / 1000,
72  (*p)->momentum().pz() / 1000,
73  (*p)->momentum().e() / 1000);
74  (*p)->set_momentum(fv);
75  (*p)->set_generated_mass((*p)->generated_mass() / 1000);
76  }
77 }

◆ mmTocm()

void GenBase::mmTocm ( HepMC::GenEvent *  evt)
protectedinherited

Scale event lengths by x 1/10.

Definition at line 87 of file GenBase.cxx.

87  {
88  for (HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin(); vtx != evt->vertices_end(); ++vtx) {
89  const HepMC::FourVector fv((*vtx)->position().x() / 10,
90  (*vtx)->position().y() / 10,
91  (*vtx)->position().z() / 10,
92  (*vtx)->position().t() / 10);
93  (*vtx)->set_position(fv);
94  }
95 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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.

◆ particleData()

const HepPDT::ParticleData* GenBase::particleData ( int  pid) const
inlineinherited

Access an element in the particle data table.

Definition at line 126 of file GenBase.h.

126  {
127  return pdt().particle(HepPDT::ParticleID(std::abs(pid)));
128  }

◆ particleTable()

const HepPDT::ParticleDataTable& GenBase::particleTable ( ) const
inlineinherited

Get a particle data table.

Definition at line 118 of file GenBase.h.

118  {
119  return *(m_ppSvc->PDT());
120  }

◆ partPropSvc()

const ServiceHandle<IPartPropSvc> GenBase::partPropSvc ( ) const
inlineinherited

Access the particle property service.

Definition at line 113 of file GenBase.h.

113  {
114  return m_ppSvc;
115  }

◆ pdt()

const HepPDT::ParticleDataTable& GenBase::pdt ( ) const
inlineinherited

Shorter alias to get a particle data table.

Definition at line 123 of file GenBase.h.

123 { return particleTable(); }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
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, PyAthena::Alg, and AthHistogramAlgorithm.

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 }

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_cleanDecays

bool FixHepMC::m_cleanDecays
private

Definition at line 53 of file FixHepMC.h.

◆ m_decayCleaned

long FixHepMC::m_decayCleaned
private

Definition at line 60 of file FixHepMC.h.

◆ 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_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_killLoops

bool FixHepMC::m_killLoops
private

Definition at line 51 of file FixHepMC.h.

◆ m_killPDG0

bool FixHepMC::m_killPDG0
private

Definition at line 52 of file FixHepMC.h.

◆ m_looper

MC::Loops<HepMC::GenEvent,HepMC::ConstGenParticlePtr,HepMC::ConstGenVertexPtr> FixHepMC::m_looper
private

member to detect loops

Definition at line 68 of file FixHepMC.h.

◆ m_loopKilled

long FixHepMC::m_loopKilled
private

Definition at line 58 of file FixHepMC.h.

◆ m_mcEventKey

std::string GenBase::m_mcEventKey {}
protectedinherited

StoreGate key for the MC event collection (defaults to GEN_EVENT)

Definition at line 137 of file GenBase.h.

◆ m_mcevents_const

SG::ReadHandleKey<McEventCollection> GenBase::m_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
privateinherited

Const handle to the MC event collection.

Definition at line 163 of file GenBase.h.

◆ m_mkMcEvent

BooleanProperty GenBase::m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
protectedinherited

Flag to determine if a new MC event collection should be made if it doesn't exist.

Definition at line 139 of file GenBase.h.

◆ m_pdg0Killed

long FixHepMC::m_pdg0Killed
private

Definition at line 59 of file FixHepMC.h.

◆ m_pidmap

std::map<int,int> FixHepMC::m_pidmap
private

map of pids to change.

Definition at line 65 of file FixHepMC.h.

◆ m_ppSvc

ServiceHandle<IPartPropSvc> GenBase::m_ppSvc {this, "PartPropSvc", "PartPropSvc"}
privateinherited

Handle on the particle property service.

Definition at line 160 of file GenBase.h.

◆ m_replacedPIDs

long FixHepMC::m_replacedPIDs
private

Definition at line 62 of file FixHepMC.h.

◆ m_totalSeen

long FixHepMC::m_totalSeen
private

Definition at line 61 of file FixHepMC.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ 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:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
FixHepMC::m_replacedPIDs
long m_replacedPIDs
Definition: FixHepMC.h:62
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
FixHepMC::m_pdg0Killed
long m_pdg0Killed
Definition: FixHepMC.h:59
GenBase::events_const
const McEventCollection * events_const() const
Access the current event's McEventCollection (const)
Definition: GenBase.h:96
SG::ReadHandle< McEventCollection >
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
python.DecayParser.parents
parents
print ("==> buf:",buf)
Definition: DecayParser.py:31
GenBase::m_mcEventKey
std::string m_mcEventKey
StoreGate key for the MC event collection (defaults to GEN_EVENT)
Definition: GenBase.h:137
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
FixHepMC::m_cleanDecays
bool m_cleanDecays
Definition: FixHepMC.h:53
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HepMC::Print::line
void line(std::ostream &os, const GenEvent &e)
Definition: GenEvent.h:676
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
reduce
void reduce(HepMC::GenEvent *ge, std::vector< HepMC::GenParticlePtr > toremove)
Remove unwanted particles from the event, collapsing the graph structure consistently.
Definition: FixHepMC.cxx:81
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
GenBase::m_ppSvc
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition: GenBase.h:160
HepMC::set_signal_process_vertex
void set_signal_process_vertex(GenEvent *e, T v)
Definition: GenEvent.h:650
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
HepMC::newGenVertexPtr
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
Definition: GenVertex.h:64
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
GenBase::m_mcevents_const
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition: GenBase.h:163
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
jobOptions.ParticleID
ParticleID
Definition: jobOptions.decayer.py:85
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FixHepMC::m_decayCleaned
long m_decayCleaned
Definition: FixHepMC.h:60
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
FixHepMC::fromDecay
bool fromDecay(const HepMC::ConstGenParticlePtr &p, std::shared_ptr< std::set< int > > &storage) const
Definition: FixHepMC.cxx:501
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
isTau
bool isTau(const T &p)
Definition: AtlasPID.h:157
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
GenBase::particleTable
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
Definition: GenBase.h:118
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
FixHepMC::m_totalSeen
long m_totalSeen
Definition: FixHepMC.h:61
FixHepMC::m_looper
MC::Loops< HepMC::GenEvent, HepMC::ConstGenParticlePtr, HepMC::ConstGenVertexPtr > m_looper
member to detect loops
Definition: FixHepMC.h:68
FixHepMC::isSimpleLoop
bool isSimpleLoop(const HepMC::ConstGenParticlePtr &p) const
Definition: FixHepMC.cxx:534
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
MC::Loops::loop_particles
const std::vector< Prt > & loop_particles() const
Definition: Loops.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
isHadron
bool isHadron(const T &p)
Definition: AtlasPID.h:218
FixHepMC::isNonTransportableInDecayChain
bool isNonTransportableInDecayChain(const HepMC::ConstGenParticlePtr &p) const
Definition: FixHepMC.cxx:528
python.PyAthena.v
v
Definition: PyAthena.py:154
MC::Loops::loop_vertices
const std::vector< Vtx > & loop_vertices() const
Definition: Loops.h:28
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
isTransportable
bool isTransportable(const T &p)
Definition: AtlasPID.h:227
FixHepMC::isPID0
bool isPID0(const HepMC::ConstGenParticlePtr &p) const
Definition: FixHepMC.cxx:496
MC::isDecayed
bool isDecayed(const T &p)
Identify if the particle decayed.
Definition: HepMCHelpers.h:42
DEBUG
#define DEBUG
Definition: page_access.h:11
GenBase::pdt
const HepPDT::ParticleDataTable & pdt() const
Shorter alias to get a particle data table.
Definition: GenBase.h:123
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.DecayParser.children
children
Definition: DecayParser.py:32
FixHepMC::m_killLoops
bool m_killLoops
Definition: FixHepMC.h:51
GenBase::GenBase
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: GenBase.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
MC::Loops::findLoops
int findLoops(const Evt *evt, bool force)
Definition: Loops.h:31
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
FixHepMC::m_loopKilled
long m_loopKilled
Definition: FixHepMC.h:58
FixHepMC::m_killPDG0
bool m_killPDG0
Definition: FixHepMC.h:52
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
FixHepMC::m_pidmap
std::map< int, int > m_pidmap
map of pids to change.
Definition: FixHepMC.h:65
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >
HepMC::signal_process_vertex
GenVertex * signal_process_vertex(const GenEvent *e)
Definition: GenEvent.h:625