1 |
Introduction:
|
2 |
-------------
|
3 |
|
4 |
This package provides a small facility to analyze one or a chain of root ntuples.
|
5 |
|
6 |
A script (./scripts/make_rootNtupleClass.sh) is used to generate automatically
|
7 |
(using the root command RootNtupleMaker->MakeClass) a class (include/rootNtupleClass.h
|
8 |
and src/rootNtupleClass.C) with the variable definitions of a given root ntuple
|
9 |
(to be provided by the user).
|
10 |
|
11 |
The class baseClass (include/baseClass.h and src/baseClass.C) inherits from the
|
12 |
automatically generated rootNtupleClass.
|
13 |
baseClass provides the methods that are common to all analysis, such as the method
|
14 |
to read a list of root files and form a chain. It will, asap, also provide a method
|
15 |
to read a list of selection cuts.
|
16 |
|
17 |
The class analysisClass (include/analysisClass.h and src/analysisClass.C) inherits
|
18 |
from baseClass.
|
19 |
The user's code should be placed in the method Loop() of analysisClass, which reimplements
|
20 |
the method Loop() of rootNtupleClass.
|
21 |
|
22 |
The main program (src/main.C) receives the configuration parameters (such a the input
|
23 |
chain of root files and a file to provide a cut list) and executes the analysisClass code.
|
24 |
|
25 |
Instructions:
|
26 |
-------------
|
27 |
|
28 |
1) Checkout the code:
|
29 |
export CVSROOT=:gserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
|
30 |
cvs checkout -d rootNtupleAnalyzer JetMETAnalysis/PromptAnalysis/test/rootNtupleAnalyzer
|
31 |
|
32 |
2) Generate the rootNtupleClass:
|
33 |
cd rootNtupleAnalyzer/
|
34 |
./scripts/make_rootNtupleClass.sh
|
35 |
(you will be asked for input arguments)
|
36 |
|
37 |
IMPORTANT NOTE:
|
38 |
you need to add
|
39 |
|
40 |
#include <vector>
|
41 |
AND
|
42 |
using namespace std;
|
43 |
|
44 |
to the file
|
45 |
|
46 |
include/rootNtupleClass.h
|
47 |
|
48 |
I will modify in future the .sh script to do it automatically.
|
49 |
|
50 |
3) Copy the analysis template file into your own file:
|
51 |
cp -i src/analysisClass_template.C src/analysisClass_myCode.C
|
52 |
and make a symbolic link analysisClass.C by:
|
53 |
ln -s analysisClass_myCode.C src/analysisClass.C
|
54 |
|
55 |
4) Compile to test that all is OK so far (in order to compile, steps 2 and 3 need to be done first):
|
56 |
make clean
|
57 |
make
|
58 |
|
59 |
5) Add your analysis code to the method Loop() of analysisClass_myCode.C
|
60 |
|
61 |
6) Compile as in 4.
|
62 |
|
63 |
7) Run:
|
64 |
./main
|
65 |
(you will be asked for input arguments)
|
66 |
|
67 |
Note1:
|
68 |
one can have several analyses in a directory, such as
|
69 |
src/analysisClass_myCode1.C
|
70 |
src/analysisClass_myCode2.C
|
71 |
src/analysisClass_myCode3.C
|
72 |
and move the symbolic link to the one to be used:
|
73 |
ln -sf analysisClass_myCode2.C src/analysisClass.C
|
74 |
and compile/run as above.
|
75 |
|
76 |
|
77 |
More details:
|
78 |
-------------
|
79 |
|
80 |
- Providing cuts via file:
|
81 |
A list of cut variable names and cut limits can be provided through a file (see config/cutFileExample.txt).
|
82 |
The variable names in such a file have to be filled with a value calculated by the user analysisClass code,
|
83 |
a function "fillVariableWithValue" is provided - see example code.
|
84 |
Once all the cut variables have been filled, the cuts can be evaluated by calling "evaluateCuts" - see
|
85 |
example code. Do not forget to reset the cuts by calling "resetCuts" at each event before filling the
|
86 |
variables - see example code.
|
87 |
The function "evaluateCuts" determines whether the cuts are satisfied or not, stores the pass/failed result
|
88 |
of each cut, calculates cut efficiencies and fills histograms for each cut variable (binning provided by the
|
89 |
cut file, see config/cutFileExample.txt).
|
90 |
The user has access to the cut results via a set of functions (see include/baseClass.h)
|
91 |
bool baseClass::passedCut(const string& s);
|
92 |
bool baseClass::passedAllPreviousCuts(const string& s);
|
93 |
bool baseClass::passedAllOtherCuts(const string& s);
|
94 |
where the string to be passed is the cut variable name.
|
95 |
The cuts are evaluated following the order of their apperance in the cut file (config/cutFileExample.txt).
|
96 |
One can simply change the sequnce of line in the cut file to have the cuts applied in a different order
|
97 |
and do cut efficiency studies.
|
98 |
Also, the user can assign to each cut a level (0,1,2,3,4 ... n) and use a function
|
99 |
bool baseClass::passedAllOtherSameLevelCuts(const string& s);
|
100 |
to have the pass/failed info on all other cuts with the same level.
|
101 |
There is actually also cuts with level=-1. These cuts are not actually evaluated, the corresponding lines
|
102 |
in the cut file (config/cutFileExample.txt) are used to pass values to the user code (such as fiducial
|
103 |
region limits). The user can access these values (and also those of the cuts with level >= 0) by
|
104 |
double baseClass::getCutMinValue1(const string& s);
|
105 |
double baseClass::getCutMaxValue1(const string& s);
|
106 |
double baseClass::getCutMinValue2(const string& s);
|
107 |
double baseClass::getCutMaxValue2(const string& s);
|
108 |
|
109 |
- Automatic histograms for cuts
|
110 |
In the output root file the following histograms are generated for each cut variable with level >= 0:
|
111 |
no cuts applied
|
112 |
passedAllPreviousCuts
|
113 |
passedAllOtherSameLevelCuts
|
114 |
passedAllOtherCuts
|
115 |
passedAllCut
|
116 |
|
117 |
- Automatic cut efficiency:
|
118 |
the absolute and relative efficiency is calculated for each cut and stored in an output file
|
119 |
(named data/output/cutEfficiencyFile.dat if the code is executed following the examples)
|
120 |
|
121 |
|
122 |
Using the Optimizer (Jeff Temple):
|
123 |
----------------------------------
|
124 |
|
125 |
The input cut file can also specify variables to be used in optimization studies.
|
126 |
To do so, specify "OPT" for minValue1, and then either ">" or "<" under maxValue1.
|
127 |
(The ">" sign will pass values greater than the applied threshold, and "<" will pass
|
128 |
those less than the threshold.) The minValue2 and maxValue2 values should be the minimum
|
129 |
and maximum thresholds you wish to apply when scanning for optimal cuts.
|
130 |
This optimizer will scan 10 different values, evenly distributed over
|
131 |
the inclusive range [minValue2, maxValue2]. At the moment, the "level" value is not used and
|
132 |
does not need to be specified.
|
133 |
|
134 |
The optimization cuts are always run after all the other cuts in the file, and are only run
|
135 |
when all other cuts are passed. An example of the optimization syntax is:
|
136 |
|
137 |
#VariableName minValue1(<) maxValue1(>=) minValue2(<) maxValue2(>=) level histoNbinsMinMax
|
138 |
#------------ ------------ ------------- ------------ ------------- ----- ----------------
|
139 |
muonPt OPT > 10 55 5
|
140 |
|
141 |
|
142 |
NOTE: for the moment, in the .cc file the variable to be optimized should be "filled" by using
|
143 |
the method "fillOptimizerWithValue" instead of "fillVariableWithValue". --> NEED IMPROVEMENT
|
144 |
|
145 |
This will make 10 different cuts on muonPt, at [10, 15, 20, 25, ..., 55]. (Cut level '5' is meaningless here.)
|
146 |
The output of the optimization will be a 10-bin histogram, showing the number of
|
147 |
events passing each of the 10 thresholds.
|
148 |
|
149 |
Multiple optimization cuts may be applied in the same file. In the case where N optimization cuts
|
150 |
are applied, a histogram of 10^N bins will be produced, with each bin corresponding to a unique cut combination.
|
151 |
No more than 6 variables may be optimized at one time (limitation in the number of bins for a TH1F ~ 10^6).
|
152 |
|
153 |
|