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 &&orig)
 
 HepMCProduct (HepMCProduct const &orig)
 
bool isPBoostApplied () const
 
bool isVtxBoostApplied () const
 
bool isVtxGenApplied () const
 
HepMCProductoperator= (HepMCProduct &&other)
 
HepMCProductoperator= (HepMCProduct const &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) {}

◆ HepMCProduct() [2/4]

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

Definition at line 16 of file HepMCProduct.cc.

18  : evt_(evt), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {}

◆ ~HepMCProduct()

HepMCProduct::~HepMCProduct ( )
virtual

Definition at line 19 of file HepMCProduct.cc.

20  {
21  delete evt_;
22  evt_ = nullptr;
23  isVtxGenApplied_ = false;
24  isVtxBoostApplied_ = false;
25  isPBoostApplied_ = false;

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

◆ HepMCProduct() [3/4]

HepMCProduct::HepMCProduct ( HepMCProduct const &  orig)

Definition at line 122 of file HepMCProduct.cc.

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;

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

◆ HepMCProduct() [4/4]

HepMCProduct::HepMCProduct ( HepMCProduct &&  orig)

Definition at line 148 of file HepMCProduct.cc.

Member Function Documentation

◆ addHepMCData()

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

Definition at line 27 of file HepMCProduct.cc.

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...

References evt_.

◆ applyVtxGen() [1/2]

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

Definition at line 36 of file HepMCProduct.cc.

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;

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

◆ applyVtxGen() [2/2]

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

Definition at line 30 of file HepMCProduct.h.

30 { applyVtxGen(*vtxShift); }

References applyVtxGen().

Referenced by applyVtxGen().

◆ boostToLab()

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

Definition at line 57 of file HepMCProduct.cc.

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;

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

◆ GetEvent()

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

Definition at line 37 of file HepMCProduct.h.

37 { return evt_; }

References evt_.

Referenced by cms::PileupVertexAccumulator::accumulate(), JetAnaPythia< Jet >::analyze(), HepMCEventWriter::analyze(), CTPPSBeamSmearingValidator::analyze(), EgammaSuperClusters::analyze(), CTPPSHepMCDistributionPlotter::analyze(), CaloTowersValidation::analyze(), CTPPSAcceptancePlotter::analyze(), RivetAnalyzer::analyze(), WValidation::analyze(), BasicHepMCHeavyIonValidation::analyze(), DrellYanValidation::analyze(), BasicHepMCValidation::analyze(), BasicGenParticleValidation::analyze(), ValidationMisalignedTracker::analyze(), MBUEandQCDValidation::analyze(), CTPPSProtonReconstructionSimulationValidator::analyze(), HiggsValidation::analyze(), HFPMTHitAnalyzer::analyze(), SimAnalyzerMinbias::analyze(), CaloSimHitStudy::analyze(), CTPPSProtonReconstructionEfficiencyEstimatorMC::analyze(), EcalPreshowerSimHitsValidation::analyze(), DuplicationChecker::analyze(), edm::TestMix::analyze(), SimplePhotonAnalyzer::analyze(), EcalSimHitsValidation::analyze(), HcalSimHitsValidation::analyze(), HOSimHitStudy::analyze(), EcalSimHitStudy::analyze(), ElectronSeedAnalyzer::analyze(), HGCalTimingAnalyzer::analyze(), EcalRecHitsValidation::analyze(), TTbar_Kinematics::analyze(), MCVerticesAnalyzer::analyze(), EcalDigisValidation::analyze(), HcalRecHitsValidation::analyze(), MCvsRecoVerticesAnalyzer::analyze(), StudyCaloGen::analyze(), HGCalTBAnalyzer::analyze(), HGCalSimHitValidation::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(), GaussianZBeamSpotFilter::filter(), LHEFilter::filter(), PythiaFilterGammaGamma::filter(), PythiaFilterZJetWithOutBg::filter(), PythiaFilterZJet::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(), PythiaFilterTTBar::filter(), ComphepSingletopFilterPy8::filter(), HighMultiplicityGenFilter::filter(), MCParticlePairFilter::filter(), MCSingleParticleFilter::filter(), PythiaFilter::filter(), PythiaMomDauFilter::filter(), PythiaFilterMotherSister::filter(), PythiaProbeFilter::filter(), PythiaDauFilter::filter(), PythiaDauVFilter::filter(), FourLepFilter::filter(), CosmicGenFilterHelix::filter(), ProtonTaggerFilter::filter(), PythiaAllDauVFilter::filter(), HGCalTBCheckGunPostion::filter(), PythiaFilterIsolatedTrack::filter(), PythiaDauVFilterMatchID::filter(), MCVerticesWeight::filter(), PythiaFilterMultiAncestor::filter(), HerwigMaxPtPartonFilter::filter(), MuScleFitUtils::findGenMuFromRes(), MuScleFitMuonSelector::findGenMuFromRes(), MuScleFitUtils::findSimMuFromRes(), MuScleFitMuonSelector::findSimMuFromRes(), RunManagerMTWorker::generateEvent(), gen::PyquenHadronizer::generatePartonsAndHadronize(), gen::HydjetHadronizer::generatePartonsAndHadronize(), VertexClassifier::genPrimaryVertices(), TrackClassifier::genPrimaryVertices(), MixEvtVtxGenerator::getVertex(), MCPdgIndexFilter::pass(), PFTauElecRejectionBenchmark::process(), FamosProducer::produce(), BaseEvtVtxGenerator::produce(), PassThroughEvtVtxGenerator::produce(), EcalTBMCInfoProducer::produce(), HectorProducer::produce(), BeamDivergenceVtxGenerator::produce(), MixEvtVtxGenerator::produce(), HTXSRivetProducer::produce(), TauSpinnerCMS::produce(), GenHIEventProducer::produce(), MixBoostEvtVtxGenerator::produce(), PPSSimTrackProducer::produce(), L1TkFastVertexProducer::produce(), BetaBoostEvtVtxGenerator::produce(), CTPPSSimHitProducer::produce(), EmbeddingVertexCorrector::produce(), CTPPSDirectProtonSimulation::produce(), GenParticleProducer::produce(), and WeightManager::weight().

◆ getHepMCData()

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

Definition at line 119 of file HepMCProduct.cc.

References evt_.

◆ isPBoostApplied()

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

Definition at line 41 of file HepMCProduct.h.

41 { return isPBoostApplied_; }

References isPBoostApplied_.

Referenced by boostToLab().

◆ isVtxBoostApplied()

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

Definition at line 40 of file HepMCProduct.h.

40 { return isVtxBoostApplied_; }

References isVtxBoostApplied_.

Referenced by boostToLab().

◆ isVtxGenApplied()

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

◆ operator=() [1/2]

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

Definition at line 149 of file HepMCProduct.cc.

149  : evt_(nullptr) { swap(other); }
151  swap(other);
152  return *this;

References trackingPlots::other, and swap().

◆ operator=() [2/2]

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

Definition at line 141 of file HepMCProduct.cc.

142  {
144  swap(temp);
145  return *this;

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

◆ swap()

void HepMCProduct::swap ( HepMCProduct other)

Definition at line 132 of file HepMCProduct.cc.

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);

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

Referenced by operator=().

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().

edm::HepMCProduct::swap
void swap(HepMCProduct &other)
Definition: HepMCProduct.cc:132
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
gather_cfg.cout
cout
Definition: gather_cfg.py:144
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::HepMCProduct::isVtxGenApplied_
bool isVtxGenApplied_
Definition: HepMCProduct.h:52
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
edm::HepMCProduct::operator=
HepMCProduct & operator=(HepMCProduct const &other)
Definition: HepMCProduct.cc:141
part
part
Definition: HCALResponse.h:20
edm::HepMCProduct::applyVtxGen
void applyVtxGen(HepMC::FourVector const *vtxShift)
Definition: HepMCProduct.h:30
edm::HepMCProduct::isPBoostApplied_
bool isPBoostApplied_
Definition: HepMCProduct.h:54
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
edm::HepMCProduct::isVtxBoostApplied_
bool isVtxBoostApplied_
Definition: HepMCProduct.h:53
trackingPlots.other
other
Definition: trackingPlots.py:1460
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
edm::HepMCProduct::isVtxBoostApplied
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:40
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::HepMCProduct::isVtxGenApplied
bool isVtxGenApplied() const
Definition: HepMCProduct.h:39
edm::HepMCProduct::evt_
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
genVertex_cff.x
x
Definition: genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
edm::HepMCProduct::isPBoostApplied
bool isPBoostApplied() const
Definition: HepMCProduct.h:41
edm::HepMCProduct
Definition: HepMCProduct.h:21
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
reco::vertex_iterator
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection
Definition: VertexFwd.h:19