Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHHepMCGenEventv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHHepMCGenEventv1.cc
1 #include "PHHepMCGenEventv1.h"
2 
3 #include <HepMC/GenEvent.h>
4 #include <HepMC/SimpleVector.h> // for FourVector
5 
6 #include <CLHEP/Vector/Boost.h>
7 #include <CLHEP/Vector/LorentzRotation.h>
8 #include <CLHEP/Vector/LorentzVector.h>
9 #include <CLHEP/Vector/Rotation.h>
10 
11 #include <sstream>
12 #include <utility> // for swap
13 
14 using namespace std;
15 
17  : m_boost_beta_vector(0, 0, 0)
18  , m_rotation_vector(0, 0, 1)
19  , m_rotation_angle(0)
20 {
21 }
22 
24  : PHHepMCGenEvent(event)
25  , m_boost_beta_vector(event.get_boost_beta_vector())
26  , m_rotation_vector(event.get_rotation_vector())
27  , m_rotation_angle(event.get_rotation_angle())
28 {
29  return;
30 }
31 
33 {
34  if (&event == this) return *this;
35 
36  Reset();
37 
38  _embedding_id = event.get_embedding_id();
39  _isSimulated = event.is_simulated();
40  _theEvt = new HepMC::GenEvent(*event.getEvent());
41 
42  return *this;
43 }
44 
46 {
47 }
48 
50 {
52 
53  m_boost_beta_vector.set(0, 0, 0);
54  m_rotation_vector.set(0, 0, 1);
55  m_rotation_angle = 0;
56 }
57 
58 //_____________________________________________________________________________
59 void PHHepMCGenEventv1::identify(std::ostream& os) const
60 {
62 
63  os << " m_boost_beta_vector = (" << m_boost_beta_vector.x() << "," << m_boost_beta_vector.y() << "," << m_boost_beta_vector.z() << ") " << endl;
64  os << " m_rotation_vector = (" << m_rotation_vector.x() << "," << m_rotation_vector.y() << "," << m_rotation_vector.z() << ") by " << m_rotation_angle << " rad" << endl;
65 
66  static const CLHEP::HepLorentzVector zp_lightcone(0, 0, 1, 1);
67  static const CLHEP::HepLorentzVector zm_lightcone(0, 0, -1, 1);
68 
69  os << " HepMC Frame unit light cone vector along +z axis "<<zp_lightcone<<" translate to lab at : "
70  << (get_LorentzRotation_EvtGen2Lab() * zp_lightcone)
71  << endl;
72  os << " HepMC Frame unit light cone vector along -z axis "<<zm_lightcone<<" translate to lab at : "
73  << (get_LorentzRotation_EvtGen2Lab() * zm_lightcone)
74  << endl;
75 
76  return;
77 }
78 
79 CLHEP::HepLorentzRotation PHHepMCGenEventv1::get_LorentzRotation_EvtGen2Lab() const
80 {
81  CLHEP::HepBoost boost(m_boost_beta_vector.x(), m_boost_beta_vector.y(), m_boost_beta_vector.z());
82  CLHEP::Hep3Vector axis(m_rotation_vector.x(), m_rotation_vector.y(), m_rotation_vector.z());
83  CLHEP::HepRotation rotation(axis, m_rotation_angle);
84 
85  return CLHEP::HepLorentzRotation(boost, rotation);
86 }
87 
88 CLHEP::HepLorentzRotation PHHepMCGenEventv1::get_LorentzRotation_Lab2EvtGen() const
89 {
90  return get_LorentzRotation_EvtGen2Lab().inverse();
91 }