-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathCreateNtuple.C
More file actions
33 lines (25 loc) · 815 Bytes
/
CreateNtuple.C
File metadata and controls
33 lines (25 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// An example of how to create a flatter tree if you want to do an unbinned lieklihood fit
// This uses cut functions defined in common_cuts.hh
//
#include "EventNtuple/rooutil/inc/RooUtil.hh"
#include "EventNtuple/rooutil/inc/common_cuts.hh"
#include "TH1F.h"
using namespace rooutil;
void CreateNtuple(std::string filename) {
// Set up RooUtil
RooUtil util(filename);
// Create an output file
TFile* outfile = new TFile("example_ntuple.root", "RECREATE");
util.CreateOutputEventNtuple(outfile);
// Loop through the events
for (int i_event = 0; i_event < util.GetNEvents(); ++i_event) {
auto& event = util.GetEvent(i_event);
event.SelectTracks(is_e_minus);
if (event.CountTracks() == 1) {
util.FillOutputEventNtuple();
}
}
outfile->Write();
outfile->Close();
}