ATLAS Offline Software
Loading...
Searching...
No Matches
Barcode::ValidationBarcodeSvc Class Reference

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

#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.
virtual ~ValidationBarcodeSvc ()
 Destructor.
virtual StatusCode initialize () override
 Athena algorithm's interface methods.
virtual StatusCode finalize () override
 framework methods
virtual void handle (const Incident &inc) override
 Incident to reset the barcodes at the beginning of the event.
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.
virtual int newSecondaryParticle (int parentBC=HepMC::UNDEFINED_ID) override
 Generate a new unique barcode for a secondary particle, based on the parent particle barcode.
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)
virtual int newGeneratedVertex () override
 Generate a new unique vertex barcode below the simulation offset.
virtual int secondaryParticleBcOffset () const override
 Return the secondary particle and vertex offsets.
virtual int secondaryVertexBcOffset () const override
 Return the secondary vertex offset.
virtual void registerLargestGeneratedParticleBC (int) override
 Inform the BarcodeSvc about the largest particle and vertex Barcodes in the event input.
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.
int m_firstVertex
 barcode information used for GenVertices
int m_vertexIncrement
int m_currentVertex
int m_firstSecondary
 barcode information used for secondary GenParticles
int m_secondaryIncrement
int m_currentSecondary
int m_particleGenerationIncrement
 barcode offset for each generation of updated particles
int m_barcodeGenerationOffset
 not sure why this is needed...

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),
23{
24 // python properties
25 declareProperty("VertexIncrement" , m_vertexIncrement);
26 declareProperty("SecondaryIncrement" , m_secondaryIncrement);
27 declareProperty("BarcodeGenerationOffset" , m_barcodeGenerationOffset);
28}
int m_particleGenerationIncrement
barcode offset for each generation of updated particles
int m_firstSecondary
barcode information used for secondary GenParticles
ServiceHandle< IIncidentSvc > m_incidentSvc
IncidentSvc to catch begin of event and end of envent.
int m_barcodeGenerationOffset
not sure why this is needed...
int m_firstVertex
barcode information used for GenVertices
constexpr int SIM_BARCODE_THRESHOLD
Constant defining the barcode threshold for simulated particles, eg. can be used to separate generato...
constexpr int SIM_REGENERATION_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...

◆ ~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}
#define ATH_MSG_VERBOSE(x)

◆ 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}
#define CHECK(...)
Evaluate an expression and check for errors.

◆ 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 }
99 int returnBC = m_currentSecondary + (primGen+1)*m_barcodeGenerationOffset;
100
101 return returnBC;
102}
#define ATH_MSG_ERROR(x)

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