Skip to content

Commit f504c5c

Browse files
Copy hVersion to reduced ntuples created by RooUtil
1 parent 856e0c6 commit f504c5c

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

rooutil/inc/RooUtil.hh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ public:
4747

4848
void SetVersionNumber(std::string filename) {
4949
TFile* file = new TFile(filename.c_str(), "READ");
50-
TH1I* hVersion = (TH1I*) file->Get("EventNtuple/version");
51-
if (!hVersion) {
50+
TH1I* version = (TH1I*) file->Get("EventNtuple/version");
51+
if (!version) {
5252
std::cout << "Warning: this EventNtuple file does not contain a version number. It is either v06_02_00 or older. This is just a warning..." << std::endl;
5353
}
5454
else {
55-
majorVer = hVersion->GetBinContent(1);
56-
minorVer = hVersion->GetBinContent(2);
57-
patchVer = hVersion->GetBinContent(3);
55+
hVersion = (TH1I*) version->Clone();
56+
hVersion->SetDirectory(0);
57+
int majorVer = hVersion->GetBinContent(1);
58+
int minorVer = hVersion->GetBinContent(2);
59+
int patchVer = hVersion->GetBinContent(3);
5860
std::cout << "EventNtuple v" << std::setw(2) << std::setfill('0') << majorVer << "_"
5961
<< std::setw(2) << std::setfill('0') << minorVer << "_"
6062
<< std::setw(2) << std::setfill('0') << patchVer << std::endl;
@@ -144,7 +146,8 @@ public:
144146
output_ntuple->Branch(pair.first.c_str(), &event->triginfo._triggerArray[pair.second]);
145147
}
146148

147-
// TODO: copy in version number histogram
149+
// Write out histograms from input to output
150+
hVersion->Write();
148151
}
149152

150153
void FillOutputEventNtuple() {
@@ -156,9 +159,7 @@ private:
156159
Event* event; // holds all the variables for SetBranchAddress
157160
bool debug;
158161

159-
int majorVer;
160-
int minorVer;
161-
int patchVer;
162+
TH1I* hVersion;
162163

163164
TTree* output_ntuple; // for output
164165
};

0 commit comments

Comments
 (0)