CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::HepMCProduct Class Reference

#include <HepMCProduct.h>

Public Member Functions

void addHepMCData (HepMC::GenEvent *evt)
 
void applyVtxGen (HepMC::FourVector const *vtxShift)
 
void applyVtxGen (HepMC::FourVector const &vtxShift)
 
void boostToLab (TMatrixD const *lorentz, std::string const &type)
 
const HepMC::GenEventGetEvent () const
 
const HepMC::GenEventgetHepMCData () const
 
 HepMCProduct ()
 
 HepMCProduct (HepMC::GenEvent *evt)
 
 HepMCProduct (HepMCProduct const &orig)
 
 HepMCProduct (HepMCProduct &&orig)
 
bool isPBoostApplied () const
 
bool isVtxBoostApplied () const
 
bool isVtxGenApplied () const
 
HepMCProductoperator= (HepMCProduct const &other)
 
HepMCProductoperator= (HepMCProduct &&other)
 
void swap (HepMCProduct &other)
 
virtual ~HepMCProduct ()
 

Private Attributes

HepMC::GenEventevt_
 
bool isPBoostApplied_
 
bool isVtxBoostApplied_
 
bool isVtxGenApplied_
 

Detailed Description

Definition at line 21 of file HepMCProduct.h.

Constructor & Destructor Documentation

◆ HepMCProduct() [1/4]

edm::HepMCProduct::HepMCProduct ( )
inline

Definition at line 23 of file HepMCProduct.h.

23 : evt_(nullptr), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {}
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ HepMCProduct() [2/4]

HepMCProduct::HepMCProduct ( HepMC::GenEvent evt)
explicit

Definition at line 17 of file HepMCProduct.cc.

18  : evt_(evt), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {}
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ ~HepMCProduct()

HepMCProduct::~HepMCProduct ( )
virtual

Definition at line 20 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

