hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
Loading...
Searching...
No Matches
processing
src
HpsEventFile.cxx
Go to the documentation of this file.
1
#include "
HpsEventFile.h
"
2
3
HpsEventFile::HpsEventFile
(
const
std::string ifilename,
const
std::string& ofilename){
4
rootfile_
=
new
TFile(ifilename.c_str());
5
//ttree_reader = new ("HPS_Event",_rootfile);
6
intree_
= (TTree*)
rootfile_
->Get(
"HPS_Event"
);
7
ofile_
=
new
TFile(ofilename.c_str(),
"recreate"
);
8
9
}
10
11
HpsEventFile::~HpsEventFile
() {}
12
13
void
HpsEventFile::setupEvent
(
IEvent
* ievent) {
14
event_
=
static_cast<
HpsEvent
*
>
(ievent);
15
//TODO protect the tree pointer
16
if
(
intree_
) {
17
event_
-> setTree(
intree_
);
18
maxEntries_
=
intree_
->GetEntriesFast();
19
}
20
21
entry_
= 0;
22
}
23
24
void
HpsEventFile::close
() {
25
rootfile_
->cd();
26
rootfile_
->Close();
27
ofile_
->cd();
28
ofile_
->Close();
29
30
}
31
32
bool
HpsEventFile::nextEvent
() {
33
34
if
(
entry_
>
maxEntries_
- 1)
35
return
false
;
36
37
//TODO Really don't like having the tree associated to the event object. Should be associated to the EventFile.
38
intree_
->GetEntry(
entry_
++);
39
40
return
true
;
41
}
HpsEventFile.h
HpsEventFile::entry_
int entry_
description
Definition
HpsEventFile.h:65
HpsEventFile::intree_
TTree * intree_
description
Definition
HpsEventFile.h:69
HpsEventFile::event_
HpsEvent * event_
description
Definition
HpsEventFile.h:64
HpsEventFile::rootfile_
TFile * rootfile_
description
Definition
HpsEventFile.h:68
HpsEventFile::~HpsEventFile
virtual ~HpsEventFile()
Definition
HpsEventFile.cxx:11
HpsEventFile::close
void close()
description
Definition
HpsEventFile.cxx:24
HpsEventFile::maxEntries_
int maxEntries_
description
Definition
HpsEventFile.h:66
HpsEventFile::ofile_
TFile * ofile_
description
Definition
HpsEventFile.h:67
HpsEventFile::HpsEventFile
HpsEventFile(const std::string ifilename, const std::string &ofilename)
Constructor.
Definition
HpsEventFile.cxx:3
HpsEventFile::nextEvent
virtual bool nextEvent()
description
Definition
HpsEventFile.cxx:32
HpsEventFile::setupEvent
void setupEvent(IEvent *ievent)
description
Definition
HpsEventFile.cxx:13
HpsEvent
Definition
HpsEvent.h:9
IEvent
Definition
IEvent.h:7
Generated by
1.9.8