BOSS 7.1.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 <iostream>
5#include "CLHEP/Vector/ThreeVector.h"
6using namespace CLHEP;
7
9 public:
11 const HepLorentzVector& Vertex(void){return m_vertex;}
12 const HepLorentzVector& Momentum(void){return m_momentum;}
13 int pdgID(void){return m_pdgId;}
14 private:
15 HepLorentzVector m_vertex;
16 HepLorentzVector m_momentum;
17 int m_eventNumber;
18 int m_pdgId;
19 std::istream& read(std::istream& is);
20 std::ostream& write(std::ostream& os) const;
21
22 friend std::istream& operator >> (std::istream& is,CosmicEventParser& ev);
23 friend std::ostream& operator << (std::ostream& os,const CosmicEventParser& ev);
24};
25
26std::istream& operator >> (std::istream& is,CosmicEventParser& ev) {
27 return ev.read(is);
28}
29
30std::ostream& operator << (std::ostream& os,const CosmicEventParser& ev) {
31 return ev.write(os);
32}
33
34inline
35std::istream& CosmicEventParser::read(std::istream& is)
36{
37 int dummy;
38 int id;
39 Hep3Vector vert,mom;
40 double v_x,v_y,v_z;
41 is >> m_eventNumber >> dummy >> id >> v_x >> v_y >> v_z >> mom;
42
43 //
44 // rotate over pi in x-z plane
45 //
46 vert.setX(-v_x);
47 vert.setY( v_y);
48 vert.setZ(-v_z);
49
50 //
51 // convert to MeV's and mm units
52 //
53 mom = 1000*mom;
54 vert = 10*vert;
55
56
57 m_vertex.setVect(vert);
58 m_vertex.setE(0.);
59
60
61 m_momentum.setVect(mom);
62 double energy = sqrt(pow(105.66,2)+mom.mag2());
63 m_momentum.setE(energy);
64
65 if(id == 5) m_pdgId = 13;
66 else m_pdgId = -13;
67
68 return is;
69}
70
71inline
72std::ostream& CosmicEventParser::write(std::ostream& os) const
73{
74 int dummy(1);
75 int id(5);
76 if(m_pdgId == -13) id = 6;
77 os << m_eventNumber << " " << dummy << " " << id << " "
78 << m_vertex.x() << " " << m_vertex.y() << " " << m_vertex.z() << " "
79 << m_momentum.x() << " " << m_momentum.y() << " " << m_momentum.z();
80
81 return os;
82}
83
84
85#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)