src
eventRecordInterfaces
PhotosHEPEVTEvent.cxx
1
#include "PhotosHEPEVTEvent.h"
2
#include "Log.h"
3
4
const
static
int
fortranNMXHEP = 10000;
5
6
/** Definition of the HEPEVT common block it can be adapted to user env of F77*/
7
struct
HEPEVT
8
{
9
int
nevhep;
10
int
nhep;
11
int
isthep[fortranNMXHEP];
12
int
idhep[fortranNMXHEP];
13
int
jmohep[fortranNMXHEP][2];
14
int
jdahep[fortranNMXHEP][2];
15
double
phep[fortranNMXHEP][5];
16
double
vhep[fortranNMXHEP][4];
17
// NEVPHO,NPHO,ISTPHO(NMXPHO),IDPHO(NMXPHO),
18
// JMOPHO(2,NMXPHO),JDAPHO(2,NMXPHO),PPHO(5,NMXPHO),VPHO(4,NMXPHO)
19
// int qedrad[NMXHEP] was an add up
20
// for HEPEVT in F77 times. Separate common PH_PHOQED
21
// also phoif_.chkif[NMXPHO] was add up for PHOEVT
22
// now it is pho.qedrad
23
} hepevt_;
24
25
struct
PHOQED
26
{
27
int
qedrad[fortranNMXHEP];
// Photos flag
28
} phoqed_;
29
30
namespace
Photospp
31
{
32
33
PhotosHEPEVTEvent::~PhotosHEPEVTEvent
()
34
{
35
for
(
unsigned
int
i=0;i<
particle_list
.size();i++)
delete
particle_list
[i];
36
}
37
38
PhotosHEPEVTEvent::PhotosHEPEVTEvent
()
39
{
40
// NOTE: We set default units to be GEV for HEPEVT events. This can be
41
// overridden by calling Photos::setMomentumUnit(Photos::MEV);
42
// after the event is created.
43
Photos::setMomentumUnit
(Photos::GEV);
44
}
45
46
void
PhotosHEPEVTEvent::addParticle
(
PhotosHEPEVTParticle
*p)
47
{
48
p->
setEvent
(
this
);
49
50
p->
setBarcode
(
particle_list
.size());
51
particle_list
.push_back(p);
52
}
53
54
PhotosHEPEVTParticle
*
PhotosHEPEVTEvent::getParticle
(
int
i)
55
{
56
if
( i<0 || i>=(
int
)
particle_list
.size() )
return
NULL;
57
return
particle_list
[i];
58
}
59
60
void
PhotosHEPEVTEvent::setParticle
(
int
i,
PhotosHEPEVTParticle
*p)
61
{
62
if
( i<0 || i>=(
int
)
particle_list
.size() )
return
;
63
particle_list
[i] = p;
64
}
65
66
int
PhotosHEPEVTEvent::getParticleCount
()
67
{
68
return
particle_list
.size();
69
}
70
71
std::vector<PhotosParticle*>
PhotosHEPEVTEvent::getParticleList
()
72
{
73
std::vector<PhotosParticle*> ret;
74
75
for
(
unsigned
int
i=0;i<
particle_list
.size();i++) ret.push_back( (
PhotosParticle
*)
particle_list
[i] );
76
77
return
ret;
78
}
79
80
void
PhotosHEPEVTEvent::print
()
81
{
82
Log::Info()<<
"PhotosHEPEVTEvent"
<<endl<<
"-----------------"
<<endl;
83
for
(
unsigned
int
i=0;i<
particle_list
.size();i++)
particle_list
[i]->
print
();
84
}
85
86
void
PhotosHEPEVTEvent::clear
()
87
{
88
for
(
unsigned
int
i=0;i<
particle_list
.size();i++)
delete
particle_list
[i];
89
particle_list
.clear();
90
}
91
92
void
PhotosHEPEVTEvent::read_event_from_HEPEVT
(
PhotosHEPEVTEvent
*evt)
93
// vertex info is not needed, but what about info for write_event_to_HEPEVT?
94
// need to be fixed later.
95
{
96
if
(evt==NULL)
return
;
97
98
for
(
int
i=0; i<hepevt_.nhep; i++)
99
{
100
PhotosHEPEVTParticle
*p =
new
PhotosHEPEVTParticle
101
(
102
hepevt_.idhep [i],
103
hepevt_.isthep[i],
104
hepevt_.phep [i][0],
105
hepevt_.phep [i][1],
106
hepevt_.phep [i][2],
107
hepevt_.phep [i][3],
108
hepevt_.phep [i][4],
109
hepevt_.jmohep[i][0]-1,
110
hepevt_.jmohep[i][1]-1,
111
hepevt_.jdahep[i][0]-1,
112
hepevt_.jdahep[i][1]-1
113
);
114
evt->
addParticle
(p);
115
}
116
}
117
118
void
PhotosHEPEVTEvent::write_event_to_HEPEVT
(
PhotosHEPEVTEvent
*evt)
119
// vertex info is needed, for photons it should be as of other sisters
120
// taken at read_event_from_HEPEVT
121
// need to be fixed later.
122
123
{
124
if
(evt==NULL)
return
;
125
126
hepevt_.nhep = evt->
getParticleCount
();
127
128
for
(
int
i=0; i<hepevt_.nhep; i++)
129
{
130
PhotosHEPEVTParticle
*p = evt->
getParticle
(i);
131
132
hepevt_.idhep [i] =p->
getPdgID
();
133
hepevt_.isthep[i] =p->
getStatus
();
134
hepevt_.phep [i][0]=p->
getPx
();
135
hepevt_.phep [i][1]=p->
getPy
();
136
hepevt_.phep [i][2]=p->
getPz
();
137
hepevt_.phep [i][3]=p->
getE
();
138
hepevt_.phep [i][4]=p->
getMass
();
139
hepevt_.jmohep[i][0]=p->
getFirstMotherIndex
() +1;
140
hepevt_.jmohep[i][1]=p->
getSecondMotherIndex
() +1;
141
hepevt_.jdahep[i][0]=p->
getDaughterRangeStart
()+1;
142
hepevt_.jdahep[i][1]=p->
getDaughterRangeEnd
() +1;
143
hepevt_.vhep [i][0]=0.0;
144
hepevt_.vhep [i][1]=0.0;
145
hepevt_.vhep [i][2]=0.0;
146
hepevt_.vhep [i][3]=0.0;
147
}
148
}
149
150
}
// namespace Photospp
Photospp::PhotosHEPEVTEvent
Definition
include/Photos/PhotosHEPEVTEvent.h:28
Photospp::PhotosHEPEVTEvent::read_event_from_HEPEVT
static void read_event_from_HEPEVT(PhotosHEPEVTEvent *evt)
Definition
PhotosHEPEVTEvent.cxx:92
Photospp::PhotosHEPEVTEvent::addParticle
void addParticle(PhotosHEPEVTParticle *p)
Definition
PhotosHEPEVTEvent.cxx:46
Photospp::PhotosHEPEVTEvent::print
void print()
Definition
PhotosHEPEVTEvent.cxx:80
Photospp::PhotosHEPEVTEvent::getParticleCount
int getParticleCount()
Definition
PhotosHEPEVTEvent.cxx:66
Photospp::PhotosHEPEVTEvent::getParticle
PhotosHEPEVTParticle * getParticle(int i)
Definition
PhotosHEPEVTEvent.cxx:54
Photospp::PhotosHEPEVTEvent::particle_list
std::vector< PhotosHEPEVTParticle * > particle_list
Definition
include/Photos/PhotosHEPEVTEvent.h:68
Photospp::PhotosHEPEVTEvent::getParticleList
std::vector< PhotosParticle * > getParticleList()
Definition
PhotosHEPEVTEvent.cxx:71
Photospp::PhotosHEPEVTEvent::PhotosHEPEVTEvent
PhotosHEPEVTEvent()
Definition
PhotosHEPEVTEvent.cxx:38
Photospp::PhotosHEPEVTEvent::clear
void clear()
Definition
PhotosHEPEVTEvent.cxx:86
Photospp::PhotosHEPEVTEvent::write_event_to_HEPEVT
static void write_event_to_HEPEVT(PhotosHEPEVTEvent *evt)
Definition
PhotosHEPEVTEvent.cxx:118
Photospp::PhotosHEPEVTEvent::~PhotosHEPEVTEvent
~PhotosHEPEVTEvent()
Definition
PhotosHEPEVTEvent.cxx:33
Photospp::PhotosHEPEVTEvent::setParticle
void setParticle(int i, PhotosHEPEVTParticle *p)
Definition
PhotosHEPEVTEvent.cxx:60
Photospp::PhotosHEPEVTParticle
Definition
include/Photos/PhotosHEPEVTParticle.h:32
Photospp::PhotosHEPEVTParticle::getPx
double getPx()
Definition
PhotosHEPEVTParticle.cxx:359
Photospp::PhotosHEPEVTParticle::getDaughterRangeStart
int getDaughterRangeStart()
Definition
PhotosHEPEVTParticle.cxx:412
Photospp::PhotosHEPEVTParticle::getPy
double getPy()
Definition
PhotosHEPEVTParticle.cxx:363
Photospp::PhotosHEPEVTParticle::getFirstMotherIndex
int getFirstMotherIndex()
Definition
PhotosHEPEVTParticle.cxx:404
Photospp::PhotosHEPEVTParticle::setEvent
void setEvent(PhotosHEPEVTEvent *event)
Definition
PhotosHEPEVTParticle.cxx:400
Photospp::PhotosHEPEVTParticle::getMass
double getMass()
Definition
PhotosHEPEVTParticle.cxx:355
Photospp::PhotosHEPEVTParticle::getPz
double getPz()
Definition
PhotosHEPEVTParticle.cxx:367
Photospp::PhotosHEPEVTParticle::setBarcode
void setBarcode(int barcode)
Definition
PhotosHEPEVTParticle.cxx:396
Photospp::PhotosHEPEVTParticle::getSecondMotherIndex
int getSecondMotherIndex()
Definition
PhotosHEPEVTParticle.cxx:408
Photospp::PhotosHEPEVTParticle::getE
double getE()
Definition
PhotosHEPEVTParticle.cxx:371
Photospp::PhotosHEPEVTParticle::getDaughterRangeEnd
int getDaughterRangeEnd()
Definition
PhotosHEPEVTParticle.cxx:416
Photospp::PhotosHEPEVTParticle::getPdgID
int getPdgID()
Definition
PhotosHEPEVTParticle.cxx:347
Photospp::PhotosHEPEVTParticle::getStatus
int getStatus()
Definition
PhotosHEPEVTParticle.cxx:351
Photospp::PhotosParticle
Definition
include/Photos/PhotosParticle.h:26
Photospp::Photos::setMomentumUnit
static void setMomentumUnit(MomentumUnits unit)
Definition
include/Photos/Photos.h:139
HEPEVT
Definition
PhotosHEPEVTEvent.cxx:8
PHOQED
Definition
PhotosHEPEVTEvent.cxx:26
Generated by
1.9.8