20  {
21  delete evt_;
22  evt_ = nullptr;
23  isVtxGenApplied_ = false;
24  isVtxBoostApplied_ = false;
25  isPBoostApplied_ = false;
26 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ HepMCProduct() [3/4]

HepMCProduct::HepMCProduct ( HepMCProduct const &  orig)

Definition at line 123 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, isVtxGenApplied_, and trackingPlots::other.

123  : evt_(nullptr) {
124  if (other.evt_)
125  evt_ = new HepMC::GenEvent(*other.evt_);
126  isVtxGenApplied_ = other.isVtxGenApplied_;
127  isVtxBoostApplied_ = other.isVtxBoostApplied_;
128  isPBoostApplied_ = other.isPBoostApplied_;
129  //fTimeOffset = other.fTimeOffset;
130 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ HepMCProduct() [4/4]

HepMCProduct::HepMCProduct ( HepMCProduct &&  orig)

Definition at line 149 of file HepMCProduct.cc.

References trackingPlots::other, and swap().

149 : evt_(nullptr) { swap(other); }
void swap(HepMCProduct &other)
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

Member Function Documentation

◆ addHepMCData()

void HepMCProduct::addHepMCData ( HepMC::GenEvent evt)

Definition at line 28 of file HepMCProduct.cc.

References evt_.

28  {
29  // evt->print();
30  // cout <<sizeof (evt) <<" " << sizeof ( HepMC::GenEvent) << endl;
31  evt_ = evt;
32 
33  // same story about vertex smearing - GenEvent won't know it...
34  // in fact, would be better to implement CmsGenEvent...
35 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ applyVtxGen() [1/2]

void edm::HepMCProduct::applyVtxGen ( HepMC::FourVector const *  vtxShift)
inline

Definition at line 30 of file HepMCProduct.h.

References applyVtxGen().

Referenced by applyVtxGen().

30 { applyVtxGen(*vtxShift); }
void applyVtxGen(HepMC::FourVector const *vtxShift)
Definition: HepMCProduct.h:30

◆ applyVtxGen() [2/2]

void HepMCProduct::applyVtxGen ( HepMC::FourVector const &  vtxShift)

Definition at line 37 of file HepMCProduct.cc.

References evt_, isVtxGenApplied(), isVtxGenApplied_, submitPVValidationJobs::t, and x.

37  {
38  //std::cout<< " applyVtxGen called " << isVtxGenApplied_ << endl;
39  //fTimeOffset = 0;
40 
41  if (isVtxGenApplied())
42  return;
43 
44  for (HepMC::GenEvent::vertex_iterator vt = evt_->vertices_begin(); vt != evt_->vertices_end(); ++vt) {
45  double x = (*vt)->position().x() + vtxShift.x();
46  double y = (*vt)->position().y() + vtxShift.y();
47  double z = (*vt)->position().z() + vtxShift.z();
48  double t = (*vt)->position().t() + vtxShift.t();
49  //std::cout << " vertex (x,y,z)= " << x <<" " << y << " " << z << std::endl;
50  (*vt)->set_position(HepMC::FourVector(x, y, z, t));
51  }
52 
53  isVtxGenApplied_ = true;
54 
55  return;
56 }
bool isVtxGenApplied() const
Definition: HepMCProduct.h:39
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
float float float z
float x
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection
Definition: VertexFwd.h:19

◆ boostToLab()

void HepMCProduct::boostToLab ( TMatrixD const *  lorentz,
std::string const &  type 
)

Definition at line 58 of file HepMCProduct.cc.

References gather_cfg::cout, evt_, isPBoostApplied(), isPBoostApplied_, isVtxBoostApplied(), and isVtxBoostApplied_.

58  {
59  //std::cout << "from boostToLab:" << std::endl;
60 
61  if (lorentz == nullptr) {
62  //std::cout << " lorentz = 0 " << std::endl;
63  return;
64  }
65 
66  //lorentz->Print();
67 
68  TMatrixD tmplorentz(*lorentz);
69  //tmplorentz.Print();
70 
71  if (type == "vertex") {
72  if (isVtxBoostApplied()) {
73  //std::cout << " isVtxBoostApplied true " << std::endl;
74  return;
75  }
76 
77  for (HepMC::GenEvent::vertex_iterator vt = evt_->vertices_begin(); vt != evt_->vertices_end(); ++vt) {
78  // change basis to lorentz boost definition: (t,x,z,y)
79  TMatrixD p4(4, 1);
80  p4(0, 0) = (*vt)->position().t();
81  p4(1, 0) = (*vt)->position().x();
82  p4(2, 0) = (*vt)->position().z();
83  p4(3, 0) = (*vt)->position().y();
84 
85  TMatrixD p4lab(4, 1);
86  p4lab = tmplorentz * p4;
87  //std::cout << " vertex lorentz: " << p4lab(1,0) << " " << p4lab(3,0) << " " << p4lab(2,0) << std::endl;
88  (*vt)->set_position(HepMC::FourVector(p4lab(1, 0), p4lab(3, 0), p4lab(2, 0), p4lab(0, 0)));
89  }
90 
91  isVtxBoostApplied_ = true;
92  } else if (type == "momentum") {
93  if (isPBoostApplied()) {
94  //std::cout << " isPBoostApplied true " << std::endl;
95  return;
96  }
97 
98  for (HepMC::GenEvent::particle_iterator part = evt_->particles_begin(); part != evt_->particles_end(); ++part) {
99  // change basis to lorentz boost definition: (E,Px,Pz,Py)
100  TMatrixD p4(4, 1);
101  p4(0, 0) = (*part)->momentum().e();
102  p4(1, 0) = (*part)->momentum().x();
103  p4(2, 0) = (*part)->momentum().z();
104  p4(3, 0) = (*part)->momentum().y();
105 
106  TMatrixD p4lab(4, 1);
107  p4lab = tmplorentz * p4;
108  //std::cout << " momentum lorentz: " << p4lab(1,0) << " " << p4lab(3,0) << " " << p4lab(2,0) << std::endl;
109  (*part)->set_momentum(HepMC::FourVector(p4lab(1, 0), p4lab(3, 0), p4lab(2, 0), p4lab(0, 0)));
110  }
111 
112  isPBoostApplied_ = true;
113  } else {
114  std::cout << " no type found for boostToLab(std::string), options are vertex or momentum" << std::endl;
115  }
116 
117  return;
118 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
bool isPBoostApplied() const
Definition: HepMCProduct.h:41
part
Definition: HCALResponse.h:20
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection
Definition: VertexFwd.h:19
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:40

◆ GetEvent()

const HepMC::GenEvent* edm::HepMCProduct::GetEvent ( ) const
inline

Definition at line 37 of file HepMCProduct.h.

References evt_.

Referenced by cms::PileupVertexAccumulator::accumulate(), JetAnaPythia< Jet >::analyze(), CTPPSBeamSmearingValidator::analyze(), EgammaSuperClusters::analyze(), CTPPSHepMCDistributionPlotter::analyze(), CaloTowersValidation::analyze(), CTPPSAcceptancePlotter::analyze(), RivetAnalyzer::analyze(), WValidation::analyze(), BasicHepMCHeavyIonValidation::analyze(), DrellYanValidation::analyze(), BasicGenParticleValidation::analyze(), BasicHepMCValidation::analyze(), CTPPSProtonReconstructionSimulationValidator::analyze(), MBUEandQCDValidation::analyze(), HFPMTHitAnalyzer::analyze(), SimAnalyzerMinbias::analyze(), HiggsValidation::analyze(), CTPPSProtonReconstructionEfficiencyEstimatorMC::analyze(), EcalPreshowerSimHitsValidation::analyze(), DuplicationChecker::analyze(), EcalSimHitsValidation::analyze(), edm::TestMix::analyze(), ValidationMisalignedTracker::analyze(), HcalSimHitsValidation::analyze(), HOSimHitStudy::analyze(), EcalSimHitStudy::analyze(), HGCalTimingAnalyzer::analyze(), CaloSimHitStudy::analyze(), TTbar_Kinematics::analyze(), MCVerticesAnalyzer::analyze(), EcalDigisValidation::analyze(), EcalRecHitsValidation::analyze(), HcalRecHitsValidation::analyze(), StudyCaloGen::analyze(), HGCalSimHitValidation::analyze(), MCvsRecoVerticesAnalyzer::analyze(), HGCalTBAnalyzer::analyze(), EcalMixingModuleValidation::analyze(), IsolatedGenParticles::analyze(), EgammaObjects::analyzeElectrons(), EgammaObjects::analyzePhotons(), ZeeCalibration::duringLoop(), DigiVtxPosCorrHistogramMaker::fill(), TrackerHitProducer::fillG4MC(), GlobalHitsAnalyzer::fillG4MC(), GlobalHitsProdHist::fillG4MC(), GlobalHitsProducer::fillG4MC(), MuScleFitPlotter::fillGen(), cms::CosmicTIFTrigFilter::filter(), BsJpsiPhiFilter::filter(), PythiaFilterMultiMother::filter(), MCParticleModuloFilter::filter(), LHEFilter::filter(), GaussianZBeamSpotFilter::filter(), PythiaFilterGammaGamma::filter(), PythiaFilterZJet::filter(), PythiaFilterZJetWithOutBg::filter(), PythiaFilterEMJetHeep::filter(), PythiaFilterGammaJet::filter(), PythiaFilterGammaJetWithBg::filter(), PythiaFilterGammaJetWithOutBg::filter(), MCProcessRangeFilter::filter(), PythiaFilterHT::filter(), MCProcessFilter::filter(), PythiaHLTSoupFilter::filter(), MCSmartSingleParticleFilter::filter(), ZgMassFilter::filter(), MCSingleParticleYPt::filter(), ZgammaMassFilter::filter(), MCZll::filter(), DJpsiFilter::filter(), MCMultiParticleFilter::filter(), ComphepSingletopFilterPy8::filter(), PythiaFilterTTBar::filter(), HighMultiplicityGenFilter::filter(), MCDisplacementFilter::filter(), MCParticlePairFilter::filter(), MCSingleParticleFilter::filter(), PythiaFilter::filter(), PythiaMomDauFilter::filter(), PythiaFilterMotherSister::filter(), FourLepFilter::filter(), PythiaDauVFilter::filter(), PythiaDauFilter::filter(), PythiaProbeFilter::filter(), CosmicGenFilterHelix::filter(), ProtonTaggerFilter::filter(), PythiaAllDauVFilter::filter(), HGCalTBCheckGunPostion::filter(), PythiaDauVFilterMatchID::filter(), MCVerticesWeight::filter(), PythiaFilterIsolatedTrack::filter(), PythiaFilterMultiAncestor::filter(), HerwigMaxPtPartonFilter::filter(), MuScleFitUtils::findGenMuFromRes(), MuScleFitMuonSelector::findGenMuFromRes(), MuScleFitUtils::findSimMuFromRes(), MuScleFitMuonSelector::findSimMuFromRes(), RunManagerMTWorker::generateEvent(), gen::PyquenHadronizer::generatePartonsAndHadronize(), gen::HydjetHadronizer::generatePartonsAndHadronize(), gen::Hydjet2Hadronizer::generatePartonsAndHadronize(), VertexClassifier::genPrimaryVertices(), TrackClassifier::genPrimaryVertices(), MixEvtVtxGenerator::getVertex(), MCPdgIndexFilter::pass(), PFTauElecRejectionBenchmark::process(), BaseEvtVtxGenerator::produce(), PassThroughEvtVtxGenerator::produce(), HectorProducer::produce(), BeamDivergenceVtxGenerator::produce(), MixEvtVtxGenerator::produce(), EcalTBMCInfoProducer::produce(), HTXSRivetProducer::produce(), TauSpinnerCMS::produce(), PPSSimTrackProducer::produce(), MixBoostEvtVtxGenerator::produce(), CTPPSSimHitProducer::produce(), EmbeddingVertexCorrector::produce(), PPSDirectProtonSimulation::produce(), GenParticleProducer::produce(), and WeightManager::weight().

37 { return evt_; }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ getHepMCData()

const HepMC::GenEvent & HepMCProduct::getHepMCData ( ) const

Definition at line 120 of file HepMCProduct.cc.

References evt_.

120 { return *evt_; }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50

◆ isPBoostApplied()

bool edm::HepMCProduct::isPBoostApplied ( ) const
inline

Definition at line 41 of file HepMCProduct.h.

References isPBoostApplied_.

Referenced by boostToLab().

41 { return isPBoostApplied_; }

◆ isVtxBoostApplied()

bool edm::HepMCProduct::isVtxBoostApplied ( ) const
inline

Definition at line 40 of file HepMCProduct.h.

References isVtxBoostApplied_.

Referenced by boostToLab().

40 { return isVtxBoostApplied_; }

◆ isVtxGenApplied()

bool edm::HepMCProduct::isVtxGenApplied ( ) const
inline

◆ operator=() [1/2]

HepMCProduct & HepMCProduct::operator= ( HepMCProduct const &  other)

Definition at line 142 of file HepMCProduct.cc.

References trackingPlots::other, swap(), and groupFilesInBlocks::temp.

142  {
144  swap(temp);
145  return *this;
146 }
void swap(HepMCProduct &other)

◆ operator=() [2/2]

HepMCProduct & HepMCProduct::operator= ( HepMCProduct &&  other)

Definition at line 150 of file HepMCProduct.cc.

References trackingPlots::other, and swap().

150  {
151  swap(other);
152  return *this;
153 }
void swap(HepMCProduct &other)

◆ swap()

void HepMCProduct::swap ( HepMCProduct other)

Definition at line 133 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, isVtxGenApplied_, trackingPlots::other, and std::swap().

Referenced by HepMCProduct(), and operator=().

133  {
134  std::swap(evt_, other.evt_);
135  std::swap(isVtxGenApplied_, other.isVtxGenApplied_);
136  std::swap(isVtxBoostApplied_, other.isVtxBoostApplied_);
137  std::swap(isPBoostApplied_, other.isPBoostApplied_);
138  //std::swap(fTimeOffset, other.fTimeOffset);
139 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

Member Data Documentation

◆ evt_

HepMC::GenEvent* edm::HepMCProduct::evt_
private

◆ isPBoostApplied_

bool edm::HepMCProduct::isPBoostApplied_
private

Definition at line 54 of file HepMCProduct.h.

Referenced by boostToLab(), HepMCProduct(), isPBoostApplied(), swap(), and ~HepMCProduct().

◆ isVtxBoostApplied_

bool edm::HepMCProduct::isVtxBoostApplied_
private

Definition at line 53 of file HepMCProduct.h.

Referenced by boostToLab(), HepMCProduct(), isVtxBoostApplied(), swap(), and ~HepMCProduct().

◆ isVtxGenApplied_

bool edm::HepMCProduct::isVtxGenApplied_
private

Definition at line 52 of file HepMCProduct.h.

Referenced by applyVtxGen(), HepMCProduct(), isVtxGenApplied(), swap(), and ~HepMCProduct().