-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBasicLoopCU.cc
146 lines (106 loc) · 4.04 KB
/
BasicLoopCU.cc
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//-----------------------------------------------------------------------------
// File: BasicLoopCU.cc
// Description: Analyzer for ntuples created by TheNtupleMaker
// Created: Fri Jun 3 16:38:31 2011 by mkntanalyzer.py
// Author: Ben Kreis
//-----------------------------------------------------------------------------
//#include "BasicLoopTools.h"
#include "EventCalculator.C"
#ifdef PROJECT_NAME
#include "PhysicsTools/TheNtupleMaker/interface/pdg.h"
#else
#include "pdg.h"
#endif
using namespace std;
//-----------------------------------------------------------------------------
int main(int argc, char** argv)
{
//code for sampleName_ and output path
TString outputDir = "./"; //this is where reducedTrees will go, use "./" for T3
//TString outputDir = "/uscmst1b_scratch/lpc1/3DayLifetime/wdteo/"; //this is where reducedTrees will go
//TString outputDir = "/tmp/joshmt/";
TString options="";
if (argc>2) options = argv[2];
stringstream ss;
TString fileArg;
*argv++;
ss<<*argv;
ss>>fileArg;
if (fileArg.Contains(".")) fileArg.Remove(fileArg.Last('.'));
// setSampleName_(fileArg);
cout << fileArg << endl;
*argv--;
// Get file list and histogram filename from command line
commandLine cmdline;
decodeCommandLine(argc, argv, cmdline);
// Get names of ntuple files to be processed and open chain of ntuples
vector<string> filenames = getFilenames(cmdline.filelist);
itreestream stream(filenames, "Events");
if ( !stream.good() ) error("unable to open ntuple file(s)");
// Get number of events to be read
int nevents = stream.size();
cout << "Number of events: " << nevents << endl;
// Select variables to be read
selectVariables(stream);
EventCalculator ec(fileArg, EventCalculator::kPF2PAT, EventCalculator::kPFMET);
//ec.setBTaggerType(EventCalculator::kSSVHPT);
ec.setBTaggerType(EventCalculator::kCSVM);
ec.setOptions(options);
ec.reducedTree(outputDir, stream);
//ec.cutflow(stream, -1);
//ec.sampleAnalyzer(stream);
//ec.plotBTagEffMC(stream);
return 0;
}
//sampleAnalyzer(stream);
//makeReducedTrees(argc, argv); // currently not working with multiple files (problem with treestream?)
// The root application is needed to make canvases visible during
// program execution. If this is not needed, just comment out the following
// line
//TApplication app("analyzer", &argc, argv);
/*
Notes:
1. Use
ofile = outputFile(cmdline.outputfile, stream)
to skim events to output file in addition to writing out histograms.
2. Use
ofile.addEvent(event-weight)
to specify that the current event is to be added to the output file. If
omitted, the event-weight is taken to 1.
3. Use
ofile.count(cut-name, event-weight)
to keep track, in the count histogram, of the number of events passing
a given cut. If omitted, the event-weight is taken to be 1. If you want
the counts in the count histogram to appear in a given order, specify the
order, before entering the event loop, as in the example below
ofile.count("NoCuts", 0)
ofile.count("GoodEvent", 0)
ofile.count("Vertex", 0)
ofile.count("MET", 0)
*/
//outputFile ofile(cmdline.outputfilename);
//---------------------------------------------------------------------------
// Declare histograms
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Loop over events
//---------------------------------------------------------------------------
/*
for(int entry=0; entry < nevents; ++entry)
{
// Read event into memory
stream.read(entry);
// Uncomment the following line if you wish to copy variables into
// structs. See the header file BasicLoopCU.h to find out what structs
// are available.
// fillObjects();
// ---------------------
// -- event selection --
// ---------------------
// ---------------------
// -- fill histograms --
// ---------------------
}
*/
//stream.close();
//ofile.close();