ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Barcode::ValidationBarcodeSvc Class Reference

#include <ValidationBarcodeSvc.h>

Inheritance diagram for Barcode::ValidationBarcodeSvc:
Collaboration diagram for Barcode::ValidationBarcodeSvc:

Public Member Functions

 ValidationBarcodeSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters. More...
 
virtual ~ValidationBarcodeSvc ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Athena algorithm's interface methods. More...
 
virtual StatusCode finalize () override
 framework methods More...
 
virtual void handle (const Incident &inc) override
 Incident to reset the barcodes at the beginning of the event. More...
 
virtual int newSimulationVertex () override
 Generate a new unique vertex barcode, based on the parent particle barcode and the physics process code causing the truth vertex. More...
 
virtual int newSecondaryParticle (int parentBC=HepMC::UNDEFINED_ID) override
 Generate a new unique barcode for a secondary particle, based on the parent particle barcode. More...
 
virtual int newGeneratedParticle (int parentBC=HepMC::UNDEFINED_ID) override
 Generate a new unique particle barcode below the simulation offset (for particles from pre-defined decays) More...
 
virtual int newGeneratedVertex () override
 Generate a new unique vertex barcode below the simulation offset. More...
 
virtual int secondaryParticleBcOffset () const override
 Return the secondary particle and vertex offsets. More...
 
virtual int secondaryVertexBcOffset () const override
 Return the secondary vertex offset. More...
 
virtual void registerLargestGeneratedParticleBC (int) override
 Inform the BarcodeSvc about the largest particle and vertex Barcodes in the event input. More...
 
virtual void registerLargestGeneratedVtxBC (int) override
 
virtual void registerLargestSecondaryParticleBC (int) override
 
virtual void registerLargestSimulationVtxBC (int) override
 

Private Attributes

ServiceHandle< IIncidentSvc > m_incidentSvc
 IncidentSvc to catch begin of event and end of envent. More...
 
int m_firstVertex
 barcode information used for GenVertices More...
 
int m_vertexIncrement
 
int m_currentVertex
 
int m_firstSecondary
 barcode information used for secondary GenParticles More...
 
int m_secondaryIncrement
 
int m_currentSecondary
 
int m_particleGenerationIncrement
 barcode offset for each generation of updated particles More...
 
int m_barcodeGenerationOffset
 not sure why this is needed... More...
 

Detailed Description

This BarcodeService reproduces the barcode treatmend for MC12: http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Simulation/G4Sim/MCTruth/src/TruthStrategyManager.cxx

Author
Andreas.Salzburger -at- cern.ch , Elmar.Ritsch -at- cern.ch

Definition at line 32 of file ValidationBarcodeSvc.h.

Constructor & Destructor Documentation

◆ ValidationBarcodeSvc()

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

Constructor with parameters.

Constructor.

Definition at line 12 of file ValidationBarcodeSvc.cxx.

12  :
13  base_class(name,svc),
14  m_incidentSvc("IncidentSvc", name),
17  m_currentVertex(-1),
23 {
24  // python properties
25  declareProperty("VertexIncrement" , m_vertexIncrement);
26  declareProperty("SecondaryIncrement" , m_secondaryIncrement);
27  declareProperty("BarcodeGenerationOffset" , m_barcodeGenerationOffset);
28 }

◆ ~ValidationBarcodeSvc()

Barcode::ValidationBarcodeSvc::~ValidationBarcodeSvc ( )
virtual

Destructor.

Definition at line 31 of file ValidationBarcodeSvc.cxx.

32 {}

Member Function Documentation

◆ finalize()

StatusCode Barcode::ValidationBarcodeSvc::finalize ( )
overridevirtual

framework methods

Definition at line 148 of file ValidationBarcodeSvc.cxx.

149 {
150  ATH_MSG_VERBOSE ("finalize() ...");
151  ATH_MSG_VERBOSE ("finalize() successful");
152  return StatusCode::SUCCESS;
153 }

◆ handle()

void Barcode::ValidationBarcodeSvc::handle ( const Incident &  inc)
overridevirtual

Incident to reset the barcodes at the beginning of the event.

Handle incident.

Definition at line 136 of file ValidationBarcodeSvc.cxx.

137 {
138  if ( inc.type() == IncidentType::BeginEvent )
139  {
140  ATH_MSG_VERBOSE("'BeginEvent' incident caught. Resetting Vertex and Particle barcode counters.");
143  }
144 }

◆ initialize()

StatusCode Barcode::ValidationBarcodeSvc::initialize ( )
overridevirtual

Athena algorithm's interface methods.

framework methods

Definition at line 36 of file ValidationBarcodeSvc.cxx.

