ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/auterman/SusyScan/PlotScript/ExclusionPlot.cc
Revision: 1.1
Committed: Mon May 23 16:48:15 2011 UTC (13 years, 11 months ago) by auterman
Content type: text/plain
Branch: MAIN
CVS Tags: JHEP2010, HEAD
Log Message:
bla

File Contents

# User Rev Content
1 auterman 1.1 #include <iostream>
2     #include <fstream>
3     #include <iomanip>
4     #include <cmath>
5     #include <sstream>
6     #include <vector>
7     #include <string>
8    
9     #include "ExclusionPlot.hh"
10    
11     #include "TH1.h"
12     #include "TH2.h"
13     #include "TFile.h"
14     #include "TStyle.h"
15     #include "TLatex.h"
16     #include "TCanvas.h"
17     #include "TMarker.h"
18     #include "vector.h"
19     #include "TMath.h"
20     #include "TList.h"
21     #include "TGraph.h"
22     #include "TObjArray.h"
23    
24     void ExclusionPlot(){
25     gStyle->SetPalette(1);
26    
27     //get yield plot
28     // hev = yieldPlot(mSuGraFile,mSuGraDir, mSuGraHist);
29     //setPlottingStyle(*hev);
30    
31     // setPlottingStyle(*exclusionPlot,lineStyle);
32    
33     Int_t tanBeta = 3;
34    
35     /* TH1F* First = getHisto_1d("./","ExclusionLimit","Significance_NLO_expected_tanBeta50.root");
36     setPlottingStyle(*First);
37     First->SetLineStyle(1);
38     First->SetLineWidth(1);
39    
40     TH1F* Second = getHisto_1d("./","ExclusionLimit","Significance_NLO_observed_tanBeta50.root");
41     Second->SetLineStyle(2);
42     Second->SetLineWidth(1);
43     Second->SetLineColor(kRed);
44    
45    
46     TH1F* Third = getHisto_1d("./","ExclusionLimit","Significance_LO_observed_tanBeta50.root");
47     Third->SetLineStyle(1);
48     Third->SetLineWidth(3);
49     Third->SetLineColor(kGreen+2);
50    
51    
52     exclusionPlots.push_back(First);
53     exclusionPlots.push_back(Second);
54     exclusionPlots.push_back(Third);*/
55    
56    
57     CommandMSUGRA("35pb_expected_11.root",tanBeta);
58    
59    
60     }
61    
62    
63    
64     void CommandMSUGRA(TString plotName_,Int_t tanBeta_, Int_t sigma){
65    
66     gStyle->SetOptTitle(0);
67     gStyle->SetOptStat(0);
68     gStyle->SetPalette(1);
69     gStyle->SetTextFont(42);
70    
71     //convert tanb value to string
72     std::stringstream tmp;
73     tmp << tanBeta_;
74     TString tanb( tmp.str() );
75    
76    
77     // Output file
78     cout << " create " << plotName_ << endl;
79     TFile* output = new TFile( plotName_, "RECREATE" );
80     if ( !output || output->IsZombie() ) { std::cout << " zombie alarm output is a zombie " << std::endl; }
81    
82    
83     //set old exclusion Limits
84     TGraph* LEP_ch = set_lep_ch(tanBeta_);
85     TGraph* LEP_sl = set_lep_sl(tanBeta_);//slepton curve
86     TGraph* TEV_sg_cdf = set_tev_sg_cdf(tanBeta_);//squark gluino cdf
87     TGraph* TEV_sg_d0 = set_tev_sg_d0(tanBeta_);//squark gluino d0
88     // TGraph* TEV_tlp_cdf = set_tev_tlp_cdf(tanBeta_);//trilepton cdf
89     // TGraph* TEV_tlp_d0 = set_tev_tlp_d0(tanBeta_);//trilepton d0
90     TGraph* stau = set_tev_stau(tanBeta_);//stau
91    
92     TGraph* TEV_sn_d0_1 = set_sneutrino_d0_1(tanBeta_);
93     TGraph* TEV_sn_d0_2 = set_sneutrino_d0_2(tanBeta_);
94    
95     //constant ssqquark and gluino lines
96     TF1* lnsq[4];
97     TF1* lngl[4];
98    
99     TLatex* sq_text[4];
100     TLatex* gl_text[4];
101    
102     for(int i = 0; i < 4; i++){
103     lnsq[i] = constant_squark(tanBeta_,i);
104     sq_text[i] = constant_squark_text(i,*lnsq[i],tanBeta_);
105     lngl[i] = constant_gluino(tanBeta_,i);
106     gl_text[i] = constant_gluino_text(i,*lngl[i]);
107     }
108    
109     //Legends
110     TLegend* legst = makeStauLegend(0.05,tanBeta_);
111     TLegend* legexp = makeExpLegend( *TEV_sg_cdf,*TEV_sg_d0,*LEP_ch,*LEP_sl,*TEV_sn_d0_1,0.03,tanBeta_);
112    
113    
114     //make Canvas
115     TCanvas* cvsSys = new TCanvas("cvsnm","cvsnm",0,0,800,600);
116     gStyle->SetOptTitle(0);
117     cvsSys->SetFillColor(0);
118     cvsSys->GetPad(0)->SetRightMargin(0.07);
119     cvsSys->Range(-120.5298,26.16437,736.0927,500);
120     // cvsSys->Range(-50.5298,26.16437,736.0927,500);
121     cvsSys->SetFillColor(0);
122     cvsSys->SetBorderMode(0);
123     cvsSys->GetPad(0)->SetBorderSize(2);
124     cvsSys->GetPad(0)->SetLeftMargin(0.1407035);
125     cvsSys->GetPad(0)->SetTopMargin(0.08);
126     cvsSys->GetPad(0)->SetBottomMargin(0.13);
127    
128     cvsSys->SetTitle("tan#beta="+tanb);
129    
130     output->cd();
131    
132     //and now
133     //the exclusion limits
134     TGraphErrors* First ;
135     TGraphErrors* Second;
136     TGraphErrors* Third;
137     TGraphErrors* Second_up;
138     TGraphErrors* Second_low;
139    
140     if(tanBeta_ == 3){
141     First = getObserved_NLO_tanBeta3_2();
142     Second = getExpected_NLO_tanBeta3_2();
143     Second_up = getExpected_NLO_tanBeta3_up();
144     Second_low = getExpected_NLO_tanBeta3_low();
145     Third = getLO_tanBeta3();
146     }
147     if(tanBeta_ == 10){
148     First = getObserved_NLO_tanBeta10_2();
149     Second = getExpected_NLO_tanBeta10_2();
150     Second_up = getExpected_NLO_tanBeta10_up();
151     Second_low = getExpected_NLO_tanBeta10_low();
152     Third = getLO_tanBeta10();
153     }
154     if(tanBeta_ == 50){
155     First = getObserved_NLO_tanBeta50_2();
156     Second = getExpected_NLO_tanBeta50_2();
157     Second_up = getExpected_NLO_tanBeta50_up();
158     Second_low = getExpected_NLO_tanBeta50_low();
159     Third = getLO_tanBeta50();
160     }
161    
162     // First->SetMarkerColor(kWhite);
163     // First->GetXaxis()->SetRangeUser(2.,500.);
164     // First->GetYaxis()->SetRangeUser(80,500);
165     // if(tanBeta_ == 50) First->GetXaxis()->SetRangeUser(200,500);
166     // First->GetXaxis()->SetTitle("m_{0} (GeV)");
167     // First->GetYaxis()->SetTitle("m_{1/2} (GeV)");
168     // First->GetYaxis()->SetTitleOffset(0.8);
169    
170     double m0min = 0;
171     if (tanBeta_ == 50) m0min=200;
172    
173     // TH2D* hist = new TH2D("h","h",100,m0min,500,100,80,500);
174    
175     //for efficiency plot
176     // TH2F* hist = getHisto("./","m0_m12_0","TanBeta3_efficiency.root");
177     //CHF DEFAULT RESULT
178     // TH2F* hist = getHisto("/home/hep/elaird1/public_html/57_stat_plots/05_cms_sm_fc/","ExclusionLimit","profileLikelihood_tanBeta"+tanb+"_nlo_1HtBin_expR.root");
179    
180     TH2F* hist = getHisto("/home/hep/elaird1/public_html/57_stat_plots/05_cmssm_fc/","ExclusionLimit","feldmanCousins_tanBeta"+tanb+"_nlo_1HtBin_expR.root");
181    
182    
183     if (sigma) {
184     //orig histos
185     // TH2F* exp = getHisto("./TedsHistos/","yield_signal_median","SigmaBand_tanBeta"+tanb+"_2HTBins_expR.root");
186     // TH2F* up = getHisto("./TedsHistos/","yield_signal_upper","SigmaBand_tanBeta"+tanb+"_2HTBins_expR.root");
187     // TH2F* down = getHisto("./TedsHistos/","yield_signal_lower","SigmaBand_tanBeta"+tanb+"_2HTBins_expR.root");
188    
189     //latest sigma bands for new result, 2 HT bins, Rconst
190     TH2F* exp = getHisto("./TedsHistos/","dsMedian","profileLikelihood_tanBeta"+tanb+"_nlo_1HtBin_expR_computeExpectedLimit_results.root");
191     TH2F* up = getHisto("./TedsHistos/","dsMedianPlusOneSigma","profileLikelihood_tanBeta"+tanb+"_nlo_1HtBin_expR_computeExpectedLimit_results.root");
192     TH2F* down = getHisto("./TedsHistos/","dsMedianMinusOneSigma","profileLikelihood_tanBeta"+tanb+"_nlo_1HtBin_expR_computeExpectedLimit_results.root");
193    
194    
195    
196    
197     // TH2F* exp = getHisto("./TedsHistos/","yield_signal_median","SigmaBand_tanBeta3_1HTBin_exponentialR.root");
198     // TH2F* up = getHisto("./TedsHistos/","yield_signal_upper","SigmaBand_tanBeta3_1HTBin_exponentialR.root");
199     // TH2F* down = getHisto("./TedsHistos/","yield_signal_lower","SigmaBand_tanBeta3_1HTBin_exponentialR.root");
200    
201    
202     //CHF hack for limit evolution
203     //HT1 exp
204     // TH2F* hist = getHisto("./TedsHistos/story/","ExclusionLimit","profileLikelihood_tanBeta3_nlo_1HtBin_expR.root");
205     // TH2F* hist = getHisto("./TedsHistos/paper/","ExclusionLimit","Significance_tanBeta3_NLO_observed.root");
206     //HT1 exp RA2BG
207     // TH2F* exp = getHisto("./TedsHistos/story/","ExclusionLimit","profileLikelihood_tanBeta3_nlo_1HtBin_expR_Ra2SyncHack.root");
208     //HT1 const
209     // TH2F* up = getHisto("./TedsHistos/story/","ExclusionLimit","profileLikelihood_tanBeta3_nlo_1HtBin_constantR.root");
210     //HT2 exp
211     // TH2F* down = getHisto("./TedsHistos/story/","ExclusionLimit","profileLikelihood_tanBeta3_nlo_1HtBin_expR.root");
212    
213     }
214    
215     gStyle->SetPalette(1);
216    
217     hist->GetXaxis()->SetRangeUser(0,500);
218     if (tanBeta_ == 10) hist->GetXaxis()->SetRangeUser(0,600);
219     if (tanBeta_ == 50) hist->GetXaxis()->SetRangeUser(200,600);
220     hist->GetYaxis()->SetRangeUser(0,500);
221     // hist->Draw("colz");
222    
223     hist->SetLineWidth(3);
224     hist->SetLineColor(9);
225     hist->SetLineStyle(2);
226     // hist->SetContourLevel(1,0.05);
227     // hist->SetContourLevel(7,0.32);
228    
229     TH2F* clone = fillHoles(hist);
230    
231     if (sigma) {
232     fillHoles(exp);
233     fillHoles(up);
234     fillHoles(down);
235     }
236     // TH2F* clone = (TH2F*)hist->Clone("clone");
237    
238     clone->GetXaxis()->SetTitle("");
239     clone->GetYaxis()->SetTitle("");
240    
241     output.cd();
242     // cvsSys->Update();
243     // hist->Reset();
244     // hist->Draw();
245    
246     //CHF change contour level for tanb3!!!
247    
248     TGraph* myGraph = getGraph( clone , -0.5 );
249     TGraph* smg = (TGraph*)myGraph->Clone("smg");
250     // smg->Print("all");
251     if (sigma) {
252     TGraph* myexp = getGraph( exp , -0.5);
253     TGraph* smexp = (TGraph*)myexp->Clone("smexp");
254     // smexp->Print("all");
255     TGraph* myup = getGraph( up , -0.5 );
256     TGraph* smup = (TGraph*)myup->Clone("smup");
257     //smup->Print("all");
258     TGraph* mydown = getGraph( down , -0.5 );
259     TGraph* smdown = (TGraph*)mydown->Clone("smdown");
260     // smdown->Print("all");
261     }
262    
263     output.cd();
264     hist->Reset();
265     hist->Draw();
266    
267     cvsSys->Update();
268    
269     hist->GetXaxis()->SetTitle("m_{0} (GeV)");
270     hist->GetYaxis()->SetTitle("m_{1/2} (GeV)");
271     hist->GetYaxis()->SetTitleOffset(1.);
272     hist->GetXaxis()->SetNdivisions(506);
273     // if (tanBeta_ == 50) hist->GetXaxis()->SetNdivisions(504);
274     hist->GetYaxis()->SetNdivisions(506);
275    
276    
277    
278     int col[]={2,3,4};
279    
280     TSpline3 *sFirst = new TSpline3("sFirst",First);
281     sFirst->SetLineColor(kRed);
282     sFirst->SetLineWidth(3);
283    
284     TSpline3 *sSecond = new TSpline3("sSecond",Second);
285     sSecond->SetLineColor(kBlue+3);
286     sSecond->SetLineStyle(4);
287     sSecond->SetLineWidth(3);
288    
289     TSpline3 *sSecond_up = new TSpline3("sSecond_up",Second_up);
290     sSecond_up->SetLineColor(kCyan);
291     sSecond_up->SetLineStyle(1);
292     sSecond_up->SetLineWidth(3);
293    
294     TSpline3 *sSecond_low = new TSpline3("sSecond_low",Second_low);
295     sSecond_low->SetLineColor(kCyan);
296     sSecond_low->SetLineStyle(1);
297     sSecond_low->SetLineWidth(3);
298    
299     TSpline3 *sThird = new TSpline3("sThird",Third);
300     sThird->SetLineColor(kGreen+2);
301     sThird->SetLineStyle(4);
302     sThird->SetLineWidth(3);
303    
304    
305     sSecond_up->Draw("h same");
306     sSecond_low->Draw("h same");
307    
308    
309     //constant squark and gluino mass contours
310     for (int it=1;it<4;it++) {
311     lngl[it]->Draw("same");
312     lnsq[it]->Draw("same");
313     sq_text[it]->Draw();
314     gl_text[it]->Draw();
315     }
316    
317    
318     //exclusion limits previous experiments
319     if(tanBeta_ == 3){
320     TEV_sn_d0_1->Draw("fsame");
321     TEV_sn_d0_2->Draw("fsame");
322     }
323     LEP_ch->Draw("fsame");
324     if (tanBeta_ != 50) LEP_sl->Draw("fsame");
325    
326     TEV_sg_cdf->Draw("fsame");
327     TEV_sg_d0->Draw("same");
328     TEV_sg_d0->Draw("fsame");
329    
330    
331     //other labels
332     Double_t xpos = 0;
333     Double_t xposi = 0;
334     Double_t ypos = 0;
335     if(tanBeta_ == 50) xposi = 100;
336     if(tanBeta_ == 50) xpos = 200;
337     if(tanBeta_ == 50) ypos = -10;
338    
339     TLatex* lumilabel = new TLatex(105.+xposi,510.,"CMS preliminary L_{int} = 35 pb^{-1}, #sqrt{s} = 7 TeV");
340     lumilabel->SetTextSize(0.05);
341    
342     lumilabel->Draw("same");
343    
344     TString text_tanBeta;
345     text_tanBeta = "tan#beta = "+tanb+", A_{0} = 0, #mu > 0";
346     TLatex* cmssmpars = new TLatex(70.+xpos,340.+ypos,text_tanBeta);
347     cmssmpars->SetTextSize(0.04);
348    
349     cmssmpars->Draw("same");
350    
351     //LM points
352     TMarker* LM0 = new TMarker(200.,160.,20);
353     TMarker* LM1 = new TMarker(60.,250.,20);
354    
355     LM0->SetMarkerSize(1.2);
356     LM1->SetMarkerSize(1.2);
357    
358     TLatex* tLM0 = new TLatex(205.,160.,"LM0");
359     tLM0->SetTextSize(0.035);
360    
361     TLatex* tLM1 = new TLatex(65.,243.,"LM1");
362     tLM1->SetTextSize(0.035);
363    
364     if (tanBeta_ != 50){
365     LM0->Draw("same");
366     tLM0->Draw("same");
367     LM1->Draw("same");
368     tLM1->Draw("same");
369     }
370    
371    
372    
373     //expected and observed (LO & NLO) contours
374    
375     TLegend* myleg = new TLegend(0.25,0.75,0.5,0.9,NULL,"brNDC");
376     myleg->SetFillColor(0);
377     myleg->SetShadowColor(0);
378     myleg->SetTextSize(0.03);
379     myleg->SetBorderSize(0);
380    
381     // myleg->AddEntry(sSecond,"NLO Expected Limit","L");
382     // myleg->AddEntry(sFirst,"NLO Observed Limit","L");
383     // myleg->AddEntry(sThird,"LO Observed Limit","L");
384    
385     myleg->AddEntry(sFirst,"Observed Limit, NLO","L");
386     // myleg->AddEntry(smg,"Obs. Limit, NLO, 1 HT bins, R_{exp}","L");
387     // myleg->AddEntry(sFirst,"Obs. Limit, NLO, 1 HT bin, R_{exp}","L");
388     if (sigma) {
389     myleg->AddEntry(sSecond,"Median Expected Limit","L");
390     // myleg->AddEntry(smexp,"Median Exp. Limit, NLO, 2 HT bins, R_{const}","L");
391     myleg->AddEntry(sSecond_up,"Expected Limit #pm 1 #sigma","F");
392     // myleg->AddEntry(smexp,"Obs. Limit NLO, 1HT bin, R_{exp}, RA2 EWK","L");
393     //myleg->AddEntry(smup,"Obs. Limit NLO, 1 HT bin, R_{const}","L");
394     //myleg->AddEntry(smdown,"Obs. Limit NLO, 2 HT bins, R_{exp}","L");
395     }
396     // myleg->AddEntry(sSecond,"Old Exp. Limit #pm 1 #sigma, NLO, 1 HT bin, R_{exp}","L");
397    
398     sSecond_up->SetFillStyle(4010);
399     sSecond_up->SetFillColor(kCyan-10);
400    
401     // sSecond_low->Draw("Csame");
402    
403     TGraph* smSec = (TGraph*)sSecond_low->Clone("smSecondlow");
404     smSec->SetFillColor(0);
405    
406     smSec->Draw("Csame");
407    
408     sSecond_low->SetFillStyle(1001);
409     sSecond_low->SetFillColor(10);
410    
411     sFirst->Draw("same");
412     sSecond->Draw("same");
413    
414     //sThird->Draw("same");
415    
416     smg->SetLineStyle(1);
417     smg->SetLineColor(kRed);
418     // smg->Draw("same");
419     if (sigma) {
420     smexp->SetLineColor(9);
421     smexp->SetLineWidth(3);
422     smexp->SetLineStyle(2);
423     //smexp->Draw("same");
424     smup->SetLineWidth(3);
425     smup->SetFillStyle(3001);
426     smup->SetFillColor(kRed);
427     smup->SetLineStyle(3);
428     smup->SetLineColor(9);
429     //smup->Draw("same");
430     smdown->SetLineWidth(3);
431     smdown->SetLineStyle(3);
432     smdown->SetLineStyle(3);
433     smdown->SetLineColor(9);
434     //smdown->Draw("same");
435     }
436    
437    
438     //stau=LSP contour
439     stau->Draw("fsame");
440    
441     //legends
442     legexp->Draw();
443     legst->Draw();
444     myleg->Draw();
445    
446     hist->Draw("sameaxis");
447     cvsSys->RedrawAxis();
448    
449     cvsSys->Update();
450    
451     cvsSys->Write();
452    
453    
454     cvsSys->SaveAs("RA1_ExclusionLimit_tanb"+tanb+".pdf");
455     cvsSys->SaveAs("RA1_ExclusionLimit_tanb"+tanb+".png");
456    
457    
458     output->Write();
459     output->Close();
460     delete output;
461    
462     }
463    
464    
465     void setPlottingStyle(TH1F& hsig){
466    
467     hsig.SetStats(kFALSE);
468    
469     hsig.SetAxisRange(80,500,"Y");
470     hsig.SetAxisRange(0,520,"X");
471     hsig.SetAxisRange(200,520,"X");
472    
473     hsig.GetXaxis()->SetTitle("m_{0} (GeV)");
474     hsig.GetYaxis()->SetTitle("m_{1/2} (GeV)");
475     hsig.GetYaxis()->SetTitleOffset(0.8);
476     hsig.GetYaxis()->SetTitleSize(0.06);
477     hsig.GetYaxis()->SetLabelSize(0.06);
478     hsig.GetXaxis()->SetTitleOffset(0.9);
479     hsig.GetXaxis()->SetTitleSize(0.06);
480     hsig.GetXaxis()->SetLabelSize(0.06);
481    
482     hsig.SetLineWidth(1);
483     hsig.SetLineColor(kBlue);
484    
485     }
486    
487    
488    
489    
490     TGraph* set_sneutrino_d0_1(Int_t tanBeta){
491     double sn_m0[14]= {0, 0, 48, 55, 80, 90,100,105,109,105,100, 72, 55,0};
492     double sn_m12[14]={0,140,210,220,237,241,242,241,230,220,210,170,150,0};
493    
494     TGraph* sn_d0_gr = new TGraph(14,sn_m0,sn_m12);
495    
496     sn_d0_gr->SetFillColor(kGreen+3);
497     sn_d0_gr->SetFillStyle(3001);
498    
499     return sn_d0_gr;
500     }
501    
502     TGraph* set_sneutrino_d0_2(Int_t tanBeta){
503     double sn_m0[9]= {0, 45, 75,115,130,150,163,185,0};
504     double sn_m12[9]={0,140,170,213,202,183,168,140,0};
505    
506     TGraph* sn_d0_gr_2 = new TGraph(9,sn_m0,sn_m12);
507    
508     sn_d0_gr_2->SetFillColor(kGreen+3);
509     sn_d0_gr_2->SetFillStyle(3001);
510    
511     return sn_d0_gr_2;
512     }
513    
514     TGraph* set_lep_ch(Int_t tanBeta){
515     if(tanBeta == 3) return set_lep_ch_tanBeta3();
516     if(tanBeta == 10) return set_lep_ch_tanBeta10();
517     if(tanBeta == 50) return set_lep_ch_tanBeta50();
518     }
519    
520     TGraph* set_lep_ch_tanBeta10(){
521    
522     double ch_m0[11];
523     double ch_m12[11];
524    
525     ch_m0[0] = 0;
526     ch_m0[1] = 100;
527     ch_m0[2] = 200;
528     ch_m0[3] = 300;
529     ch_m0[4] = 400;
530     ch_m0[5] = 500;
531     ch_m0[6] = 600;
532     ch_m0[7] = 700;
533     ch_m0[8] = 800;
534     ch_m0[9] = 800;
535     ch_m0[10] = 0;
536    
537     ch_m12[0] = 163;
538     ch_m12[1] = 162;
539     ch_m12[2] = 161;
540     ch_m12[3] = 160;
541     ch_m12[4] = 159;
542     ch_m12[5] = 158;
543     ch_m12[6] = 157;
544     ch_m12[7] = 156;
545     ch_m12[8] = 155.4;
546     ch_m12[9] = 0;
547     ch_m12[10] = 0;
548    
549    
550     TGraph* ch_gr = new TGraph(11,ch_m0,ch_m12);
551    
552     ch_gr->SetFillColor(3);
553     ch_gr->SetLineColor(3);
554     // ch_gr->SetLineWidth(3);
555     ch_gr->SetFillStyle(3001);
556    
557     return ch_gr;
558    
559     }
560    
561    
562    
563     TGraph* set_lep_ch_tanBeta3(){
564    
565     double ch_m0[17];
566     double ch_m12[17];
567    
568     ch_m0[0] = 0;
569     ch_m0[1] = 100;
570     ch_m0[2] = 150;
571     ch_m0[3] = 200;
572     ch_m0[4] = 250;
573     ch_m0[5] = 300;
574     ch_m0[6] = 350;
575     ch_m0[7] = 400;
576     ch_m0[8] = 450;
577     ch_m0[9] = 500;
578     ch_m0[10] = 550;
579     ch_m0[11] = 600;
580     ch_m0[12] = 650;
581     ch_m0[13] = 700;
582     ch_m0[14] = 750;
583     ch_m0[15] = 750;
584     ch_m0[16] = 0;
585    
586     ch_m12[0] = 170;
587     ch_m12[1] = 168;
588     ch_m12[2] = 167;
589     ch_m12[3] = 165;
590     ch_m12[4] = 163;
591     ch_m12[5] = 161;
592     ch_m12[6] = 158;
593     ch_m12[7] = 156;
594     ch_m12[8] = 154;
595     ch_m12[9] = 152;
596     ch_m12[10] = 150;
597     ch_m12[11] = 148;
598     ch_m12[12] = 147;
599     ch_m12[13] = 145;
600     ch_m12[14] = 144;
601     ch_m12[15] = 0;
602     ch_m12[16] = 0;
603    
604     TGraph* ch_gr = new TGraph(17,ch_m0,ch_m12);
605    
606     ch_gr->SetFillColor(3);
607     ch_gr->SetLineColor(3);
608     // ch_gr->SetLineWidth(3);
609     ch_gr->SetFillStyle(3001);
610    
611     return ch_gr;
612    
613     }
614    
615    
616     TGraph* set_lep_ch_tanBeta50(){
617    
618     double ch_m0[21];
619     double ch_m12[21];
620    
621     ch_m0[0] = 200;
622     ch_m0[1] = 250;
623     ch_m0[2] = 300;
624     ch_m0[3] = 350;
625     ch_m0[4] = 400;
626     ch_m0[5] = 450;
627     ch_m0[6] = 500;
628     ch_m0[7] = 550;
629     ch_m0[8] = 600;
630     ch_m0[9] = 650;
631     ch_m0[10] = 700;
632     ch_m0[11] = 750;
633     ch_m0[12] = 800;
634     ch_m0[13] =850;
635     ch_m0[14] = 900;
636     ch_m0[15] = 950;
637     ch_m0[16] = 1000;
638     ch_m0[17] = 1050;
639     ch_m0[18] = 1100;
640     ch_m0[19] = 1100;
641     ch_m0[20] = 200;
642    
643     ch_m12[0] = 157;
644     ch_m12[1] = 156;
645     ch_m12[2] = 156;
646     ch_m12[3] = 155;
647     ch_m12[4] = 155;
648     ch_m12[5] = 154;
649     ch_m12[6] = 154;
650     ch_m12[7] = 153;
651     ch_m12[8] = 153;
652     ch_m12[9] = 152;
653     ch_m12[10] = 152;
654     ch_m12[11] = 152;
655     ch_m12[12] = 152;
656     ch_m12[13] = 152;
657     ch_m12[14] = 152;
658     ch_m12[15] = 153;
659     ch_m12[16] = 153;
660     ch_m12[17] = 153;
661     ch_m12[18] = 154;
662     ch_m12[19] = 0;
663     ch_m12[20] = 0;
664    
665    
666     TGraph* ch_gr = new TGraph(21,ch_m0,ch_m12);
667    
668     ch_gr->SetFillColor(3);
669     ch_gr->SetLineColor(3);
670     ch_gr->SetFillStyle(3001);
671    
672     return ch_gr;
673    
674     }
675    
676    
677    
678    
679     TGraph* set_lep_sl(Int_t tanBeta){
680    
681     // CMS SUSY Summer2010 implementation
682     // double sl_m0[] = {0, 0, 30, 50, 60, 75, 80,90,100};
683     // double sl_m12[] = {0,245,240,220,200,150,100,50,0};
684    
685     //contour from D0 trilepton paper (PLB 680 (2009) 34-43)
686     if (tanBeta==3){
687     double sl_m0[] ={0, 0, 10, 20, 30, 40, 50, 60, 70, 77,88,95};
688     double sl_m12[]={0,245,242,239,232,222,209,189,165,140,60,0};
689     int n = 12;
690     }
691     //CMS PTDR-II
692     //* Selectron_R line mass=99, ISASUGRA7.69, A0=0, m_top=175, tan(beta]=10
693     if (tanBeta==10 || tanBeta==50){
694     double sl_m0[]={ 0, 0, 11, 20, 24, 49, 70, 82,88,90};
695     double sl_m12[]={0,240,237,233,230,200,150,100,50,0};
696     int n = 10;
697     }
698    
699     TGraph* lep_sl = new TGraph(n,sl_m0,sl_m12);
700    
701     lep_sl->SetFillColor(5);
702     lep_sl->SetLineColor(5);
703     lep_sl->SetFillStyle(3001);
704    
705     return lep_sl;
706     }
707    
708    
709     TGraph* set_tev_sg_cdf(Int_t tanBeta){
710    
711     // double sg_m0[] = {0, 0, 20, 50,100,150,200,250,300,350,400,450,500,550,600,600};
712     // double sg_m12[] = {0,160,169,170,160,155,150,122,116,112,110,106,105,100, 98, 0};
713     // int np=16;
714     //New CHF from CDF plot in ICHEP2010 talk (E. Halkiadakis)
715     double sg_m0[]= {0, 0, 30, 75,150,185,225,310,360,400,430,500,600,600};
716     double sg_m12[]={0,162,168,170,160,150,130,120,109,108,100, 96, 95, 0};
717     int np=14;
718    
719     TGraph* sg_gr = new TGraph(np,sg_m0,sg_m12);
720    
721     // gStyle->SetHatchesLineWidth(3);
722    
723     sg_gr->SetFillColor(2);
724     sg_gr->SetLineColor(2);
725     // sg_gr->SetLineWidth(3);
726     sg_gr->SetFillStyle(3001);
727    
728     return sg_gr;
729    
730     }
731    
732     TGraph* set_tev_sg_d0(Int_t tanBeta){
733    
734     //official D0 contour from P. Verdier
735     double sgd_m0[]= {0, 0., 25., 80.,100.,150.,192.,250.,300. ,350.,400.,450. ,500.,600.,600.,0.};
736     double sgd_m12[]={0,167.,167.,163.,162.,157.,149.,136.,125.5,116.,109.,106.5,105.,105., 0.,0.};
737     int npd=16;
738    
739     TGraph* sgd_gr = new TGraph(npd,sgd_m0,sgd_m12);
740    
741     gStyle->SetHatchesLineWidth(3);
742    
743     sgd_gr->SetFillColor(kMagenta+1);
744     sgd_gr->SetLineColor(kMagenta+1);
745     sgd_gr->SetLineWidth(3);
746     sgd_gr->SetFillStyle(3335);
747    
748     return sgd_gr;
749    
750     }
751    
752     // TGraph* set_tev_tlp_cdf(Int_t tanBeta){
753     // double tlp1_m0[] = { 0, 20, 40, 60, 70, 80, 90, 80, 70, 60};
754     // double tlp1_m12[] = {170,185,200,215,220,215,210,190,175,160};
755     // TGraph* tlp1_gr = new TGraph(10,tlp1_m0,tlp1_m12);
756    
757     // tlp1_gr->SetFillColor(4);
758     // tlp1_gr->SetLineColor(4);
759     // tlp1_gr->SetFillStyle(1001);
760    
761     // return tlp1_gr;
762     // }
763    
764     // TGraph* set_tev_tlp_d0(Int_t tanBeta){
765     // double tlp2_m0[] = { 70, 80, 90,100,105,110,120,130,140};
766     // double tlp2_m12[] = {160,172,184,196,205,195,185,173,160};
767     // TGraph* tlp2_gr = new TGraph(9,tlp2_m0,tlp2_m12);
768    
769     // tlp2_gr->SetFillColor(4);
770     // tlp2_gr->SetFillStyle(1001);
771    
772     // return tlp2_gr;
773    
774     // }
775    
776    
777    
778    
779    
780     TGraph* set_tev_stau(Int_t tanBeta){
781    
782     double st_m0_tanBeta3[] = {0,10,20,30,40,50,60,70,80,90,100,0};
783     double st_m12_tanBeta3[] = {337,341,356,378,406,439,473,510,548,587,626,626};
784    
785     double st_m0_tanBeta10[] = {0,10,20,30,40,50,60,70,80,90,100,0};
786     double st_m12_tanBeta10[] = {213,220,240,275,312,351,393,435,476,518,559,559};
787    
788     double st_m0_tanBeta50[] = {200,210,220,230,240,250,260,270,280,290,310,325,200,200};
789     double st_m12_tanBeta50[] = {206,226,246,267,288,310,332,354,376,399,450,500,500,206};
790    
791    
792     TGraph* st_gr_tanBeta3 = new TGraph(12,st_m0_tanBeta3,st_m12_tanBeta3);
793     TGraph* st_gr_tanBeta10 = new TGraph(12,st_m0_tanBeta10,st_m12_tanBeta10);
794     TGraph* st_gr_tanBeta50 = new TGraph(14,st_m0_tanBeta50,st_m12_tanBeta50);
795    
796     st_gr_tanBeta3->SetFillColor(40);
797     st_gr_tanBeta3->SetFillStyle(1001);
798    
799     st_gr_tanBeta50->SetFillColor(40);
800     st_gr_tanBeta50->SetFillStyle(1001);
801    
802     st_gr_tanBeta10->SetFillColor(40);
803     st_gr_tanBeta10->SetFillStyle(1001);
804    
805    
806     if(tanBeta == 3)return st_gr_tanBeta3;
807     if(tanBeta == 10)return st_gr_tanBeta10;
808     if(tanBeta == 50)return st_gr_tanBeta50;
809    
810     }
811    
812    
813    
814    
815     TF1* constant_squark(int tanBeta,int i){
816     //---lines of constant gluino/squark
817     double coef1 = 0.35;
818     double coef2[] = {5,5,4.6,4.1};
819    
820     char hname[200];
821    
822     sprintf(hname,"lnsq_%i",i);
823    
824    
825     TF1* lnsq = new TF1(hname,"sqrt([0]-x*x*[1]-[2])",0,1000);
826     lnsq->SetParameter(0,(500+150*(i-1))*(500+150*(i-1))/coef2[i]);
827     lnsq->SetParameter(1,1./coef2[i]);
828     lnsq->SetParameter(2,-coef1*91*91*(2*TMath::Cos(TMath::ATan(tanBeta)))/coef2[i]);//--tanbeta=10 --> cos2beta = -99/101
829     lnsq->SetLineWidth(1);
830    
831    
832     lnsq->SetLineColor(kGray);
833    
834     return lnsq;
835     }
836    
837    
838     TF1* constant_gluino(int tanBeta,int i){
839     //---lines of constant gluino/squark
840     double coef1 = 0.35;
841     double coef2[] = {5,5,4.6,4.1};
842    
843     char hname[200];
844    
845     sprintf(hname,"lngl_%i",i);
846    
847     TF1* lngl = new TF1(hname,"[0]+x*[1]",0,1000);
848     lngl->SetParameter(0,(500+150.*(i-1))/2.4);
849     lngl->SetParameter(1,-40./1400);
850     lngl->SetLineWidth(1);
851     lngl->SetLineColor(kGray);
852    
853     return lngl;
854     }
855    
856    
857     TLatex* constant_squark_text(Int_t it,TF1& lnsq,Int_t tanBeta_){
858     char legnm[200];
859    
860     sprintf(legnm,"#font[92]{#tilde{q}(%i)GeV}",500+150*(it-1));
861     Double_t place_x = 170;
862     if(tanBeta_ == 50)place_x = 290;
863     TLatex* t3 = new TLatex(place_x+10*(it-1),lnsq.Eval(place_x+10*(it-1))+5,legnm);
864     t3->SetTextSize(0.03);
865     t3->SetTextAngle(-8);
866     t3->SetTextColor(kGray+2);
867    
868    
869    
870     return t3;
871     }
872    
873     TLatex* constant_gluino_text(Int_t it,TF1& lngl){
874     char legnm[200];
875    
876     sprintf(legnm,"#font[12]{#tilde{g}}#font[92]{(%i)GeV}",500+150*(it-1));
877     TLatex* t4 = new TLatex(423,18+lngl.Eval(480),legnm);
878     t4->SetTextSize(0.03);
879     t4->SetTextAlign(13);
880     t4->SetTextColor(kGray+2);
881    
882     return t4;
883     }
884    
885    
886    
887     TLegend* makeStauLegend(Double_t txtsz,Int_t tanBeta_){
888     Double_t ypos_1 = 0.86;
889     Double_t ypos_2 = 0.88;
890     Double_t xpos_1 = 0.16;
891     Double_t xpos_2 = 0.17;
892     if(tanBeta_ == 50){
893     xpos_1 = 0.17;
894     xpos_2 = 0.18;
895     ypos_1 = 0.76;
896     ypos_2 = 0.78;
897    
898     }
899     TLegend* legst = new TLegend(xpos_1,ypos_1,xpos_2,ypos_2);
900     legst->SetHeader("#tilde{#tau} = LSP");
901     legst->SetFillStyle(0);
902     legst->SetBorderSize(0);
903     legst->SetTextSize(0.03);
904    
905     return legst;
906     }
907    
908    
909     TLegend* makeExpLegend(TGraph& sg_gr, TGraph& sgd_gr,TGraph& ch_gr,TGraph& sl_gr,TGraph& tev_sn,Double_t txtsz,Int_t tanbeta){
910     TLegend* legexp = new TLegend(0.64,0.65,0.99,0.9,NULL,"brNDC");
911     legexp->SetFillColor(0);
912     legexp->SetShadowColor(0);
913     legexp->SetTextSize(txtsz);
914     legexp->SetBorderSize(0);
915    
916     sg_gr.SetLineColor(1);
917     legexp->AddEntry(&sg_gr,"CDF #tilde{#font[12]{g}}, #tilde{#font[12]{q}}, #scale[0.8]{tan#beta=5, #mu<0}","f");
918     // sgd_gr.SetLineColor(1);
919     // sgd_gr.SetLineWidth(1);
920    
921     legexp->AddEntry(&sgd_gr,"D0 #tilde{#font[12]{g}}, #tilde{#font[12]{q}}, #scale[0.8]{tan#beta=3, #mu<0}","f");
922     ch_gr.SetLineColor(1);
923     legexp->AddEntry(&ch_gr,"LEP2 #tilde{#chi}_{1}^{#pm}","f");
924    
925     sl_gr.SetLineColor(1);
926     if(tanbeta != 50) legexp->AddEntry(&sl_gr,"LEP2 #tilde{#font[12]{l}}^{#pm}","f");
927     if(tanbeta == 3) legexp->AddEntry(&tev_sn,"D0 #chi^{#pm}_{1}, #chi^{0}_{2}","f");
928    
929    
930     return legexp;
931    
932     }
933    
934    
935     TGraph* getGraph(TH2F* h1, double level){
936    
937     h1->SetContour(1);
938     h1->SetContourLevel(0,level);
939     h1->Draw("CONT LIST");
940     gPad->Update();
941    
942     TObjArray* contours = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
943    
944     cout << "contours: " << contours << endl;
945     // Draw contours
946     TList* graphList = (TList*)(contours->At(0));
947     cout << "number of graphs: " << graphList->GetSize() << endl;
948     for (int igraph = 0; igraph<graphList->GetSize();++igraph) {
949     TGraph* myGraph = (TGraph*)graphList->At(igraph);
950    
951     std::cout << " - graph " << igraph << " has " << myGraph->GetN() << " points" << std::endl;
952     if (myGraph->GetN() > 50){
953     cout << "Drawing " << myGraph->GetN() <<" points" << endl;
954     // myGraph->Print("all");
955     // myGraph->SetLineColor(9);
956     // myGraph->SetLineColor(46);
957     //myGraph->SetLineWidth(3);
958     // myGraph->SetLineStyle(2);
959     // myGraph->SetMarkerStyle(20);
960     // myGraph->SetMarkerColor(9);
961    
962     // myGraph->Draw("C");
963     // cvsSys->Update();
964    
965     // TString graphName("graph"+name+"_");
966     // graphName += igraph;
967     // myGraph->SetName(graphName);
968     break;
969     }
970     }
971     return myGraph;
972     }
973    
974     TH2F* fillHoles(TH2F* h2){
975    
976     int nx = h2->GetNbinsX();
977     int ny = h2->GetNbinsY();
978     cout << "Nbins: " << nx << " " << ny << endl;
979    
980     for (int i=1;i<nx+1;i++){
981     for (int j=ny;j>0;j--){
982     int pos = j;
983     int count =0;
984     if (h2->GetBinContent(i,j)==0 && h2->GetBinContent(i-1,j)==-1 && h2->GetBinContent(i+1,j)==-1) h2->SetBinContent(i,j,-1.);
985    
986     if (h2->GetBinContent(i,j)==1
987     && h2->GetBinContent(i-1,j)==-1
988     && h2->GetBinContent(i+1,j)==-1
989     && h2->GetBinContent(i,j+1)==-1
990     && h2->GetBinContent(i,j-1)==-1)
991     h2->SetBinContent(i,j,-1.);
992    
993     // if (h2->GetBinContent(i,j)<0){
994     if (h2->GetBinContent(i,j)<0 && h2->GetBinContent(i,j-1)<0){
995     // cout <<" bin content " << i <<" " << j<< " " << pos << " " << h2->GetBinContent(i,j) <<endl;
996     for (int k=pos;k>0;k--){
997     h2->SetBinContent(i,k,-1.);
998     }
999     break;
1000     }
1001    
1002    
1003     }
1004     }
1005     return h2;
1006     }