Commit 392c8d2d authored by Andrii Verbytskyi's avatar Andrii Verbytskyi
Browse files

Replaced headers, created typedefs

parent b91eae22
......@@ -54,7 +54,7 @@ StatusCode HepMCTruthReader::execute() {
if (cntr>0) ATH_MSG_INFO("Printing pileup events...");
if (cntr==0) {
HepMC::GenVertex* signalProcessVtx = genEvt->signal_process_vertex();
HepMC::GenVertexPtr signalProcessVtx = genEvt->signal_process_vertex();
ATH_MSG_INFO("Signal process vertex position: (" << (signalProcessVtx?signalProcessVtx->position().x():0)
<< ", " << (signalProcessVtx?signalProcessVtx->position().y():0)
<< ", " << (signalProcessVtx?signalProcessVtx->position().z():0)
......@@ -87,13 +87,13 @@ void HepMCTruthReader::printEvent(const HepMC::GenEvent* event) {
// Print method for vertex - mimics the HepMC dump.
// Particle print method called within here
void HepMCTruthReader::printVertex(const HepMC::GenVertex* vertex) {
void HepMCTruthReader::printVertex(const HepMC::GenVertexPtr vertex) {
std::ios::fmtflags f( cout.flags() );
cout << "GenVertex (" << vertex << "):";
if (vertex->barcode() != 0) {
if (HepMC::barcode(vertex) != 0) {
if (vertex->position().x() != 0.0 && vertex->position().y() != 0.0 && vertex->position().z() != 0.0) {
cout.width(9);
cout << vertex->barcode();
cout <<HepMC::barcode(vertex);
cout << " ID:";
cout.width(5);
cout << vertex->id();
......@@ -117,7 +117,7 @@ void HepMCTruthReader::printVertex(const HepMC::GenVertex* vertex) {
cout << endl;
} else {
cout.width(9);
cout << vertex->barcode();
cout << HepMC::barcode(vertex);
cout << " ID:";
cout.width(5);
cout << vertex->id();
......@@ -194,11 +194,11 @@ void HepMCTruthReader::printVertex(const HepMC::GenVertex* vertex) {
// Print method for particle - mimics the HepMC dump.
void HepMCTruthReader::printParticle(const HepMC::GenParticle* particle) {
void HepMCTruthReader::printParticle(const HepMC::GenParticlePtr particle) {
std::ios::fmtflags f( cout.flags() );
cout << " ";
cout.width(9);
cout << particle->barcode();
cout << HepMC::barcode(particle);
cout.width(9);
cout << particle->pdg_id() << " ";
cout.width(9);
......@@ -218,11 +218,11 @@ void HepMCTruthReader::printParticle(const HepMC::GenParticle* particle) {
cout.setf(ios::fmtflags(0), ios::floatfield);
cout.unsetf(ios_base::showpos);
if ( particle->has_decayed() ) {
if ( particle->end_vertex()->barcode()!=0 ) {
if ( HepMC::barcode(particle->end_vertex())!=0 ) {
cout.width(3);
cout << particle->status() << " ";
cout.width(9);
cout << particle->end_vertex()->barcode();
cout << HepMC::barcode(particle->end_vertex());
}
} else {
cout.width(3);
......
......@@ -7,11 +7,9 @@
#include "AthenaBaseComps/AthAlgorithm.h"
namespace HepMC {
class GenEvent;
class GenVertex;
class GenParticle;
}
#include "HepMCI/GenEvent_fwd.h"
#include "HepMCI/GenVertex_fwd.h"
#include "HepMCI/GenParticle_fwd.h"
/// @short Algorithm demonstrating reading of HepMC truth, and printing to screen
......@@ -35,8 +33,8 @@ private:
std::string m_hepMCContainerName;
void printEvent(const HepMC::GenEvent*);
void printVertex(const HepMC::GenVertex*);
void printParticle(const HepMC::GenParticle*);
void printVertex(const HepMC::GenVertexPtr);
void printParticle(const HepMC::GenParticlePtr);
}; // class HepMCTruthReader
......
......@@ -255,11 +255,11 @@ namespace xAODMaker {
// If signal process vertex is a disconnected vertex (no incoming/outgoing particles), add it manually
VertexMap vertexMap;
VertexMap::iterator mapItr;
vector<const HepMC::GenVertex*> vertices;
vector<HepMC::GenVertexPtr> vertices;
// Check signal process vertex
// If this is a disconnected vertex, add it manually or won't be added from the loop over particles below.
HepMC::GenVertex* disconnectedSignalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
HepMC::GenVertexPtr disconnectedSignalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
if (disconnectedSignalProcessVtx) {
if (disconnectedSignalProcessVtx->particles_in_size() == 0 &&
disconnectedSignalProcessVtx->particles_out_size() == 0 ) {
......@@ -271,7 +271,7 @@ namespace xAODMaker {
}
// Get the beam particles
pair<HepMC::GenParticle*,HepMC::GenParticle*> beamParticles;
pair<HepMC::GenParticlePtr,HepMC::GenParticlePtr> beamParticles;
if ( genEvt->valid_beam_particles() ) beamParticles = genEvt->beam_particles();
for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) {
// (a) create TruthParticle
......@@ -295,7 +295,7 @@ namespace xAODMaker {
}
}
// (d) Particle's production vertex
HepMC::GenVertex* productionVertex = (*pitr)->production_vertex();
HepMC::GenVertexPtr productionVertex = (*pitr)->production_vertex();
if (productionVertex) {
VertexParticles& parts = vertexMap[productionVertex];
if (parts.incoming.empty() && parts.outgoing.empty())
......@@ -307,7 +307,7 @@ namespace xAODMaker {
// else maybe want to keep track that this is the production vertex
//
// (e) Particle's decay vertex
HepMC::GenVertex* decayVertex = (*pitr)->end_vertex();
HepMC::GenVertexPtr decayVertex = (*pitr)->end_vertex();
if (decayVertex) {
VertexParticles& parts = vertexMap[decayVertex];
if (parts.incoming.empty() && parts.outgoing.empty())
......@@ -319,8 +319,8 @@ namespace xAODMaker {
} // end of loop over particles
// (3) Loop over the map
HepMC::GenVertex* signalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
for (const HepMC::GenVertex* vertex : vertices) {
HepMC::GenVertexPtr signalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
for (const HepMC::GenVertexPtr vertex : vertices) {
const auto& parts = vertexMap[vertex];
// (a) create TruthVertex
xAOD::TruthVertex* xTruthVertex = new xAOD::TruthVertex();
......@@ -357,9 +357,9 @@ namespace xAODMaker {
// A helper to set up a TruthVertex (without filling the ELs)
void xAODTruthCnvAlg::fillVertex(xAOD::TruthVertex* tv, const HepMC::GenVertex* gv) {
void xAODTruthCnvAlg::fillVertex(xAOD::TruthVertex* tv, const HepMC::GenVertexPtr gv) {
tv->setId(gv->id());
tv->setBarcode(gv->barcode());
tv->setBarcode(HepMC::barcode(gv));
// No vertex weights
// vector<float> weights;
......@@ -374,9 +374,9 @@ namespace xAODMaker {
// A helper to set up a TruthParticle (without filling the ELs)
void xAODTruthCnvAlg::fillParticle(xAOD::TruthParticle* tp, const HepMC::GenParticle* gp) {
void xAODTruthCnvAlg::fillParticle(xAOD::TruthParticle* tp, const HepMC::GenParticlePtr gp) {
tp->setPdgId(gp->pdg_id());
tp->setBarcode(gp->barcode());
tp->setBarcode(HepMC::barcode(gp));
tp->setStatus(gp->status());
const HepMC::Polarization& pol = gp->polarization();
......
......@@ -15,7 +15,7 @@
#pragma clang diagnostic ignored "-Wkeyword-macro"
#endif
#define private public
# include "HepMC/WeightContainer.h"
#include "HepMCI/WeightContainer.h"
#undef private
#ifdef __clang__
#pragma clang diagnostic pop
......@@ -38,10 +38,10 @@
#include <unordered_set>
namespace HepMC {
class GenVertex;
class GenParticle;
}
#include "HepMCI/GenVertex_fwd.h"
#include "HepMCI/GenParticle_fwd.h"
namespace xAODMaker {
......@@ -97,11 +97,11 @@ namespace xAODMaker {
std::vector<ElementLink<xAOD::TruthParticleContainer> > outgoingEL;
};
/// Convenience handle for a map of vtx ptrs -> connected particles
typedef std::map<const HepMC::GenVertex*, VertexParticles> VertexMap;
typedef std::map<const HepMC::GenVertexPtr, VertexParticles> VertexMap;
/// These functions do not set up ELs, just the other variables
static void fillVertex(xAOD::TruthVertex *tv, const HepMC::GenVertex *gv);
static void fillParticle(xAOD::TruthParticle *tp, const HepMC::GenParticle *gp);
static void fillVertex(xAOD::TruthVertex *tv, const HepMC::GenVertexPtr gv);
static void fillParticle(xAOD::TruthParticle *tp, const HepMC::GenParticlePtr gp);
/// The key of the input AOD truth container
SG::ReadHandleKey<McEventCollection> m_aodContainerKey{
......
......@@ -8,10 +8,9 @@
#include "BeamHaloGenerator/BeamHaloParticle.h"
#include <string>
#include <vector>
#include "HepMCI/GenEvent.h"
namespace HepMC {
class GenEvent;
}
namespace HepPDT {
class ParticleDataTable;
}
......
......@@ -5,7 +5,7 @@
#ifndef BEAMHALOPARTICLE_H
#define BEAMHALOPARTICLE_H
#include "HepMC/SimpleVector.h"
#include "HepMCI/SimpleVector.h"
class MarsParticle;
class FlukaParticle;
......
......@@ -5,7 +5,7 @@
#ifndef FLUKAPARTICLE_H
#define FLUKAPARTICLE_H
#include "HepMC/SimpleVector.h"
#include "HepMCI/SimpleVector.h"
#include <string>
#include <vector>
......
......@@ -5,7 +5,7 @@
#ifndef MARSPARTICLE_H
#define MARSPARTICLE_H
#include "HepMC/SimpleVector.h"
#include "HepMCI/SimpleVector.h"
#include <vector>
#include <string>
......
......@@ -9,6 +9,7 @@ atlas_subdir( BeamHaloGenerator )
atlas_depends_on_subdirs( PUBLIC
GaudiKernel
Generators/GeneratorModules
Generators/HepMCI
PRIVATE
Control/AthenaKernel )
......
......@@ -7,7 +7,7 @@
#include "BeamHaloGenerator/BeamHaloGeneratorAlg.h"
#include "BeamHaloGenerator/AsciiInput.h"
#include "BeamHaloGenerator/BeamHaloGeneratorSettings.h"
#include "HepMC/GenEvent.h"
#include "HepMCI/GenEvent.h"
#include "CLHEP/Random/RandFlat.h"
#include "CLHEP/Units/PhysicalConstants.h"
#include "TMath.h"
......@@ -97,8 +97,8 @@ int BeamHaloGenerator::convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent
HepMC::GenEvent* evt) {
double pz;
bool flipFlag = flipEvent();
HepMC::GenParticle* genParticle;
HepMC::GenVertex* genVertex;
HepMC::GenParticlePtr genParticle;
HepMC::GenVertexPtr genVertex;
const double c = 2.99792458E+11; // speed of light in mm/s
std::vector<BeamHaloParticle>::iterator itr = beamHaloEvent->begin();
......@@ -121,11 +121,11 @@ int BeamHaloGenerator::convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent
HepMC::FourVector fourVector = (*itr).fourVector();
if(!flipFlag) {
genParticle = new HepMC::GenParticle(fourVector,
genParticle = HepMC::newGenParticlePtr(fourVector,
(*itr).pdgId(),
1);
genVertex = new HepMC::GenVertex(HepMC::FourVector(position.x(),
genVertex = HepMC::newGenVertexPtr(HepMC::FourVector(position.x(),
position.y(),
(position.z() + m_interfacePlane),
c*position.t() -1.0*std::fabs(m_interfacePlane)),
......@@ -135,11 +135,11 @@ int BeamHaloGenerator::convertEvent(std::vector<BeamHaloParticle>* beamHaloEvent
pz = fourVector.pz();
fourVector.setPz(-pz);
genParticle = new HepMC::GenParticle(fourVector,
genParticle = HepMC::newGenParticlePtr(fourVector,
(*itr).pdgId(),
1);
genVertex = new HepMC::GenVertex(HepMC::FourVector(position.x(),
genVertex = HepMC::newGenVertexPtr(HepMC::FourVector(position.x(),
position.y(),
-1.0*(position.z() + m_interfacePlane),
c*position.t() -1.0*std::fabs(m_interfacePlane)),
......
......@@ -9,7 +9,8 @@
#include "GaudiKernel/MsgStream.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
#include "HepMC/GenEvent.h"
#include "HepMCI/GenEvent.h"
#include "HepMCI/WeightContainer.h"
#include <cmath>
//--------------------------------------------------------------------------
......@@ -209,7 +210,7 @@ StatusCode BeamHaloGeneratorAlg::callGenerator() {
for (hepmc_part_itr = m_evt.particles_begin();
hepmc_part_itr != m_evt.particles_end();
hepmc_part_itr++) {
HepMC::GenVertex* prodVertex = (*hepmc_part_itr)->production_vertex();
HepMC::GenVertexPtr prodVertex = (*hepmc_part_itr)->production_vertex();
if(!prodVertex) continue;
// Store the values for use in the if conditions that follow
......
......@@ -8,7 +8,7 @@
#include "BeamHaloGenerator/BeamHaloGeneratorAlg.h"
#include "BeamHaloGenerator/BeamHaloGeneratorSettings.h"
#include "HepMC/GenEvent.h"
#include "HepMCI/GenEvent.h"
#include "CLHEP/Random/RandFlat.h"
#include <cmath>
......@@ -67,7 +67,7 @@ int FlukaHaloGenerator::fillEvt(HepMC::GenEvent* evt) {
evt->set_event_number(m_eventNumber);
// Set the signal process
evt->set_signal_process_id(BeamHaloGenerator::FLUKA_SHOWER);
HepMC::set_signal_process_id(evt,BeamHaloGenerator::FLUKA_SHOWER);
// Increment the event number
m_eventNumber++;
......
......@@ -93,11 +93,11 @@ int MarsHaloGenerator::fillEvt(HepMC::GenEvent* evt) {
// Check if sampling has been enabled or not.
if(!m_enableSampling) {
evt->set_signal_process_id(BeamHaloGenerator::MARS_READ);
HepMC::set_signal_process_id(evt,BeamHaloGenerator::MARS_READ);
evt->weights().push_back(beamHaloEvent[0].weight());
}
else {
evt->set_signal_process_id(BeamHaloGenerator::MARS_SINGLE);
HepMC::set_signal_process_id(evt,BeamHaloGenerator::MARS_SINGLE);
evt->weights().push_back(1.0);
}
......
......@@ -78,7 +78,7 @@ StatusCode BoostEvent::execute()
<< std::setw(10) << momentum.phi()
<< endmsg;
(*particleItr)->set_momentum( momentum );
(*particleItr)->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) );
}
}
......
......@@ -9,6 +9,7 @@ atlas_subdir( CavernBkgGenerator )
atlas_depends_on_subdirs( PUBLIC
Control/AthenaKernel
GaudiKernel
Generators/HepMCI
Generators/GeneratorModules )
# External dependencies:
......
......@@ -36,7 +36,7 @@
#include "CLHEP/Random/RandomEngine.h"
#include "CLHEP/Vector/LorentzVector.h"
#include "HepMC/Polarization.h"
#include "HepMCI/Polarization.h"
#include <iostream>
#include <fstream>
......
......@@ -61,17 +61,15 @@ GenerateCavernBkg::fillEvt(HepMC::GenEvent* evt) {
ATH_MSG_INFO("GenerateCavernBkg FILLING.");
// Set event properties
evt->set_signal_process_id(-1);
HepMC::set_signal_process_id(evt,-1);
evt->set_event_number(m_bkgout.ievent());
evt->set_random_states(m_seeds);
HepMC::set_random_states(evt,m_seeds);
for (int i = 1; i <= m_bkgout.npv(); ++i) {
const CLHEP::HepLorentzVector position(m_bkgout.vx(i)*10., // CLHEP::cm to CLHEP::mm
m_bkgout.vy(i)*10., // CLHEP::cm to CLHEP::mm
m_bkgout.vz(i)*10., // CLHEP::cm to CLHEP::mm
m_bkgout.ptof(i)*299.792458); // CLHEP::ns to CLHEP::mm
HepMC::GenVertex* v = new HepMC::GenVertex(position, m_bkgout.irp(i));
HepMC::GenVertexPtr v = HepMC::newGenVertexPtr(HepMC::FourVector(position.x(),position.y(),position.z(),position.t()), m_bkgout.irp(i));
// Get the mass from the particle property service
const HepPDT::ParticleData* particle = particleData(abs(m_bkgout.ityp(i)));
const double mass = particle->mass().value();
......@@ -81,7 +79,7 @@ GenerateCavernBkg::fillEvt(HepMC::GenEvent* evt) {
const double pz = m_bkgout.pz(i)*1000.; // CLHEP::GeV to CLHEP::MeV
const double ener = sqrt(px*px + py*py + pz*pz + mass*mass);
const CLHEP::HepLorentzVector momentum(px, py, pz, ener);
HepMC::GenParticle* p = new HepMC::GenParticle(momentum, m_bkgout.ityp(i), 1);
HepMC::GenParticlePtr p = HepMC::newGenParticlePtr(HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()), m_bkgout.ityp(i), 1);
v->add_particle_out(p);
evt->add_vertex(v);
......
......@@ -34,8 +34,8 @@
#include "CLHEP/Units/SystemOfUnits.h"
#include "CLHEP/Units/PhysicalConstants.h"
#include "HepMC/GenEvent.h"
#include "HepMC/Polarization.h"
#include "HepMCI/GenEvent.h"
#include "HepMCI/Polarization.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/ISvcLocator.h"
......@@ -309,11 +309,10 @@ StatusCode MuonBackgroundConverter::fillEvt( HepMC::GenEvent* event )
int nPart = m_pdgCode.size();
for ( int i = 0; i < nPart; i++ )
{
HepMC::GenParticle* particle = new HepMC::GenParticle( m_fourMom[i], m_pdgCode[i], 1 );
particle->set_polarization( m_polarization[i] );
HepMC::GenParticlePtr particle = HepMC::newGenParticlePtr( HepMC::FourVector(m_fourMom[i].x(),m_fourMom[i].y(),m_fourMom[i].z(),m_fourMom[i].e()), m_pdgCode[i], 1 );
HepMC::set_polarization(particle, m_polarization[i] );
// Create the vertex, and add the particle to the vertex
HepMC::GenVertex* vertex = new HepMC::GenVertex( m_fourPos[i] );
HepMC::GenVertexPtr vertex = HepMC::newGenVertexPtr( HepMC::FourVector(m_fourPos[i].x(),m_fourPos[i].y(),m_fourPos[i].z(),m_fourPos[i].t()) );
vertex->add_particle_out( particle );
// Add the vertex to the event
......
......@@ -9,6 +9,7 @@ atlas_subdir( CosmicGenerator )
atlas_depends_on_subdirs( PUBLIC
Control/AthenaKernel
Generators/GeneratorModules
Generators/HepMCI
PRIVATE
GaudiKernel )
......
......@@ -62,7 +62,7 @@ in the vertical position (the way it is positioned in the ATLAS detector)
#include "AthenaKernel/IAtRndmGenSvc.h"
#include "CLHEP/Vector/LorentzVector.h"
#include "HepMC/Polarization.h"
#include "HepMCI/Polarization.h"
#include <iostream>
#include <fstream>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment