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) const
 
void boostToLab (TMatrixD *lorentz, std::string type) const
 
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_(0), 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.

References gather_cfg::cout.

17  {
18  evt_ = evt;
19  cout << "Contructing HepMCProduct" << endl;
20 
21  //note: this is not quite safe, because GenEvent does NOT
22  // know if vertex smearing applied or nor - only the
23  // HepMCProduct itself knows !
24  // isVtxGenApplied_ = 0 ; // ???
25 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
tuple cout
Definition: gather_cfg.py:121
HepMCProduct::~HepMCProduct ( )
virtual

Definition at line 27 of file HepMCProduct.cc.

27  {
28 
29  delete evt_; evt_ = 0; isVtxGenApplied_ = false;
30  isVtxBoostApplied_ = false;
31  isPBoostApplied_ = false;
32 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
HepMCProduct::HepMCProduct ( HepMCProduct const &  orig)

Definition at line 153 of file HepMCProduct.cc.

References evt_, isPBoostApplied_, isVtxBoostApplied_, and isVtxGenApplied_.

153  :
154  evt_(0) {
155 
156  if (other.evt_) evt_=new HepMC::GenEvent(*other.evt_);
157  isVtxGenApplied_ = other.isVtxGenApplied_ ;
158  isVtxBoostApplied_ = other.isVtxBoostApplied_;
159  isPBoostApplied_ = other.isPBoostApplied_;
160  //fTimeOffset = other.fTimeOffset;
161 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46

Member Function Documentation

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

Definition at line 35 of file HepMCProduct.cc.

35  {
36  // evt->print();
37  // cout <<sizeof (evt) <<" " << sizeof ( HepMC::GenEvent) << endl;
38  evt_ = evt;
39 
40  // same story about vertex smearing - GenEvent won't know it...
41  // in fact, would be better to implement CmsGenEvent...
42 
43 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
void HepMCProduct::applyVtxGen ( HepMC::FourVector *  vtxShift) const

Definition at line 45 of file HepMCProduct.cc.

References reco::return(), lumiQTWidget::t, funct::true, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

46 {
47  //std::cout<< " applyVtxGen called " << isVtxGenApplied_ << endl;
48  //fTimeOffset = 0;
49 
50  if ( isVtxGenApplied() ) return ;
51 
52  for ( HepMC::GenEvent::vertex_iterator vt=evt_->vertices_begin();
53  vt!=evt_->vertices_end(); ++vt )
54  {
55 
56  double x = (*vt)->position().x() + vtxShift->x() ;
57  double y = (*vt)->position().y() + vtxShift->y() ;
58  double z = (*vt)->position().z() + vtxShift->z() ;
59  double t = (*vt)->position().t() + vtxShift->t() ;
60  //std::cout << " vertex (x,y,z)= " << x <<" " << y << " " << z << std::endl;
61  (*vt)->set_position( HepMC::FourVector(x,y,z,t) ) ;
62  }
63 
65 
66  return ;
67 
68 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
float float float z
bool isVtxGenApplied() const
Definition: HepMCProduct.h:37
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
Definition: DDAxes.h:10
void HepMCProduct::boostToLab ( TMatrixD *  lorentz,
std::string  type 
) const

Definition at line 70 of file HepMCProduct.cc.

References gather_cfg::cout, p4, reco::return(), and funct::true.

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

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

147  {
148 
149  return * evt_;
150 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
bool edm::HepMCProduct::isPBoostApplied ( ) const
inline

Definition at line 39 of file HepMCProduct.h.

References isPBoostApplied_.

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

Definition at line 38 of file HepMCProduct.h.

References isVtxBoostApplied_.

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

Definition at line 37 of file HepMCProduct.h.

References isVtxGenApplied_.

Referenced by MixEvtVtxGenerator::getVertex().

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

Definition at line 175 of file HepMCProduct.cc.

References swap(), and groupFilesInBlocks::temp.

175  {
176  HepMCProduct temp(other);
177  swap(temp);
178  return *this;
179 }
void swap(HepMCProduct &other)
void HepMCProduct::swap ( HepMCProduct other)

Definition at line 165 of file HepMCProduct.cc.

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

Referenced by operator=().

165  {
166  std::swap(evt_, other.evt_);
170  //std::swap(fTimeOffset, other.fTimeOffset);
171 }
HepMC::GenEvent * evt_
Definition: HepMCProduct.h:46
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

Member Data Documentation

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

Definition at line 46 of file HepMCProduct.h.

Referenced by GetEvent(), HepMCProduct(), and swap().

bool edm::HepMCProduct::isPBoostApplied_
mutableprivate

Definition at line 50 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxBoostApplied_
mutableprivate

Definition at line 49 of file HepMCProduct.h.

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

bool edm::HepMCProduct::isVtxGenApplied_
mutableprivate

Definition at line 48 of file HepMCProduct.h.

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