10 #include <HepMC3/GenEvent.h> 11 #include <HepMC3/GenVertex.h> 12 #include <HepMC3/GenParticle.h> 20 : evt_(evt), isVtxGenApplied_(
false), isVtxBoostApplied_(
false), isPBoostApplied_(
false) {}
44 evt_->shift_position_by(vtxShift);
52 if (lorentz ==
nullptr) {
59 TMatrixD tmplorentz(*lorentz);
62 if (
type ==
"vertex") {
68 for (
const HepMC3::GenVertexPtr& vt :
evt_->vertices()) {
71 p4(0, 0) = vt->position().t();
72 p4(1, 0) = vt->position().x();
73 p4(2, 0) = vt->position().z();
74 p4(3, 0) = vt->position().y();
77 p4lab = tmplorentz * p4;
79 vt->set_position(HepMC3::FourVector(p4lab(1, 0), p4lab(3, 0), p4lab(2, 0), p4lab(0, 0)));
83 }
else if (
type ==
"momentum") {
92 p4(0, 0) =
part->momentum().e();
93 p4(1, 0) =
part->momentum().x();
94 p4(2, 0) =
part->momentum().z();
95 p4(3, 0) =
part->momentum().y();
98 p4lab = tmplorentz * p4;
100 part->set_momentum(HepMC3::FourVector(p4lab(1, 0), p4lab(3, 0), p4lab(2, 0), p4lab(0, 0)));
105 edm::LogWarning(
"GeneratorProducts") <<
"no type found for boostToLab(std::string), options are vertex or momentum";
118 evt_ =
new HepMC3::GenEvent(*
other.evt_);
const HepMC3::GenEvent & getHepMCData() const
HepMC3Product & operator=(HepMC3Product const &other)
bool isPBoostApplied() const
void boostToLab(TMatrixD const *lorentz, std::string const &type)
void swap(Association< C > &lhs, Association< C > &rhs)
void swap(HepMC3Product &other)
bool isVtxGenApplied() const
bool isVtxBoostApplied() const
void applyVtxGen(HepMC3::FourVector const *vtxShift)
void addHepMCData(HepMC3::GenEvent *evt)
edm::Ptr< GenParticle > GenParticlePtr
persistent reference to a GenParticle
Log< level::Warning, false > LogWarning