29 |
|
histo->GetYaxis()->CenterTitle(); |
30 |
|
} |
31 |
|
|
32 |
– |
void scan_susy_space(string mcjzb, string datajzb) { |
33 |
– |
TCanvas *c3 = new TCanvas("c3","c3"); |
34 |
– |
vector<float> binning; |
35 |
– |
binning=allsamples.get_optimal_binsize(mcjzb,cutmass&&cutOSSF&&cutnJets,20,50,800); |
36 |
– |
float arrbinning[binning.size()]; |
37 |
– |
for(int i=0;i<binning.size();i++) arrbinning[i]=binning[i]; |
38 |
– |
TH1F *puredata = allsamples.Draw("puredata", datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
39 |
– |
puredata->SetMarkerSize(DataMarkerSize); |
40 |
– |
TH1F *allbgs = allsamples.Draw("allbgs", "-"+datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
41 |
– |
TH1F *allbgsb = allsamples.Draw("allbgsb", "-"+datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity); |
42 |
– |
TH1F *allbgsc = allsamples.Draw("allbgsc", datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity); |
43 |
– |
allbgs->Add(allbgsb,-1); |
44 |
– |
allbgs->Add(allbgsc); |
45 |
– |
int ndata=puredata->Integral(); |
46 |
– |
ofstream myfile; |
47 |
– |
myfile.open ("susyscan_log.txt"); |
48 |
– |
TFile *susyscanfile = new TFile("/scratch/fronga/SMS/T5z_SqSqToQZQZ_38xFall10.root"); |
49 |
– |
TTree *suevents = (TTree*)susyscanfile->Get("events"); |
50 |
– |
TH2F *exclusionmap = new TH2F("exclusionmap","",20,0,500,20,0,1000); |
51 |
– |
TH2F *exclusionmap1s = new TH2F("exclusionmap1s","",20,0,500,20,0,1000); |
52 |
– |
TH2F *exclusionmap2s = new TH2F("exclusionmap2s","",20,0,500,20,0,1000); |
53 |
– |
TH2F *exclusionmap3s = new TH2F("exclusionmap3s","",20,0,500,20,0,1000); |
54 |
– |
|
55 |
– |
susy_scan_axis_labeling(exclusionmap); |
56 |
– |
susy_scan_axis_labeling(exclusionmap1s); |
57 |
– |
susy_scan_axis_labeling(exclusionmap2s); |
58 |
– |
susy_scan_axis_labeling(exclusionmap3s); |
59 |
– |
|
60 |
– |
Int_t MyPalette[100]; |
61 |
– |
Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0}; |
62 |
– |
Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0}; |
63 |
– |
Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0}; |
64 |
– |
Double_t stop[] = {0., .25, .50, .75, 1.0}; |
65 |
– |
Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 100); |
66 |
– |
for (int i=0;i<100;i++) MyPalette[i] = FI+i; |
67 |
– |
|
68 |
– |
gStyle->SetPalette(100, MyPalette); |
69 |
– |
|
70 |
– |
for(int m23=50;m23<500;m23+=25) { |
71 |
– |
for (int m0=(2*(m23-50)+150);m0<=1000;m0+=50) |
72 |
– |
{ |
73 |
– |
c3->cd(); |
74 |
– |
stringstream drawcondition; |
75 |
– |
drawcondition << "pfJetGoodNum>=3&&(TMath::Abs(masses[0]-"<<m0<<")<10&&TMath::Abs(masses[2]-masses[3]-"<<m23<<")<10)&&mll>5&&id1==id2"; |
76 |
– |
TH1F *puresignal = new TH1F("puresignal","puresignal",binning.size()-1,arrbinning); |
77 |
– |
TH1F *puresignall= new TH1F("puresignall","puresignal",binning.size()-1,arrbinning); |
78 |
– |
stringstream drawvar,drawvar2; |
79 |
– |
drawvar<<mcjzb<<">>puresignal"; |
80 |
– |
drawvar2<<"-"<<mcjzb<<">>puresignall"; |
81 |
– |
suevents->Draw(drawvar.str().c_str(),drawcondition.str().c_str()); |
82 |
– |
suevents->Draw(drawvar2.str().c_str(),drawcondition.str().c_str()); |
83 |
– |
if(puresignal->Integral()<60) { |
84 |
– |
delete puresignal; |
85 |
– |
continue; |
86 |
– |
} |
87 |
– |
puresignal->Add(puresignall,-1);//we need to correct for the signal contamination - we effectively only see (JZB>0)-(JZB<0) !! |
88 |
– |
puresignal->Scale(ndata/(20*puresignal->Integral()));//normalizing it to 5% of the data |
89 |
– |
stringstream saveas; |
90 |
– |
saveas<<"Model_Scan/m0_"<<m0<<"__m23_"<<m23; |
91 |
– |
dout << "PLEASE KEEP IN MIND THAT SIGNAL CONTAMINATION IS NOT REALLY TAKEN CARE OF YET DUE TO LOW STATISTICS! SHOULD BE SOMETHING LIKE THIS : "<< endl; |
92 |
– |
// TH1F *signalpredlo = allsamples.Draw("signalpredlo", "-"+mcjzb, binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity,allsamples.FindSample("LM4")); |
93 |
– |
// TH1F *signalpredro = allsamples.Draw("signalpredro", mcjzb, binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity,allsamples.FindSample("LM4")); |
94 |
– |
// TH1F *puredata = allsamples.Draw("puredata", datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
95 |
– |
// signalpred->Add(signalpredlo,-1); |
96 |
– |
// signalpred->Add(signalpredro); |
97 |
– |
// puresignal->Add(signalpred,-1);//subtracting signal contamination |
98 |
– |
//--------------------- |
99 |
– |
// dout << "(m0,m23)=("<<m0<<","<<m23<<") contains " << puresignal->Integral() << endl; |
100 |
– |
// TH1F *puresignal = allsamples.Draw("puresignal",mcjzb, binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity,allsamples.FindSample("LM4")); |
101 |
– |
vector<float> results=establish_upper_limits(puredata,allbgs,puresignal,saveas.str(),myfile); |
102 |
– |
if(results.size()==0) { |
103 |
– |
delete puresignal; |
104 |
– |
continue; |
105 |
– |
} |
106 |
– |
exclusionmap->Fill(m23,m0,results[0]); |
107 |
– |
exclusionmap1s->Fill(m23,m0,results[1]); |
108 |
– |
exclusionmap2s->Fill(m23,m0,results[2]); |
109 |
– |
exclusionmap3s->Fill(m23,m0,results[3]); |
110 |
– |
delete puresignal; |
111 |
– |
dout << "(m0,m23)=("<<m0<<","<<m23<<") : 3 sigma at " << results[3] << endl; |
112 |
– |
} |
113 |
– |
}//end of model scan for loop |
114 |
– |
|
115 |
– |
dout << "Exclusion Map contains" << exclusionmap->Integral() << " (integral) and entries: " << exclusionmap->GetEntries() << endl; |
116 |
– |
c3->cd(); |
117 |
– |
exclusionmap->Draw("CONTZ"); |
118 |
– |
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_Mean_values"); |
119 |
– |
exclusionmap->Draw("COLZ"); |
120 |
– |
CompleteSave(c3,"Model_Scan/COL/Model_Scan_Mean_values"); |
121 |
– |
|
122 |
– |
exclusionmap1s->Draw("CONTZ"); |
123 |
– |
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_1sigma_values"); |
124 |
– |
exclusionmap1s->Draw("COLZ"); |
125 |
– |
CompleteSave(c3,"Model_Scan/COL/Model_Scan_1sigma_values"); |
126 |
– |
|
127 |
– |
exclusionmap2s->Draw("CONTZ"); |
128 |
– |
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_2sigma_values"); |
129 |
– |
exclusionmap2s->Draw("COLZ"); |
130 |
– |
CompleteSave(c3,"Model_Scan/COL/Model_Scan_2sigma_values"); |
131 |
– |
|
132 |
– |
exclusionmap3s->Draw("CONTZ"); |
133 |
– |
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_3sigma_values"); |
134 |
– |
exclusionmap3s->Draw("COLZ"); |
135 |
– |
CompleteSave(c3,"Model_Scan/COL/Model_Scan_3sigma_values"); |
136 |
– |
|
137 |
– |
TFile *exclusion_limits = new TFile("exclusion_limits.root","RECREATE"); |
138 |
– |
exclusionmap->Write(); |
139 |
– |
exclusionmap1s->Write(); |
140 |
– |
exclusionmap2s->Write(); |
141 |
– |
exclusionmap3s->Write(); |
142 |
– |
exclusion_limits->Close(); |
143 |
– |
susyscanfile->Close(); |
144 |
– |
|
145 |
– |
myfile.close(); |
146 |
– |
} |
147 |
– |
|
32 |
|
bool isThreadActive=false; |
33 |
|
|
34 |
|
struct limit_args { |
73 |
|
} |
74 |
|
} |
75 |
|
|
76 |
< |
void prepare_scan_axis(TH2 *variablemap) { |
76 |
> |
void prepare_scan_axis(TH2 *variablemap,bool ismSUGRA) { |
77 |
|
variablemap->GetXaxis()->SetTitle("m_{glu}"); |
194 |
– |
variablemap->GetXaxis()->CenterTitle(); |
78 |
|
variablemap->GetYaxis()->SetTitle("m_{LSP}"); |
196 |
– |
variablemap->GetYaxis()->CenterTitle(); |
79 |
|
|
80 |
< |
variablemap->GetXaxis()->SetTitle("m_{glu}"); |
80 |
> |
if(ismSUGRA) { |
81 |
> |
variablemap->GetXaxis()->SetTitle("m_{0}"); |
82 |
> |
variablemap->GetYaxis()->SetTitle("m_{1/2}"); |
83 |
> |
} |
84 |
> |
|
85 |
|
variablemap->GetXaxis()->CenterTitle(); |
200 |
– |
variablemap->GetYaxis()->SetTitle("m_{LSP}"); |
86 |
|
variablemap->GetYaxis()->CenterTitle(); |
87 |
|
} |
88 |
|
|
105 |
|
string massgluname="MassGlu"; |
106 |
|
string massLSPname="MassLSP"; |
107 |
|
|
108 |
+ |
// up to here, everything is set up for SMS; now we need to switch stuff around if we're dealing with an mSUGRA scan! |
109 |
+ |
bool ismSUGRA=false; |
110 |
+ |
if(Contains((scansample.collection)[0].filename,"mSUGRA")) ismSUGRA=true; |
111 |
+ |
if(ismSUGRA) { |
112 |
+ |
massgluname="M0"; // this is the "x axis" in the limit plot (like the gluino in the SMS case) |
113 |
+ |
massLSPname="M12"; // this is the "y axis" in the limit plot (like the LSP in the SMS case) |
114 |
+ |
mglustart=m0start; |
115 |
+ |
mgluend=m0end; |
116 |
+ |
mglustep=m0step; |
117 |
+ |
mLSPstart=m12start; |
118 |
+ |
mLSPend=m12end; |
119 |
+ |
mLSPstep=m12step; |
120 |
+ |
} |
121 |
+ |
|
122 |
|
Int_t MyPalette[100]; |
123 |
|
Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0}; |
124 |
|
Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0}; |
130 |
|
gStyle->SetPalette(100, MyPalette); |
131 |
|
|
132 |
|
TH2F *limitmap = new TH2F(("limitmap"+any2string(jzbSel)).c_str(), "",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep); |
133 |
+ |
TH2F *exclmap = new TH2F(("exclusionmap"+any2string(jzbSel)).c_str(), "",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep); |
134 |
|
TH2F *sysjesmap = new TH2F(("sysjes"+any2string(jzbSel)).c_str(), "",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep); |
135 |
|
TH2F *sysjsumap = new TH2F(("sysjsu"+any2string(jzbSel)).c_str(), "",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep); |
136 |
|
TH2F *sysresmap = new TH2F(("sysresmap"+any2string(jzbSel)).c_str(),"",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep); |
141 |
|
|
142 |
|
TCanvas *limcanvas = new TCanvas("limcanvas","Limit canvas"); |
143 |
|
|
244 |
– |
|
144 |
|
int Npoints=0; |
145 |
|
for(int mglu=mglustart;mglu<=mgluend;mglu+=mglustep) { |
146 |
|
for (int mlsp=mLSPstart;mlsp<=mLSPend&&mlsp<=mglu;mlsp+=mLSPstep) Npoints++; |
158 |
|
(scansample.collection)[0].events->Draw("eventNum",addcut.str().c_str(),"goff"); |
159 |
|
float nevents = (scansample.collection)[0].events->GetSelectedRows(); |
160 |
|
vector<vector<float> > systematics; |
161 |
< |
if(nevents!=0) MCefficiency((scansample.collection)[0].events,result,resulterr,mcjzb,requireZ,nevents,addcut.str()); |
162 |
< |
if(nevents==0||result!=result||resulterr!=resulterr) { |
264 |
< |
dout << "Limits can't be calculated for this configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") as either the efficiency or its error are not numbers or the number of events is zero! (result="<<result<<" and resulterr="<<resulterr<<"; Nevents=" << nevents << ")"<< endl; |
161 |
> |
if(nevents==0) { |
162 |
> |
dout << "This configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains no events and will be skipped."<< endl; |
163 |
|
continue; |
164 |
|
} else { |
165 |
< |
dout << "Configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") passed the mcefficiency and Nevents test." << "(result="<<result<<" and resulterr="<<resulterr<<"; Nevents=" << nevents << ")" << endl; |
165 |
> |
dout << "OK! This configuration ("<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp << ") contains " << nevents << " and will therefore not be skipped."<< endl; |
166 |
> |
} |
167 |
> |
if(nevents!=0&&efficiencyonly) { |
168 |
> |
MCefficiency((scansample.collection)[0].events,result,resulterr,mcjzb,requireZ,nevents,addcut.str()); |
169 |
> |
efficiencymap->Fill(mglu,mlsp,result); |
170 |
|
} |
269 |
– |
efficiencymap->Fill(mglu,mlsp,result); |
171 |
|
Neventsmap->Fill(mglu,mlsp,nevents); |
172 |
|
if(efficiencyonly) continue; |
173 |
|
|
174 |
< |
do_systematics_for_one_file((scansample.collection)[0].events,nevents,"SUSY SCAN", systematics,mcjzb,datajzb,peakerror,requireZ, addcut.str()); |
174 |
> |
do_systematics_for_one_file((scansample.collection)[0].events,nevents,"SUSY SCAN", systematics,mcjzb,datajzb,peakerror,requireZ, addcut.str(),ismSUGRA); |
175 |
|
float JZBcutat = systematics[0][0]; |
176 |
|
float mceff = systematics[0][1]; |
177 |
+ |
float mcefferr = systematics[0][2];//MC stat error |
178 |
|
float toterr = systematics[0][4]; |
179 |
|
float sys_jes = systematics[0][5]; // Jet Energy Scale |
180 |
|
float sys_jsu = systematics[0][6]; // JZB scale uncertainty |
181 |
|
float sys_res = systematics[0][7]; // resolution |
182 |
< |
|
183 |
< |
// cout << "EXTRACTED THE FOLLOWING INFORMATION: mceff=" << mceff << " , toterr=" << toterr << " , sys_jes=" << sys_jes << " , sys_jsu=" << sys_jsu << " , sys_res = " << sys_res << endl; |
182 |
> |
efficiencymap->Fill(mglu,mlsp,mceff); |
183 |
> |
efficiencymap->SetBinError(efficiencymap->FindBin(mglu,mlsp),mcefferr);//blublu |
184 |
|
|
185 |
|
if(mceff!=mceff||toterr!=toterr||mceff<0) { |
186 |
|
dout << "Limits can't be calculated for this configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") as either the efficiency or its error are not positive numbers! (mceff="<<mceff<<" and toterr="<<toterr<<")"<< endl; |
187 |
|
continue; |
188 |
|
} else { |
189 |
|
if(!systematicsonly&&!efficiencyonly) { |
190 |
< |
dout << "Calculating limit now for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl; |
190 |
> |
dout << "Calculating limit now for "<<massgluname<<"="<<mglu<<" , "<<massLSPname<<"="<<mlsp <<endl; |
191 |
|
vector<float> sigmas; |
192 |
|
do_limit_wrapper(mceff,toterr,ibin,mcjzb,sigmas); |
193 |
|
cout << "back in " << __FUNCTION__ << endl; |
211 |
|
} |
212 |
|
} |
213 |
|
|
214 |
< |
prepare_scan_axis(limitmap); |
215 |
< |
prepare_scan_axis(sysjesmap); |
216 |
< |
prepare_scan_axis(sysjsumap); |
217 |
< |
prepare_scan_axis(sysresmap); |
214 |
> |
prepare_scan_axis(limitmap,ismSUGRA); |
215 |
> |
prepare_scan_axis(sysjesmap,ismSUGRA); |
216 |
> |
prepare_scan_axis(sysjsumap,ismSUGRA); |
217 |
> |
prepare_scan_axis(sysresmap,ismSUGRA); |
218 |
|
|
219 |
|
if(!systematicsonly&&!efficiencyonly) { |
220 |
|
limcanvas->cd(); |
221 |
|
limitmap->Draw("COLZ"); |
222 |
< |
TText *title = write_title("Limits in LSP-Glu plane"); |
222 |
> |
string titletobewritten="Limits in LSP-Glu plane"; |
223 |
> |
if(ismSUGRA) titletobewritten="Limits in m_{1/2}-m_{0} plane"; |
224 |
> |
TText *title = write_title(titletobewritten); |
225 |
|
title->Draw(); |
226 |
|
if(runninglocally) { |
227 |
|
CompleteSave(limcanvas,"SUSYScan/Limits_JZB_geq"+any2string(jzb_cut[ibin])); |
240 |
|
if(systematicsonly) { // systematics only : |
241 |
|
limcanvas->cd(); |
242 |
|
sysjesmap->Draw("COLZ"); |
243 |
< |
TText *title = write_title("Jet Energy scale in LSP-Glu plane"); |
243 |
> |
string titletobewritten="Jet Energy scale in LSP-Glu plane"; |
244 |
> |
if(ismSUGRA) titletobewritten="Limits in m_{1/2}-m_{0} plane"; |
245 |
> |
TText *title = write_title(titletobewritten); |
246 |
|
title->Draw(); |
247 |
|
if(runninglocally) { |
248 |
|
CompleteSave(limcanvas,"SUSYScan/JES_geq"+any2string(jzb_cut[ibin])); |
249 |
|
} |
250 |
|
sysjsumap->Draw("COLZ"); |
251 |
< |
TText *title2 = write_title("JZB Scale Uncertainty in LSP-Glu plane"); |
251 |
> |
titletobewritten="JZB Scale Uncertainty in LSP-Glu plane"; |
252 |
> |
if(ismSUGRA) titletobewritten="JZB Scale Uncertainty in m_{1/2}-m_{0} plane"; |
253 |
> |
TText *title2 = write_title(titletobewritten); |
254 |
|
title2->Draw(); |
255 |
|
if(runninglocally) { |
256 |
|
CompleteSave(limcanvas,"SUSYScan/JSU_geq"+any2string(jzb_cut[ibin])); |
257 |
|
} |
258 |
|
sysresmap->Draw("COLZ"); |
259 |
< |
TText *title3 = write_title("Resolution in LSP-Glu plane"); |
259 |
> |
titletobewritten="Resolution in LSP-Glu plane"; |
260 |
> |
if(ismSUGRA) titletobewritten="Resolution in m_{1/2}-m_{0} plane"; |
261 |
> |
TText *title3 = write_title(titletobewritten); |
262 |
|
title3->Draw(); |
263 |
|
if(runninglocally) { |
264 |
|
CompleteSave(limcanvas,"SUSYScan/Resolution_geq"+any2string(jzb_cut[ibin])); |
277 |
|
if(efficiencyonly) { |
278 |
|
limcanvas->cd(); |
279 |
|
efficiencymap->Draw("COLZ"); |
280 |
< |
TText *title = write_title("Efficiencies in LSP-Glu plane"); |
280 |
> |
string titletobewritten="Efficiencies in LSP-Glu plane"; |
281 |
> |
if(ismSUGRA) titletobewritten="Efficiencies in m_{1/2}-m_{0} plane"; |
282 |
> |
TText *title = write_title(titletobewritten); |
283 |
|
title->Draw(); |
284 |
|
if(runninglocally) { |
285 |
|
CompleteSave(limcanvas,"SUSYScan/Efficiency_geq"+any2string(jzb_cut[ibin])); |
286 |
|
} |
287 |
|
limcanvas->cd(); |
288 |
|
sysjesmap->Draw("COLZ"); |
289 |
< |
TText *title2 = write_title("N(events) in LSP-Glu plane"); |
289 |
> |
titletobewritten="N(events) in LSP-Glu plane"; |
290 |
> |
if(ismSUGRA) titletobewritten="N(events) in m_{1/2}-m_{0} plane"; |
291 |
> |
TText *title2 = write_title(titletobewritten); |
292 |
|
title2->Draw(); |
293 |
|
if(runninglocally) { |
294 |
|
CompleteSave(limcanvas,"SUSYScan/Nevents_geq"+any2string(jzb_cut[ibin])); |