37 {
38  ATH_MSG_VERBOSE ("initialize() ...");
39 
40  CHECK( m_incidentSvc.retrieve() );
41 
42  // register to the incident service: BeginEvent needed for refresh of counter
43  m_incidentSvc->addListener( this, IncidentType::BeginEvent);
44 
45  ATH_MSG_VERBOSE ("initialize() successful");
46  return StatusCode::SUCCESS;
47 }

◆ newGeneratedParticle()

int Barcode::ValidationBarcodeSvc::newGeneratedParticle ( int  parentBC = HepMC::UNDEFINED_ID)
overridevirtual

Generate a new unique particle barcode below the simulation offset (for particles from pre-defined decays)

Definition at line 87 of file ValidationBarcodeSvc.cxx.

88 {
90  // a naive overflow checking based on the fact that particle
91  // barcodes should never be negative
92  if ( m_currentSecondary < 0)
93  {
94  ATH_MSG_ERROR("ValidationBarcodeSvc::newGeneratedParticle(...)"
95  << " will return a particle barcode of less than 0: "
96  << m_currentSecondary << ". Possibly Integer Overflow?");
97  }
98  int primGen = int( (parentBC-m_particleGenerationIncrement) / m_barcodeGenerationOffset);
99  int returnBC = m_currentSecondary + (primGen+1)*m_barcodeGenerationOffset;
100 
101  return returnBC;
102 }

◆ newGeneratedVertex()

int Barcode::ValidationBarcodeSvc::newGeneratedVertex ( )
overridevirtual

Generate a new unique vertex barcode below the simulation offset.

Generate a new unique vertex barcode.

Definition at line 106 of file ValidationBarcodeSvc.cxx.

107 {
109  // a naive underflog checking based on the fact that vertex
110  // barcodes should never be positive
111  if ( m_currentVertex > 0)
112  {
113  ATH_MSG_ERROR("ValidationBarcodeSvc::newGeneratedVertex(...)"
114  << " will return a vertex barcode greater than 0: "
115  << m_currentVertex << ". Possibly Integer Underflow?");
116  }
117  return m_currentVertex;
118 }

◆ newSecondaryParticle()

int Barcode::ValidationBarcodeSvc::newSecondaryParticle ( int  parentBC = HepMC::UNDEFINED_ID)
overridevirtual

Generate a new unique barcode for a secondary particle, based on the parent particle barcode.

Definition at line 68 of file ValidationBarcodeSvc.cxx.

69 {
71  // a naive overflow checking based on the fact that particle
72  // barcodes should never be negative
73  if ( m_currentSecondary < 0)
74  {
75  ATH_MSG_ERROR("ValidationBarcodeSvc::newSecondaryParticle(...)"
76  << " will return a particle barcode of less than 0: "
77  << m_currentSecondary << ". Possibly Integer Overflow?");
78  }
79  int primGen = int( (parentBC-m_particleGenerationIncrement) / m_barcodeGenerationOffset);
80  int returnBC = m_currentSecondary + (primGen+1)*m_barcodeGenerationOffset;
81 
82  return returnBC;
83 }

◆ newSimulationVertex()

int Barcode::ValidationBarcodeSvc::newSimulationVertex ( )
overridevirtual

Generate a new unique vertex barcode, based on the parent particle barcode and the physics process code causing the truth vertex.

Generate a new unique vertex barcode.

Definition at line 51 of file ValidationBarcodeSvc.cxx.

52 {
54  // a naive underflog checking based on the fact that vertex
55  // barcodes should never be positive
56  if ( m_currentVertex > 0)
57  {
58  ATH_MSG_ERROR("ValidationBarcodeSvc::newVertex(...)"
59  << " will return a vertex barcode greater than 0: "
60  << m_currentVertex << ". Possibly Integer Underflow?");
61  }
62  return m_currentVertex;
63 }

◆ registerLargestGeneratedParticleBC()

virtual void Barcode::ValidationBarcodeSvc::registerLargestGeneratedParticleBC ( int  )
inlineoverridevirtual

Inform the BarcodeSvc about the largest particle and vertex Barcodes in the event input.

Definition at line 68 of file ValidationBarcodeSvc.h.

68 {};

◆ registerLargestGeneratedVtxBC()

virtual void Barcode::ValidationBarcodeSvc::registerLargestGeneratedVtxBC ( int  )
inlineoverridevirtual

Definition at line 69 of file ValidationBarcodeSvc.h.

69 {};

◆ registerLargestSecondaryParticleBC()

virtual void Barcode::ValidationBarcodeSvc::registerLargestSecondaryParticleBC ( int  )
inlineoverridevirtual

