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::GenEvent * GetEvent () const
 
const HepMC::GenEvent & getHepMCData () const
 
 HepMCProduct ()
 
 HepMCProduct (HepMC::GenEvent *evt)
 
 HepMCProduct (HepMCProduct const &orig)
 
bool isPBoostApplied () const
 
bool isVtxBoostApplied () const
 
bool isVtxGenApplied () const
 
HepMCProductoperator= (HepMCProduct const &other)
 
void swap (HepMCProduct &other)
 
virtual ~HepMCProduct ()
 

Private Attributes

HepMC::GenEvent * evt_
 
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:49
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:49
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:49
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:49

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:49
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_, reco::return(), lumiQTWidget::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:49
bool isVtxGenApplied() const
Definition: HepMCProduct.h:40
return(e1-e2)*(e1-e2)+dp *dp
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, reco::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:49
double p4[4]
Definition: TauolaWrapper.h:92
bool isPBoostApplied() const
Definition: HepMCProduct.h:42
part
Definition: HCALResponse.h:20
return(e1-e2)*(e1-e2)+dp *dp
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(), RivetHarvesting::analyze(), RivetAnalyzer::analyze(), EgammaSuperClusters::analyze(), CaloTowersValidation::analyze(), WValidation::analyze(), ValidationMisalignedTracker::analyze(), ElectronSeedAnalyzer::analyze(), BasicHepMCHeavyIonValidation::analyze(), DrellYanValidation::analyze(), BasicGenParticleValidation::analyze(), BasicHepMCValidation::analyze(), MBUEandQCDValidation::analyze(), SimplePhotonAnalyzer::analyze(), HiggsValidation::analyze(), edm::TestMix::analyze(), DuplicationChecker::analyze(), HcalSimHitsValidation::analyze(), EcalPreshowerSimHitsValidation::analyze(), EnergyScaleAnalyzer::analyze(), EcalSimHitsValidation::analyze(), HGCalTimingAnalyzer::analyze(), HcalRecHitsValidation::analyze(), EcalRecHitsValidation::analyze(), MCVerticesAnalyzer::analyze(), TTbar_Kinematics::analyze(), MCvsRecoVerticesAnalyzer::analyze(), HGCalTBAnalyzer::analyze(), EcalDigisValidation::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(), GaussianZBeamSpotFilter::filter(), LHEFilter::filter(), ComphepSingletopFilterPy8::filter(), cms::BHFilter::filter(), PythiaFilterGammaGamma::filter(), PythiaFilterMultiMother::filter(), PythiaFilterEMJet::filter(), JetFlavourCutFilter::filter(), JetFlavourFilter::filter(), PythiaFilterZgamma::filter(), BdecayFilter::filter(), PythiaFilterGammaJet::filter(), PythiaFilterGammaJetIsoPi0::filter(), PythiaFilterGammaJetWithBg::filter(), PythiaFilterGammaJetWithOutBg::filter(), BsJpsiPhiFilter::filter(), PythiaFilterZJet::filter(), PythiaFilterZJetWithOutBg::filter(), GenLeadTrackFilter::filter(), PythiaFilterEMJetHeep::filter(), MCSingleParticleYPt::filter(), HighMultiplicityGenFilter::filter(), TwoVBGenFilter::filter(), MCSmartSingleParticleFilter::filter(), LQGenFilter::filter(), Zto2lFilter::filter(), MCLongLivedParticles::filter(), CosmicGenFilterHelix::filter(), MCMultiParticleFilter::filter(), MCZll::filter(), PythiaFilter::filter(), PythiaFilterHT::filter(), MCDecayingPionKaonFilter::filter(), MCDijetResonance::filter(), MCSingleParticleFilter::filter(), MCProcessRangeFilter::filter(), DJpsiFilter::filter(), FourLepFilter::filter(), HZZ4lFilter::filter(), PythiaHLTSoupFilter::filter(), MCParticlePairFilter::filter(), ZgMassFilter::filter(), ZgammaMassFilter::filter(), PythiaDauFilter::filter(), PythiaDauVFilter::filter(), MCProcessFilter::filter(), HGCalTBCheckGunPostion::filter(), PythiaMomDauFilter::filter(), HerwigMaxPtPartonFilter::filter(), ProtonTaggerFilter::filter(), PythiaFilterIsolatedTrack::filter(), MCVerticesWeight::filter(), PythiaDauVFilterMatchID::filter(), UEDMultiLeptonFilter::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(), HectorProducer::produce(), CTPPSHectorProducer::produce(), MixEvtVtxGenerator::produce(), HTXSRivetProducer::produce(), TauSpinnerCMS::produce(), GenHIEventProducer::produce(), MixBoostEvtVtxGenerator::produce(), BetaBoostEvtVtxGenerator::produce(), CTPPSSimHitProducer::produce(), EmbeddingVertexCorrector::produce(), FastSimProducer::produce(), GenParticleProducer::produce(), and WeightManager::weight().

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

Definition at line 141 of file HepMCProduct.cc.

References evt_.

Referenced by applyVtxGen(), and edm::refhelper::FindTrait< edm::HepMCProduct, HepMC::GenVertex >::Find::operator()().

141  {
142 
143  return * evt_;
144 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:49
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)
void HepMCProduct::swap ( HepMCProduct other)

Definition at line 159 of file HepMCProduct.cc.

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

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

159  {
160  std::swap(evt_, other.evt_);
164  //std::swap(fTimeOffset, other.fTimeOffset);
165 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:49
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 53 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxBoostApplied_
private

Definition at line 52 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxGenApplied_
private

Definition at line 51 of file HepMCProduct.h.

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