CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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::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 ( )
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::HepMCProduct ( HepMCProduct const &  orig)

Definition at line 123 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

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::HepMCProduct ( HepMCProduct &&  orig)

Definition at line 149 of file HepMCProduct.cc.

References swap().

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

Member Function Documentation

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
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
void HepMCProduct::applyVtxGen ( HepMC::FourVector const &  vtxShift)

Definition at line 37 of file HepMCProduct.cc.

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

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 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
float float float z
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
bool isVtxGenApplied() const
Definition: HepMCProduct.h:39
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 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 }
bool isVtxBoostApplied() const
Definition: HepMCProduct.h:40
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:50
bool isPBoostApplied() const
Definition: HepMCProduct.h:41
part
Definition: HCALResponse.h:20
tuple cout
Definition: gather_cfg.py:144
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
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
bool edm::HepMCProduct::isPBoostApplied ( ) const
inline

Definition at line 41 of file HepMCProduct.h.

References isPBoostApplied_.

Referenced by boostToLab().

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

Definition at line 40 of file HepMCProduct.h.

References isVtxBoostApplied_.

Referenced by boostToLab().

40 { return isVtxBoostApplied_; }
bool edm::HepMCProduct::isVtxGenApplied ( ) const
inline
HepMCProduct & HepMCProduct::operator= ( HepMCProduct const &  other)

Definition at line 142 of file HepMCProduct.cc.

References swap(), and groupFilesInBlocks::temp.

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

Definition at line 150 of file HepMCProduct.cc.

References swap().

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

Definition at line 133 of file HepMCProduct.cc.

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

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

133  {
134  std::swap(evt_, other.evt_);
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

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

Definition at line 54 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxBoostApplied_
private

Definition at line 53 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxGenApplied_
private

Definition at line 52 of file HepMCProduct.h.

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