ATLAS Offline Software
Loading...
Searching...
No Matches
PrintMC Class Reference

Print MC event details for a range of event numbers. More...

#include <PrintMC.h>

Inheritance diagram for PrintMC:
Collaboration diagram for PrintMC:

Public Member Functions

 PrintMC (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Event collection accessors (const and non-const)
HepMC::GenEvent *event ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current signal event (first in the McEventCollection)
McEventCollection *events ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current event's McEventCollection.
const HepMC::GenEvent * event_const () const
 Access the current signal event (const)
const McEventCollectionevents_const () const
 Access the current event's McEventCollection (const)
const McEventCollectionevents_const (const EventContext &ctx) const
Particle data accessors
const ServiceHandle< IPartPropSvc > partPropSvc () const
 Access the particle property service.
const HepPDT::ParticleDataTable & particleTable () const
 Get a particle data table.
const HepPDT::ParticleDataTable & pdt () const
 Shorter alias to get a particle data table.
const HepPDT::ParticleData * particleData (int pid) const
 Access an element in the particle data table.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

Properties
std::string m_mcEventKey {}
 StoreGate key for the MC event collection (defaults to GEN_EVENT)
BooleanProperty m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
 Flag to determine if a new MC event collection should be made if it doesn't exist.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

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

Private Attributes

SG::ReadHandleKey< xAOD::EventInfom_evtInfoKey
std::string m_keyout
bool m_VerboseOutput
std::string m_printsty
bool m_vertexinfo
uint64_t m_firstEvt
uint64_t m_lastEvt
bool m_trustHepMC
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Utility event-mangling functions

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

Detailed Description

Print MC event details for a range of event numbers.

Definition at line 12 of file PrintMC.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

◆ PrintMC()

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

Definition at line 21 of file PrintMC.cxx.

22 : GenBase(name, pSvcLocator)
23{
24 // Declare JO interface
25 declareProperty("VerboseOutput", m_VerboseOutput=true, "Print out detailed information or not");
26 declareProperty("PrintStyle", m_printsty="Barcode", "Type of info to print out: 'Barcode' or 'Vertex'");
27 declareProperty("VertexInfo", m_vertexinfo=false, "Print out vertex information");
28 declareProperty("TrustHepMC", m_trustHepMC=false, "Use the event numbers in the HepMC record to choose the events to print");
29 declareProperty("FirstEvent", m_firstEvt=1, "Lowest event number to print");
30 declareProperty("LastEvent", m_lastEvt=100000000, "Highest event number to print");
31}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenBase.cxx:11
bool m_vertexinfo
Definition PrintMC.h:28
std::string m_printsty
Definition PrintMC.h:27
bool m_trustHepMC
Definition PrintMC.h:31
uint64_t m_firstEvt
Definition PrintMC.h:29
bool m_VerboseOutput
Definition PrintMC.h:26
uint64_t m_lastEvt
Definition PrintMC.h:30

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 }
#define ATH_MSG_ERROR(x)
static const Attributes_t empty

◆ 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()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

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

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ 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 }
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const McEventCollection * events_const() const
Access the current event's McEventCollection (const)
Definition GenBase.h:96

◆ 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 {
100 SG::ReadHandle<McEventCollection> ret = SG::makeHandle(m_mcevents_const, ctx);
101 if (!ret.isValid())
102 ATH_MSG_ERROR("No McEventCollection found in StoreGate with key " << m_mcevents_const.key());
103 return ret.cptr();
104 }
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition GenBase.h:163
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ evtStore()

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.

◆ execute()

StatusCode PrintMC::execute ( )
overridevirtual
Todo
Avoid use of unprotected std::cout: stringstream + MsgStream would be better
Todo
I get the feeling VerboseOutput is being abused here...
Todo
Looks like misuse of the verbose output flag
Todo
Isn't this if (m_VerboseOutput... redundant?
Todo
Isn't this if (m_VerboseOutput... redundant?
Todo
Is there no better way to detect unspecified masses than == 0? Final state photons should be 0

Reimplemented from GenBase.

Definition at line 53 of file PrintMC.cxx.

