-
Notifications
You must be signed in to change notification settings - Fork 1
/
SteerPlotter.cxx
245 lines (198 loc) · 10.3 KB
/
SteerPlotter.cxx
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#include "SteerPlotter.h"
#include <iostream>
#include <iomanip>
#include <TObjString.h>
using namespace std;
ClassImp(SteerPlotter)
SteerPlotter::SteerPlotter()
{
// Here you have to set the default values which will be used,
// if this steering class is required but not given in the steering file
fNumOfSamples = 0;
fOutputPsFile = "Plots/test.ps";
bSubstractBkgd = false;
bDrawEntries = false;
bDrawLumi = false;
bDrawLegend = true;
bSingleEPS = false;
bIgnoreEmptyBins = false;
bDoCumulative = false;
fNumOfSamplesToStack = 0;
fLumi = 0;
fSysError = -1.;
bPlotThetaFile = false;
bLogy = false;
bZScoreInRatio = false;
}
SteerPlotter::~SteerPlotter()
{
fLegStrings.Delete();
}
void SteerPlotter::Print(Option_t* opt) const
{
// Prints all settings of the steering
// First: perform some sanity checks
if (fNumOfSamples != fInputFiles.GetEntries()){
cout << "Error: Number of input files is not the same as the number of samples to be plotted." << endl;
exit(3);
}
if (fNumOfSamples != fSamplesWeight.GetSize()){
cout << "Error: Number of given weights is not the same as number of samples." << endl;
exit(3);
}
if (fSamplesUnc.GetSize()!=0){
if (fNumOfSamples != fSamplesUnc.GetSize()){
cout << "Error: Number of given uncertainties for normalisation of samples is not the same as number of samples." << endl;
exit(3);
}
}
if (fNumOfSamples != fHistColors.GetSize()){
cout << "Error: Number of colours given is not the same as number of samples." << endl;
exit(3);
}
if (fNumOfSamples != fHistMarkers.GetSize()){
cout << "Error: Number of markers given is not the same as number of samples." << endl;
exit(3);
}
if (fNumOfSamples < fSamplesToStack.GetEntries() ){
cout << "Error: Number of samples is smaller than the number of samples to stack." << endl;
exit(3);
}
cout << endl;
cout << "-------------------------------------------------------- SteerPlotter " << opt << "-----------------------------------------------" << endl;
cout << "Number of analysis samples to be plotted: " << fNumOfSamples << endl;
if (fCycleName.Length()>0){
cout << "Cylcle Name (used as prefix for root files): " << fCycleName << endl;
}
for (Int_t i=0; i<fNumOfSamples; ++i){
TString name(((TObjString*) fSampleNames.At(i))->GetName() );
cout << "File of sample " << i << ": " << setw(25) << ((TObjString*)fInputFiles.At(i))->GetName()
<< " name = " << setw(15) << name
<< " color = " << setw(4) << fHistColors.At(i)
<< " marker = " << setw(4) << fHistMarkers.At(i)
<< " with weight " << fSamplesWeight.At(i);
if (fSamplesUnc.GetSize()!=0){
cout << " and uncertainty of " << fSamplesUnc.At(i)*100 << "%" << endl;
} else {
cout << endl;
}
}
cout << "Output Ps File: " << fOutputPsFile << endl;
cout << endl;
if (fNumOfSamplesToStack>0){
cout << "These samples will be stacked:" << endl;
for (Int_t i=0; i<fNumOfSamplesToStack; ++i){
TString name(((TObjString*) fSamplesToStack.At(i))->GetName() );
cout << " Name of sample " << i << " in stack : " << setw(15) << name << endl;
}
} else {
cout << "No stacking will be plotted." << endl;
}
if (bPlotThetaFile){
if (fScaleSysUnc.GetEntries()>0){
cout << endl;
if (fScaleSysUnc.GetEntries() != fSysUncWeight.GetSize()){
cout << "Error: inconsistent number of entries in fScaleSysUnc and fSysUncWeight! Arrays must have same length, please correct steering." << endl;
exit(3);
}
cout << "Systematic errors will be scaled with these factors:" << endl;
for (Int_t i=0; i<fScaleSysUnc.GetEntries(); ++i){
TString name(((TObjString*) fScaleSysUnc.At(i))->GetName() );
cout << " Name of systematic unc " << i << " = " << setw(15) << name << " scale with factor : " << fSysUncWeight.At(i) << endl;
}
}
}
if (bSubstractBkgd){
cout << "Background will be substracted from sample 0: " << (((TObjString*) fSampleNames.At(0))->GetName() ) << endl;
} else {
cout << "No background substraction" << endl;
}
cout << (bRatioPlot? "Ratios will be plotted." : "No ratios will be plotted") << endl;
if (bRatioPlot){
cout << (bZScoreInRatio? "Z-Score will be plotted in bottom pad." : "Usual data/MC ratios will be plotted in bottom pad.") << endl;
}
cout << (bDrawEntries? "Number of histogram entries will be plotted." : "Number of histogram entries will not be plotted") << endl;
cout << (bDrawLumi? "Lumi inforamtion will be plotted." : "Lumi inforamtion will not be plotted") << endl;
cout << "Integrated luminosity = " << fLumi << " fb-1" << endl;
if (fSysError>0){
cout << "Normalisation error of " << fSysError*100 << "% will be drawn." << endl;
} else {
cout << "No normalisation error will be drawn." << endl;
}
cout << (bDrawLegend? "Legend will be plotted everywhere." : "Legend will be plotted on first plot only") << endl;
cout << (bShapeNorm? "Shape normalization" : "No shape normalization") << endl;
cout << (bDoCumulative? "Cumulative distributions will be plotted." : "Normal distributions will be plotted") << endl;
cout << (bSingleEPS? "Creating one eps file per histogram." : "Creating one ps file with all histograms for each histogram collection.") << endl;
cout << (bIgnoreEmptyBins? "Empty bins will not be plotted in the ratio." : "Empty bins will have infinite error in the ratio.") << endl;
cout << (bLumiNorm? "Luminosity normalization" : "No lumi normalization") << endl;
cout << (bPortrait? "Setting the page to portrait mode" : "Setting the page to landscape mode") << endl;
cout << (bPlotThetaFile? "Creating plots from one input theta file." : "Using standard SFrame output for plots.") << endl;
cout << "--------------------------------------------------------------------------------------------------------------------" << endl;
}
void SteerPlotter::SetShapeNorm(Bool_t flag){bShapeNorm = flag;}
Bool_t SteerPlotter::GetShapeNorm(){return bShapeNorm;}
void SteerPlotter::SetLumiNorm(Bool_t flag){bLumiNorm = flag;}
Bool_t SteerPlotter::GetLumiNorm(){return bLumiNorm;}
void SteerPlotter::SetRatioPlot(Bool_t flag){bRatioPlot = flag;}
Bool_t SteerPlotter::GetRatioPlot(){return bRatioPlot;}
void SteerPlotter::SetZScoreInRatio(Bool_t flag){bZScoreInRatio = flag;}
Bool_t SteerPlotter::GetZScoreInRatio(){return bZScoreInRatio;}
void SteerPlotter::SetPortrait(Bool_t flag){bPortrait = flag;}
Bool_t SteerPlotter::GetPortrait(){return bPortrait;}
void SteerPlotter::SetFitPtBalanceHists(Bool_t flag){bFitPtBalanceHists = flag;}
Bool_t SteerPlotter::GetFitPtBalanceHists(){return bFitPtBalanceHists;}
void SteerPlotter::SetDrawEntries(Bool_t flag){bDrawEntries = flag;}
Bool_t SteerPlotter::GetDrawEntries(){return bDrawEntries;}
void SteerPlotter::SetDrawLumi(Bool_t flag){bDrawLumi = flag;}
Bool_t SteerPlotter::GetDrawLumi(){return bDrawLumi;}
void SteerPlotter::SetForPrelim(Bool_t flag){bForPrelim = flag;}
Bool_t SteerPlotter::GetForPrelim(){return bForPrelim;}
void SteerPlotter::SetForPublication(Bool_t flag){bForPublication = flag;}
Bool_t SteerPlotter::GetForPublication(){return bForPublication;}
void SteerPlotter::SetDrawLegend(Bool_t flag){bDrawLegend = flag;}
Bool_t SteerPlotter::GetDrawLegend(){return bDrawLegend;}
void SteerPlotter::SetDoCumulative(Bool_t flag){bDoCumulative = flag;}
Bool_t SteerPlotter::GetDoCumulative(){return bDoCumulative;}
void SteerPlotter::SetSingleEPS(Bool_t flag){bSingleEPS = flag;}
Bool_t SteerPlotter::GetSingleEPS(){return bSingleEPS;}
void SteerPlotter::SetIgnoreEmptyBins(Bool_t flag){bIgnoreEmptyBins = flag;}
Bool_t SteerPlotter::GetIgnoreEmptyBins(){return bIgnoreEmptyBins;}
void SteerPlotter::SetPlotThetaFile(Bool_t flag){bPlotThetaFile = flag;}
Bool_t SteerPlotter::GetPlotThetaFile(){return bPlotThetaFile;}
void SteerPlotter::SetJetShapesPerSlice(Bool_t flag){bJetShapesPerSlice = flag;}
Bool_t SteerPlotter::GetJetShapesPerSlice(){return bJetShapesPerSlice;}
void SteerPlotter::SetLogy(Bool_t flag){bLogy = flag;}
Bool_t SteerPlotter::GetLogy(){return bLogy;}
void SteerPlotter::SetLumi(Float_t lumi){fLumi = lumi;}
Float_t SteerPlotter::GetLumi(){return fLumi;}
void SteerPlotter::SetSysError(Float_t err){fSysError = err;}
Float_t SteerPlotter::GetSysError(){return fSysError;}
void SteerPlotter::SetSampleNames(const char* in) {
this->SplitString(in,",",&fSampleNames);
fNumOfSamples = fSampleNames.GetEntries();
}
TObjArray* SteerPlotter::GetSampleNames(){return &fSampleNames;}
void SteerPlotter::SetInputFiles(const char* in){ this->SplitString(in,",",&fInputFiles);}
TObjArray* SteerPlotter::GetInputFiles() {return &fInputFiles;}
void SteerPlotter::SetOutputPsFile(const char* in) {fOutputPsFile = in;}
const char* SteerPlotter::GetOutputPsFile() {return fOutputPsFile.Data();}
void SteerPlotter::SetCycleName(const char* in) {fCycleName = in;}
const char* SteerPlotter::GetCycleName() {return fCycleName.Data();}
void SteerPlotter::SetLegStrings(const char* in){this->SplitString(in,",",&fLegStrings);}
TObjArray* SteerPlotter::GetLegStrings() {return &fLegStrings;}
void SteerPlotter::SetHistColors(const char* in){this->StringToArray(in, fHistColors);}
TArrayI SteerPlotter::GetHistColors(){return fHistColors;}
void SteerPlotter::SetHistMarkers(const char* in){this->StringToArray(in, fHistMarkers);}
TArrayI SteerPlotter::GetHistMarkers(){return fHistMarkers;}
void SteerPlotter::SetSamplesToStack(const char* in){ this->SplitString(in,",",&fSamplesToStack); fNumOfSamplesToStack = fSamplesToStack.GetEntries();}
TObjArray* SteerPlotter::GetSamplesToStack(){return &fSamplesToStack;}
void SteerPlotter::SetScaleSysUnc(const char* in){ this->SplitString(in,",",&fScaleSysUnc);}
TObjArray* SteerPlotter::GetScaleSysUnc(){return &fScaleSysUnc;}
void SteerPlotter::SetSysUncWeight(const char* in){ this->StringToArray(in, fSysUncWeight);}
TArrayF SteerPlotter::GetSysUncWeight(){return fSysUncWeight;}
void SteerPlotter::SetSamplesWeight(const char* in){ this->StringToArray(in, fSamplesWeight);}
TArrayF SteerPlotter::GetSamplesWeight(){return fSamplesWeight;}
void SteerPlotter::SetSamplesUnc(const char* in){ this->StringToArray(in, fSamplesUnc);}
TArrayF SteerPlotter::GetSamplesUnc(){return fSamplesUnc;}
void SteerPlotter::SetSubstractBkgd(Bool_t flag){ bSubstractBkgd = flag; }
Bool_t SteerPlotter::GetSubstractBkgd(){ return bSubstractBkgd; }