ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/Modules/SUSYScan.C
Revision: 1.20
Committed: Fri Aug 19 17:15:37 2011 UTC (13 years, 8 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Changes since 1.19: +1 -1 lines
Log Message:
Providing more information on screen about points that passed the basic test

File Contents

# User Rev Content
1 buchmann 1.1 #include <iostream>
2     #include <vector>
3     #include <sys/stat.h>
4     #include <fstream>
5 buchmann 1.7 #include <pthread.h>
6 buchmann 1.1
7     #include <TCut.h>
8     #include <TROOT.h>
9     #include <TCanvas.h>
10     #include <TMath.h>
11     #include <TColor.h>
12     #include <TPaveText.h>
13     #include <TRandom.h>
14     #include <TH1.h>
15     #include <TH2.h>
16     #include <TF1.h>
17     #include <TSQLResult.h>
18     #include <TProfile.h>
19    
20     //#include "TTbar_stuff.C"
21     using namespace std;
22    
23     using namespace PlottingSetup;
24    
25     void susy_scan_axis_labeling(TH2F *histo) {
26     histo->GetXaxis()->SetTitle("#Chi_{2}^{0}-LSP");
27     histo->GetXaxis()->CenterTitle();
28     histo->GetYaxis()->SetTitle("m_{#tilde{q}}");
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    
148 buchmann 1.7 bool isThreadActive=false;
149    
150     struct limit_args {
151     float mceff;
152     float toterr;
153     int ibin;
154     string mcjzb;
155     vector<float> sigmas;
156     };
157    
158     void* compute_one_upper_limit_wrapper(void* data) {
159     isThreadActive=true;
160     limit_args* args = (limit_args*) data;
161     std::cout << "Thread to compute limits has been started" << std::endl;
162     args->sigmas=compute_one_upper_limit(args->mceff,args->toterr,args->ibin,args->mcjzb);
163     std::cout << "Thread to compute limits has finished" << std::endl;
164     isThreadActive=false;
165     return NULL; // oder in C++: return 0;// Damit kann man Werte zurückgeben
166     }
167    
168     void do_limit_wrapper(float mceff,float toterr,int ibin,string mcjzb,vector<float> &sigmas) {
169     pthread_t limitthread;
170 fronga 1.8 limit_args limargs={mceff,toterr,ibin,mcjzb,sigmas};
171 buchmann 1.7 pthread_create( &limitthread, NULL, compute_one_upper_limit_wrapper, (void*) &limargs);
172     int counter=0;
173     sleep(1); //waiting a second for the process to become active
174     while(counter<limitpatience*60 && isThreadActive) {
175 buchmann 1.13 std::cout << "Limits are being calculated; Checking round " << counter << " ( corresponds to " << seconds_to_time(counter) << " ) , patience will end in " << seconds_to_time(60*60*limitpatience-counter) << std::endl;
176 buchmann 1.7 counter++;
177     sleep(1);
178     }
179    
180     if(!isThreadActive) {
181     cout << "Thread finished sucessfully" << endl;
182     pthread_join( limitthread, NULL );
183     std::cout<< __FUNCTION__ << " : going to save sigmas " << std::endl;
184     sigmas=limargs.sigmas;
185     } else {
186     pthread_cancel(limitthread);
187     std::cout << "DID NOT TERMINATE IN TIME - ABORTED!" << std::endl;
188     sigmas.push_back(-1);sigmas.push_back(-1);sigmas.push_back(-1);
189     }
190     }
191    
192 buchmann 1.9 void prepare_scan_axis(TH2 *variablemap) {
193     variablemap->GetXaxis()->SetTitle("m_{glu}");
194     variablemap->GetXaxis()->CenterTitle();
195     variablemap->GetYaxis()->SetTitle("m_{LSP}");
196     variablemap->GetYaxis()->CenterTitle();
197    
198     variablemap->GetXaxis()->SetTitle("m_{glu}");
199     variablemap->GetXaxis()->CenterTitle();
200     variablemap->GetYaxis()->SetTitle("m_{LSP}");
201     variablemap->GetYaxis()->CenterTitle();
202     }
203    
204 buchmann 1.13 void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, int ibin,float njobs=-1, float jobnumber=-1, bool systematicsonly=false,bool efficiencyonly=false) {
205 buchmann 1.6 bool runninglocally=true;
206     if(njobs>-1&&jobnumber>-1) {
207     runninglocally=false;
208 buchmann 1.13 dout << "Running on the GRID (this is job " << jobnumber << "/" << njobs << ") for a jzb cut at " << jzb_cut[ibin] << endl;
209 buchmann 1.6 } else {
210 buchmann 1.7 dout << "Running locally " << endl;
211     dout << "This will take a really, really long time - if you want to see the results THIS week try running the LimitWorkerScript on the grid (DistributedModelCalculation/Limits/)" << endl;
212 buchmann 1.6 }
213 buchmann 1.4
214 buchmann 1.18 cout << "FILE USED: " << (scansample.collection)[0].filename << endl;
215 buchmann 1.4 jzbSel=jzb_cut[ibin];
216     geqleq="geq";
217     automatized=true;
218     mcjzbexpression=mcjzb;
219    
220     string massgluname="MassGlu";
221     string massLSPname="MassLSP";
222    
223     Int_t MyPalette[100];
224     Double_t r[] = {0., 0.0, 1.0, 1.0, 1.0};
225     Double_t g[] = {0., 0.0, 0.0, 1.0, 1.0};
226     Double_t b[] = {0., 1.0, 0.0, 0.0, 1.0};
227     Double_t stop[] = {0., .25, .50, .75, 1.0};
228     Int_t FI = TColor::CreateGradientColorTable(5, stop, r, g, b, 110);
229     for (int i=0;i<100;i++) MyPalette[i] = FI+i;
230    
231     gStyle->SetPalette(100, MyPalette);
232    
233 buchmann 1.9 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);
234     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);
235     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);
236     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);
237 buchmann 1.13 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);
238     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);
239 buchmann 1.4 float rightmargin=gStyle->GetPadRightMargin();
240     gStyle->SetPadRightMargin(0.15);
241    
242     TCanvas *limcanvas = new TCanvas("limcanvas","Limit canvas");
243    
244 buchmann 1.6
245     int Npoints=0;
246     for(int mglu=mglustart;mglu<=mgluend;mglu+=mglustep) {
247     for (int mlsp=mLSPstart;mlsp<=mLSPend&&mlsp<=mglu;mlsp+=mLSPstep) Npoints++;
248     }
249    
250     int ipoint=-1;
251 buchmann 1.4 for(int mglu=mglustart;mglu<=mgluend;mglu+=mglustep) {
252     for (int mlsp=mLSPstart;mlsp<=mLSPend&&mlsp<=mglu;mlsp+=mLSPstep)
253     {
254 buchmann 1.6 ipoint++;
255     if(!runninglocally&&!do_this_point(ipoint,Npoints,jobnumber,njobs)) continue;
256 buchmann 1.19 float result=-987,resulterr=-987;
257 buchmann 1.4 stringstream addcut;
258     addcut << "(TMath::Abs("<<massgluname<<"-"<<mglu<<")<5)&&(TMath::Abs("<<massLSPname<<"-"<<mlsp<<")<5)";
259 buchmann 1.14 (scansample.collection)[0].events->Draw("eventNum",addcut.str().c_str(),"goff");
260     float nevents = (scansample.collection)[0].events->GetSelectedRows();
261 buchmann 1.4 vector<vector<float> > systematics;
262 buchmann 1.15 if(nevents!=0) MCefficiency((scansample.collection)[0].events,result,resulterr,mcjzb,requireZ,nevents,addcut.str());
263     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;
265 buchmann 1.6 continue;
266     } else {
267 buchmann 1.20 dout << "Configuration (mglu="<<mglu<<" , mlsp="<<mlsp << ") passed the mcefficiency and Nevents test." << "(result="<<result<<" and resulterr="<<resulterr<<"; Nevents=" << nevents << ")" << endl;
268 buchmann 1.13 }
269 buchmann 1.17 efficiencymap->Fill(mglu,mlsp,result);
270     Neventsmap->Fill(mglu,mlsp,nevents);
271     if(efficiencyonly) continue;
272    
273 buchmann 1.14 do_systematics_for_one_file((scansample.collection)[0].events,nevents,"SUSY SCAN", systematics,mcjzb,datajzb,peakerror,requireZ, addcut.str());
274 buchmann 1.9 float JZBcutat = systematics[0][0];
275     float mceff = systematics[0][1];
276     float toterr = systematics[0][4];
277     float sys_jes = systematics[0][5]; // Jet Energy Scale
278     float sys_jsu = systematics[0][6]; // JZB scale uncertainty
279     float sys_res = systematics[0][7]; // resolution
280    
281 buchmann 1.13 // cout << "EXTRACTED THE FOLLOWING INFORMATION: mceff=" << mceff << " , toterr=" << toterr << " , sys_jes=" << sys_jes << " , sys_jsu=" << sys_jsu << " , sys_res = " << sys_res << endl;
282 buchmann 1.10
283 buchmann 1.15 if(mceff!=mceff||toterr!=toterr||mceff<0) {
284     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;
285 buchmann 1.4 continue;
286 buchmann 1.5 } else {
287 buchmann 1.13 if(!systematicsonly&&!efficiencyonly) {
288 buchmann 1.9 dout << "Calculating limit now for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
289     vector<float> sigmas;
290     do_limit_wrapper(mceff,toterr,ibin,mcjzb,sigmas);
291     cout << "back in " << __FUNCTION__ << endl;
292     if(sigmas[0]>-0.5) { // negative sigmas are the error signature of do_limit_wrapper, so we want to exclude them.
293     limitmap->Fill(mglu,mlsp,sigmas[0]);
294 buchmann 1.17 sysjesmap->Fill(mglu,mlsp,sys_jes);
295     sysjsumap->Fill(mglu,mlsp,sys_jsu);
296     sysresmap->Fill(mglu,mlsp,sys_res);
297     efficiencymap->Fill(mglu,mlsp,result);
298     Neventsmap->Fill(mglu,mlsp,nevents);
299 buchmann 1.9 dout << "A limit has been added at " << sigmas[0] << " for m_{glu}="<<mglu << " and m_{lsp}="<<mlsp<<endl;
300 buchmann 1.11 } //end of if sigma is positive
301     //end of not systematics only condition
302 buchmann 1.13 }
303     if(systematicsonly) {
304 buchmann 1.9 sysjesmap->Fill(mglu,mlsp,sys_jes);
305     sysjsumap->Fill(mglu,mlsp,sys_jsu);
306     sysresmap->Fill(mglu,mlsp,sys_res);
307 buchmann 1.17 efficiencymap->Fill(mglu,mlsp,result);
308     Neventsmap->Fill(mglu,mlsp,nevents);
309 buchmann 1.11 }
310 buchmann 1.15 }//efficiency is valid
311 buchmann 1.4 }
312     }
313    
314 buchmann 1.9 prepare_scan_axis(limitmap);
315     prepare_scan_axis(sysjesmap);
316     prepare_scan_axis(sysjsumap);
317     prepare_scan_axis(sysresmap);
318    
319 buchmann 1.13 if(!systematicsonly&&!efficiencyonly) {
320 buchmann 1.9 limcanvas->cd();
321     limitmap->Draw("COLZ");
322     TText *title = write_title("Limits in LSP-Glu plane");
323     title->Draw();
324     if(runninglocally) {
325     CompleteSave(limcanvas,"SUSYScan/Limits_JZB_geq"+any2string(jzb_cut[ibin]));
326     } else {
327 buchmann 1.12 TFile *outputfile;
328     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 :-)
329     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
330 buchmann 1.9 limitmap->Write();
331 buchmann 1.18 sysjesmap->Write();
332     sysjsumap->Write();
333     efficiencymap->Write();
334     Neventsmap->Write();
335 buchmann 1.9 outputfile->Close();
336     }
337 buchmann 1.13 }
338     if(systematicsonly) { // systematics only :
339 buchmann 1.9 limcanvas->cd();
340     sysjesmap->Draw("COLZ");
341     TText *title = write_title("Jet Energy scale in LSP-Glu plane");
342     title->Draw();
343     if(runninglocally) {
344     CompleteSave(limcanvas,"SUSYScan/JES_geq"+any2string(jzb_cut[ibin]));
345     }
346     sysjsumap->Draw("COLZ");
347     TText *title2 = write_title("JZB Scale Uncertainty in LSP-Glu plane");
348     title2->Draw();
349     if(runninglocally) {
350     CompleteSave(limcanvas,"SUSYScan/JSU_geq"+any2string(jzb_cut[ibin]));
351     }
352     sysresmap->Draw("COLZ");
353     TText *title3 = write_title("Resolution in LSP-Glu plane");
354     title3->Draw();
355     if(runninglocally) {
356     CompleteSave(limcanvas,"SUSYScan/Resolution_geq"+any2string(jzb_cut[ibin]));
357     }
358    
359     if(!runninglocally) {
360     TFile *outputfile=new TFile(("output/DistributedSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");
361     sysjesmap->Write();
362     sysjsumap->Write();
363     sysresmap->Write();
364 buchmann 1.18 efficiencymap->Write();
365     Neventsmap->Write();
366 buchmann 1.9 outputfile->Close();
367     }
368     }//end of systematics only
369 buchmann 1.13 if(efficiencyonly) {
370     limcanvas->cd();
371     efficiencymap->Draw("COLZ");
372     TText *title = write_title("Efficiencies in LSP-Glu plane");
373     title->Draw();
374     if(runninglocally) {
375     CompleteSave(limcanvas,"SUSYScan/Efficiency_geq"+any2string(jzb_cut[ibin]));
376     }
377     limcanvas->cd();
378     sysjesmap->Draw("COLZ");
379     TText *title2 = write_title("N(events) in LSP-Glu plane");
380     title2->Draw();
381     if(runninglocally) {
382     CompleteSave(limcanvas,"SUSYScan/Nevents_geq"+any2string(jzb_cut[ibin]));
383     }
384     if(!runninglocally) {
385     TFile *outputfile=new TFile(("output/DistributedSystematics_job"+string(any2string(jobnumber))+"_of_"+string(any2string(njobs))+".root").c_str(),"UPDATE");
386     Neventsmap->Write();
387     efficiencymap->Write();
388     outputfile->Close();
389     }
390     }//end of efficiencies only
391     delete limcanvas;
392 buchmann 1.1 }
393 buchmann 1.4
394 buchmann 1.13 void scan_SUSY_parameter_space(string mcjzb,string datajzb,vector<float> jzb_cut,bool requireZ, float peakerror, float njobs=-1, float jobnumber=-1, bool systonly=false, bool effonly=false) {
395 buchmann 1.10 dout << "Starting the SUSY scan now with all " << jzb_cut.size() << " bin(s)" << endl;
396 buchmann 1.4 for(int ibin=0;ibin<jzb_cut.size();ibin++) {
397 buchmann 1.13 scan_SUSY_parameter_space(mcjzb,datajzb,jzb_cut,requireZ, peakerror, ibin, njobs, jobnumber,systonly,effonly);
398 buchmann 1.4 }
399 buchmann 1.6 }