53 {
54 // If output already turned off by passing last dumped event, just return
56 if (!m_VerboseOutput) return StatusCode::SUCCESS;
57
58 // Loop over all events in McEventCollection
59
60 for (const HepMC::GenEvent* evt : *events_const()) {
61
62 // Get event number from HepMC
63 uint64_t evtnum = std::max(0,evt->event_number());
64 // Override with evtnum from Athena if enabled and functional
65 if (!m_trustHepMC) {
66 SG::ReadHandle<xAOD::EventInfo> evtInfo(m_evtInfoKey);
67 evtnum = evtInfo->eventNumber();
68 }
69
70 // Return immediately if event number is outside the print range
71 if (evtnum < m_firstEvt) {
72 return StatusCode::SUCCESS;
73 }
74 if (evtnum > m_lastEvt) {
76 m_VerboseOutput = false;
77 return StatusCode::SUCCESS;
78 }
79
80 // Printout header
81 ATH_MSG_INFO(">>> PrintMC from execute");
82
83 // VERTEX format
85 if (m_VerboseOutput && m_printsty == "Vertex") {
86 HepMC::Print::line(std::cout, *evt); // standard HepMC dump of vertex list
87 }
88 // BARCODE format
90 else if (m_VerboseOutput && m_printsty == "Barcode") {
91 drawLine(std::cout);
92
93 std::cout << "GenEvent: #" << evt->event_number()
94 << " ID=" << HepMC::signal_process_id(evt)
95 << " SignalProcessGenVertex Barcode: "
97 std::cout << " Entries this event: " << evt->vertices_size() << " vertices, "
98 << evt->particles_size() << " particles.\n";
99#ifdef HEPMC3
100 if (evt->heavy_ion()) {
101 std::cout << " HeavyIon: jatt=" << evt->heavy_ion()->Ncoll_hard
102 << " np=" << evt->heavy_ion()->Npart_proj
103 << " nt=" << evt->heavy_ion()->Npart_targ
104 << " ncoll=" << evt->heavy_ion()->Ncoll
105 << " specn=" << evt->heavy_ion()->spectator_neutrons
106 << " specp=" << evt->heavy_ion()->spectator_protons
107 << " n01=" << evt->heavy_ion()->N_Nwounded_collisions
108 << " n10=" << evt->heavy_ion()->Nwounded_N_collisions
109 << " n11=" << evt->heavy_ion()->Nwounded_Nwounded_collisions
110 << " impact=" << evt->heavy_ion()->impact_parameter
111 << " evplane=" << evt->heavy_ion()->event_plane_angle
112 << " ecc=" << evt->heavy_ion()->eccentricity
113 << " sigmaNNinel=" << evt->heavy_ion()->sigma_inel_NN
114 << std::endl;
115 }
116 else {
117 std::cout << "HeavyIon: EMPTY"
118 << std::endl;
119 }
120
121
122 // Weights
123 std::cout << " Weights(" << evt->weights().size() << ")=";
124 for ( auto wgt = evt->weights().begin();
125 wgt != evt->weights().end(); wgt++ ) { std::cout << *wgt << " "; }
126 std::cout << "\n";
127 std::cout << " EventScale " << (evt->attribute<HepMC3::DoubleAttribute>("event_scale")? evt->attribute<HepMC3::DoubleAttribute>("event_scale")->value():0.0)
128 << " [energy] \t alphaQCD=" << (evt->attribute<HepMC3::DoubleAttribute>("alphaQCD")? evt->attribute<HepMC3::DoubleAttribute>("alphaQCD")->value():0.0)
129 << "\t alphaQED=" << (evt->attribute<HepMC3::DoubleAttribute>("alphaQED")? evt->attribute<HepMC3::DoubleAttribute>("alphaQED")->value():0.0) << std::endl;
130
131 if (evt->pdf_info()) {
132 std::cout << "PdfInfo: id1=" << evt->pdf_info()->parton_id[0]
133 << " id2=" << evt->pdf_info()->parton_id[1]
134 << " x1=" << evt->pdf_info()->x[0]
135 << " x2=" << evt->pdf_info()->x[1]
136 << " q=" << evt->pdf_info()->scale
137 << " xpdf1=" << evt->pdf_info()->pdf_id[0]
138 << " xpdf2=" << evt->pdf_info()->pdf_id[1]
139 << std::endl;
140 }
141 else {
142 std::cout << "PdfInfo: EMPTY"
143 << std::endl;
144 }
145#else
146 if (evt->heavy_ion()) {
147 std::cout << " HeavyIon: jatt=" << evt->heavy_ion()->Ncoll_hard()
148 << " np=" << evt->heavy_ion()->Npart_proj()
149 << " nt=" << evt->heavy_ion()->Npart_targ()
150 << " ncoll=" << evt->heavy_ion()->Ncoll()
151 << " specn=" << evt->heavy_ion()->spectator_neutrons()
152 << " specp=" << evt->heavy_ion()->spectator_protons()
153 << " n01=" << evt->heavy_ion()->N_Nwounded_collisions()
154 << " n10=" << evt->heavy_ion()->Nwounded_N_collisions()
155 << " n11=" << evt->heavy_ion()->Nwounded_Nwounded_collisions()
156 << " impact=" << evt->heavy_ion()->impact_parameter()
157 << " evplane=" << evt->heavy_ion()->event_plane_angle()
158 << " ecc=" << evt->heavy_ion()->eccentricity()
159 << " sigmaNNinel=" << evt->heavy_ion()->sigma_inel_NN()
160 << std::endl;
161 }
162 else {
163 std::cout << "HeavyIon: EMPTY"
164 << std::endl;
165 }
166
167
168 // Weights
169 std::cout << " Weights(" << evt->weights().size() << ")=";
170 for (double w : evt->weights()) {
171 std::cout << w << " ";
172 }
173 std::cout << "\n";
174 std::cout << " EventScale " << evt->event_scale()
175 << " [energy] \t alphaQCD=" << evt->alphaQCD()
176 << "\t alphaQED=" << evt->alphaQED() << std::endl;
177
178 if (evt->pdf_info()) {
179 std::cout << "PdfInfo: id1=" << evt->pdf_info()->id1()
180 << " id2=" << evt->pdf_info()->id2()
181 << " x1=" << evt->pdf_info()->x1()
182 << " x2=" << evt->pdf_info()->x2()
183 << " q=" << evt->pdf_info()->scalePDF()
184 << " xpdf1=" << evt->pdf_info()->pdf1()
185 << " xpdf2=" << evt->pdf_info()->pdf2()
186 << std::endl;
187 }
188 else {
189 std::cout << "PdfInfo: EMPTY"
190 << std::endl;
191 }
192#endif
193
194 // Print a legend to describe the particle info
195 char particle_legend[120];
196 sprintf( particle_legend," %9s %8s %-15s %4s %8s %8s (%9s,%9s,%9s,%9s,%9s)",
197 "Barcode","PDG ID","Name","Stat","ProdVtx","DecayVtx","Px","Py","Pz","E ","m");
198 std::cout << std::endl;
199 std::cout << " GenParticle Legend\n" << particle_legend << "\n";
200 if (m_vertexinfo) {
201 sprintf( particle_legend," %60s (%9s,%9s,%9s,%9s)"," ","Vx","Vy","Vz","Vct ");
202 std::cout << particle_legend << std::endl;
203 }
204 drawLine(std::cout);
205
206 // Print all particles
207 for (auto p: *evt) {
208 int p_bcode = HepMC::barcode(p);
209 int p_pdg_id = p->pdg_id();
210 HepMC::FourVector mom=p->momentum();
211 int p_stat = p->status();
212 int p_prodvtx = p->production_vertex()?HepMC::barcode(p->production_vertex()):0;
213 int p_endvtx = p->end_vertex()?HepMC::barcode(p->end_vertex()):0;
214 HepMC::FourVector prodvtx=p->production_vertex()?p->production_vertex()->position():HepMC::FourVector(0.0,0.0,0.0,0.0);
215 // Access the PDG table to get the particle name (and mass?)
216 std::string sname;
217 double p_mass = p->generated_mass();
218 const HepPDT::ParticleData* ap = particleData(std::abs(p_pdg_id));
219 if (!ap) {
220 ATH_MSG_DEBUG("PID " << std::abs(p_pdg_id) << " is not in particle data table");
221 } else {
222 const double p_charge = ap->charge() * (p_pdg_id < 0 ? -1 : 1); // assuming that charged leptons are in the PDT...
223 // Build particle name string
224 sname = ap->name();
225 if (p_charge < 0) {
226 const size_t plusidx = sname.rfind("+");
227 if (plusidx != std::string::npos) {
228 sname.replace(plusidx, 1, "-");
229 }
230 }
231 }
232 // PDG table missing or exceptions
233 // quarks & gluons
234 if (p_pdg_id == 21) sname="g";
235 else if (p_pdg_id == 1) sname="d";
236 else if (p_pdg_id == -1) sname="d~";
237 else if (p_pdg_id == 2) sname="u";
238 else if (p_pdg_id == -2) sname="u~";
239 else if (p_pdg_id == 3) sname="s";
240 else if (p_pdg_id == -3) sname="s~";
241 else if (p_pdg_id == 4) sname="c";
242 else if (p_pdg_id == -4) sname="c~";
243 else if (p_pdg_id == 5) sname="b";
244 else if (p_pdg_id == -5) sname="b~";
245 else if (p_pdg_id == 6) sname="t";
246 else if (p_pdg_id == -6) sname="t~";
247 // shower-specific
248 else if (p_pdg_id == 91) sname="cluster";
249 else if (p_pdg_id == 92) sname="string";
250 else if (p_pdg_id == 9922212) sname="remn";
251 else if (p_pdg_id == 2101) sname="ud";
252 else if (p_pdg_id == 2203) sname="uu";
253
254 // Calc mass if missing
256 if (p_mass == 0 && (p_stat == 2 || (p_stat != 1 && p_pdg_id != 22))) {
257 p_mass = mom.m();
258 }
259
260 const char* p_name = sname.c_str() ;
261 char particle_entries[120];
262 sprintf(particle_entries, " %9i %8i %-15s %4i %8i %8i (%+9.3g,%+9.3g,%+9.3g,%+9.3g,%9.3g)",
263 p_bcode, p_pdg_id, p_name, p_stat, p_prodvtx, p_endvtx, mom.px(), mom.py(),mom.pz(), mom.e(), p_mass);
264 std::cout << particle_entries << "\n";
265 if (m_vertexinfo) {
266 sprintf(particle_entries," %60s (%+9.3g,%+9.3g,%+9.3g,%+9.3g)"," ",prodvtx.x(), prodvtx.y(),prodvtx.z(), prodvtx.t());
267 std::cout << particle_entries << "\n";
268 }
269 }
270
271 }
272
273 }
274 // End of execution for each event
275 return StatusCode::SUCCESS;
276}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
if(febId1==febId2)
void drawLine(std::ostream &os)
Definition PrintMC.cxx:16
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
Definition GenBase.h:126
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
Definition PrintMC.h:20
void line(std::ostream &os, const GenEvent &e)
Definition GenEvent.h:677
int signal_process_id(const GenEvent &e)
Definition GenEvent.h:636
int barcode(const T *p)
Definition Barcode.h:16
GenVertex * signal_process_vertex(const GenEvent *e)
Definition GenEvent.h:626

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

