ndmspc
0.20250128.0
HepEvent.cxx
1
#include <TString.h>
2
#include <TRandom.h>
3
#include "HepEvent.h"
4
6
ClassImp(
Ndmspc::Hep::Event
);
8
9
namespace
Ndmspc {
10
namespace
Hep {
11
12
Event::Event
() : TObject(), fID(0), fVx(0.0), fVy(0.0), fVz(0.0), fNTracks(0), fTracks(0)
13
{
17
}
18
19
Event::Event
(Long64_t
id
, Double_t vx, Double_t vy, Double_t vz)
20
: TObject(), fID(id), fVx(vx), fVy(vy), fVz(vz), fNTracks(0), fTracks(0)
21
{
25
26
fTracks
=
new
TClonesArray(
"Ndmspc::Hep::Track"
);
27
gRandom->SetSeed(0);
28
}
29
30
Event::~Event
()
31
{
35
36
delete
fTracks
;
37
fTracks
= 0;
38
}
39
40
Track
*
Event::AddTrack
()
41
{
45
return
(
Track
*)
fTracks
->ConstructedAt(
fNTracks
++);
46
}
47
void
Event::Print
(Option_t * option)
const
48
{
52
Printf(
"id=%lld vx=%.3f vy=%.3f vz=%.3f nTracks=%d "
,
fID
,
fVx
,
fVy
,
fVz
,
fNTracks
);
53
54
if
(!
fTracks
)
return
;
55
56
TString str(option);
57
str.ToLower();
58
if
(str.Contains(
"all"
)) {
59
Track
* t;
60
for
(Int_t i = 0; i <
fTracks
->GetEntries(); i++) {
61
t = (
Track
*)
fTracks
->At(i);
62
t->
Print
();
63
}
64
}
65
}
66
67
void
Event::Clear
(Option_t *)
68
{
72
fID
= 0;
73
fVx
= 0;
74
fVy
= 0;
75
fVz
= 0;
76
77
fNTracks
= 0;
78
fTracks
->Clear(
"C"
);
79
}
80
81
void
Event::BuildVertexRandom
()
82
{
86
87
fVx
= gRandom->Gaus();
88
fVy
= gRandom->Gaus();
89
fVz
= gRandom->Gaus();
90
}
91
92
}
// namespace Hep
93
}
// namespace Ndmspc
Ndmspc::Hep::Event
Event object.
Definition:
HepEvent.h:17
Ndmspc::Hep::Event::~Event
virtual ~Event()
Definition:
HepEvent.cxx:30
Ndmspc::Hep::Event::BuildVertexRandom
void BuildVertexRandom()
Definition:
HepEvent.cxx:81
Ndmspc::Hep::Event::AddTrack
Track * AddTrack()
Definition:
HepEvent.cxx:40
Ndmspc::Hep::Event::fVy
Double_t fVy
Vertex y.
Definition:
HepEvent.h:88
Ndmspc::Hep::Event::fVz
Double_t fVz
Vertex z.
Definition:
HepEvent.h:89
Ndmspc::Hep::Event::Event
Event()
Definition:
HepEvent.cxx:12
Ndmspc::Hep::Event::fID
Long64_t fID
ID of event.
Definition:
HepEvent.h:86
Ndmspc::Hep::Event::fTracks
TClonesArray * fTracks
Array with all tracks.
Definition:
HepEvent.h:93
Ndmspc::Hep::Event::Clear
virtual void Clear(Option_t *option="")
Definition:
HepEvent.cxx:67
Ndmspc::Hep::Event::fVx
Double_t fVx
Vertex x.
Definition:
HepEvent.h:87
Ndmspc::Hep::Event::fNTracks
Int_t fNTracks
Number of tracks.
Definition:
HepEvent.h:90
Ndmspc::Hep::Event::Print
virtual void Print(Option_t *option="") const
Definition:
HepEvent.cxx:47
Ndmspc::Hep::Track
Track object.
Definition:
HepTrack.h:15
Ndmspc::Hep::Track::Print
virtual void Print(Option_t *option="") const
Definition:
HepTrack.cxx:50
Event
Hep
HepEvent.cxx
Generated by
1.9.1