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 18 of file HepMCProduct.h.

Constructor & Destructor Documentation

edm::HepMCProduct::HepMCProduct ( )
inline

Definition at line 20 of file HepMCProduct.h.

References addHepMCData(), and ~HepMCProduct().

Referenced by isPBoostApplied().

20  :
21  evt_(nullptr), isVtxGenApplied_(false),
22  isVtxBoostApplied_(false), isPBoostApplied_(false) {}
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
HepMCProduct::HepMCProduct ( HepMC::GenEvent evt)
explicit

Definition at line 17 of file HepMCProduct.cc.

17  :
18  evt_(evt), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {
19 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
HepMCProduct::~HepMCProduct ( )
virtual

Definition at line 21 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

Referenced by HepMCProduct().

21  {
22 
23  delete evt_; evt_ = nullptr; isVtxGenApplied_ = false;
24  isVtxBoostApplied_ = false;
25  isPBoostApplied_ = false;
26 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
HepMCProduct::HepMCProduct ( HepMCProduct const &  orig)

Definition at line 147 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

147  :
148  evt_(nullptr) {
149 
150  if (other.evt_) evt_=new HepMC::GenEvent(*other.evt_);
151  isVtxGenApplied_ = other.isVtxGenApplied_ ;
152  isVtxBoostApplied_ = other.isVtxBoostApplied_;
153  isPBoostApplied_ = other.isPBoostApplied_;
154  //fTimeOffset = other.fTimeOffset;
155 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
HepMCProduct::HepMCProduct ( HepMCProduct &&  orig)

Definition at line 176 of file HepMCProduct.cc.

References trackingPlots::other, and swap().

176  :
177  evt_(nullptr) {
178  swap(other);
179 }
void swap(HepMCProduct &other)
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51

Member Function Documentation

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

Definition at line 29 of file HepMCProduct.cc.

References evt_.

Referenced by HepMCProduct().

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

Definition at line 29 of file HepMCProduct.h.

References boostToLab(), getHepMCData(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 39 of file HepMCProduct.cc.

References evt_, isVtxGenApplied(), isVtxGenApplied_, mathSSE::return(), protons_cff::t, and funct::true.

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

Definition at line 64 of file HepMCProduct.cc.

References gather_cfg::cout, evt_, isPBoostApplied(), isPBoostApplied_, isVtxBoostApplied(), isVtxBoostApplied_, p4, mathSSE::return(), and funct::true.

Referenced by applyVtxGen().

64  {
65 
66  //std::cout << "from boostToLab:" << std::endl;
67 
68 
69 
70  if ( lorentz == nullptr ) {
71 
72  //std::cout << " lorentz = 0 " << std::endl;
73  return;
74  }
75 
76  //lorentz->Print();
77 
78  TMatrixD tmplorentz(*lorentz);
79  //tmplorentz.Print();
80 
81  if ( type == "vertex") {
82 
83  if ( isVtxBoostApplied() ) {
84  //std::cout << " isVtxBoostApplied true " << std::endl;
85  return ;
86  }
87 
88  for ( HepMC::GenEvent::vertex_iterator vt=evt_->vertices_begin();
89  vt!=evt_->vertices_end(); ++vt ) {
90 
91  // change basis to lorentz boost definition: (t,x,z,y)
92  TMatrixD p4(4,1);
93  p4(0,0) = (*vt)->position().t();
94  p4(1,0) = (*vt)->position().x();
95  p4(2,0) = (*vt)->position().z();
96  p4(3,0) = (*vt)->position().y();
97 
98  TMatrixD p4lab(4,1);
99  p4lab = tmplorentz * p4;
100  //std::cout << " vertex lorentz: " << p4lab(1,0) << " " << p4lab(3,0) << " " << p4lab(2,0) << std::endl;
101  (*vt)->set_position( HepMC::FourVector(p4lab(1,0),p4lab(3,0),p4lab(2,0), p4lab(0,0) ) ) ;
102  }
103 
105  }
106  else if ( type == "momentum") {
107 
108  if ( isPBoostApplied() ) {
109  //std::cout << " isPBoostApplied true " << std::endl;
110  return ;
111  }
112 
113  for ( HepMC::GenEvent::particle_iterator part=evt_->particles_begin();
114  part!=evt_->particles_end(); ++part ) {
115 
116  // change basis to lorentz boost definition: (E,Px,Pz,Py)
117  TMatrixD p4(4,1);
118  p4(0,0) = (*part)->momentum().e();
119  p4(1,0) = (*part)->momentum().x();
120  p4(2,0) = (*part)->momentum().z();
121  p4(3,0) = (*part)->momentum().y();
122 
123  TMatrixD p4lab(4,1);
124  p4lab = tmplorentz * p4;
125  //std::cout << " momentum lorentz: " << p4lab(1,0) << " " << p4lab(3,0) << " " << p4lab(2,0) << std::endl;
126  (*part)->set_momentum( HepMC::FourVector(p4lab(1,0),p4lab(3,0),p4lab(2,0),p4lab(0,0) ) ) ;
127  }
128 
130  }
131  else {
132  std::cout << " no type found for boostToLab(std::string), options are vertex or momentum" << std::endl;
133  }
134 
135 
136  return ;
137 }
type
Definition: HCALResponse.h:21
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:41
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
return((rh^lh)&mask)
double p4[4]
Definition: TauolaWrapper.h:92
bool isPBoostApplied() const
Definition: HepMCProduct.h:42
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
const HepMC::GenEvent* edm::HepMCProduct::GetEvent ( ) const
inline

Definition at line 38 of file HepMCProduct.h.

References evt_.

Referenced by cms::PileupVertexAccumulator::accumulate(), ZMCHistogrammer::analyze(), JetAnaPythia< Jet >::analyze(), HiBasicGenTest::analyze(), HepMCEventWriter::analyze(), CTPPSBeamSmearingValidator::analyze(), RivetAnalyzer::analyze(), EgammaSuperClusters::analyze(), CTPPSHepMCDistributionPlotter::analyze(), CTPPSAcceptancePlotter::analyze(), CaloTowersValidation::analyze(), WValidation::analyze(), BasicHepMCHeavyIonValidation::analyze(), ElectronSeedAnalyzer::analyze(), ValidationMisalignedTracker::analyze(), DrellYanValidation::analyze(), CTPPSProtonReconstructionSimulationValidator::analyze(), BasicGenParticleValidation::analyze(), BasicHepMCValidation::analyze(), SimAnalyzerMinbias::analyze(), MBUEandQCDValidation::analyze(), HiggsValidation::analyze(), SimplePhotonAnalyzer::analyze(), CTPPSProtonReconstructionEfficiencyEstimatorMC::analyze(), edm::TestMix::analyze(), EcalPreshowerSimHitsValidation::analyze(), DuplicationChecker::analyze(), HcalSimHitsValidation::analyze(), EnergyScaleAnalyzer::analyze(), EcalSimHitsValidation::analyze(), EcalRecHitsValidation::analyze(), HcalRecHitsValidation::analyze(), HGCalTimingAnalyzer::analyze(), TTbar_Kinematics::analyze(), MCVerticesAnalyzer::analyze(), MCvsRecoVerticesAnalyzer::analyze(), EcalDigisValidation::analyze(), HGCalTBAnalyzer::analyze(), PhotonValidator::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(), STFilter::filter(), CosmicGenFilterLowE::filter(), ComphepSingletopFilter::filter(), MCParticleModuloFilter::filter(), GaussianZBeamSpotFilter::filter(), ComphepSingletopFilterPy8::filter(), LHEFilter::filter(), cms::BHFilter::filter(), PythiaFilterGammaGamma::filter(), PythiaFilterMultiMother::filter(), PythiaFilterMultiAncestor::filter(), PythiaFilterEMJet::filter(), JetFlavourCutFilter::filter(), JetFlavourFilter::filter(), PythiaFilterZgamma::filter(), PythiaFilterGammaJet::filter(), BdecayFilter::filter(), PythiaFilterGammaJetIsoPi0::filter(), PythiaFilterGammaJetWithBg::filter(), PythiaFilterGammaJetWithOutBg::filter(), PythiaFilterZJet::filter(), PythiaFilterZJetWithOutBg::filter(), BsJpsiPhiFilter::filter(), GenLeadTrackFilter::filter(), PythiaFilterEMJetHeep::filter(), MCSingleParticleYPt::filter(), TwoVBGenFilter::filter(), HighMultiplicityGenFilter::filter(), MCDisplacementFilter::filter(), Zto2lFilter::filter(), MCSmartSingleParticleFilter::filter(), LQGenFilter::filter(), CosmicGenFilterHelix::filter(), MCLongLivedParticles::filter(), MCMultiParticleFilter::filter(), MCZll::filter(), PythiaFilter::filter(), PythiaFilterHT::filter(), PythiaFilterMotherSister::filter(), MCDecayingPionKaonFilter::filter(), MCDijetResonance::filter(), ZgMassFilter::filter(), MCSingleParticleFilter::filter(), DJpsiFilter::filter(), MCProcessRangeFilter::filter(), FourLepFilter::filter(), HZZ4lFilter::filter(), MCParticlePairFilter::filter(), PythiaHLTSoupFilter::filter(), ZgammaMassFilter::filter(), PythiaDauFilter::filter(), PythiaDauVFilter::filter(), PythiaProbeFilter::filter(), MCProcessFilter::filter(), PythiaMomDauFilter::filter(), HGCalTBCheckGunPostion::filter(), ProtonTaggerFilter::filter(), HerwigMaxPtPartonFilter::filter(), PythiaFilterIsolatedTrack::filter(), MCVerticesWeight::filter(), UEDMultiLeptonFilter::filter(), PythiaDauVFilterMatchID::filter(), HiCentralityBiasFilter::filter(), PythiaFilterTTBar::filter(), MuScleFitUtils::findGenMuFromRes(), MuScleFitMuonSelector::findGenMuFromRes(), MuScleFitUtils::findSimMuFromRes(), MuScleFitMuonSelector::findSimMuFromRes(), RunManagerMTWorker::generateEvent(), RunManager::generateEvent(), gen::PyquenHadronizer::generatePartonsAndHadronize(), gen::HydjetHadronizer::generatePartonsAndHadronize(), gen::Hydjet2Hadronizer::generatePartonsAndHadronize(), VertexClassifier::genPrimaryVertices(), TrackClassifier::genPrimaryVertices(), MixEvtVtxGenerator::getVertex(), HSCPValidator::makeGenPlots(), HSCPValidator::makeRecoPlots(), MCPdgIndexFilter::pass(), PFTauElecRejectionBenchmark::process(), FamosProducer::produce(), BaseEvtVtxGenerator::produce(), EcalTBMCInfoProducer::produce(), PassThroughEvtVtxGenerator::produce(), HectorProducer::produce(), BeamDivergenceVtxGenerator::produce(), MixEvtVtxGenerator::produce(), HTXSRivetProducer::produce(), PPSSimTrackProducer::produce(), TauSpinnerCMS::produce(), GenHIEventProducer::produce(), MixBoostEvtVtxGenerator::produce(), CTPPSDirectProtonSimulation::produce(), BetaBoostEvtVtxGenerator::produce(), CTPPSSimHitProducer::produce(), EmbeddingVertexCorrector::produce(), FastSimProducer::produce(), GenParticleProducer::produce(), and WeightManager::weight().

38 { return evt_; }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
const HepMC::GenEvent & HepMCProduct::getHepMCData ( ) const

Definition at line 141 of file HepMCProduct.cc.

References evt_.

Referenced by applyVtxGen().

141  {
142 
143  return * evt_;
144 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
bool edm::HepMCProduct::isPBoostApplied ( ) const
inline

Definition at line 42 of file HepMCProduct.h.

References HepMCProduct(), isPBoostApplied_, operator=(), trackingPlots::other, and swap().

Referenced by boostToLab().

42 { return isPBoostApplied_; }
bool edm::HepMCProduct::isVtxBoostApplied ( ) const
inline

Definition at line 41 of file HepMCProduct.h.

References isVtxBoostApplied_.

Referenced by boostToLab().

41 { return isVtxBoostApplied_; }
bool edm::HepMCProduct::isVtxGenApplied ( ) const
inline

Definition at line 40 of file HepMCProduct.h.

References isVtxGenApplied_.

Referenced by applyVtxGen(), MixEvtVtxGenerator::getVertex(), and MixEvtVtxGenerator::produce().

40 { return isVtxGenApplied_; }
HepMCProduct & HepMCProduct::operator= ( HepMCProduct const &  other)

Definition at line 169 of file HepMCProduct.cc.

References swap(), and groupFilesInBlocks::temp.

Referenced by isPBoostApplied().

169  {
171  swap(temp);
172  return *this;
173 }
void swap(HepMCProduct &other)
HepMCProduct & HepMCProduct::operator= ( HepMCProduct &&  other)

Definition at line 180 of file HepMCProduct.cc.

References trackingPlots::other, and swap().

180  {
181  swap(other);
182  return *this;
183 }
void swap(HepMCProduct &other)
void HepMCProduct::swap ( HepMCProduct other)

Definition at line 159 of file HepMCProduct.cc.

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

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

159  {
160  std::swap(evt_, other.evt_);
164  //std::swap(fTimeOffset, other.fTimeOffset);
165 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:51
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

Member Data Documentation

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

Definition at line 55 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxBoostApplied_
private

Definition at line 54 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxGenApplied_
private

Definition at line 53 of file HepMCProduct.h.

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