◆ 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 PrintMC::initialize ( )
overridevirtual

Reimplemented from GenBase.

Definition at line 34 of file PrintMC.cxx.

34 {
36 if(!m_trustHepMC) ATH_CHECK(m_evtInfoKey.initialize());
37
38 // Check settings
39 if (m_printsty != "Barcode" && m_printsty != "Vertex") {
40 ATH_MSG_ERROR("Unknown PrintStyle: " << m_printsty << "! Choose Barcode/Vertex");
41 return StatusCode::FAILURE;
42 }
43
44 // Check that last > first
46
47 return StatusCode::SUCCESS;
48}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode initialize() override
Definition GenBase.cxx:17

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

◆ 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()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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 }
const HepPDT::ParticleDataTable & pdt() const
Shorter alias to get a particle data table.
Definition GenBase.h:123

◆ 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 }
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition GenBase.h:160

◆ 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(); }
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
Definition GenBase.h:118

◆ 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();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
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, AthHistogramAlgorithm, and PyAthena::Alg.

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}
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

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

Member Data Documentation

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

SG::ReadHandleKey<xAOD::EventInfo> PrintMC::m_evtInfoKey
private
Initial value:
{this
, "EventInfo"
, "EventInfo"
, "ReadHandleKey for xAOD::EventInfo" }

Definition at line 20 of file PrintMC.h.

20 {this
21 , "EventInfo"
22 , "EventInfo"
23 , "ReadHandleKey for xAOD::EventInfo" };

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

uint64_t PrintMC::m_firstEvt
private

Definition at line 29 of file PrintMC.h.

◆ m_keyout

std::string PrintMC::m_keyout
private

Definition at line 25 of file PrintMC.h.

◆ m_lastEvt

uint64_t PrintMC::m_lastEvt
private

Definition at line 30 of file PrintMC.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.

137{};

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

163{ this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" };

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

139{this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"};

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

160{this, "PartPropSvc", "PartPropSvc"};

◆ m_printsty

std::string PrintMC::m_printsty
private

Definition at line 27 of file PrintMC.h.

◆ m_trustHepMC

bool PrintMC::m_trustHepMC
private

Definition at line 31 of file PrintMC.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_VerboseOutput

bool PrintMC::m_VerboseOutput
private

Definition at line 26 of file PrintMC.h.

◆ m_vertexinfo

bool PrintMC::m_vertexinfo
private

Definition at line 28 of file PrintMC.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: