1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
#include <fstream>
|
5 |
|
|
#include <pthread.h>
|
6 |
|
|
#include <assert.h>
|
7 |
buchmann |
1.16 |
#include <cctype>
|
8 |
buchmann |
1.1 |
|
9 |
|
|
#include <TCut.h>
|
10 |
|
|
#include <TROOT.h>
|
11 |
|
|
#include <TCanvas.h>
|
12 |
|
|
#include <TMath.h>
|
13 |
|
|
#include <TColor.h>
|
14 |
|
|
#include <TPaveText.h>
|
15 |
|
|
#include <TRandom.h>
|
16 |
|
|
#include <TH1.h>
|
17 |
|
|
#include <TH2.h>
|
18 |
|
|
#include <TF1.h>
|
19 |
|
|
#include <TSQLResult.h>
|
20 |
|
|
#include <TProfile.h>
|
21 |
|
|
#include <TKey.h>
|
22 |
|
|
|
23 |
buchmann |
1.9 |
#include "ShapeDroplet.C"
|
24 |
|
|
#include "ShapeLimit.C"
|
25 |
buchmann |
1.22 |
//#include "EdgeLimit.C"
|
26 |
buchmann |
1.9 |
|
27 |
buchmann |
1.1 |
using namespace std;
|
28 |
|
|
|
29 |
|
|
using namespace PlottingSetup;
|
30 |
|
|
|
31 |
buchmann |
1.13 |
void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float peakerrordata, float njobs, float jobnumber, bool systonly, bool effonly,bool shapeanalysis);
|
32 |
|
|
|
33 |
|
|
bool isValidShapeResult(ShapeDroplet droplet) {
|
34 |
buchmann |
1.17 |
if(droplet.isValid==false) return false;
|
35 |
buchmann |
1.13 |
if(droplet.observed>50000) {
|
36 |
|
|
// error code of ShapeLimit/CreateModel.sh, invoked if there were too many errors during computation
|
37 |
|
|
write_warning(__FUNCTION__,"Shape limit was ridiculously high ("+any2string(droplet.observed)+"); this is a typical error signature of the combine tool. Shape result will be discarded, and c&c will be carried out instead.");
|
38 |
|
|
return false;
|
39 |
|
|
}
|
40 |
|
|
if(droplet.observed==-12345) {
|
41 |
|
|
write_warning(__FUNCTION__,"Shape limit was ("+any2string(droplet.observed)+"); this is the error signature of CreateModel.sh / ShapeDroplet. Shape result will be discarded, and c&c will be carried out instead.");
|
42 |
|
|
return false;
|
43 |
|
|
}
|
44 |
|
|
if(droplet.expected>-1&&droplet.expected==0&&droplet.observed>5000) {
|
45 |
|
|
write_warning(__FUNCTION__,"Observed shape limit was ("+any2string(droplet.observed)+") while expected limit was "+any2string(droplet.expected)+"; this is a typical error signature of the combine tool. Shape result will be discarded, and c&c will be carried out instead.");
|
46 |
|
|
return false;
|
47 |
|
|
}
|
48 |
|
|
if(droplet.expected>-1&&droplet.expected/droplet.observed>50) {
|
49 |
|
|
write_warning(__FUNCTION__,"Observed shape limit was ("+any2string(droplet.observed)+") while expected limit was "+any2string(droplet.expected)+"; such a high ratio between expected & observed limit is a typical error signature of the combine tool. Shape result will be discarded, and c&c will be carried out instead.");
|
50 |
|
|
return false;
|
51 |
|
|
}
|
52 |
|
|
if(droplet.expected>-1&&droplet.observed/droplet.expected>50) {
|
53 |
|
|
write_warning(__FUNCTION__,"Observed shape limit was ("+any2string(droplet.observed)+") while expected limit was "+any2string(droplet.expected)+"; such a high ratio between observed & expected limit is a typical error signature of the combine tool. Shape result will be discarded, and c&c will be carried out instead.");
|
54 |
|
|
return false;
|
55 |
|
|
}
|
56 |
|
|
return true;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
buchmann |
1.1 |
void susy_scan_axis_labeling(TH2F *histo) {
|
60 |
|
|
histo->GetXaxis()->SetTitle("m_{#Chi_{2}^{0}}-m_{LSP}");
|
61 |
|
|
histo->GetXaxis()->CenterTitle();
|
62 |
|
|
histo->GetYaxis()->SetTitle("m_{#tilde{q}}");
|
63 |
|
|
histo->GetYaxis()->CenterTitle();
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
void prepare_scan_axis(TH2 *variablemap,int scantype) {
|
67 |
|
|
//assuming regular SMS
|
68 |
|
|
variablemap->GetXaxis()->SetTitle("m_{glu}");
|
69 |
|
|
variablemap->GetYaxis()->SetTitle("m_{LSP}");
|
70 |
|
|
|
71 |
|
|
if(scantype==mSUGRA) {
|
72 |
|
|
variablemap->GetXaxis()->SetTitle("m_{0}");
|
73 |
|
|
variablemap->GetYaxis()->SetTitle("m_{1/2}");
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
if(scantype==GMSB) {
|
77 |
|
|
variablemap->GetXaxis()->SetTitle("m_{glu}");
|
78 |
|
|
variablemap->GetYaxis()->SetTitle("m_{NLSP}");
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
variablemap->GetXaxis()->CenterTitle();
|
82 |
|
|
variablemap->GetYaxis()->CenterTitle();
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
void set_SUSY_style() {
|
86 |
|
|
Int_t MyPalette[100];
|
87 |
|
|
Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0};
|
88 |
|
|
Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0};
|
89 |
|
|
Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0};
|
90 |
|
|
Double_t stop[] = {0., .25, .50, .75, 1.0};
|
91 |
|
|
Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 110);
|
92 |
|
|
for (int i=0;i<100;i++) MyPalette[i] = FI+i;
|
93 |
|
|
|
94 |
|
|
gStyle->SetPalette(100, MyPalette);
|
95 |
|
|
|
96 |
|
|
gStyle->SetPadRightMargin(0.15);
|
97 |
|
|
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
bool delete_any_cached_scans() {
|
101 |
buchmann |
1.8 |
char hostname[1023];
|
102 |
|
|
gethostname(hostname,1023);
|
103 |
buchmann |
1.6 |
|
104 |
|
|
|
105 |
|
|
/*
|
106 |
buchmann |
1.1 |
//This should only be called via CRAB
|
107 |
buchmann |
1.14 |
dout << " Deleting all cached files." << endl;
|
108 |
buchmann |
1.1 |
gSystem->Exec("ls -ltrh | grep root");
|
109 |
buchmann |
1.6 |
if(!((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))))
|
110 |
|
|
{
|
111 |
buchmann |
1.1 |
vector<string> all_files;
|
112 |
|
|
char currentpath[1024];
|
113 |
|
|
TString directory=TString(getcwd(currentpath,1024));
|
114 |
|
|
directory=directory+"/";
|
115 |
|
|
process_directory(directory,all_files);
|
116 |
|
|
for(int ifile=0;ifile<all_files.size();ifile++)
|
117 |
|
|
{
|
118 |
|
|
if(Contains(all_files[ifile],"_clean_splitup_")) {
|
119 |
|
|
dout << " About to delete " << all_files[ifile] << endl;
|
120 |
|
|
gSystem->Exec(((string)"rm "+all_files[ifile]).c_str());
|
121 |
|
|
}
|
122 |
|
|
}
|
123 |
buchmann |
1.6 |
return true;
|
124 |
|
|
}
|
125 |
|
|
*/
|
126 |
buchmann |
1.8 |
if(!((Contains(hostname,"t3ui")||Contains(hostname,"t3wn")))) {
|
127 |
buchmann |
1.14 |
dout << "Going to purge files in local_storage that have been loaded!" << endl;
|
128 |
buchmann |
1.15 |
for(int i=0;i<(int)SUSYScanSpace::loaded_files.size();i++) {
|
129 |
buchmann |
1.6 |
gSystem->Exec(((string)"rm "+SUSYScanSpace::loaded_files[i]).c_str());
|
130 |
|
|
dout << " Purging : Deleted file " << SUSYScanSpace::loaded_files[i] << endl;
|
131 |
|
|
}
|
132 |
|
|
}
|
133 |
buchmann |
1.1 |
return true;
|
134 |
|
|
}
|
135 |
|
|
|
136 |
|
|
bool initialized_t2=false;
|
137 |
|
|
|
138 |
|
|
int srmcpretries=0;
|
139 |
|
|
|
140 |
buchmann |
1.8 |
void load_local_scan_sample(int a, int b, int &scanfileindex,int scantype,int mglu, int mlsp, bool isretry=false) {
|
141 |
|
|
stringstream filetoload;
|
142 |
|
|
string samplename;
|
143 |
buchmann |
1.1 |
filetoload << "/shome/buchmann/ntuples/"<<PlottingSetup::ScanSampleDirectory;
|
144 |
buchmann |
1.4 |
if(scantype==mSUGRA) {
|
145 |
|
|
//filetoload << "/mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
146 |
|
|
filetoload.str("");
|
147 |
|
|
filetoload << "/shome/lbaeni/jzb/" << PlottingSetup::ScanSampleDirectory << "/mSUGRA_M0_" << mglu << "__M12_" << mlsp << ".root";
|
148 |
|
|
samplename="mSUGRA";
|
149 |
|
|
// filetoload << "/mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
150 |
|
|
}
|
151 |
|
|
if(scantype==SMS) {
|
152 |
|
|
filetoload << "/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
153 |
|
|
samplename="SMS";
|
154 |
|
|
}
|
155 |
|
|
if(scantype==GMSB) {
|
156 |
|
|
filetoload << "/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
157 |
|
|
samplename="GMSB";
|
158 |
|
|
}
|
159 |
buchmann |
1.9 |
|
160 |
|
|
if(scantype==SMS && Contains(PlottingSetup::ScanSampleDirectory,"T1lh")) {
|
161 |
|
|
filetoload.str("");
|
162 |
|
|
filetoload << "/shome/lbaeni/jzb/" << PlottingSetup::ScanSampleDirectory << "/SMS_MassGlu_" << mglu << "__MassLSP_" << mlsp << ".root";
|
163 |
|
|
samplename="SMS";
|
164 |
|
|
}
|
165 |
|
|
|
166 |
buchmann |
1.3 |
if(scansample.collection.size()<1||!Contains(((scansample.collection)[(scansample.collection).size()-1]).filename,"_"+any2string(a)+"_"+any2string(b))) {
|
167 |
buchmann |
1.1 |
dout << "The last sample is NOT the same one as the current one, possibly popping off last one and adding the new one." << endl;
|
168 |
buchmann |
1.4 |
if((scansample.collection).size()>=1) {
|
169 |
buchmann |
1.1 |
scansample.RemoveLastSample();
|
170 |
|
|
}
|
171 |
|
|
scanfileindex=(scansample.collection).size();
|
172 |
|
|
//New: Loading file when necessary, not before (avoiding high memory usage and startup times)
|
173 |
buchmann |
1.4 |
|
174 |
|
|
scansample.AddSample(filetoload.str(),samplename,1,1,false,true,scanfileindex,kRed);
|
175 |
|
|
dout << "Just added the following file: " << filetoload.str() << endl;
|
176 |
buchmann |
1.1 |
} else {
|
177 |
|
|
dout << "Last sample is the same as the current one. Recycling it." << endl;
|
178 |
|
|
scanfileindex=(scansample.collection).size()-1;
|
179 |
|
|
}
|
180 |
|
|
dout << " Going to use the following file: " << filetoload.str() << endl;
|
181 |
buchmann |
1.8 |
}
|
182 |
|
|
|
183 |
|
|
void load_remote_scan_sample(int a, int b, int &scanfileindex,int scantype,int mglu, int mlsp, bool isretry=false) {
|
184 |
buchmann |
1.1 |
write_info(__FUNCTION__,"Hello, CRAB! Might need to load files ...");
|
185 |
buchmann |
1.8 |
string samplename;
|
186 |
buchmann |
1.1 |
PlottingSetup::limitpatience=PlottingSetup::limitpatienceCRAB;
|
187 |
|
|
stringstream copyfile;
|
188 |
buchmann |
1.4 |
gSystem->Exec("mkdir -p local_storage");
|
189 |
buchmann |
1.1 |
copyfile << "lcg-cp -b -T srmv2 srm://storage01.lcg.cscs.ch:8443/srm/managerv2?SFN=/pnfs/lcg.cscs.ch/cms/trivcat/store/user/buchmann/bussola/" << PlottingSetup::ScanSampleDirectory;
|
190 |
buchmann |
1.4 |
if(scantype==mSUGRA) {
|
191 |
buchmann |
1.5 |
copyfile<< "/mSUGRA_M0_" << mglu << "__M12_" << mlsp << ".root local_storage/mSUGRA_M0_" << mglu << "__M12_" << mlsp << ".root ";
|
192 |
buchmann |
1.4 |
samplename="mSUGRA";
|
193 |
|
|
}
|
194 |
|
|
if(scantype==SMS) {
|
195 |
|
|
copyfile << "/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "local_storage/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root ";
|
196 |
|
|
samplename="SMS";
|
197 |
|
|
}
|
198 |
|
|
if(scantype==GMSB) {
|
199 |
|
|
copyfile << "/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root " << "local_storage/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root ";
|
200 |
|
|
samplename="GMSB";
|
201 |
|
|
}
|
202 |
buchmann |
1.1 |
stringstream newfilename;
|
203 |
buchmann |
1.5 |
// if(scantype==mSUGRA) newfilename << "local_storage/mSUGRA_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
204 |
|
|
if(scantype==mSUGRA) newfilename << "local_storage/mSUGRA_M0_" << mglu << "__M12_" << mlsp << ".root";
|
205 |
buchmann |
1.4 |
if(scantype==SMS) newfilename << "local_storage/SMS_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
206 |
|
|
if(scantype==GMSB) newfilename << "local_storage/GMSB_clean_splitup_" << any2string(a) << "_" << any2string(b) << ".root";
|
207 |
buchmann |
1.1 |
|
208 |
buchmann |
1.6 |
SUSYScanSpace::SUSYscantype=scantype;
|
209 |
|
|
|
210 |
buchmann |
1.7 |
if((scansample.collection).size()==0||!Contains(((scansample.collection)[(scansample.collection).size()-1]).filename,"_"+any2string(a)+"_"+any2string(b))||(a==0&&b==0)&&!initialized_t2) {
|
211 |
buchmann |
1.1 |
dout << "The last sample is NOT the same one as the current one, possibly popping off last one and downloading as well as adding the new one." << endl;
|
212 |
buchmann |
1.5 |
while((scansample.collection).size()>0) {
|
213 |
buchmann |
1.1 |
scansample.RemoveLastSample();
|
214 |
|
|
}
|
215 |
buchmann |
1.14 |
dout << "New scanfileindex stems from scansample size: " << (scansample.collection).size() << endl;
|
216 |
buchmann |
1.1 |
scanfileindex=(scansample.collection).size();
|
217 |
|
|
//New: Loading file when necessary, not before (avoiding high memory usage and startup times)
|
218 |
buchmann |
1.5 |
if(1) {
|
219 |
|
|
if(!doesROOTFileExist(newfilename.str())) {
|
220 |
|
|
dout << "Going to download the scan file with the following copy command: " << copyfile.str() << endl;
|
221 |
buchmann |
1.7 |
int retcode = gSystem->Exec(copyfile.str().c_str()); // download it if it hasn't been downloaded before
|
222 |
|
|
if(retcode==0) SUSYScanSpace::loaded_files.push_back(newfilename.str()); // adding it to the list of loaded files (will be deleted once we finish running
|
223 |
buchmann |
1.5 |
}
|
224 |
buchmann |
1.1 |
if(doesROOTFileExist(newfilename.str())) {
|
225 |
|
|
initialized_t2=true;
|
226 |
buchmann |
1.14 |
dout << "Going to add the following sample: " << newfilename.str() << endl;
|
227 |
buchmann |
1.5 |
gSystem->Exec(("ls -ltrh "+newfilename.str()).c_str());
|
228 |
|
|
scansample.AddSample(newfilename.str(),samplename,1,1,false,true,scanfileindex,kRed);
|
229 |
buchmann |
1.1 |
} else {
|
230 |
|
|
srmcpretries++;
|
231 |
|
|
if(srmcpretries<5) {
|
232 |
|
|
dout << "The file could not be loaded correctly - retrying!" << endl;
|
233 |
|
|
sleep(5);
|
234 |
buchmann |
1.8 |
load_remote_scan_sample(a,b,scanfileindex,scantype,mglu,mlsp,true);
|
235 |
buchmann |
1.1 |
} else {
|
236 |
|
|
dout << "Have tried 5 times to load this sample. Giving up now and failing the program execution" << endl;
|
237 |
buchmann |
1.4 |
assert(srmcpretries<5);
|
238 |
buchmann |
1.1 |
dout << "The command " << copyfile.str() << " failed to copy the file to the local storage (saving it as " << newfilename.str() << ")" << endl;
|
239 |
|
|
}
|
240 |
|
|
}
|
241 |
|
|
}
|
242 |
|
|
} else {
|
243 |
|
|
dout << "Last sample is the same as the current one. Recycling it." << endl;
|
244 |
|
|
scanfileindex=(scansample.collection).size()-1;
|
245 |
|
|
}
|
246 |
buchmann |
1.8 |
}
|
247 |
|
|
|
248 |
|
|
void load_scan_sample(int a, int b, int &scanfileindex,int scantype,int mglu, int mlsp, bool isretry=false) {
|
249 |
|
|
|
250 |
|
|
// There is no need to define your sample here. That is done in Setup.C where you define the loading directory!
|
251 |
buchmann |
1.3 |
|
252 |
buchmann |
1.12 |
SUSYScanSpace::SUSYscantype=scantype;
|
253 |
buchmann |
1.8 |
dout << "Going to load file with Xzone=" << a << " and Yzone=" << b << " for scantype (mSugra: " << (bool)(scantype==mSUGRA) << " , SMS: " << (bool)(scantype==SMS) << " , GMSB: " << (bool)(scantype==GMSB) << ")" << endl;
|
254 |
|
|
char hostname[1023];
|
255 |
|
|
gethostname(hostname,1023);
|
256 |
|
|
if((Contains(hostname,"t3ui")||Contains(hostname,"t3wn"))) load_local_scan_sample(a,b,scanfileindex,scantype,mglu,mlsp,isretry);
|
257 |
|
|
else load_remote_scan_sample(a,b,scanfileindex,scantype,mglu,mlsp,isretry);
|
258 |
buchmann |
1.1 |
}
|
259 |
|
|
|
260 |
buchmann |
1.3 |
/*float get_xs(float &altxs, float mglu, float mlsp, string massgluname, string massLSPname, map < pair<float, float>, map<string, float> > &xsec, string mcjzb, bool requireZ) {
|
261 |
buchmann |
1.1 |
altxs=0;
|
262 |
buchmann |
1.3 |
for(int iproc=1;iproc<=10;iproc++) altxs+=GetXSecForPointAndChannel(mglu,mlsp,xsec,iproc);
|
263 |
buchmann |
1.1 |
return altxs;
|
264 |
buchmann |
1.3 |
}*/
|
265 |
buchmann |
1.1 |
|
266 |
|
|
void establish_SUSY_limits(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, TFile *fsyst, int ibin,float njobs=-1, float jobnumber=-1) {
|
267 |
|
|
bool runninglocally=true;
|
268 |
|
|
if(njobs>-1&&jobnumber>-1) {
|
269 |
|
|
runninglocally=false;
|
270 |
|
|
dout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ") for a jzb cut at " << jzb_cut[ibin] << endl;
|
271 |
|
|
} else {
|
272 |
|
|
dout << "Running locally " << endl;
|
273 |
|
|
dout << "This will take a really, really long time - if you want to see the results within hours instead of weeks try running the worker script on the grid (DistributedModelCalculation/Limits/)" << endl;
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
string massgluname="MassGlu";
|
277 |
|
|
string massLSPname="MassLSP";
|
278 |
|
|
jzbSel=jzb_cut[ibin];
|
279 |
|
|
geqleq="geq";
|
280 |
|
|
automatized=true;
|
281 |
|
|
mcjzbexpression=mcjzb;
|
282 |
|
|
|
283 |
|
|
string prefix="SMS_";
|
284 |
|
|
// up to here, everything is set up for SMS; now we need to switch stuff around if we're dealing with an mSUGRA scan!
|
285 |
|
|
int scantype=SMS;
|
286 |
|
|
TIter nextkey(fsyst->GetListOfKeys());
|
287 |
|
|
TKey *key;
|
288 |
|
|
while ((key = (TKey*)nextkey()))
|
289 |
|
|
{
|
290 |
|
|
TObject *obj = key->ReadObj();
|
291 |
buchmann |
1.4 |
if(Contains((string)(obj->GetName()),"SUGRA")) scantype=mSUGRA;
|
292 |
buchmann |
1.1 |
if(Contains((string)(obj->GetName()),"GMSB")) scantype=GMSB;
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
map < pair<float, float>, map<string, float> > xsec;
|
296 |
|
|
|
297 |
|
|
if(scantype==mSUGRA) {
|
298 |
|
|
massgluname="M0"; // this is the "x axis" in the limit plot (like the gluino in the SMS case)
|
299 |
|
|
massLSPname="M12"; // this is the "y axis" in the limit plot (like the LSP in the SMS case)
|
300 |
|
|
mglustart=m0start;
|
301 |
buchmann |
1.10 |
xsec=getXsec(PlottingSetup::cbafbasedir+"/"+mSUGRAxsFile);
|
302 |
|
|
|
303 |
buchmann |
1.1 |
mgluend=m0end;
|
304 |
|
|
mglustep=m0step;
|
305 |
|
|
mLSPstart=m12start;
|
306 |
|
|
mLSPend=m12end;
|
307 |
|
|
mLSPstep=m12step;
|
308 |
|
|
prefix="mSUGRA_";
|
309 |
|
|
dout << "mSUGRA scan has been set up." << endl;
|
310 |
|
|
}
|
311 |
|
|
if(scantype==SMS) {
|
312 |
|
|
dout << "SMS scan has been set up." << endl;
|
313 |
|
|
write_warning(__FUNCTION__,"Don't have the correct XS file yet");
|
314 |
|
|
}
|
315 |
|
|
if(scantype==GMSB) {
|
316 |
|
|
string massgluname="MassGMSBGlu";
|
317 |
|
|
string massLSPname="MassGMSBChi";
|
318 |
|
|
prefix="GMSB_";
|
319 |
|
|
dout << "GMSB scan has been set up." << endl;
|
320 |
|
|
write_warning(__FUNCTION__,"Don't have the correct XS file yet");
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
set_SUSY_style();
|
324 |
buchmann |
1.19 |
std::cout << __LINE__ << std::endl;
|
325 |
buchmann |
1.1 |
|
326 |
|
|
TCanvas *limcanvas = new TCanvas("limcanvas","Limit canvas");
|
327 |
|
|
|
328 |
|
|
int Npoints=0;
|
329 |
|
|
for(int mglu=(int)mglustart;mglu<=mgluend;mglu+=(int)mglustep) {
|
330 |
|
|
for (int mlsp=(int)mLSPstart;mlsp<=mLSPend&&(scantype==mSUGRA||mlsp<=mglu);mlsp+=(int)mLSPstep) Npoints++;
|
331 |
|
|
}
|
332 |
|
|
TH2F *mceff = (TH2F*)fsyst->Get((prefix+"efficiencymap"+any2string(jzb_cut[ibin])).c_str());
|
333 |
|
|
//write_warning(__FUNCTION__,"Currently the efficiencymap name was switched to Pablo's convention. This NEEDS to be switched BACK!");TH2F *mceff = (TH2F*)fsyst->Get(("efficiency_jzbdiff"+any2string(jzb_cut[ibin])).c_str());
|
334 |
|
|
TH2F *fullerr = (TH2F*)fsyst->Get((prefix+"systotmap"+any2string(jzb_cut[ibin])).c_str());
|
335 |
|
|
TH2F *NEvents = (TH2F*)fsyst->Get((prefix+"Neventsmap"+any2string(jzb_cut[ibin])).c_str());
|
336 |
|
|
TH2F *lflip = (TH2F*)fsyst->Get((prefix+"flipmap"+any2string(jzb_cut[ibin])).c_str());
|
337 |
buchmann |
1.3 |
TH2F *XSmap = (TH2F*)fsyst->Get((prefix+"XS"+any2string(jzb_cut[ibin])).c_str());
|
338 |
buchmann |
1.1 |
|
339 |
|
|
TH2F *limitmap = new TH2F((prefix+"limitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//observed limit
|
340 |
|
|
TH2F *explimitmap = new TH2F((prefix+"explimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit
|
341 |
|
|
TH2F *exp1plimitmap = new TH2F((prefix+"exp1plimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit + 1 sigma
|
342 |
|
|
TH2F *exp2plimitmap = new TH2F((prefix+"exp2plimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit + 2 sigma
|
343 |
|
|
TH2F *exp1mlimitmap = new TH2F((prefix+"exp1mlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit - 1 sigma
|
344 |
|
|
TH2F *exp2mlimitmap = new TH2F((prefix+"exp2mlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit - 2 sigma
|
345 |
|
|
|
346 |
|
|
TH2F *exclmap = new TH2F((prefix+"exclusionmap"+any2string(jzb_cut[ibin])).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
347 |
|
|
TH2F *flipmap = new TH2F((prefix+"limitflipmap"+any2string(jzb_cut[ibin])).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
348 |
buchmann |
1.5 |
TH2F *asymptoticmap = new TH2F((prefix+"asymptoticmap"+any2string(jzb_cut[ibin])).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
349 |
buchmann |
1.1 |
|
350 |
|
|
|
351 |
|
|
if(!fullerr || !mceff || !NEvents) {
|
352 |
|
|
write_error(__FUNCTION__,"The supplied systematics file did not contain the correct histograms - please check the file");
|
353 |
|
|
dout << "mc eff address: " << mceff << " , error address: " << fullerr << " , NEvents address: " << NEvents << endl;
|
354 |
|
|
delete limcanvas;
|
355 |
|
|
return;
|
356 |
|
|
}
|
357 |
|
|
|
358 |
|
|
bool doexpected=true;
|
359 |
|
|
|
360 |
|
|
int ipoint=-1;
|
361 |
|
|
for(int mglu=(int)mglustart;mglu<=mgluend;mglu+=(int)mglustep) {
|
362 |
|
|
for (int mlsp=(int)mLSPstart;mlsp<=mLSPend&&(scantype==mSUGRA||mlsp<=mglu);mlsp+=(int)mLSPstep)
|
363 |
|
|
{
|
364 |
|
|
ipoint++;
|
365 |
|
|
if(!runninglocally&&!do_this_point(ipoint,(int)Npoints,(int)jobnumber,(int)njobs)) continue;
|
366 |
|
|
int GlobalBin=flipmap->FindBin(mglu,mlsp);
|
367 |
|
|
float currmceff=mceff->GetBinContent(mceff->FindBin(mglu,mlsp));
|
368 |
|
|
float currtoterr=(fullerr->GetBinContent(fullerr->FindBin(mglu,mlsp)))*currmceff;
|
369 |
|
|
float nevents=NEvents->GetBinContent(NEvents->FindBin(mglu,mlsp));
|
370 |
|
|
int flipped = (int)(lflip->GetBinContent(lflip->FindBin(mglu,mlsp)));
|
371 |
|
|
flipmap->SetBinContent(GlobalBin,flipped);
|
372 |
|
|
dout << "Looking at point " << ipoint << " / " << Npoints << " with masses " << massgluname << " = " << mglu << " and " << massLSPname << " = " << mlsp << endl;
|
373 |
|
|
dout << "Found : MCeff=" << currmceff << " and total error=" << currtoterr << " and Nevents=" << nevents << endl;
|
374 |
|
|
string plotfilename=(string)(TString(massgluname)+TString(any2string(mglu))+TString("__")+TString(massLSPname)+TString(any2string(mlsp))+TString(".png"));
|
375 |
|
|
if(currmceff<=0||currtoterr<=0||nevents==0) {
|
376 |
|
|
dout << " Nothing to work with, skipping this point." << endl;
|
377 |
|
|
continue;
|
378 |
|
|
}
|
379 |
|
|
vector<float> sigmas;
|
380 |
buchmann |
1.9 |
if(scantype!=mSUGRA) {
|
381 |
|
|
sigmas=compute_one_upper_limit(currmceff,currtoterr,ibin,mcjzb,plotfilename,true, flipped,true);
|
382 |
|
|
write_warning(__FUNCTION__,"Temporarily doing asymptotic limits!!!!");
|
383 |
|
|
}
|
384 |
buchmann |
1.3 |
else {
|
385 |
|
|
//this is a bit trickier - what we want to do is compute the limit fast, and if it is in [0.5 xs, 2xs], compute it again but "correctly"!
|
386 |
|
|
vector<float> asigmas;
|
387 |
|
|
asigmas=compute_one_upper_limit(currmceff,currtoterr,ibin,mcjzb,plotfilename,true, flipped,true); // asymptotic limit first
|
388 |
|
|
float strength=asigmas[0]/XSmap->GetBinContent(GlobalBin);
|
389 |
buchmann |
1.9 |
/* if(strength>0.5&&strength<2) {
|
390 |
buchmann |
1.5 |
sigmas=compute_one_upper_limit(currmceff,currtoterr,ibin,mcjzb,plotfilename,true, flipped); // asymptotic limit first
|
391 |
|
|
asymptoticmap->SetBinContent(GlobalBin,0);
|
392 |
buchmann |
1.9 |
} else {*/
|
393 |
buchmann |
1.5 |
sigmas=asigmas;
|
394 |
|
|
asymptoticmap->SetBinContent(GlobalBin,1);
|
395 |
buchmann |
1.9 |
/* }*/
|
396 |
buchmann |
1.3 |
exclmap->SetBinContent(GlobalBin,strength);
|
397 |
|
|
}
|
398 |
|
|
|
399 |
buchmann |
1.1 |
if(sigmas[0]>0) limitmap->SetBinContent(GlobalBin,sigmas[0]); //anything else is an error code
|
400 |
|
|
if(sigmas.size()>1) {
|
401 |
|
|
explimitmap->SetBinContent(GlobalBin,sigmas[1]);
|
402 |
|
|
exp1plimitmap->SetBinContent(GlobalBin,sigmas[2]);
|
403 |
|
|
exp1mlimitmap->SetBinContent(GlobalBin,sigmas[3]);
|
404 |
|
|
exp2plimitmap->SetBinContent(GlobalBin,sigmas[4]);
|
405 |
|
|
exp2mlimitmap->SetBinContent(GlobalBin,sigmas[5]);
|
406 |
|
|
}
|
407 |
|
|
|
408 |
|
|
dout << "An upper limit has been added for this point ( " << massgluname << " = " << mglu << " and " << massLSPname << " = " << mlsp << " ) at " << sigmas[0] << endl;
|
409 |
|
|
}
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
prepare_scan_axis(limitmap,scantype);
|
413 |
buchmann |
1.6 |
gSystem->Exec("mkdir -p output");
|
414 |
buchmann |
1.1 |
TFile *outputfile=new TFile(("output/DistributedLimitsFromSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");//needs to be "UPDATE" as we can get to this point for different JZB cuts and don't want to erase the previous data :-)
|
415 |
|
|
outputfile->cd();
|
416 |
|
|
limitmap->Write();
|
417 |
buchmann |
1.8 |
XSmap->Write();
|
418 |
buchmann |
1.1 |
flipmap->Write();
|
419 |
buchmann |
1.5 |
asymptoticmap->Write();
|
420 |
buchmann |
1.1 |
if(doexpected) {
|
421 |
|
|
explimitmap->Write();
|
422 |
|
|
exp1plimitmap->Write();
|
423 |
|
|
exp1mlimitmap->Write();
|
424 |
|
|
exp2plimitmap->Write();
|
425 |
|
|
exp2mlimitmap->Write();
|
426 |
|
|
}
|
427 |
buchmann |
1.5 |
if(scantype==mSUGRA) exclmap->Write();
|
428 |
buchmann |
1.1 |
outputfile->Close();
|
429 |
|
|
delete limcanvas;
|
430 |
|
|
}
|
431 |
|
|
|
432 |
|
|
void establish_SUSY_limits(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, string fsystfilename, float njobs=-1, float jobnumber=-1) {
|
433 |
|
|
dout << "Starting the SUSY scan from systematics file now with all " << jzb_cut.size() << " bin(s)" << " and using " << fsystfilename << endl;
|
434 |
|
|
TFile *fsyst = new TFile(fsystfilename.c_str());
|
435 |
|
|
if(!fsyst) {
|
436 |
|
|
write_error(__FUNCTION__,"You provided an invalid systematics file. Please change it ... ");
|
437 |
|
|
return;
|
438 |
|
|
}
|
439 |
buchmann |
1.15 |
for(int ibin=0;ibin<(int)jzb_cut.size();ibin++) {
|
440 |
buchmann |
1.1 |
establish_SUSY_limits(mcjzb,datajzb,jzb_cut,requireZ, peakerror, fsyst, ibin,njobs, jobnumber);
|
441 |
|
|
}
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
|
445 |
buchmann |
1.16 |
string SimpleFormat(string input) {
|
446 |
|
|
string output;
|
447 |
|
|
for (unsigned int i=0; i<input.length();i++) {
|
448 |
|
|
if (isalnum(input[i])) //If current character is alpha-numeric
|
449 |
|
|
output+= input[i]; //Add the character to strConverted
|
450 |
|
|
|
451 |
|
|
}
|
452 |
|
|
return output;
|
453 |
|
|
}
|
454 |
buchmann |
1.1 |
|
455 |
|
|
|
456 |
buchmann |
1.18 |
vector<float> scan_SUSY_parameter_space_for_one_cut(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float peakerrordata, int ibin,float njobs=-1, float jobnumber=-1, bool systematicsonly=false,bool efficiencyonly=false, bool shapeanalysis=false,string specialfilename="") {
|
457 |
|
|
//note: njobs==-2 means that we're running a benchmark point
|
458 |
buchmann |
1.19 |
dout << "Starting the SUSY scan now with " << jzb_cut[ibin] << " (bin #" << ibin << " )" << endl;
|
459 |
|
|
dout << " mcjzb: " << mcjzb << endl;
|
460 |
|
|
dout << " datajzb: " << datajzb << endl;
|
461 |
|
|
dout << " jzb_cuts: ";
|
462 |
buchmann |
1.21 |
for(int ib=0;ib<(int)jzb_cut.size()-1;ib++) dout << jzb_cut[ib] << ", ";
|
463 |
buchmann |
1.19 |
dout << jzb_cut[jzb_cut.size()-1] << endl;
|
464 |
|
|
dout << " requireZ: " << requireZ << endl;
|
465 |
|
|
dout << " Peak error: " << peakerror << endl;
|
466 |
|
|
dout << " Data Peak e: " << peakerrordata << endl;
|
467 |
|
|
dout << " NJobs : " << njobs << endl;
|
468 |
|
|
dout << " Job num: " << jobnumber << endl;
|
469 |
|
|
dout << " Syst only? " << systematicsonly << endl;
|
470 |
|
|
dout << " Eff only? " << efficiencyonly << endl;
|
471 |
|
|
dout << " Shape analysis?" << shapeanalysis << endl;
|
472 |
|
|
dout << " Special file name? \"" << specialfilename<< "\"" << endl;
|
473 |
|
|
|
474 |
buchmann |
1.18 |
vector<float> empty;
|
475 |
buchmann |
1.9 |
|
476 |
buchmann |
1.18 |
if(shapeanalysis&&ibin>0) return empty; // pointless since we're doing a shape analysis :-)
|
477 |
buchmann |
1.9 |
|
478 |
buchmann |
1.1 |
bool runninglocally=true;
|
479 |
|
|
if(njobs>-1&&jobnumber>-1) {
|
480 |
|
|
runninglocally=false;
|
481 |
buchmann |
1.2 |
dout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
|
482 |
buchmann |
1.1 |
dout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ") for a jzb cut at " << jzb_cut[ibin] << endl;
|
483 |
|
|
} else {
|
484 |
|
|
dout << "Running locally " << endl;
|
485 |
buchmann |
1.18 |
if(njobs>-2) dout << "If you are running more than one point and you want to see the results THIS month try running scripts from DistributedModelCalculation" << endl;
|
486 |
buchmann |
1.1 |
}
|
487 |
|
|
|
488 |
|
|
jzbSel=jzb_cut[ibin];
|
489 |
buchmann |
1.13 |
if(shapeanalysis) jzbSel=0;
|
490 |
buchmann |
1.1 |
geqleq="geq";
|
491 |
|
|
automatized=true;
|
492 |
|
|
mcjzbexpression=mcjzb;
|
493 |
|
|
|
494 |
|
|
string massgluname="MassGlu";
|
495 |
|
|
string massLSPname="MassLSP";
|
496 |
|
|
|
497 |
|
|
string prefix="SMS_";
|
498 |
|
|
// up to here, everything is set up for SMS; now we need to switch stuff around if we're dealing with an mSUGRA scan!
|
499 |
|
|
int scantype=SMS;
|
500 |
buchmann |
1.19 |
write_info(__FUNCTION__,PlottingSetup::ScanSampleDirectory);
|
501 |
buchmann |
1.9 |
if(Contains((PlottingSetup::ScanSampleDirectory),"SUGRA")) scantype=mSUGRA;
|
502 |
|
|
if(Contains((PlottingSetup::ScanSampleDirectory),"GMSB")) scantype=GMSB;
|
503 |
buchmann |
1.1 |
|
504 |
|
|
if(scantype==mSUGRA) {
|
505 |
|
|
massgluname="M0"; // this is the "x axis" in the limit plot (like the gluino in the SMS case)
|
506 |
|
|
massLSPname="M12"; // this is the "y axis" in the limit plot (like the LSP in the SMS case)
|
507 |
|
|
mglustart=m0start;
|
508 |
|
|
mgluend=m0end;
|
509 |
|
|
mglustep=m0step;
|
510 |
|
|
mLSPstart=m12start;
|
511 |
|
|
mLSPend=m12end;
|
512 |
|
|
mLSPstep=m12step;
|
513 |
|
|
prefix="mSUGRA_";
|
514 |
|
|
dout << "mSUGRA scan has been set up." << endl;
|
515 |
|
|
}
|
516 |
|
|
if(scantype==SMS) {
|
517 |
|
|
dout << "SMS scan has been set up." << endl;
|
518 |
|
|
}
|
519 |
|
|
if(scantype==GMSB) {
|
520 |
|
|
dout << "GMSB scan has been set up." << endl;
|
521 |
|
|
prefix="GMSB_";
|
522 |
|
|
massgluname="MassGMSBGlu"; // this is the "x axis" in the limit plot (like the gluino in the SMS case)
|
523 |
|
|
massLSPname="MassGMSBChi"; // this is the "y axis" in the limit plot (like the LSP in the SMS case)
|
524 |
|
|
}
|
525 |
|
|
|
526 |
|
|
Int_t MyPalette[100];
|
527 |
|
|
Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0};
|
528 |
|
|
Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0};
|
529 |
|
|
Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0};
|
530 |
|
|
Double_t stop[] = {0., .25, .50, .75, 1.0};
|
531 |
|
|
Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 110);
|
532 |
|
|
for (int i=0;i<100;i++) MyPalette[i] = FI+i;
|
533 |
|
|
|
534 |
|
|
gStyle->SetPalette(100, MyPalette);
|
535 |
|
|
|
536 |
buchmann |
1.12 |
TH2F *rawlimitmap = new TH2F((prefix+"rawlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//observed limit
|
537 |
|
|
TH2F *rawelimitmap = new TH2F((prefix+"rawelimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//observed limit
|
538 |
|
|
|
539 |
buchmann |
1.1 |
TH2F *limitmap = new TH2F((prefix+"limitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//observed limit
|
540 |
|
|
TH2F *explimitmap = new TH2F((prefix+"explimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit
|
541 |
|
|
TH2F *exp1plimitmap = new TH2F((prefix+"exp1plimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit + 1 sigma
|
542 |
|
|
TH2F *exp2plimitmap = new TH2F((prefix+"exp2plimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit + 2 sigma
|
543 |
|
|
TH2F *exp1mlimitmap = new TH2F((prefix+"exp1mlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit - 1 sigma
|
544 |
|
|
TH2F *exp2mlimitmap = new TH2F((prefix+"exp2mlimitmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);//expected limit - 2 sigma
|
545 |
|
|
|
546 |
buchmann |
1.2 |
TH2F *exclmap = new TH2F((prefix+"exclusionmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
547 |
|
|
TH2F *sysjesmap = new TH2F((prefix+"sysjes"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
548 |
|
|
TH2F *sysjsumap = new TH2F((prefix+"sysjsu"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
549 |
|
|
TH2F *sysresmap = new TH2F((prefix+"sysresmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
550 |
|
|
TH2F *efficiencymap = new TH2F((prefix+"efficiencymap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
551 |
|
|
TH2F *efficiencymapmet = new TH2F((prefix+"efficiencymapmet"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
552 |
|
|
TH2F *efficiencymapAcc = new TH2F((prefix+"efficiencymapAcc"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
553 |
|
|
TH2F *efficiencymapID = new TH2F((prefix+"efficiencymapID"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
554 |
buchmann |
1.1 |
TH2F *efficiencymapJets = new TH2F((prefix+"efficiencymapJets"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
555 |
|
|
TH2F *efficiencymapSignal = new TH2F((prefix+"efficiencymapSignal"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
556 |
buchmann |
1.3 |
TH2F *efficiencymapContam = new TH2F((prefix+"efficiencymapContam"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-
|
557 |
|
|
mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
558 |
buchmann |
1.1 |
TH2F *noscefficiencymap = new TH2F((prefix+"noscefficiencymap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
559 |
buchmann |
1.2 |
TH2F *Neventsmap = new TH2F((prefix+"Neventsmap"+any2string(jzbSel)).c_str(),"", (int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
560 |
|
|
TH2F *ipointmap = new TH2F((prefix+"ipointmap"+any2string(jzbSel)).c_str(),"", (int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
561 |
|
|
TH2F *syspdfmap = new TH2F((prefix+"syspdfmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
562 |
|
|
TH2F *systotmap = new TH2F((prefix+"systotmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
563 |
|
|
TH2F *sysstatmap = new TH2F((prefix+"sysstatmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
564 |
buchmann |
1.3 |
TH2F *XSmap = new TH2F((prefix+"XS"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
565 |
buchmann |
1.8 |
TH2F *absXSmap = new TH2F((prefix+"absXS"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
566 |
buchmann |
1.9 |
TH2F *FilterEff = new TH2F((prefix+"FilterEfficiency"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
567 |
buchmann |
1.13 |
|
568 |
buchmann |
1.16 |
TH2F *ScanIdentifier = new TH2F(("ScanIdentifier"+any2string(jzbSel)+SimpleFormat(PlottingSetup::ScanSampleDirectory)).c_str(),("ScanIdentifier"+any2string(jzbSel)+SimpleFormat(PlottingSetup::ScanSampleDirectory)).c_str(),1,0,1,1,0,1);
|
569 |
|
|
|
570 |
|
|
|
571 |
buchmann |
1.13 |
TH2F *asymptoticmap = new TH2F((prefix+"asymptoticmap"+any2string(jzbSel)).c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
572 |
|
|
// only used for asymptoticmap
|
573 |
buchmann |
1.1 |
|
574 |
buchmann |
1.2 |
TH2F *imposedxmap;
|
575 |
|
|
TH2F *realxmap;
|
576 |
buchmann |
1.1 |
|
577 |
buchmann |
1.3 |
TH2F *centermap;
|
578 |
|
|
TH2F *widthmap;
|
579 |
|
|
|
580 |
buchmann |
1.2 |
TH2F *timemap = new TH2F((prefix+"timemap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
581 |
|
|
|
582 |
|
|
TH2F *flipmap = new TH2F((prefix+"flipmap"+any2string(jzbSel)).c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
583 |
buchmann |
1.1 |
|
584 |
buchmann |
1.2 |
if(ibin==0) {
|
585 |
buchmann |
1.3 |
centermap = new TH2F((prefix+"centermap").c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
586 |
|
|
widthmap = new TH2F((prefix+"widthmap").c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
587 |
|
|
|
588 |
buchmann |
1.2 |
imposedxmap = new TH2F((prefix+"imposedxmap").c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
589 |
|
|
realxmap = new TH2F((prefix+"realxmap").c_str(),"",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,int((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
590 |
|
|
}
|
591 |
|
|
|
592 |
buchmann |
1.13 |
|
593 |
|
|
if(shapeanalysis) jzbSel=jzb_cut[ibin];
|
594 |
buchmann |
1.2 |
vector<int> susy_Zdecay_origin;
|
595 |
|
|
vector<TH2F*> h_susy_Zdecay_origin;
|
596 |
|
|
// we only generate these histograms IF we're dealing with the lowest cut! (we don't need them n times, they're the same for all of them)
|
597 |
|
|
for(int i=1000022;i<1000039;i++) {
|
598 |
|
|
if(ibin>0) continue;
|
599 |
|
|
susy_Zdecay_origin.push_back(i);
|
600 |
|
|
TH2F *susy_dec = new TH2F((prefix+"SUSY_Decay_From_"+any2string(i)+"_to_Z").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
601 |
|
|
h_susy_Zdecay_origin.push_back(susy_dec);
|
602 |
|
|
}
|
603 |
|
|
for(int i=2000006;i<2000016;i++) {
|
604 |
|
|
if(ibin>0) continue;
|
605 |
|
|
susy_Zdecay_origin.push_back(i);
|
606 |
|
|
TH2F *susy_dec = new TH2F((prefix+"SUSY_Decay_From_"+any2string(i)+"_to_Z").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
607 |
|
|
h_susy_Zdecay_origin.push_back(susy_dec);
|
608 |
|
|
}
|
609 |
|
|
|
610 |
|
|
TH2F *PrimaryZSource = new TH2F((prefix+"PrimaryZSource").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
611 |
|
|
TH2F *SecondaryZSource = new TH2F((prefix+"SecondaryZSource").c_str(), "",(int)((mgluend-mglustart)/mglustep+1),mglustart-0.5*mglustep,mgluend+0.5*mglustep,(int)((mLSPend-mLSPstart)/mLSPstep+1),mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
612 |
|
|
|
613 |
buchmann |
1.1 |
write_warning(__FUNCTION__,"CURRENTLY SWITCHING AUTOMATIZED MODE OFF!");automatized=false;
|
614 |
|
|
|
615 |
|
|
gStyle->SetPadRightMargin(0.15);
|
616 |
|
|
|
617 |
|
|
TCanvas *limcanvas = new TCanvas("limcanvas","Limit canvas");
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
bool doexpected=true;
|
621 |
|
|
|
622 |
|
|
int Npoints=0;
|
623 |
|
|
for(int mglu=(int)mglustart;mglu<=mgluend;mglu+=(int)mglustep) {
|
624 |
|
|
for (int mlsp=(int)mLSPstart;mlsp<=mLSPend&&(scantype==mSUGRA||mlsp<=mglu);mlsp+=(int)mLSPstep) Npoints++;
|
625 |
|
|
}
|
626 |
buchmann |
1.3 |
|
627 |
|
|
map < pair<float, float>, map<string, float> > xsec;
|
628 |
|
|
if(scantype==mSUGRA) {
|
629 |
buchmann |
1.12 |
xsec=getXsec(PlottingSetup::cbafbasedir+"/"+mSUGRAxsFile);
|
630 |
buchmann |
1.3 |
}
|
631 |
|
|
|
632 |
buchmann |
1.1 |
int ipoint=-1;
|
633 |
|
|
for(int mglu=(int)mglustart;mglu<=mgluend;mglu+=(int)mglustep) {
|
634 |
|
|
for (int mlsp=(int)mLSPstart;mlsp<=mLSPend&&(scantype==mSUGRA||mlsp<=mglu);mlsp+=(int)mLSPstep)
|
635 |
|
|
{
|
636 |
|
|
ipoint++;
|
637 |
|
|
int GlobalBin=efficiencymap->FindBin(mglu,mlsp);
|
638 |
|
|
if(!runninglocally&&!do_this_point(ipoint,(int)Npoints,(int)jobnumber,(int)njobs)) continue;
|
639 |
buchmann |
1.13 |
|
640 |
buchmann |
1.1 |
int flipped=0;
|
641 |
|
|
float result=-987,resulterr=-987;
|
642 |
|
|
float m0trees = PlottingSetup::mgluend;
|
643 |
|
|
float m12trees = PlottingSetup::mLSPend;
|
644 |
|
|
int a = int((PlottingSetup::ScanXzones*mlsp)/(m12trees+1));
|
645 |
|
|
int b = int((PlottingSetup::ScanYzones*mglu)/(m0trees+1));
|
646 |
|
|
int scanfileindex=PlottingSetup::ScanYzones*a+b;
|
647 |
buchmann |
1.18 |
if(njobs>-2) load_scan_sample(a,b,scanfileindex,scantype,mglu,mlsp);
|
648 |
|
|
else {
|
649 |
|
|
if((scansample.collection).size()>=1) scansample.RemoveLastSample();
|
650 |
|
|
scanfileindex=(scansample.collection).size();
|
651 |
|
|
scansample.AddSample(specialfilename,"LMpoint",1,1,false,true,scanfileindex,kRed);
|
652 |
|
|
}
|
653 |
buchmann |
1.1 |
|
654 |
|
|
clock_t start,finish;
|
655 |
|
|
start = clock(); // starting the clock to measure how long the computation takes!
|
656 |
|
|
stringstream addcut;
|
657 |
|
|
addcut << "(TMath::Abs("<<massgluname<<"-"<<mglu<<")<5)&&(TMath::Abs("<<massLSPname<<"-"<<mlsp<<")<5)";
|
658 |
buchmann |
1.18 |
if(njobs==-2) {
|
659 |
|
|
dout << "Processing a signal sample, not a scan : setting addcut to \"eventNum>0||eventNum<1\" (empty cut)" << endl;
|
660 |
|
|
addcut.str("(eventNum>0||eventNum<1)");
|
661 |
|
|
}
|
662 |
|
|
|
663 |
buchmann |
1.1 |
(scansample.collection)[scanfileindex].events->Draw("eventNum",addcut.str().c_str(),"goff");
|
664 |
|
|
float nevents = (scansample.collection)[scanfileindex].events->GetSelectedRows();
|
665 |
|
|
vector<vector<float> > systematics;
|
666 |
|
|
if(nevents<10) {
|
667 |
buchmann |
1.3 |
dout << "This point ("<<ipoint<<" / " << Npoints << ") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") does not contain enough events and will be \033[1;31m skipped \033[0m."<< endl;
|
668 |
buchmann |
1.1 |
continue;
|
669 |
|
|
} else {
|
670 |
buchmann |
1.2 |
dout << "OK! This point ("<<ipoint<<") with configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore \033[1;32m not be skipped \033[0m. " << endl;
|
671 |
buchmann |
1.13 |
if(PlottingSetup::RestrictToMassPeak==true) dout << "Analysis type: on-peak" << endl;
|
672 |
|
|
if(PlottingSetup::RestrictToMassPeak==false) dout << "Analysis type: offpeak" << endl;
|
673 |
|
|
if(shapeanalysis) dout << "Shape analysis? Yes." << endl;
|
674 |
|
|
else dout << "Shape analysis? No." << endl;
|
675 |
buchmann |
1.2 |
}
|
676 |
|
|
float hitrecord=0;
|
677 |
|
|
int hitrecordholder=0;
|
678 |
|
|
float hitsecondplace=0;
|
679 |
|
|
int hitsecondplaceholder=0;
|
680 |
buchmann |
1.18 |
for(int imo=0;imo<(int)susy_Zdecay_origin.size()&&ibin==0&&njobs>-2;imo++) {
|
681 |
buchmann |
1.2 |
if(ibin>0) continue;
|
682 |
|
|
int MotherParticlePDGid = susy_Zdecay_origin[imo];
|
683 |
|
|
(scansample.collection)[scanfileindex].events->Draw("eventNum",("("+addcut.str()+")&&(abs(SourceOfZ-"+any2string(MotherParticlePDGid)+")<0.5)").c_str(),"goff");
|
684 |
|
|
float hits = (scansample.collection)[scanfileindex].events->GetSelectedRows();
|
685 |
|
|
hits/=nevents;
|
686 |
|
|
h_susy_Zdecay_origin[imo]->SetBinContent(GlobalBin,hits);
|
687 |
|
|
if(hits>hitrecord) {
|
688 |
|
|
hitsecondplace=hitrecord;
|
689 |
|
|
hitsecondplaceholder=hitrecordholder;
|
690 |
|
|
hitrecord=hits;
|
691 |
|
|
hitrecordholder=imo;
|
692 |
|
|
}
|
693 |
|
|
if(hits<hitrecord&&hits>hitsecondplace) {
|
694 |
|
|
hitsecondplace=hits;
|
695 |
|
|
hitsecondplaceholder=imo;
|
696 |
|
|
}
|
697 |
|
|
}
|
698 |
|
|
if(ibin==0) {
|
699 |
|
|
PrimaryZSource->SetBinContent(GlobalBin,hitrecordholder);
|
700 |
|
|
SecondaryZSource->SetBinContent(GlobalBin,hitsecondplaceholder);
|
701 |
|
|
}
|
702 |
|
|
|
703 |
buchmann |
1.18 |
if(ibin==0&&njobs>-2) {
|
704 |
buchmann |
1.2 |
TH1F *realxhisto = new TH1F("realxhisto","realxhisto",1000,0,1);
|
705 |
|
|
(scansample.collection)[scanfileindex].events->Draw("realx>>realxhisto",addcut.str().c_str(),"goff");
|
706 |
|
|
realxmap->SetBinContent(GlobalBin,realxhisto->GetMean());
|
707 |
|
|
realxmap->SetBinError(GlobalBin,realxhisto->GetRMS());
|
708 |
|
|
(scansample.collection)[scanfileindex].events->Draw("imposedx>>realxhisto",addcut.str().c_str(),"goff");
|
709 |
|
|
imposedxmap->SetBinContent(GlobalBin,realxhisto->GetMean());
|
710 |
|
|
imposedxmap->SetBinError(GlobalBin,realxhisto->GetRMS());
|
711 |
buchmann |
1.3 |
stringstream specialexpression;
|
712 |
|
|
specialexpression << mcjzb << ">>jzbhisto";
|
713 |
|
|
TH1F *jzbhisto = new TH1F("jzbhisto","jzbhisto",100,-500,500);
|
714 |
|
|
(scansample.collection)[scanfileindex].events->Draw(specialexpression.str().c_str(),addcut.str().c_str(),"goff");
|
715 |
|
|
centermap->SetBinContent(GlobalBin,jzbhisto->GetMean());
|
716 |
|
|
widthmap->SetBinContent(GlobalBin,jzbhisto->GetRMS());
|
717 |
buchmann |
1.2 |
delete realxhisto;
|
718 |
buchmann |
1.3 |
delete jzbhisto;
|
719 |
buchmann |
1.1 |
}
|
720 |
|
|
|
721 |
|
|
|
722 |
buchmann |
1.5 |
if(scantype==mSUGRA) {
|
723 |
|
|
float absxs=0;
|
724 |
|
|
for(int i=0;i<12;i++) absxs+=GetXSecForPointAndChannel(mglu,mlsp,xsec,i);
|
725 |
buchmann |
1.8 |
TFile *FilterEffFile = new TFile(PlottingSetup::FilterEfficiencyFile.c_str());
|
726 |
|
|
TH2F *FilterEfficiency = (TH2F*)FilterEffFile->Get("FilterEfficiency");
|
727 |
|
|
float filtereff = FilterEfficiency->GetBinContent(FilterEfficiency->FindBin(mglu,mlsp));
|
728 |
|
|
FilterEff->SetBinContent(GlobalBin,filtereff);
|
729 |
|
|
FilterEffFile->Close();
|
730 |
|
|
absXSmap->SetBinContent(GlobalBin,absxs);
|
731 |
|
|
absxs*=filtereff;
|
732 |
buchmann |
1.5 |
XSmap->SetBinContent(GlobalBin,absxs);
|
733 |
|
|
}
|
734 |
|
|
|
735 |
buchmann |
1.14 |
if(nevents!=0) {
|
736 |
buchmann |
1.3 |
Value effwosigcont = MCefficiency((scansample.collection)[scanfileindex].events,result,resulterr,flipped,mcjzb,requireZ,(int)nevents,scantype,xsec,addcut.str(),-1);
|
737 |
buchmann |
1.2 |
if(result<0&&allowflipping) {
|
738 |
buchmann |
1.1 |
write_info(__FUNCTION__,"Found negative efficiency (signal distribution populating JZB<0 more than JZB>0) - flipping analysis!");
|
739 |
|
|
flipped=1;
|
740 |
buchmann |
1.3 |
MCefficiency((scansample.collection)[scanfileindex].events,result,resulterr,flipped,mcjzb,requireZ,(int)nevents,scantype,xsec,addcut.str(),-1);
|
741 |
buchmann |
1.1 |
}
|
742 |
|
|
efficiencymap->SetBinContent(GlobalBin,result);
|
743 |
|
|
efficiencymap->SetBinError(GlobalBin,resulterr);
|
744 |
|
|
flipmap->SetBinContent(GlobalBin,flipped);
|
745 |
|
|
noscefficiencymap->SetBinContent(GlobalBin,effwosigcont.getValue());
|
746 |
|
|
noscefficiencymap->SetBinError(GlobalBin,effwosigcont.getError());
|
747 |
buchmann |
1.2 |
efficiencymapContam->SetBinContent(GlobalBin,effwosigcont.getValue()-result);
|
748 |
|
|
efficiencymapContam->SetBinError(GlobalBin,TMath::Sqrt(effwosigcont.getError()+resulterr));
|
749 |
buchmann |
1.1 |
//Partial efficiencies
|
750 |
|
|
float resultAcc, resultID, resultJets, resultSignal, resultmet;
|
751 |
|
|
float resulterrAcc, resulterrID, resulterrJets, resulterrSignal, resulterrmet;
|
752 |
|
|
MCPartialefficiency((scansample.collection)[scanfileindex].events,resultAcc,resulterrAcc,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1, 1);
|
753 |
|
|
MCPartialefficiency((scansample.collection)[scanfileindex].events,resultID,resulterrID,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1, 2);
|
754 |
|
|
MCPartialefficiency((scansample.collection)[scanfileindex].events,resultJets,resulterrJets,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1, 3);
|
755 |
|
|
MCPartialefficiency((scansample.collection)[scanfileindex].events,resultSignal,resulterrSignal,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1, 4);
|
756 |
|
|
MCPartialefficiency((scansample.collection)[scanfileindex].events,resultmet,resulterrmet,flipped,mcjzb,requireZ,(int)nevents,addcut.str(),-1, 5);
|
757 |
|
|
efficiencymapAcc->SetBinContent(GlobalBin,resultAcc);
|
758 |
|
|
efficiencymapAcc->SetBinError(GlobalBin,resulterrAcc);
|
759 |
|
|
efficiencymapmet->SetBinContent(GlobalBin,resultmet);
|
760 |
|
|
efficiencymapmet->SetBinError(GlobalBin,resulterrmet);
|
761 |
|
|
efficiencymapID->SetBinContent(GlobalBin,resultID);
|
762 |
|
|
efficiencymapID->SetBinError(GlobalBin,resulterrID);
|
763 |
|
|
efficiencymapJets->SetBinContent(GlobalBin,resultJets);
|
764 |
|
|
efficiencymapJets->SetBinError(GlobalBin,resulterrJets);
|
765 |
|
|
efficiencymapSignal->SetBinContent(GlobalBin,resultSignal);
|
766 |
|
|
efficiencymapSignal->SetBinError(GlobalBin,resulterrSignal);
|
767 |
|
|
finish = clock();
|
768 |
|
|
}
|
769 |
|
|
Neventsmap->SetBinContent(GlobalBin,nevents);
|
770 |
|
|
ipointmap->SetBinContent(GlobalBin,ipoint);
|
771 |
|
|
if(efficiencyonly) continue;
|
772 |
buchmann |
1.9 |
|
773 |
|
|
if(!shapeanalysis) {
|
774 |
|
|
do_systematics_for_one_file((scansample.collection)[scanfileindex].events,(int)nevents,"SUSY SCAN", systematics,flipped, xsec, mcjzb,datajzb,peakerror,requireZ, addcut.str(),true,scantype);
|
775 |
buchmann |
1.15 |
// float JZBcutat = systematics[0][0];
|
776 |
buchmann |
1.9 |
float mceff = systematics[0][1];
|
777 |
|
|
float mcefferr = systematics[0][2];//MC stat error
|
778 |
|
|
float toterr = systematics[0][4];
|
779 |
|
|
float sys_jes = systematics[0][5]; // Jet Energy Scale
|
780 |
|
|
float sys_jsu = systematics[0][6]; // JZB scale uncertainty
|
781 |
|
|
float sys_res = systematics[0][7]; // resolution
|
782 |
buchmann |
1.15 |
// float mcwoscef = systematics[0][8]; // efficiency without signal contamination
|
783 |
|
|
// float mcwoscefr= systematics[0][9]; // error on efficiency without signal contamination
|
784 |
buchmann |
1.9 |
float sys_pdf = 0;
|
785 |
|
|
if(systematics[0].size()>10) sys_pdf = systematics[0][10]; // PDF
|
786 |
buchmann |
1.14 |
dout << "Going to store: total error is: " << toterr << " and the relative tot error, i.e. total error / mc efficiency is " << toterr/mceff << endl;
|
787 |
buchmann |
1.9 |
if(mceff!=mceff||toterr!=toterr||mceff<0 && (!systematicsonly&&!efficiencyonly)) {
|
788 |
buchmann |
1.13 |
dout << "Limits can't be calculated for this configuration (" << massgluname <<"="<<mglu<<" , " << massLSPname << "="<<mlsp << ") as either the efficiency or its error are not positive numbers! (mceff="<<mceff<<"and toterr="<<toterr<<")"<< endl;
|
789 |
buchmann |
1.9 |
continue;
|
790 |
|
|
} else {
|
791 |
|
|
// Systematics and efficiencies make sense (i.e. non-zero, and all numbers)
|
792 |
|
|
if(!systematicsonly&&!efficiencyonly) {
|
793 |
|
|
dout << "Calculating limit now for "<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp <<endl;
|
794 |
|
|
vector<float> sigmas;
|
795 |
|
|
string plotfilename=(string)(TString((scansample.collection)[scanfileindex].samplename)+TString(massgluname)+TString(any2string(mglu))+TString("__")+TString(massLSPname)+TString(any2string(mlsp))+TString(".png"));
|
796 |
|
|
sigmas=compute_one_upper_limit(mceff,toterr,ibin,mcjzb,plotfilename,true,flipped);
|
797 |
|
|
// do_limit_wrapper(mceff,toterr,ibin,mcjzb,sigmas,plotfilename);
|
798 |
|
|
if(sigmas[0]>-0.5) { // negative sigmas are the error signature of do_limit_wrapper, so we want to exclude them.
|
799 |
|
|
limitmap->SetBinContent(GlobalBin,sigmas[0]);
|
800 |
|
|
if(sigmas.size()>1) {
|
801 |
|
|
explimitmap->SetBinContent(GlobalBin,sigmas[1]);
|
802 |
|
|
exp1plimitmap->SetBinContent(GlobalBin,sigmas[2]);
|
803 |
|
|
exp1mlimitmap->SetBinContent(GlobalBin,sigmas[3]);
|
804 |
|
|
exp2plimitmap->SetBinContent(GlobalBin,sigmas[4]);
|
805 |
|
|
exp2mlimitmap->SetBinContent(GlobalBin,sigmas[5]);
|
806 |
|
|
}
|
807 |
|
|
sysjesmap->SetBinContent(GlobalBin,sys_jes);
|
808 |
|
|
sysjsumap->SetBinContent(GlobalBin,sys_jsu);
|
809 |
|
|
sysresmap->SetBinContent(GlobalBin,sys_res);
|
810 |
|
|
syspdfmap->SetBinContent(GlobalBin,sys_pdf);
|
811 |
|
|
systotmap->SetBinContent(GlobalBin,toterr/mceff);//total relative (!) error
|
812 |
|
|
sysstatmap->SetBinContent(GlobalBin,mcefferr);//total relative (!) error
|
813 |
|
|
dout << "A limit has been added at " << sigmas[0] << " for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
|
814 |
|
|
}//end of if sigma is positive
|
815 |
|
|
}//end of not systematics only condition
|
816 |
|
|
if(systematicsonly) {
|
817 |
|
|
sysjesmap->SetBinContent(GlobalBin,sys_jes);
|
818 |
|
|
sysjsumap->SetBinContent(GlobalBin,sys_jsu);
|
819 |
|
|
sysresmap->SetBinContent(GlobalBin,sys_res);
|
820 |
|
|
syspdfmap->SetBinContent(GlobalBin,sys_pdf);
|
821 |
|
|
systotmap->SetBinContent(GlobalBin,toterr/mceff);//total relative (!) error
|
822 |
|
|
sysstatmap->SetBinContent(GlobalBin,mcefferr);//total relative (!) error
|
823 |
|
|
}
|
824 |
|
|
}//efficiency is valid
|
825 |
buchmann |
1.13 |
}
|
826 |
|
|
if(shapeanalysis) {
|
827 |
buchmann |
1.9 |
//shape analysis
|
828 |
buchmann |
1.14 |
dout << "This is the shape analysis. Have fun with it!" << endl;
|
829 |
buchmann |
1.11 |
float quickmceff,quickmcefferr;
|
830 |
|
|
MCefficiency((scansample.collection)[scanfileindex].events,quickmceff,quickmcefferr,flipped,mcjzb,requireZ,(int)nevents,scantype,xsec,addcut.str(),-1);
|
831 |
|
|
if(quickmceff==0) {
|
832 |
|
|
write_warning(__FUNCTION__,"The MC efficiency is zero - need to skip this point.");
|
833 |
|
|
continue;
|
834 |
|
|
}
|
835 |
buchmann |
1.9 |
stringstream PointName;
|
836 |
|
|
PointName << massgluname << "_" << mglu << "__" << massLSPname << "_" << mlsp;
|
837 |
buchmann |
1.10 |
SUSYScanSpace::SavedMLSP=mlsp;
|
838 |
|
|
SUSYScanSpace::SavedMGlu=mglu;
|
839 |
|
|
SUSYScanSpace::SavedMLSPname=massLSPname;
|
840 |
|
|
SUSYScanSpace::SavedMGluname=massgluname;
|
841 |
buchmann |
1.17 |
float referenceXS=0;
|
842 |
|
|
if(scantype==mSUGRA) referenceXS=XSmap->GetBinContent(GlobalBin);
|
843 |
|
|
else referenceXS=getSMSxs(mlsp,mglu);
|
844 |
|
|
float low_fullCLs=referenceXS*0.5;
|
845 |
|
|
float high_fullCLs=referenceXS*2.5;
|
846 |
|
|
if(scantype!=mSUGRA) {
|
847 |
|
|
low_fullCLs=-1;
|
848 |
|
|
high_fullCLs=10e10;
|
849 |
|
|
}
|
850 |
|
|
ShapeDroplet droplet = LimitsFromShapes(low_fullCLs,high_fullCLs, (scansample.collection)[scanfileindex].events,addcut.str().c_str(),PointName.str(),mcjzb,datajzb,jzb_cut,peakerror,peakerror);
|
851 |
buchmann |
1.13 |
if(!isValidShapeResult(droplet)) {
|
852 |
buchmann |
1.14 |
write_error(__FUNCTION__,"Something went horribly wrong with the shape analysis - ignoring this point!!!");
|
853 |
buchmann |
1.13 |
// scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, peakerrordata, (float)Npoints, (float)ipoint, systematicsonly, efficiencyonly,false); // don't uncomment this line; it would lead to multiple limitmap histos ...
|
854 |
buchmann |
1.19 |
if(njobs==-2) {
|
855 |
|
|
delete limcanvas;
|
856 |
|
|
return empty;
|
857 |
|
|
}
|
858 |
buchmann |
1.13 |
continue;
|
859 |
buchmann |
1.18 |
|
860 |
buchmann |
1.13 |
}
|
861 |
|
|
|
862 |
buchmann |
1.12 |
float excludedXSobs = droplet.observed/droplet.SignalIntegral;
|
863 |
|
|
absXSmap->SetBinContent(GlobalBin,referenceXS);
|
864 |
|
|
write_info(__FUNCTION__,"Established limit at "+any2string(excludedXSobs)+" , ref XS is "+any2string(referenceXS));
|
865 |
buchmann |
1.18 |
if(njobs==-2) {
|
866 |
|
|
//this is the non-scan case
|
867 |
|
|
vector<float> sigmas;
|
868 |
|
|
sigmas.push_back(droplet.observed/droplet.SignalIntegral);
|
869 |
|
|
sigmas.push_back(droplet.expected/droplet.SignalIntegral);
|
870 |
|
|
sigmas.push_back(droplet.expectedPlus1Sigma/droplet.SignalIntegral);
|
871 |
|
|
sigmas.push_back(droplet.expectedMinus1Sigma/droplet.SignalIntegral);
|
872 |
|
|
sigmas.push_back(droplet.expectedPlus2Sigma/droplet.SignalIntegral);
|
873 |
|
|
sigmas.push_back(droplet.expectedMinus2Sigma/droplet.SignalIntegral);
|
874 |
buchmann |
1.19 |
delete limcanvas;
|
875 |
buchmann |
1.18 |
return sigmas;
|
876 |
|
|
}
|
877 |
buchmann |
1.17 |
|
878 |
buchmann |
1.12 |
rawlimitmap->SetBinContent(GlobalBin,droplet.observed);
|
879 |
|
|
rawelimitmap->SetBinContent(GlobalBin,droplet.expected);
|
880 |
|
|
limitmap->SetBinContent(GlobalBin,droplet.observed/droplet.SignalIntegral);
|
881 |
|
|
explimitmap->SetBinContent(GlobalBin,droplet.expected/droplet.SignalIntegral);
|
882 |
|
|
exp1plimitmap->SetBinContent(GlobalBin,droplet.expectedPlus1Sigma/droplet.SignalIntegral);
|
883 |
|
|
exp1mlimitmap->SetBinContent(GlobalBin,droplet.expectedMinus1Sigma/droplet.SignalIntegral);
|
884 |
|
|
exp2plimitmap->SetBinContent(GlobalBin,droplet.expectedPlus2Sigma/droplet.SignalIntegral);
|
885 |
|
|
exp2mlimitmap->SetBinContent(GlobalBin,droplet.expectedMinus2Sigma/droplet.SignalIntegral);
|
886 |
buchmann |
1.16 |
dout <<"Saved the following shape limit: " << droplet.observed/droplet.SignalIntegral << " (observed) , " << droplet.expected/droplet.SignalIntegral << " (expected) " << endl;
|
887 |
buchmann |
1.9 |
sysjesmap->SetBinContent(GlobalBin,droplet.JES);
|
888 |
|
|
sysjsumap->SetBinContent(GlobalBin,droplet.JSU);
|
889 |
|
|
syspdfmap->SetBinContent(GlobalBin,droplet.PDF);
|
890 |
|
|
systotmap->SetBinContent(GlobalBin,droplet.toterr);
|
891 |
|
|
sysstatmap->SetBinContent(GlobalBin,droplet.staterr);
|
892 |
|
|
}
|
893 |
buchmann |
1.1 |
finish = clock();
|
894 |
|
|
timemap->SetBinContent(GlobalBin,((float(finish)-float(start))/CLOCKS_PER_SEC));
|
895 |
|
|
}
|
896 |
|
|
}
|
897 |
|
|
prepare_scan_axis(limitmap,scantype);
|
898 |
|
|
prepare_scan_axis(sysjesmap,scantype);
|
899 |
|
|
prepare_scan_axis(sysjsumap,scantype);
|
900 |
|
|
prepare_scan_axis(sysresmap,scantype);
|
901 |
|
|
prepare_scan_axis(syspdfmap,scantype);
|
902 |
|
|
prepare_scan_axis(systotmap,scantype);
|
903 |
|
|
prepare_scan_axis(sysstatmap,scantype);
|
904 |
|
|
prepare_scan_axis(timemap,scantype);
|
905 |
|
|
|
906 |
|
|
if(!systematicsonly&&!efficiencyonly) {
|
907 |
buchmann |
1.13 |
TObject* old=gDirectory->GetList()->FindObject("limcanvas");
|
908 |
|
|
if(old) gDirectory->GetList()->Remove(old);
|
909 |
|
|
TCanvas *limcanvas = new TCanvas("limcanvas","Limit canvas");
|
910 |
buchmann |
1.1 |
limitmap->Draw("COLZ");
|
911 |
|
|
string titletobewritten="Limits in LSP-Glu plane";
|
912 |
|
|
if(scantype==mSUGRA) titletobewritten="Limits in m_{1/2}-m_{0} plane";
|
913 |
|
|
if(scantype==GMSB) titletobewritten="Limits in Chi-Glu plane";
|
914 |
|
|
TText *title = write_title(titletobewritten);
|
915 |
|
|
title->Draw();
|
916 |
|
|
if(runninglocally) {
|
917 |
|
|
CompleteSave(limcanvas,"SUSYScan/Limits_JZB_geq"+any2string(jzb_cut[ibin]));
|
918 |
|
|
} else {
|
919 |
|
|
TFile *outputfile;
|
920 |
|
|
if(systematicsonly) outputfile=new TFile(("output/DistributedSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");//needs to be "UPDATE" as we can get to this point for different JZB cuts and don't want to erase the previous data :-)
|
921 |
|
|
else outputfile=new TFile(("output/DistributedLimits_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");//needs to be "UPDATE" as we can get to this point for
|
922 |
|
|
limitmap->Write();
|
923 |
buchmann |
1.12 |
rawlimitmap->Write();
|
924 |
|
|
rawelimitmap->Write();
|
925 |
buchmann |
1.1 |
if(doexpected) {
|
926 |
|
|
explimitmap->Write();
|
927 |
|
|
exp1plimitmap->Write();
|
928 |
|
|
exp1mlimitmap->Write();
|
929 |
|
|
exp2plimitmap->Write();
|
930 |
|
|
exp2mlimitmap->Write();
|
931 |
|
|
}
|
932 |
|
|
sysjesmap->Write();
|
933 |
|
|
sysjsumap->Write();
|
934 |
|
|
sysresmap->Write();
|
935 |
|
|
efficiencymap->Write();
|
936 |
buchmann |
1.3 |
if(ibin==0) centermap->Write();
|
937 |
|
|
if(ibin==0) widthmap->Write();
|
938 |
buchmann |
1.1 |
flipmap->Write();
|
939 |
|
|
efficiencymapmet->Write();
|
940 |
|
|
efficiencymapAcc->Write();
|
941 |
|
|
efficiencymapID->Write();
|
942 |
|
|
efficiencymapJets->Write();
|
943 |
|
|
efficiencymapSignal->Write();
|
944 |
|
|
noscefficiencymap->Write();
|
945 |
buchmann |
1.2 |
efficiencymapContam->Write();
|
946 |
buchmann |
1.1 |
syspdfmap->Write();
|
947 |
|
|
systotmap->Write();
|
948 |
|
|
sysstatmap->Write();
|
949 |
buchmann |
1.3 |
XSmap->Write();
|
950 |
buchmann |
1.8 |
absXSmap->Write();
|
951 |
|
|
FilterEff->Write();
|
952 |
buchmann |
1.13 |
if(shapeanalysis) asymptoticmap->Write();
|
953 |
buchmann |
1.2 |
if(ibin==0) imposedxmap->Write();
|
954 |
|
|
if(ibin==0) realxmap->Write();
|
955 |
buchmann |
1.1 |
Neventsmap->Write();
|
956 |
buchmann |
1.16 |
ScanIdentifier->Write();
|
957 |
buchmann |
1.1 |
ipointmap->Write();
|
958 |
|
|
timemap->Write();
|
959 |
buchmann |
1.15 |
for(int i=0;i<(int)susy_Zdecay_origin.size();i++) {
|
960 |
buchmann |
1.2 |
h_susy_Zdecay_origin[i]->Write();
|
961 |
|
|
}
|
962 |
buchmann |
1.3 |
outputfile->Close();
|
963 |
buchmann |
1.1 |
}
|
964 |
|
|
}
|
965 |
|
|
if(systematicsonly) { // systematics only :
|
966 |
|
|
limcanvas->cd();
|
967 |
|
|
sysjesmap->Draw("COLZ");
|
968 |
|
|
string titletobewritten="Jet Energy scale in LSP-Glu plane";
|
969 |
|
|
if(scantype==mSUGRA) titletobewritten="Limits in m_{1/2}-m_{0} plane";
|
970 |
|
|
if(scantype==GMSB) titletobewritten="Limits in Chi-Glu plane";
|
971 |
|
|
TText *title = write_title(titletobewritten);
|
972 |
|
|
title->Draw();
|
973 |
|
|
if(runninglocally) {
|
974 |
|
|
CompleteSave(limcanvas,"SUSYScan/JES_geq"+any2string(jzb_cut[ibin]));
|
975 |
|
|
}
|
976 |
|
|
sysjsumap->Draw("COLZ");
|
977 |
|
|
titletobewritten="JZB Scale Uncertainty in LSP-Glu plane";
|
978 |
|
|
if(scantype==mSUGRA) titletobewritten="JZB Scale Uncertainty in m_{1/2}-m_{0} plane";
|
979 |
|
|
if(scantype==GMSB) titletobewritten="JZB Scale Uncertainty in Chi-Glu plane";
|
980 |
|
|
TText *title2 = write_title(titletobewritten);
|
981 |
|
|
title2->Draw();
|
982 |
|
|
if(runninglocally) {
|
983 |
|
|
CompleteSave(limcanvas,"SUSYScan/JSU_geq"+any2string(jzb_cut[ibin]));
|
984 |
|
|
}
|
985 |
|
|
sysresmap->Draw("COLZ");
|
986 |
|
|
titletobewritten="Resolution in LSP-Glu plane";
|
987 |
|
|
if(scantype==mSUGRA) titletobewritten="Resolution in m_{1/2}-m_{0} plane";
|
988 |
|
|
if(scantype==GMSB) titletobewritten="Resolution in Chi-Glu plane";
|
989 |
|
|
TText *title3 = write_title(titletobewritten);
|
990 |
|
|
title3->Draw();
|
991 |
|
|
if(runninglocally) {
|
992 |
|
|
CompleteSave(limcanvas,"SUSYScan/Resolution_geq"+any2string(jzb_cut[ibin]));
|
993 |
|
|
}
|
994 |
|
|
|
995 |
|
|
if(!runninglocally) {
|
996 |
|
|
TFile *outputfile=new TFile(("output/DistributedSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");
|
997 |
|
|
sysjesmap->Write();
|
998 |
|
|
sysjsumap->Write();
|
999 |
|
|
sysresmap->Write();
|
1000 |
|
|
flipmap->Write();
|
1001 |
buchmann |
1.3 |
if(ibin==0) centermap->Write();
|
1002 |
|
|
if(ibin==0) widthmap->Write();
|
1003 |
buchmann |
1.1 |
efficiencymap->Write();
|
1004 |
|
|
efficiencymapmet->Write();
|
1005 |
|
|
efficiencymapAcc->Write();
|
1006 |
|
|
efficiencymapID->Write();
|
1007 |
|
|
efficiencymapJets->Write();
|
1008 |
|
|
efficiencymapSignal->Write();
|
1009 |
|
|
noscefficiencymap->Write();
|
1010 |
buchmann |
1.2 |
efficiencymapContam->Write();
|
1011 |
buchmann |
1.1 |
Neventsmap->Write();
|
1012 |
buchmann |
1.16 |
ScanIdentifier->Write();
|
1013 |
buchmann |
1.1 |
ipointmap->Write();
|
1014 |
|
|
syspdfmap->Write();
|
1015 |
|
|
systotmap->Write();
|
1016 |
|
|
sysstatmap->Write();
|
1017 |
buchmann |
1.8 |
absXSmap->Write();
|
1018 |
buchmann |
1.9 |
XSmap->Write();
|
1019 |
buchmann |
1.8 |
FilterEff->Write();
|
1020 |
buchmann |
1.13 |
if(shapeanalysis) asymptoticmap->Write();
|
1021 |
buchmann |
1.2 |
if(ibin==0) imposedxmap->Write();
|
1022 |
|
|
if(ibin==0) realxmap->Write();
|
1023 |
buchmann |
1.1 |
timemap->Write();
|
1024 |
buchmann |
1.15 |
for(int i=0;i<(int)susy_Zdecay_origin.size();i++) {
|
1025 |
buchmann |
1.2 |
h_susy_Zdecay_origin[i]->Write();
|
1026 |
|
|
}
|
1027 |
buchmann |
1.3 |
outputfile->Close();
|
1028 |
buchmann |
1.1 |
}
|
1029 |
|
|
}//end of systematics only
|
1030 |
|
|
if(efficiencyonly) {
|
1031 |
|
|
limcanvas->cd();
|
1032 |
|
|
string titletobewritten="Efficiencies in LSP-Glu plane";
|
1033 |
|
|
if(scantype==mSUGRA) titletobewritten="Efficiencies in m_{1/2}-m_{0} plane";
|
1034 |
|
|
if(scantype==GMSB) titletobewritten="Efficiencies in Chi-Glu plane";
|
1035 |
|
|
TText *title = write_title(titletobewritten);
|
1036 |
|
|
efficiencymap->Draw("COLZ");
|
1037 |
|
|
title->Draw();
|
1038 |
|
|
if(runninglocally) {
|
1039 |
|
|
CompleteSave(limcanvas,"SUSYScan/Efficiency_geq"+any2string(jzb_cut[ibin]));
|
1040 |
|
|
}
|
1041 |
|
|
limcanvas->cd();
|
1042 |
|
|
efficiencymapmet->Draw("COLZ");
|
1043 |
|
|
title->Draw();
|
1044 |
|
|
if(runninglocally) {
|
1045 |
|
|
CompleteSave(limcanvas,"SUSYScan/EfficiencyMet_geq"+any2string(jzb_cut[ibin]));
|
1046 |
|
|
}
|
1047 |
|
|
limcanvas->cd();
|
1048 |
|
|
efficiencymapAcc->Draw("COLZ");
|
1049 |
|
|
title->Draw();
|
1050 |
|
|
if(runninglocally) {
|
1051 |
|
|
CompleteSave(limcanvas,"SUSYScan/EfficiencyAcc_geq"+any2string(jzb_cut[ibin]));
|
1052 |
|
|
}
|
1053 |
|
|
limcanvas->cd();
|
1054 |
|
|
efficiencymapID->Draw("COLZ");
|
1055 |
|
|
title->Draw();
|
1056 |
|
|
if(runninglocally) {
|
1057 |
|
|
CompleteSave(limcanvas,"SUSYScan/EfficiencyID_geq"+any2string(jzb_cut[ibin]));
|
1058 |
|
|
}
|
1059 |
|
|
limcanvas->cd();
|
1060 |
|
|
efficiencymapJets->Draw("COLZ");
|
1061 |
|
|
title->Draw();
|
1062 |
|
|
if(runninglocally) {
|
1063 |
|
|
CompleteSave(limcanvas,"SUSYScan/EfficiencyJets_geq"+any2string(jzb_cut[ibin]));
|
1064 |
|
|
}
|
1065 |
|
|
limcanvas->cd();
|
1066 |
|
|
efficiencymapSignal->Draw("COLZ");
|
1067 |
|
|
title->Draw();
|
1068 |
|
|
if(runninglocally) {
|
1069 |
|
|
CompleteSave(limcanvas,"SUSYScan/EfficiencySignal_geq"+any2string(jzb_cut[ibin]));
|
1070 |
|
|
}
|
1071 |
|
|
limcanvas->cd();
|
1072 |
|
|
noscefficiencymap->Draw("COLZ");
|
1073 |
|
|
title->Draw();
|
1074 |
|
|
if(runninglocally) {
|
1075 |
|
|
CompleteSave(limcanvas,"SUSYScan/NoEfficiency_geq"+any2string(jzb_cut[ibin]));
|
1076 |
|
|
}
|
1077 |
|
|
limcanvas->cd();
|
1078 |
|
|
sysjesmap->Draw("COLZ");
|
1079 |
|
|
titletobewritten="N(events) in LSP-Glu plane";
|
1080 |
|
|
if(scantype==mSUGRA) titletobewritten="N(events) in m_{1/2}-m_{0} plane";
|
1081 |
|
|
if(scantype==GMSB) titletobewritten="Resolution in Chi-Glu plane";
|
1082 |
|
|
TText *title2 = write_title(titletobewritten);
|
1083 |
|
|
title2->Draw();
|
1084 |
|
|
if(runninglocally) {
|
1085 |
|
|
CompleteSave(limcanvas,"SUSYScan/Nevents_geq"+any2string(jzb_cut[ibin]));
|
1086 |
|
|
}
|
1087 |
|
|
if(!runninglocally) {
|
1088 |
|
|
TFile *outputfile=new TFile(("output/DistributedSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");
|
1089 |
|
|
ipointmap->Write();
|
1090 |
|
|
Neventsmap->Write();
|
1091 |
buchmann |
1.16 |
ScanIdentifier->Write();
|
1092 |
buchmann |
1.1 |
noscefficiencymap->Write();
|
1093 |
buchmann |
1.2 |
efficiencymapContam->Write();
|
1094 |
buchmann |
1.1 |
efficiencymap->Write();
|
1095 |
buchmann |
1.3 |
if(ibin==0) centermap->Write();
|
1096 |
|
|
if(ibin==0) widthmap->Write();
|
1097 |
buchmann |
1.1 |
flipmap->Write();
|
1098 |
|
|
efficiencymapmet->Write();
|
1099 |
|
|
efficiencymapAcc->Write();
|
1100 |
|
|
efficiencymapID->Write();
|
1101 |
|
|
efficiencymapJets->Write();
|
1102 |
|
|
efficiencymapSignal->Write();
|
1103 |
|
|
timemap->Write();
|
1104 |
|
|
outputfile->Close();
|
1105 |
|
|
}
|
1106 |
|
|
}//end of efficiencies only
|
1107 |
buchmann |
1.13 |
|
1108 |
buchmann |
1.15 |
for(int i=0;i<(int)susy_Zdecay_origin.size();i++) {
|
1109 |
buchmann |
1.2 |
delete h_susy_Zdecay_origin[i];
|
1110 |
|
|
}
|
1111 |
|
|
|
1112 |
|
|
delete PrimaryZSource;
|
1113 |
|
|
delete SecondaryZSource;
|
1114 |
|
|
|
1115 |
|
|
|
1116 |
buchmann |
1.1 |
delete limitmap;
|
1117 |
|
|
delete exclmap;
|
1118 |
|
|
delete sysjesmap;
|
1119 |
|
|
delete sysjsumap;
|
1120 |
|
|
delete sysresmap;
|
1121 |
|
|
delete noscefficiencymap;
|
1122 |
buchmann |
1.2 |
delete efficiencymapContam;
|
1123 |
buchmann |
1.1 |
delete efficiencymap;
|
1124 |
|
|
delete efficiencymapmet;
|
1125 |
|
|
delete efficiencymapAcc;
|
1126 |
|
|
delete efficiencymapID;
|
1127 |
|
|
delete efficiencymapJets;
|
1128 |
|
|
delete efficiencymapSignal;
|
1129 |
|
|
delete Neventsmap;
|
1130 |
buchmann |
1.16 |
delete ScanIdentifier;
|
1131 |
buchmann |
1.1 |
delete ipointmap;
|
1132 |
|
|
delete syspdfmap;
|
1133 |
|
|
delete systotmap;
|
1134 |
|
|
delete sysstatmap;
|
1135 |
buchmann |
1.3 |
delete XSmap;
|
1136 |
buchmann |
1.8 |
delete absXSmap;
|
1137 |
buchmann |
1.13 |
TObject* old=gDirectory->GetList()->FindObject("limcanvas");
|
1138 |
|
|
if(old) gDirectory->GetList()->Remove(old);
|
1139 |
buchmann |
1.19 |
return empty;
|
1140 |
buchmann |
1.1 |
}
|
1141 |
|
|
|
1142 |
buchmann |
1.9 |
void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float peakerrordata, float njobs=-1, float jobnumber=-1, bool systonly=false, bool effonly=false,bool shapeanalysis=false) {
|
1143 |
buchmann |
1.1 |
dout << "Starting the SUSY scan now with all " << jzb_cut.size() << " bin(s)" << endl;
|
1144 |
buchmann |
1.19 |
dout << " mcjzb: " << mcjzb << endl;
|
1145 |
|
|
dout << " datajzb: " << datajzb << endl;
|
1146 |
|
|
dout << " jzb_cut: ";
|
1147 |
buchmann |
1.21 |
for(int ib=0;ib<(int)jzb_cut.size()-1;ib++) dout << jzb_cut[ib] << ", ";
|
1148 |
buchmann |
1.19 |
dout << jzb_cut[jzb_cut.size()-1] << endl;
|
1149 |
|
|
dout << " requireZ: " << requireZ << endl;
|
1150 |
|
|
dout << " Peak error: " << peakerror << endl;
|
1151 |
|
|
dout << " Data Peak e: " << peakerrordata << endl;
|
1152 |
|
|
dout << " NJobs : " << njobs << endl;
|
1153 |
|
|
dout << " Job num: " << jobnumber << endl;
|
1154 |
|
|
dout << " Syst only?" << systonly << endl;
|
1155 |
|
|
dout << " Eff only? " << effonly << endl;
|
1156 |
|
|
dout << " Shape analysis?" << shapeanalysis << endl;
|
1157 |
|
|
|
1158 |
buchmann |
1.15 |
for(int ibin=0;ibin<(int)jzb_cut.size();ibin++) {
|
1159 |
buchmann |
1.13 |
scan_SUSY_parameter_space_for_one_cut(mcjzb,datajzb,jzb_cut,requireZ, peakerror, peakerrordata, ibin, njobs, jobnumber,systonly,effonly,shapeanalysis);
|
1160 |
buchmann |
1.1 |
}
|
1161 |
buchmann |
1.6 |
delete_any_cached_scans();// tidy up ...
|
1162 |
buchmann |
1.1 |
}
|
1163 |
|
|
|
1164 |
buchmann |
1.18 |
|
1165 |
|
|
|
1166 |
|
|
void compute_upper_limits_from_shapes(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float peakerrordata) {
|
1167 |
|
|
dout << "Starting the SUSY scan now with all " << jzb_cut.size() << " bin(s)" << endl;
|
1168 |
|
|
vector<vector<float> > limits;
|
1169 |
|
|
vector<string> samplename;
|
1170 |
buchmann |
1.21 |
for(int isample=0;isample<(int)signalsamples.collection.size();isample++) {
|
1171 |
buchmann |
1.18 |
limits.push_back(scan_SUSY_parameter_space_for_one_cut(mcjzb,datajzb,jzb_cut,requireZ, peakerror, peakerrordata, 0, -2, -2,false,false,true,signalsamples.collection[isample].filename));// the "-2" stands for "load from customized path"
|
1172 |
|
|
}
|
1173 |
buchmann |
1.21 |
for(int isample=0;isample<(int)signalsamples.collection.size();isample++) {
|
1174 |
buchmann |
1.18 |
dout << signalsamples.collection[isample].samplename << " :" << endl;
|
1175 |
|
|
dout << " observed : " << limits[isample][0] << endl;
|
1176 |
|
|
dout << " expected : " << limits[isample][1] << endl;
|
1177 |
|
|
dout << " exp. band: [ " << limits[isample][5] << " , " << limits[isample][3] << " , \033[1;34m " << limits[isample][1] << "\033[0m , " << limits[isample][2] << " , " << limits[isample][4] << "] " << endl;
|
1178 |
|
|
}
|
1179 |
|
|
}
|