BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
CosmicEventParser.h
Go to the documentation of this file.
1#ifndef COSMICGENERATOR_COSMICEVENTPARSER_H
2#define COSMICGENERATOR_COSMICEVENTPARSER_H
3
4#include "CLHEP/Vector/LorentzVector.h"
5#include "CLHEP/Vector/ThreeVector.h"
6#include <iostream>
7using namespace CLHEP;
8
10public:
12 const HepLorentzVector& Vertex( void ) { return m_vertex; }
13 const HepLorentzVector& Momentum( void ) { return m_momentum; }
14 int pdgID( void ) { return m_pdgId; }
15
16private:
17 HepLorentzVector m_vertex;
18 HepLorentzVector m_momentum;
19 int m_eventNumber;
20 int m_pdgId;
21 std::istream& read( std::istream& is );
22 std::ostream& write( std::ostream& os ) const;
23
24 friend std::istream& operator>>( std::istream& is, CosmicEventParser& ev );
25 friend std::ostream& operator<<( std::ostream& os, const CosmicEventParser& ev );
26};
27
28std::istream& operator>>( std::istream& is, CosmicEventParser& ev ) { return ev.read( is ); }
29
30std::ostream& operator<<( std::ostream& os, const CosmicEventParser& ev ) {
31 return ev.write( os );
32}
33
34inline std::istream& CosmicEventParser::read( std::istream& is ) {
35 int dummy;
36 int id;
37 Hep3Vector vert, mom;
38 double v_x, v_y, v_z;
39 is >> m_eventNumber >> dummy >> id >> v_x >> v_y >> v_z >> mom;
40
41 //
42 // rotate over pi in x-z plane
43 //
44 vert.setX( -v_x );
45 vert.setY( v_y );
46 vert.setZ( -v_z );
47
48 //
49 // convert to MeV's and mm units
50 //
51 mom = 1000 * mom;
52 vert = 10 * vert;
53
54 m_vertex.setVect( vert );
55 m_vertex.setE( 0. );
56
57 m_momentum.setVect( mom );
58 double energy = sqrt( pow( 105.66, 2 ) + mom.mag2() );
59 m_momentum.setE( energy );
60
61 if ( id == 5 ) m_pdgId = 13;
62 else m_pdgId = -13;
63
64 return is;
65}
66
67inline std::ostream& CosmicEventParser::write( std::ostream& os ) const {
68 int dummy( 1 );
69 int id( 5 );
70 if ( m_pdgId == -13 ) id = 6;
71 os << m_eventNumber << " " << dummy << " " << id << " " << m_vertex.x() << " "
72 << m_vertex.y() << " " << m_vertex.z() << " " << m_momentum.x() << " " << m_momentum.y()
73 << " " << m_momentum.z();
74
75 return os;
76}
77
78#endif
std::ostream & operator<<(std::ostream &os, const CosmicEventParser &ev)
std::istream & operator>>(std::istream &is, CosmicEventParser &ev)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition KK2f.h:50
const HepLorentzVector & Vertex(void)
const HepLorentzVector & Momentum(void)
friend std::ostream & operator<<(std::ostream &os, const CosmicEventParser &ev)
friend std::istream & operator>>(std::istream &is, CosmicEventParser &ev)