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

#include <TruthClosureCheck.h>

Inheritance diagram for TruthClosureCheck:
Collaboration diagram for TruthClosureCheck:

Public Member Functions

 TruthClosureCheck (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TruthClosureCheck ()=default
 
virtual StatusCode initialize () override final
 
virtual StatusCode execute () override final
 
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
 

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

StatusCode sanityCheck (const HepMC::GenEvent &event) const
 
StatusCode compareGenVertex (const HepMC::GenVertex &origVertex, const HepMC::GenVertex &resetVertex) const
 
StatusCode compareGenParticle (const HepMC::GenParticle &origParticle, const HepMC::GenParticle &resetParticle) const
 
void printGenVertex (const HepMC::GenVertex &origVertex, const HepMC::GenVertex &resetVertex) const
 
StatusCode compareMomenta (const HepMC::FourVector &origMomenta, const HepMC::FourVector &resetMomenta) const
 
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...
 

Private Attributes

SG::ReadHandleKey< McEventCollectionm_originalMcEventCollection
 
SG::ReadHandleKey< McEventCollectionm_resetMcEventCollection
 
bool m_compareMomenta {true}
 
double m_momentaLimit {0.000000000001}
 
bool m_postSimulation {false}
 
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
 

Detailed Description

Definition at line 15 of file TruthClosureCheck.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

◆ TruthClosureCheck()

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

Definition at line 22 of file TruthClosureCheck.cxx.

22  :
23  AthAlgorithm(name, pSvcLocator)
24 {
25  declareProperty("OriginalMcEventCollection" , m_originalMcEventCollection = "BeamTruthEvent");
26  declareProperty("ResetMcEventCollection" , m_resetMcEventCollection = "NewTruthEvent");
27  declareProperty("CompareMomenta", m_compareMomenta);
28  declareProperty("PostSimulation", m_postSimulation);
29 }

◆ ~TruthClosureCheck()

TruthClosureCheck::~TruthClosureCheck ( )
default

Member Function Documentation

◆ compareGenParticle()

StatusCode TruthClosureCheck::compareGenParticle ( const HepMC::GenParticle origParticle,
const HepMC::GenParticle resetParticle 
) const
private

Definition at line 327 of file TruthClosureCheck.cxx.

329 {
330  bool pass{true};
331  if (HepMC::barcode(origParticle) != HepMC::barcode(resetParticle)) { // FIXME barcode-based
332  ATH_MSG_ERROR ("particle barcode differs! Original: "<<HepMC::barcode(origParticle)<<", Reset: "<<HepMC::barcode(resetParticle));
333  pass &= false;
334  }
335  if (origParticle.status() != resetParticle.status()) {
336  ATH_MSG_ERROR ("particle status differs! Original: "<<origParticle.status()<<", Reset: "<<resetParticle.status());
337  pass &= false;
338  }
339  if (origParticle.pdg_id() != resetParticle.pdg_id()) {
340  ATH_MSG_ERROR ("particle pdg_id differs! Original: "<<origParticle.pdg_id()<<", Reset: "<<resetParticle.pdg_id());
341  pass &= false;
342  }
343  if (compareMomenta(origParticle.momentum(), resetParticle.momentum()).isFailure()) {
344  const HepMC::FourVector& oM = origParticle.momentum();
345  const HepMC::FourVector& rM = resetParticle.momentum();
346  ATH_MSG_DEBUG("particle momentum differs! Original: ("<<oM.x()<<","<<oM.y()<<","<<oM.z()<<","<<oM.t()<<"), Reset: ("<<rM.x()<<","<<rM.y()<<","<<rM.z()<<","<<rM.t()<<")");
347  pass &= false;
348  }
349  if(!pass) { return StatusCode::FAILURE; }
350  return StatusCode::SUCCESS;
351 }

◆ compareGenVertex()

StatusCode TruthClosureCheck::compareGenVertex ( const HepMC::GenVertex &  origVertex,
const HepMC::GenVertex &  resetVertex 
) const
private

Definition at line 202 of file TruthClosureCheck.cxx.

204 {
205  bool pass{true};
206 
207  if (HepMC::barcode(origVertex) != HepMC::barcode(resetVertex)) { // FIXME HepMC::barcode
208  ATH_MSG_ERROR ("vertex barcode differs! Original: " << HepMC::barcode(origVertex) << ", Reset: " << HepMC::barcode(resetVertex));
209  pass = false;
210  }
211  if (origVertex.position() != resetVertex.position()) {
212  const HepMC::FourVector& oP = origVertex.position();
213  const HepMC::FourVector& rP = resetVertex.position();
214  ATH_MSG_ERROR("vertex position differs! Original: ("<<oP.x()<<","<<oP.y()<<","<<oP.z()<<","<<oP.t()<<"), Reset: ("<<rP.x()<<","<<rP.y()<<","<<rP.z()<<","<<rP.t()<<")");
215  pass = false;
216  }
217  if (origVertex.particles_in_size() != resetVertex.particles_in_size() ) {
218  ATH_MSG_ERROR ("particles_in_size differs! Original: "<<origVertex.particles_in_size()<<", Reset: "<<resetVertex.particles_in_size());
219  pass = false;
220  }
221  if (origVertex.particles_out_size() != resetVertex.particles_out_size() ) {
222  ATH_MSG_ERROR ("particles_out_size differs! Original: "<<origVertex.particles_out_size()<<", Reset: "<<resetVertex.particles_out_size());
223  pass = false;
224  }
225  HepMC::GenVertex::particles_in_const_iterator originalPartInIter(origVertex.particles_in_const_begin());
226  const HepMC::GenVertex::particles_in_const_iterator endOfOriginalListOfParticlesIn(origVertex.particles_in_const_end());
227  HepMC::GenVertex::particles_in_const_iterator resetPartInIter(resetVertex.particles_in_const_begin());
228  const HepMC::GenVertex::particles_in_const_iterator endOfResetListOfParticlesIn(resetVertex.particles_in_const_end());
229  while( originalPartInIter!=endOfOriginalListOfParticlesIn &&
230  resetPartInIter!=endOfResetListOfParticlesIn ) {
231  if (compareGenParticle(**originalPartInIter,**resetPartInIter).isFailure()) {
232  ATH_MSG_ERROR ( "input particle properties differ!" );
233  pass &= false;
234  }
235  ATH_MSG_VERBOSE ( "particles match!" );
236  ++resetPartInIter;
237  ++originalPartInIter;
238  }
239 
240  HepMC::GenVertex::particles_out_const_iterator originalPartOutIter(origVertex.particles_out_const_begin());
241  const HepMC::GenVertex::particles_out_const_iterator endOfOriginalListOfParticlesOut(origVertex.particles_out_const_end());
242  // ordering of particles may differ in each case - sigh..
243  const HepMC::GenVertex::particles_out_const_iterator endOfResetListOfParticlesOut(resetVertex.particles_out_const_end());
244  while( originalPartOutIter!=endOfOriginalListOfParticlesOut) {
245  const int barcodeOrig{HepMC::barcode(*originalPartOutIter)}; // FIXME barcode-based
246  HepMC::GenVertex::particles_out_const_iterator resetPartOutIter(resetVertex.particles_out_const_begin());
247  HepMC::GenVertex::particles_in_const_iterator matchingResetParticleIter{endOfResetListOfParticlesOut};
248  while(resetPartOutIter!=endOfResetListOfParticlesOut) {
249  if ( barcodeOrig == HepMC::barcode(*resetPartOutIter) ) {
250  matchingResetParticleIter = resetPartOutIter;
251  break;
252  }
253  ++resetPartOutIter;
254  }
255  if (matchingResetParticleIter==endOfResetListOfParticlesOut ||
256  compareGenParticle(**originalPartOutIter,**matchingResetParticleIter).isFailure()) {
257  ATH_MSG_ERROR ( "output particle properties differ!" );
258  pass &= false;
259  }
260  ATH_MSG_VERBOSE ( "particles match!" );
261  ++originalPartOutIter;
262  }
263 
264  if(!pass) { return StatusCode::FAILURE; }
265  return StatusCode::SUCCESS;
266 }

◆ compareMomenta()

StatusCode TruthClosureCheck::compareMomenta ( const HepMC::FourVector &  origMomenta,
const HepMC::FourVector &  resetMomenta 
) const
private

Definition at line 270 of file TruthClosureCheck.cxx.

272 {
273  bool pass{true};
274  if (m_compareMomenta) {
275  if (m_momentaLimit<std::abs(origMomenta.px()-resetMomenta.px())) {
276  pass &= false;
277  }
278  if (m_momentaLimit<std::abs(origMomenta.py()-resetMomenta.py())) {
279  pass &= false;
280  }
281  if (m_momentaLimit<std::abs(origMomenta.pz()-resetMomenta.pz())) {
282  pass &= false;
283  }
284  if (m_momentaLimit<std::abs(origMomenta.e()-resetMomenta.e())) {
285  pass &= false;
286  }
287  if(origMomenta != resetMomenta) {
288  ATH_MSG_ERROR ("Exact momenta agreement check failed.");
289  pass &= false;
290  }
291  }
292  if(!pass) { return StatusCode::FAILURE; }
293  return StatusCode::SUCCESS;
294 }

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

◆ 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 TruthClosureCheck::execute ( )
finaloverridevirtual

Definition at line 435 of file TruthClosureCheck.cxx.

435  {
436  //-------------------------------------------------
437 
438  ATH_MSG_DEBUG( " execute..... " );
440  if (!originalMcEventCollection.isValid()) {
441  ATH_MSG_ERROR("Could not find original McEventCollection called " << originalMcEventCollection.name() << " in store " << originalMcEventCollection.store() << ".");
442  return StatusCode::FAILURE;
443  }
444  const HepMC::GenEvent& originalEvent(**(originalMcEventCollection->begin()));
445 
446  if (sanityCheck(originalEvent).isFailure()) {
447  ATH_MSG_FATAL("Problems in original GenEvent - bailing out.");
448  return StatusCode::FAILURE;
449  }
450 
452  if (!resetMcEventCollection.isValid()) {
453  ATH_MSG_ERROR("Could not find reset McEventCollection called " << resetMcEventCollection.name() << " in store " << resetMcEventCollection.store() << ".");
454  return StatusCode::FAILURE;
455  }
456  const HepMC::GenEvent& resetEvent(**(resetMcEventCollection->begin()));
457 
458  if (sanityCheck(resetEvent).isFailure()) {
459  ATH_MSG_FATAL("Problems in reset GenEvent - bailing out.");
460  return StatusCode::FAILURE;
461  }
462 
463  if (originalEvent.event_number() != resetEvent.event_number() ) {
464  ATH_MSG_ERROR ("event_number differs! Original: "<<originalEvent.event_number()<<", Reset: "<<resetEvent.event_number());
465  }
466 
467  if (originalEvent.signal_process_id() != resetEvent.signal_process_id() ) {
468  ATH_MSG_ERROR ("signal_process_id differs! Original: "<<originalEvent.signal_process_id()<<", Reset: "<<resetEvent.signal_process_id());
469  }
470 
471  if (originalEvent.valid_beam_particles() != resetEvent.valid_beam_particles() ) {
472  ATH_MSG_ERROR ("valid_beam_particles differs! Original: "<<originalEvent.valid_beam_particles()<<", Reset: "<<resetEvent.valid_beam_particles());
473  }
474  else if (originalEvent.valid_beam_particles() && resetEvent.valid_beam_particles()) {
475  std::pair<HepMC::GenParticle*,HepMC::GenParticle*> originalBP = originalEvent.beam_particles();
476  std::pair<HepMC::GenParticle*,HepMC::GenParticle*> resetBP = resetEvent.beam_particles();
477  if ( ( !originalBP.first && resetBP.first ) ||
478  ( originalBP.first && !resetBP.first ) ||
479  ( originalBP.first && resetBP.first && compareGenParticle(*(originalBP.first), *(resetBP.first)).isFailure() ) ) {
480  ATH_MSG_ERROR ( "First beam particle does not match" );
481  }
482  if ( ( !originalBP.second && resetBP.second ) ||
483  ( originalBP.second && !resetBP.second ) ||
484  ( originalBP.second && resetBP.second && compareGenParticle(*(originalBP.second), *(resetBP.second)).isFailure() ) ) {
485  ATH_MSG_ERROR ( "Second beam particle does not match" );
486  }
487 
488  if (originalEvent.particles_size() != resetEvent.particles_size() ) {
489  ATH_MSG_ERROR ("particles_size differs! Original: "<<originalEvent.particles_size()<<", Reset: "<<resetEvent.particles_size());
490  }
491 
492  if (originalEvent.vertices_size() != resetEvent.vertices_size() ) {
493  ATH_MSG_ERROR ("vertices_size differs! Original: "<<originalEvent.vertices_size()<<", Reset: "<<resetEvent.vertices_size());
494  }
495  }
496 
497  //loop over vertices in Background GenEvent
498  HepMC::GenEvent::vertex_const_iterator origVertexIter(originalEvent.vertices_begin());
499  const HepMC::GenEvent::vertex_const_iterator endOfOriginalListOfVertices(originalEvent.vertices_end());
500  HepMC::GenEvent::vertex_const_iterator resetVertexIter(resetEvent.vertices_begin());
501  const HepMC::GenEvent::vertex_const_iterator endOfResetListOfVertices(resetEvent.vertices_end());
502  while( origVertexIter!=endOfOriginalListOfVertices &&
503  resetVertexIter!=endOfResetListOfVertices) {
504  if (compareGenVertex(**origVertexIter,**resetVertexIter).isFailure()) {
505  ATH_MSG_ERROR ( "vertices differ!" );
506  printGenVertex(**origVertexIter,**resetVertexIter);
507  }
508  ++origVertexIter;
509  ++resetVertexIter;
510  }
511  ATH_MSG_INFO( "Completed Truth reset closure check ..... " );
512 
513  return StatusCode::SUCCESS;
514 
515 }

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

◆ initialize()

StatusCode TruthClosureCheck::initialize ( )
finaloverridevirtual

Definition at line 33 of file TruthClosureCheck.cxx.

33  {
34  //----------------------------------------------------
35 
38  return StatusCode::SUCCESS;
39 
40 }

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

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

◆ printGenVertex()

void TruthClosureCheck::printGenVertex ( const HepMC::GenVertex &  origVertex,
const HepMC::GenVertex &  resetVertex 
) const
private

Definition at line 98 of file TruthClosureCheck.cxx.

100 {
101  ATH_MSG_INFO("----------------------------------");
102  ATH_MSG_INFO("Original Vertex:");
103  ATH_MSG_INFO( origVertex );
104  ATH_MSG_INFO("Particles In:");
105  HepMC::GenVertex::particles_in_const_iterator originalPartInIter(origVertex.particles_in_const_begin());
106  const HepMC::GenVertex::particles_in_const_iterator endOfOriginalListOfParticlesIn(origVertex.particles_in_const_end());
107  while( originalPartInIter!=endOfOriginalListOfParticlesIn ) {
108  ATH_MSG_INFO( **originalPartInIter );
109  ++originalPartInIter;
110  }
111  ATH_MSG_INFO("Particles Out:");
112  HepMC::GenVertex::particles_out_const_iterator originalPartOutIter(origVertex.particles_out_const_begin());
113  const HepMC::GenVertex::particles_out_const_iterator endOfOriginalListOfParticlesOut(origVertex.particles_out_const_end());
114  while( originalPartOutIter!=endOfOriginalListOfParticlesOut) {
115  ATH_MSG_INFO( **originalPartOutIter );
116  ++originalPartOutIter;
117  }
118  ATH_MSG_INFO("----------------------------------");
119  ATH_MSG_INFO("Reset Vertex:");
120  ATH_MSG_INFO( resetVertex );
121  ATH_MSG_INFO("Particles In:");
122  HepMC::GenVertex::particles_in_const_iterator resetPartInIter(resetVertex.particles_in_const_begin());
123  const HepMC::GenVertex::particles_in_const_iterator endOfResetListOfParticlesIn(resetVertex.particles_in_const_end());
124  while( resetPartInIter!=endOfResetListOfParticlesIn ) {
125  ATH_MSG_INFO( **resetPartInIter );
126  ++resetPartInIter;
127  }
128  ATH_MSG_INFO("Particles Out:");
129  HepMC::GenVertex::particles_out_const_iterator resetPartOutIter(resetVertex.particles_out_const_begin());
130  const HepMC::GenVertex::particles_out_const_iterator endOfResetListOfParticlesOut(resetVertex.particles_out_const_end());
131  while( resetPartOutIter!=endOfResetListOfParticlesOut) {
132  ATH_MSG_INFO( **resetPartOutIter );
133  ++resetPartOutIter;
134  }
135  ATH_MSG_INFO("----------------------------------");
136  return;
137 }

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

◆ sanityCheck()

StatusCode TruthClosureCheck::sanityCheck ( const HepMC::GenEvent &  event) const
private

Definition at line 43 of file TruthClosureCheck.cxx.

43  {
44  //Sanity check
45  bool resetProblem(false);
46  for (const auto& particle: event) {
47  if (MC::isStable(particle)) {
48  if (!particle->production_vertex()) {
49  ATH_MSG_ERROR("Stable particle without a production vertex!! " << particle);
50  resetProblem = true;
51  }
52  if (!m_postSimulation && particle->end_vertex()) {
53  ATH_MSG_ERROR("Stable particle with an end vertex!! " << particle);
54  resetProblem = true;
55  }
56  }
57  else if (MC::isDecayed(particle)) {
58  if (!particle->production_vertex()) {
59  ATH_MSG_ERROR("Decayed particle without a production vertex!! " << particle);
60  resetProblem = true;
61  }
62  if (!particle->end_vertex()) {
63  ATH_MSG_ERROR("Decayed particle without an end vertex!! " << particle);
64  resetProblem = true;
65  }
66  }
67  }
68  if (resetProblem) {
69  return StatusCode::FAILURE;
70  }
71 
72  return StatusCode::SUCCESS;
73 }

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

bool TruthClosureCheck::m_compareMomenta {true}
private

Definition at line 45 of file TruthClosureCheck.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_momentaLimit

double TruthClosureCheck::m_momentaLimit {0.000000000001}
private

Definition at line 46 of file TruthClosureCheck.h.

◆ m_originalMcEventCollection

SG::ReadHandleKey<McEventCollection> TruthClosureCheck::m_originalMcEventCollection
private

Definition at line 43 of file TruthClosureCheck.h.

◆ m_postSimulation

bool TruthClosureCheck::m_postSimulation {false}
private

Definition at line 47 of file TruthClosureCheck.h.

◆ m_resetMcEventCollection

SG::ReadHandleKey<McEventCollection> TruthClosureCheck::m_resetMcEventCollection
private

Definition at line 44 of file TruthClosureCheck.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:
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TruthClosureCheck::m_postSimulation
bool m_postSimulation
Definition: TruthClosureCheck.h:47
TruthClosureCheck::m_originalMcEventCollection
SG::ReadHandleKey< McEventCollection > m_originalMcEventCollection
Definition: TruthClosureCheck.h:43
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
TruthClosureCheck::m_compareMomenta
bool m_compareMomenta
Definition: TruthClosureCheck.h:45
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle< McEventCollection >
TruthClosureCheck::sanityCheck
StatusCode sanityCheck(const HepMC::GenEvent &event) const
Definition: TruthClosureCheck.cxx:43
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TruthClosureCheck::compareGenParticle
StatusCode compareGenParticle(const HepMC::GenParticle &origParticle, const HepMC::GenParticle &resetParticle) const
Definition: TruthClosureCheck.cxx:327
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
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TruthClosureCheck::compareMomenta
StatusCode compareMomenta(const HepMC::FourVector &origMomenta, const HepMC::FourVector &resetMomenta) const
Definition: TruthClosureCheck.cxx:270
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
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
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
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
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TruthClosureCheck::m_momentaLimit
double m_momentaLimit
Definition: TruthClosureCheck.h:46
TruthClosureCheck::printGenVertex
void printGenVertex(const HepMC::GenVertex &origVertex, const HepMC::GenVertex &resetVertex) const
Definition: TruthClosureCheck.cxx:98
TruthClosureCheck::compareGenVertex
StatusCode compareGenVertex(const HepMC::GenVertex &origVertex, const HepMC::GenVertex &resetVertex) const
Definition: TruthClosureCheck.cxx:202
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MC::isDecayed
bool isDecayed(const T &p)
Identify if the particle decayed.
Definition: HepMCHelpers.h:42
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
TruthClosureCheck::m_resetMcEventCollection
SG::ReadHandleKey< McEventCollection > m_resetMcEventCollection
Definition: TruthClosureCheck.h:44
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >