42 std::string histdirname(
"Truth");
43 if (
m_key!=
"TruthEvent") {
120 _SET_TITLE(
m_particle_status,
"Particle Status (1==undecayed, 2==decayed, 4==beam particle)",
"GenParticle Status",
"N GenParticles");
122 _SET_TITLE(
m_particle_type,
"Type (Type 0 = PDG 22, 1=11, 2=13,15, 3=111,211, 4=130,310,311,321, 5=2122, 6=2212, 7=else)",
"Particle Type (negative for anti-particles)",
"N Particles");
131 _SET_TITLE(
m_p_gen,
"momentum distribution of generator particles",
"p",
"dN/dp [1/MeV]");
133 _SET_TITLE(
m_log_p_gen,
"momentum distribution of generator particles",
"log(p)",
"dN/dlog(p) [1/log(MeV)]");
139 return StatusCode::SUCCESS;
148 const int evtnum(eventInfo->eventNumber());
151 if (evtStore()->retrieve(mcCollection,
m_key).isSuccess()) {
154 if (currentGenEventIter!=mcCollection->
end() ) {
157 if (!vtx && (*currentGenEventIter)->vertices().size()>0) vtx=((*currentGenEventIter)->vertices()).front();
160 m_x_vert->Fill( vtx->position().x() );
161 m_y_vert->Fill( vtx->position().y() );
162 m_z_vert->Fill( vtx->position().z() );
168 float mx=0.,my=0.,mz=0.;
169 for (
const auto& vtx: (*currentGenEventIter)->vertices()) {
170 double x = vtx->position().x();
171 double y = vtx->position().y();
172 double z = vtx->position().z();
173 double r = std::sqrt(
x*
x+
y*
y);
201 for (;currentGenEventIter!=mcCollection->
end(); ++currentGenEventIter) {
204 sprintf(fname,
"%s.event%d.txt",
m_key.c_str(),evtnum);
205 std::ofstream of(fname);
206 HepMC::Print::line(of,*(*currentGenEventIter));
210 int npart_prim=0, npart_sec=0;
211 for (
const auto& currentGenParticle: *(*currentGenEventIter)) {
224 if(std::abs(currentGenParticle->pdg_id())==211) {
231 int pdg = currentGenParticle->pdg_id();
233 switch ( abs(pdg) ) {
267 if ( !is_simulation ) {
268 double momentum=std::sqrt(mom.x()*mom.x()+mom.y()*mom.y()+mom.z()*mom.z());
282 m_n_part->Fill(npart_prim+npart_sec);
286 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
#define _TH1D(var, name, nbin, xmin, xmax)
#define _SET_TITLE(var, title, xaxis, yaxis)
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation (TODO migrate to be based on status).
HepMC3::FourVector FourVector
ConstGenVertexPtr signal_process_vertex(const GenEvent *e)
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (TODO migrate to be...