CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 *vtxShift)
 
void boostToLab (TMatrixD *lorentz, std::string 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.

20  :
21  evt_(nullptr), isVtxGenApplied_(false),
22  isVtxBoostApplied_(false), isPBoostApplied_(false) {}
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
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:46
HepMCProduct::~HepMCProduct ( )
virtual

Definition at line 21 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

21  {
22 
23  delete evt_; evt_ = nullptr; isVtxGenApplied_ = false;
24  isVtxBoostApplied_ = false;
25  isPBoostApplied_ = false;
26 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
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:46

Member Function Documentation

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

Definition at line 29 of file HepMCProduct.cc.

References evt_.

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

Definition at line 39 of file HepMCProduct.cc.

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

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:46
return((rh^lh)&mask)
bool isVtxGenApplied() const
Definition: HepMCProduct.h:37
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 *  lorentz,
std::string  type 
)

Definition at line 64 of file HepMCProduct.cc.

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

64  {
65 
66  //std::cout << "from boostToLab:" << std::endl;
67 
68 
69 
70  if ( lorentz == 0 ) {
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:38
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
return((rh^lh)&mask)
double p4[4]
Definition: TauolaWrapper.h:92
bool isPBoostApplied() const
Definition: HepMCProduct.h:39
part
Definition: HCALResponse.h:20
tuple cout
Definition: gather_cfg.py:121
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 141 of file HepMCProduct.cc.

References evt_.

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

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

Definition at line 39 of file HepMCProduct.h.

References isPBoostApplied_.

Referenced by boostToLab().

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

Definition at line 38 of file HepMCProduct.h.

References isVtxBoostApplied_.

Referenced by boostToLab().

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

Definition at line 37 of file HepMCProduct.h.

References isVtxGenApplied_.

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

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

Definition at line 169 of file HepMCProduct.cc.

References swap(), and groupFilesInBlocks::temp.

169  {
170  HepMCProduct temp(other);
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 operator=().

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

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

bool edm::HepMCProduct::isVtxBoostApplied_
private

Definition at line 49 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxGenApplied_
private

Definition at line 48 of file HepMCProduct.h.

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