6#include "AthLinks/ElementLink.h"
8#include "GaudiKernel/MsgStream.h"
9#include "GaudiKernel/DataSvc.h"
10#include "GaudiKernel/PhysicalConstants.h"
42 return StatusCode::SUCCESS;
51 if (xTruthEventContainer.
isValid()) {
56 return StatusCode::FAILURE;
59 ATH_MSG_INFO(
"Number of signal events in this Athena event: " << xTruthEventContainer->size());
69 if (vtx)
ATH_MSG_INFO(
"Poistion = (" << vtx->
x() <<
", " << vtx->
y() <<
", " << vtx->
z() <<
")");
97 return StatusCode::SUCCESS;
104 cout <<
"--------------------------------------------------------------------------------\n";
105 cout <<
"GenEvent: #" <<
"NNN" <<
"\n";
106 cout <<
" Entries this event: " <<
event->nTruthVertices() <<
" vertices, " <<
event->nTruthParticles() <<
" particles.\n";
107 cout <<
" GenParticle Legend\n";
108 if (do4momPtEtaPhi) cout <<
" UniqueID PDG ID ( pt, eta, phi, E ) Stat DecayVtx\n";
109 else cout <<
" UniqueID PDG ID ( Px, Py, Pz, E ) Stat DecayVtx\n";
110 cout <<
"--------------------------------------------------------------------------------\n";
111 for (
unsigned int iv = 0; iv <
event->nTruthVertices(); ++iv) {
112 printVertex(event->truthVertex(iv), do4momPtEtaPhi);
114 cout <<
"--------------------------------------------------------------------------------\n";
120 std::ios::fmtflags f( cout.flags() );
122 cout <<
"TruthVertex:";
124 if (vertex->x() != 0.0 && vertex->y() != 0.0 && vertex->z() != 0.0) {
133 cout.setf(ios::scientific, ios::floatfield);
134 cout.setf(ios_base::showpos);
135 cout << vertex->x() <<
",";
138 cout << vertex->y() <<
",";
141 cout << vertex->z() <<
",";
145 cout.setf(ios::fmtflags(0), ios::floatfield);
146 cout.unsetf(ios_base::showpos);
154 cout <<
" (X,cT): 0";
161 if (vertex->x() != 0.0 && vertex->y() != 0.0 && vertex->z() != 0.0) {
163 cout << (
void*)vertex;
170 cout.setf(ios::scientific, ios::floatfield);
171 cout.setf(ios_base::showpos);
182 cout.setf(ios::fmtflags(0), ios::floatfield);
183 cout.unsetf(ios_base::showpos);
187 cout << (
void*)vertex;
196 for (
unsigned int iPIn = 0; iPIn<vertex->nIncomingParticles(); ++iPIn) {
200 cout << vertex->nIncomingParticles();
202 printParticle(vertex->incomingParticle(iPIn), do4momPtEtaPhi);
204 for (
unsigned int iPOut = 0; iPOut<vertex->nOutgoingParticles(); ++iPOut) {
208 cout << vertex->nOutgoingParticles();
210 printParticle(vertex->outgoingParticle(iPOut), do4momPtEtaPhi);
219 std::ios::fmtflags f( cout.flags() );
225 cout << particle->pdgId() <<
" ";
228 cout.setf(ios::scientific, ios::floatfield);
229 cout.setf(ios_base::showpos);
230 if (do4momPtEtaPhi) cout << particle->pt() <<
",";
231 else cout << particle->px() <<
",";
234 if (do4momPtEtaPhi) cout << particle->eta() <<
",";
235 else cout << particle->py() <<
",";
238 if (do4momPtEtaPhi) cout << particle->phi() <<
",";
239 else cout << particle->pz() <<
",";
242 cout << particle->e() <<
" ";
243 cout.setf(ios::fmtflags(0), ios::floatfield);
244 cout.unsetf(ios_base::showpos);
245 if ( particle->hasDecayVtx() ) {
248 cout << particle->status() <<
" ";
254 cout << particle->status();
#define ATH_CHECK
Evaluate an expression and check for errors.
Helpers for checking error return status codes and reporting errors.
Handle class for reading from StoreGate.
An algorithm that can be simultaneously executed in multiple threads.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual StatusCode initialize()
Function initialising the algorithm.
static void printEvent(const xAOD::TruthEventBase *evt, bool do4momPtEtaPhi)
SG::ReadHandleKey< xAOD::TruthEventContainer > m_xaodTruthEventContainerKey
The keys for the input xAOD truth containers.
xAODTruthReader(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
static void printParticle(const xAOD::TruthParticle *part, bool do4momPtEtaPhi)
Gaudi::Property< bool > m_do4momPtEtaPhi
Flag to printout in pt,eta,phi instead of px,py,pz.
static void printVertex(const xAOD::TruthVertex *vtx, bool do4momPtEtaPhi)
virtual StatusCode execute(const EventContext &ctx) const
Function executing the algorithm.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.
constexpr int UNDEFINED_ID
TruthEventBase_v1 TruthEventBase
Typedef to implementation.
TruthVertex_v1 TruthVertex
Typedef to implementation.
TruthEvent_v1 TruthEvent
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.