1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
#include <fstream>
|
5 |
|
|
|
6 |
|
|
#include <TCut.h>
|
7 |
|
|
#include <TROOT.h>
|
8 |
|
|
#include <TCanvas.h>
|
9 |
|
|
#include <TMath.h>
|
10 |
|
|
#include <TColor.h>
|
11 |
|
|
#include <TPaveText.h>
|
12 |
|
|
#include <TRandom.h>
|
13 |
|
|
#include <TH1.h>
|
14 |
|
|
#include <TH2.h>
|
15 |
|
|
#include <TF1.h>
|
16 |
|
|
#include <TSQLResult.h>
|
17 |
|
|
#include <TProfile.h>
|
18 |
|
|
|
19 |
|
|
//#include "TTbar_stuff.C"
|
20 |
|
|
using namespace std;
|
21 |
|
|
|
22 |
|
|
using namespace PlottingSetup;
|
23 |
|
|
|
24 |
|
|
void susy_scan_axis_labeling(TH2F *histo) {
|
25 |
|
|
histo->GetXaxis()->SetTitle("#Chi_{2}^{0}-LSP");
|
26 |
|
|
histo->GetXaxis()->CenterTitle();
|
27 |
|
|
histo->GetYaxis()->SetTitle("m_{#tilde{q}}");
|
28 |
|
|
histo->GetYaxis()->CenterTitle();
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
void scan_susy_space(string mcjzb, string datajzb) {
|
32 |
|
|
TCanvas *c3 = new TCanvas("c3","c3");
|
33 |
|
|
vector<float> binning;
|
34 |
|
|
binning=allsamples.get_optimal_binsize(mcjzb,cutmass&&cutOSSF&&cutnJets,20,50,800);
|
35 |
|
|
float arrbinning[binning.size()];
|
36 |
|
|
for(int i=0;i<binning.size();i++) arrbinning[i]=binning[i];
|
37 |
|
|
TH1F *puredata = allsamples.Draw("puredata", datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity);
|
38 |
|
|
puredata->SetMarkerSize(DataMarkerSize);
|
39 |
|
|
TH1F *allbgs = allsamples.Draw("allbgs", "-"+datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity);
|
40 |
|
|
TH1F *allbgsb = allsamples.Draw("allbgsb", "-"+datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity);
|
41 |
|
|
TH1F *allbgsc = allsamples.Draw("allbgsc", datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity);
|
42 |
|
|
allbgs->Add(allbgsb,-1);
|
43 |
|
|
allbgs->Add(allbgsc);
|
44 |
|
|
int ndata=puredata->Integral();
|
45 |
|
|
ofstream myfile;
|
46 |
|
|
myfile.open ("susyscan_log.txt");
|
47 |
|
|
TFile *susyscanfile = new TFile("/scratch/fronga/SMS/T5z_SqSqToQZQZ_38xFall10.root");
|
48 |
|
|
TTree *suevents = (TTree*)susyscanfile->Get("events");
|
49 |
|
|
TH2F *exclusionmap = new TH2F("exclusionmap","",20,0,500,20,0,1000);
|
50 |
|
|
TH2F *exclusionmap1s = new TH2F("exclusionmap1s","",20,0,500,20,0,1000);
|
51 |
|
|
TH2F *exclusionmap2s = new TH2F("exclusionmap2s","",20,0,500,20,0,1000);
|
52 |
|
|
TH2F *exclusionmap3s = new TH2F("exclusionmap3s","",20,0,500,20,0,1000);
|
53 |
|
|
|
54 |
|
|
susy_scan_axis_labeling(exclusionmap);
|
55 |
|
|
susy_scan_axis_labeling(exclusionmap1s);
|
56 |
|
|
susy_scan_axis_labeling(exclusionmap2s);
|
57 |
|
|
susy_scan_axis_labeling(exclusionmap3s);
|
58 |
|
|
|
59 |
|
|
Int_t MyPalette[100];
|
60 |
|
|
Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0};
|
61 |
|
|
Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0};
|
62 |
|
|
Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0};
|
63 |
|
|
Double_t stop[] = {0., .25, .50, .75, 1.0};
|
64 |
|
|
Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 100);
|
65 |
|
|
for (int i=0;i<100;i++) MyPalette[i] = FI+i;
|
66 |
|
|
|
67 |
|
|
gStyle->SetPalette(100, MyPalette);
|
68 |
|
|
|
69 |
|
|
for(int m23=50;m23<500;m23+=25) {
|
70 |
|
|
for (int m0=(2*(m23-50)+150);m0<=1000;m0+=50)
|
71 |
|
|
{
|
72 |
|
|
c3->cd();
|
73 |
|
|
stringstream drawcondition;
|
74 |
|
|
drawcondition << "pfJetGoodNum>=3&&(TMath::Abs(masses[0]-"<<m0<<")<10&&TMath::Abs(masses[2]-masses[3]-"<<m23<<")<10)&&mll>5&&id1==id2";
|
75 |
|
|
TH1F *puresignal = new TH1F("puresignal","puresignal",binning.size()-1,arrbinning);
|
76 |
|
|
TH1F *puresignall= new TH1F("puresignall","puresignal",binning.size()-1,arrbinning);
|
77 |
|
|
stringstream drawvar,drawvar2;
|
78 |
|
|
drawvar<<mcjzb<<">>puresignal";
|
79 |
|
|
drawvar2<<"-"<<mcjzb<<">>puresignall";
|
80 |
|
|
suevents->Draw(drawvar.str().c_str(),drawcondition.str().c_str());
|
81 |
|
|
suevents->Draw(drawvar2.str().c_str(),drawcondition.str().c_str());
|
82 |
|
|
if(puresignal->Integral()<60) {
|
83 |
|
|
delete puresignal;
|
84 |
|
|
continue;
|
85 |
|
|
}
|
86 |
|
|
puresignal->Add(puresignall,-1);//we need to correct for the signal contamination - we effectively only see (JZB>0)-(JZB<0) !!
|
87 |
|
|
puresignal->Scale(ndata/(20*puresignal->Integral()));//normalizing it to 5% of the data
|
88 |
|
|
stringstream saveas;
|
89 |
|
|
saveas<<"Model_Scan/m0_"<<m0<<"__m23_"<<m23;
|
90 |
|
|
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;
|
91 |
|
|
// TH1F *signalpredlo = allsamples.Draw("signalpredlo", "-"+mcjzb, binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity,allsamples.FindSample("LM4"));
|
92 |
|
|
// TH1F *signalpredro = allsamples.Draw("signalpredro", mcjzb, binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity,allsamples.FindSample("LM4"));
|
93 |
|
|
// TH1F *puredata = allsamples.Draw("puredata", datajzb,binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity);
|
94 |
|
|
// signalpred->Add(signalpredlo,-1);
|
95 |
|
|
// signalpred->Add(signalpredro);
|
96 |
|
|
// puresignal->Add(signalpred,-1);//subtracting signal contamination
|
97 |
|
|
//---------------------
|
98 |
|
|
// dout << "(m0,m23)=("<<m0<<","<<m23<<") contains " << puresignal->Integral() << endl;
|
99 |
|
|
// TH1F *puresignal = allsamples.Draw("puresignal",mcjzb, binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity,allsamples.FindSample("LM4"));
|
100 |
|
|
vector<float> results=establish_upper_limits(puredata,allbgs,puresignal,saveas.str(),myfile);
|
101 |
|
|
if(results.size()==0) {
|
102 |
|
|
delete puresignal;
|
103 |
|
|
continue;
|
104 |
|
|
}
|
105 |
|
|
exclusionmap->Fill(m23,m0,results[0]);
|
106 |
|
|
exclusionmap1s->Fill(m23,m0,results[1]);
|
107 |
|
|
exclusionmap2s->Fill(m23,m0,results[2]);
|
108 |
|
|
exclusionmap3s->Fill(m23,m0,results[3]);
|
109 |
|
|
delete puresignal;
|
110 |
|
|
dout << "(m0,m23)=("<<m0<<","<<m23<<") : 3 sigma at " << results[3] << endl;
|
111 |
|
|
}
|
112 |
|
|
}//end of model scan for loop
|
113 |
|
|
|
114 |
|
|
dout << "Exclusion Map contains" << exclusionmap->Integral() << " (integral) and entries: " << exclusionmap->GetEntries() << endl;
|
115 |
|
|
c3->cd();
|
116 |
|
|
exclusionmap->Draw("CONTZ");
|
117 |
|
|
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_Mean_values");
|
118 |
|
|
exclusionmap->Draw("COLZ");
|
119 |
|
|
CompleteSave(c3,"Model_Scan/COL/Model_Scan_Mean_values");
|
120 |
|
|
|
121 |
|
|
exclusionmap1s->Draw("CONTZ");
|
122 |
|
|
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_1sigma_values");
|
123 |
|
|
exclusionmap1s->Draw("COLZ");
|
124 |
|
|
CompleteSave(c3,"Model_Scan/COL/Model_Scan_1sigma_values");
|
125 |
|
|
|
126 |
|
|
exclusionmap2s->Draw("CONTZ");
|
127 |
|
|
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_2sigma_values");
|
128 |
|
|
exclusionmap2s->Draw("COLZ");
|
129 |
|
|
CompleteSave(c3,"Model_Scan/COL/Model_Scan_2sigma_values");
|
130 |
|
|
|
131 |
|
|
exclusionmap3s->Draw("CONTZ");
|
132 |
|
|
CompleteSave(c3,"Model_Scan/CONT/Model_Scan_3sigma_values");
|
133 |
|
|
exclusionmap3s->Draw("COLZ");
|
134 |
|
|
CompleteSave(c3,"Model_Scan/COL/Model_Scan_3sigma_values");
|
135 |
|
|
|
136 |
|
|
TFile *exclusion_limits = new TFile("exclusion_limits.root","RECREATE");
|
137 |
|
|
exclusionmap->Write();
|
138 |
|
|
exclusionmap1s->Write();
|
139 |
|
|
exclusionmap2s->Write();
|
140 |
|
|
exclusionmap3s->Write();
|
141 |
|
|
exclusion_limits->Close();
|
142 |
|
|
susyscanfile->Close();
|
143 |
|
|
|
144 |
|
|
myfile.close();
|
145 |
|
|
}
|
146 |
|
|
|
147 |
|
|
void efficiency_scan_in_susy_space(string mcjzb, string datajzb, bool requireZ) {
|
148 |
|
|
cout << "Doing efficiency scan using " << (scansample.collection)[0].filename << endl;
|
149 |
|
|
geqleq="geq";
|
150 |
|
|
automatized=true;
|
151 |
buchmann |
1.2 |
mcjzbexpression=mcjzb;
|
152 |
buchmann |
1.1 |
|
153 |
|
|
string massgluname="MassGlu";
|
154 |
|
|
string massLSPname="MassLSP";
|
155 |
|
|
|
156 |
|
|
Int_t MyPalette[100];
|
157 |
|
|
Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0};
|
158 |
|
|
Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0};
|
159 |
|
|
Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0};
|
160 |
|
|
Double_t stop[] = {0., .25, .50, .75, 1.0};
|
161 |
buchmann |
1.2 |
Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 110);
|
162 |
buchmann |
1.1 |
for (int i=0;i<100;i++) MyPalette[i] = FI+i;
|
163 |
|
|
|
164 |
|
|
gStyle->SetPalette(100, MyPalette);
|
165 |
|
|
|
166 |
buchmann |
1.3 |
float mglustart=25;float mgluend=1200;float mglustep=25; //guessed values for official file
|
167 |
|
|
float mLSPstart=25;float mLSPend=1200;float mLSPstep=25; //guessed values for official file
|
168 |
|
|
// float mglustart=950;float mgluend=970;float mglustep=10;
|
169 |
|
|
// float mLSPstart=825;float mLSPend=900;float mLSPstep=10;
|
170 |
buchmann |
1.1 |
|
171 |
|
|
|
172 |
|
|
TH2F *efficiencymap = new TH2F("efficiencymap","",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
173 |
buchmann |
1.2 |
TH2F *Neventsmap = new TH2F("Neventsmap","",(mgluend-mglustart)/mglustep+1,mglustart-0.5*mglustep,mgluend+0.5*mglustep,(mLSPend-mLSPstart)/mLSPstep+1,mLSPstart-0.5*mLSPstep,mLSPend+0.5*mLSPstep);
|
174 |
|
|
|
175 |
buchmann |
1.1 |
float rightmargin=gStyle->GetPadRightMargin();
|
176 |
buchmann |
1.2 |
gStyle->SetPadRightMargin(0.14);
|
177 |
|
|
|
178 |
buchmann |
1.1 |
TCanvas *effcanvas = new TCanvas("effcanvas","Efficiency canvas");
|
179 |
buchmann |
1.2 |
|
180 |
buchmann |
1.1 |
for(int mglu=mglustart;mglu<=mgluend;mglu+=mglustep) {
|
181 |
|
|
for (int mlsp=mLSPstart;mlsp<=mLSPend&&mlsp<=mglu;mlsp+=mLSPstep)
|
182 |
|
|
{
|
183 |
|
|
float result,resulterr;
|
184 |
|
|
stringstream addcut;
|
185 |
|
|
addcut << "(TMath::Abs("<<massgluname<<"-"<<mglu<<")<5)&&(TMath::Abs("<<massLSPname<<"-"<<mlsp<<")<5)";
|
186 |
|
|
MCefficiency((scansample.collection)[0].events,result,resulterr,mcjzb,requireZ,addcut.str());
|
187 |
|
|
if(result!=result||isanyinf(result)) {
|
188 |
|
|
cout << "Watch out the result for mlsp=" << mlsp << " and mglu=" << mglu << " (" << result << ") has been detected as being not a number (nan) or infinity (inf) !" << endl;
|
189 |
|
|
result=0; // kicking nan and inf errors
|
190 |
|
|
}
|
191 |
|
|
efficiencymap->Fill(mglu,mlsp,result);
|
192 |
buchmann |
1.2 |
|
193 |
|
|
(scansample.collection)[0].events->Draw(mcjzb.c_str(),addcut.str().c_str(),"goff");
|
194 |
|
|
float nevents = (scansample.collection)[0].events->GetSelectedRows();
|
195 |
|
|
Neventsmap->Fill(mglu,mlsp,nevents);
|
196 |
buchmann |
1.1 |
}
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
efficiencymap->GetXaxis()->SetTitle("m_{glu}");
|
200 |
|
|
efficiencymap->GetXaxis()->CenterTitle();
|
201 |
|
|
efficiencymap->GetYaxis()->SetTitle("m_{LSP}");
|
202 |
|
|
efficiencymap->GetYaxis()->CenterTitle();
|
203 |
|
|
|
204 |
buchmann |
1.2 |
Neventsmap->GetXaxis()->SetTitle("m_{glu}");
|
205 |
|
|
Neventsmap->GetXaxis()->CenterTitle();
|
206 |
|
|
Neventsmap->GetYaxis()->SetTitle("m_{LSP}");
|
207 |
|
|
Neventsmap->GetYaxis()->CenterTitle();
|
208 |
buchmann |
1.1 |
|
209 |
|
|
efficiencymap->Draw("COLZ");
|
210 |
|
|
TText *title = write_title("Efficiency in LSP-Glu plane");
|
211 |
|
|
title->Draw();
|
212 |
|
|
CompleteSave(effcanvas,"SUSYScan/Efficency");
|
213 |
buchmann |
1.2 |
Neventsmap->Draw("COLZ");
|
214 |
|
|
TText *title2 = write_title("Number of events in LSP-Glu plane");
|
215 |
|
|
title2->Draw();
|
216 |
|
|
CompleteSave(effcanvas,"SUSYScan/Nevents");
|
217 |
buchmann |
1.1 |
gStyle->SetPadRightMargin(rightmargin);
|
218 |
|
|
}
|