Definition at line 70 of file ValidationBarcodeSvc.h.

70 {};

◆ registerLargestSimulationVtxBC()

virtual void Barcode::ValidationBarcodeSvc::registerLargestSimulationVtxBC ( int  )
inlineoverridevirtual

Definition at line 71 of file ValidationBarcodeSvc.h.

71 {};

◆ secondaryParticleBcOffset()

int Barcode::ValidationBarcodeSvc::secondaryParticleBcOffset ( ) const
overridevirtual

Return the secondary particle and vertex offsets.

Return the secondary particle offset.

Definition at line 122 of file ValidationBarcodeSvc.cxx.

123 {
124  return m_firstSecondary;
125 }

◆ secondaryVertexBcOffset()

int Barcode::ValidationBarcodeSvc::secondaryVertexBcOffset ( ) const
overridevirtual

Return the secondary vertex offset.

Definition at line 129 of file ValidationBarcodeSvc.cxx.

130 {
131  return m_firstVertex;
132 }

Member Data Documentation

◆ m_barcodeGenerationOffset

int Barcode::ValidationBarcodeSvc::m_barcodeGenerationOffset
private

not sure why this is needed...

Definition at line 88 of file ValidationBarcodeSvc.h.

◆ m_currentSecondary

int Barcode::ValidationBarcodeSvc::m_currentSecondary
private

Definition at line 84 of file ValidationBarcodeSvc.h.

◆ m_currentVertex

int Barcode::ValidationBarcodeSvc::m_currentVertex
private

Definition at line 79 of file ValidationBarcodeSvc.h.

◆ m_firstSecondary

int Barcode::ValidationBarcodeSvc::m_firstSecondary
private

barcode information used for secondary GenParticles

Definition at line 82 of file ValidationBarcodeSvc.h.

◆ m_firstVertex

int Barcode::ValidationBarcodeSvc::m_firstVertex
private

barcode information used for GenVertices

Definition at line 77 of file ValidationBarcodeSvc.h.

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> Barcode::ValidationBarcodeSvc::m_incidentSvc
private

IncidentSvc to catch begin of event and end of envent.

Definition at line 74 of file ValidationBarcodeSvc.h.

◆ m_particleGenerationIncrement

int Barcode::ValidationBarcodeSvc::m_particleGenerationIncrement
private

barcode offset for each generation of updated particles

Definition at line 87 of file ValidationBarcodeSvc.h.

◆ m_secondaryIncrement

int Barcode::ValidationBarcodeSvc::m_secondaryIncrement
private

Definition at line 83 of file ValidationBarcodeSvc.h.

◆ m_vertexIncrement

int Barcode::ValidationBarcodeSvc::m_vertexIncrement
private

Definition at line 78 of file ValidationBarcodeSvc.h.


The documentation for this class was generated from the following files:
HepMC::SIM_BARCODE_THRESHOLD
constexpr int SIM_BARCODE_THRESHOLD
Constant defining the barcode threshold for simulated particles, eg. can be used to separate generato...
Definition: MagicNumbers.h:29
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Barcode::ValidationBarcodeSvc::m_currentSecondary
int m_currentSecondary
Definition: ValidationBarcodeSvc.h:84
Barcode::ValidationBarcodeSvc::m_vertexIncrement
int m_vertexIncrement
Definition: ValidationBarcodeSvc.h:78
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Barcode::ValidationBarcodeSvc::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
IncidentSvc to catch begin of event and end of envent.
Definition: ValidationBarcodeSvc.h:71
Barcode::ValidationBarcodeSvc::m_currentVertex
int m_currentVertex
Definition: ValidationBarcodeSvc.h:79
Barcode::ValidationBarcodeSvc::m_firstVertex
int m_firstVertex
barcode information used for GenVertices
Definition: ValidationBarcodeSvc.h:77
Barcode::ValidationBarcodeSvc::m_secondaryIncrement
int m_secondaryIncrement
Definition: ValidationBarcodeSvc.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Barcode::ValidationBarcodeSvc::m_firstSecondary
int m_firstSecondary
barcode information used for secondary GenParticles
Definition: ValidationBarcodeSvc.h:82
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Barcode::ValidationBarcodeSvc::m_barcodeGenerationOffset
int m_barcodeGenerationOffset
not sure why this is needed...
Definition: ValidationBarcodeSvc.h:88
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
HepMC::SIM_REGENERATION_INCREMENT
constexpr int SIM_REGENERATION_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
Definition: MagicNumbers.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Barcode::ValidationBarcodeSvc::m_particleGenerationIncrement
int m_particleGenerationIncrement
barcode offset for each generation of updated particles
Definition: ValidationBarcodeSvc.h:87
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15