Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:00

0001 #include "PHHepMCGenEventv1.h"
0002 
0003 #include <HepMC/GenEvent.h>
0004 #include <HepMC/SimpleVector.h>  // for FourVector
0005 
0006 #include <CLHEP/Vector/Boost.h>
0007 #include <CLHEP/Vector/LorentzRotation.h>
0008 #include <CLHEP/Vector/LorentzVector.h>
0009 #include <CLHEP/Vector/Rotation.h>
0010 
0011 #include <sstream>
0012 #include <utility>  // for swap
0013 
0014 using namespace std;
0015 
0016 PHHepMCGenEventv1::PHHepMCGenEventv1()
0017   : m_boost_beta_vector(0, 0, 0)
0018   , m_rotation_vector(0, 0, 1)
0019   , m_rotation_angle(0)
0020 {
0021 }
0022 
0023 PHHepMCGenEventv1::PHHepMCGenEventv1(const PHHepMCGenEventv1& event)
0024   : PHHepMCGenEvent(event)
0025   , m_boost_beta_vector(event.get_boost_beta_vector())
0026   , m_rotation_vector(event.get_rotation_vector())
0027   , m_rotation_angle(event.get_rotation_angle())
0028 {
0029   return;
0030 }
0031 
0032 PHHepMCGenEventv1& PHHepMCGenEventv1::operator=(const PHHepMCGenEventv1& event)
0033 {
0034   if (&event == this) return *this;
0035 
0036   Reset();
0037 
0038   _embedding_id = event.get_embedding_id();
0039   _isSimulated = event.is_simulated();
0040   _theEvt = new HepMC::GenEvent(*event.getEvent());
0041 
0042   return *this;
0043 }
0044 
0045 PHHepMCGenEventv1::~PHHepMCGenEventv1()
0046 {
0047 }
0048 
0049 void PHHepMCGenEventv1::Reset()
0050 {
0051   PHHepMCGenEvent::Reset();
0052 
0053   m_boost_beta_vector.set(0, 0, 0);
0054   m_rotation_vector.set(0, 0, 1);
0055   m_rotation_angle = 0;
0056 }
0057 
0058 //_____________________________________________________________________________
0059 void PHHepMCGenEventv1::identify(std::ostream& os) const
0060 {
0061   PHHepMCGenEvent::identify(os);
0062 
0063   os << " m_boost_beta_vector = (" << m_boost_beta_vector.x() << "," << m_boost_beta_vector.y() << "," << m_boost_beta_vector.z() << ") " << endl;
0064   os << " m_rotation_vector = (" << m_rotation_vector.x() << "," << m_rotation_vector.y() << "," << m_rotation_vector.z() << ") by " << m_rotation_angle << " rad" << endl;
0065 
0066   static const CLHEP::HepLorentzVector zp_lightcone(0, 0, 1, 1);
0067   static const CLHEP::HepLorentzVector zm_lightcone(0, 0, -1, 1);
0068 
0069   os << " HepMC Frame unit light cone vector along +z axis "<<zp_lightcone<<" translate to lab at : "
0070      << (get_LorentzRotation_EvtGen2Lab() * zp_lightcone)
0071      << endl;
0072   os << " HepMC Frame unit light cone vector along -z axis  "<<zm_lightcone<<" translate to lab at : "
0073      << (get_LorentzRotation_EvtGen2Lab() * zm_lightcone)
0074      << endl;
0075 
0076   return;
0077 }
0078 
0079 CLHEP::HepLorentzRotation PHHepMCGenEventv1::get_LorentzRotation_EvtGen2Lab() const
0080 {
0081   CLHEP::HepBoost boost(m_boost_beta_vector.x(), m_boost_beta_vector.y(), m_boost_beta_vector.z());
0082   CLHEP::Hep3Vector axis(m_rotation_vector.x(), m_rotation_vector.y(), m_rotation_vector.z());
0083   CLHEP::HepRotation rotation(axis, m_rotation_angle);
0084 
0085   return CLHEP::HepLorentzRotation(boost, rotation);
0086 }
0087 
0088 CLHEP::HepLorentzRotation PHHepMCGenEventv1::get_LorentzRotation_Lab2EvtGen() const
0089 {
0090   return get_LorentzRotation_EvtGen2Lab().inverse();
0091 }