hlit-ana  0.0.0
 All Classes Functions Variables Pages
HlitEvent.cxx
1 #include <TString.h>
2 #include <TRandom.h>
3 #include "HlitEvent.h"
4 
6 ClassImp(HlitEvent);
8 
10  : TObject(), fID(0), fVx(0.0), fVy(0.0), fVz(0.0), fNTracks(0), fTracks(0) {
14 }
15 
16 HlitEvent::HlitEvent(Long64_t id, Double_t vx, Double_t vy, Double_t vz)
17  : TObject(), fID(id), fVx(vx), fVy(vy), fVz(vz), fNTracks(0), fTracks(0) {
21 
22  fTracks = new TClonesArray("HlitTrack");
23  gRandom->SetSeed(0);
24 }
25 
30 
31  delete fTracks;
32  fTracks = 0;
33 }
34 
39  return (HlitTrack *)fTracks->ConstructedAt(fNTracks++);
40 }
41 void HlitEvent::Print(Option_t *option) const {
45  Printf("id=%lld vx=%.3f vy=%.3f vz=%.3f", fID, fVx, fVy, fVz);
46 
47  if (!fTracks)
48  return;
49 
50  TString str(option);
51  str.ToLower();
52  if (str.Contains("all")) {
53  HlitTrack *t;
54  for (Int_t i = 0; i < fTracks->GetEntries(); i++) {
55  t = (HlitTrack *)fTracks->At(i);
56  t->Print();
57  }
58  }
59 }
60 
61 void HlitEvent::Clear(Option_t *) {
65  fID = 0;
66  fVx = 0;
67  fVy = 0;
68  fVz = 0;
69 
70  fNTracks = 0;
71  fTracks->Clear("C");
72 }
73 
78 
79  fVx = gRandom->Gaus();
80  fVy = gRandom->Gaus();
81  fVz = gRandom->Gaus();
82 }
Track object.
Definition: HlitTrack.h:13
virtual void Clear(Option_t *option="")
Definition: HlitEvent.cxx:61
Double_t fVy
Vertex y.
Definition: HlitEvent.h:87
Double_t fVx
Vertex x.
Definition: HlitEvent.h:86
TClonesArray * fTracks
Array with all tracks.
Definition: HlitEvent.h:92
Event object.
Definition: HlitEvent.h:15
Int_t fNTracks
Number of tracks.
Definition: HlitEvent.h:89
Double_t fVz
Vertex z.
Definition: HlitEvent.h:88
Long64_t fID
ID of event.
Definition: HlitEvent.h:85
void BuildVertexRandom()
Definition: HlitEvent.cxx:74
virtual ~HlitEvent()
Definition: HlitEvent.cxx:26
virtual void Print(Option_t *option="") const
Definition: HlitTrack.cxx:39
HlitTrack * AddTrack()
Definition: HlitEvent.cxx:35
virtual void Print(Option_t *option="") const
Definition: HlitEvent.cxx:41