ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/ExclusionPlot.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/ExclusionPlot.C (file contents):
Revision 1.6 by buchmann, Wed Apr 18 09:21:36 2012 UTC vs.
Revision 1.13 by buchmann, Thu May 17 20:02:28 2012 UTC

# Line 32 | Line 32 | using namespace std;
32   bool draweachone=false;
33   bool draw2sigma=true;
34  
35 < float limits_lower_bound=0.05;
35 > float limits_lower_bound=0.02;
36   float limits_upper_bound=10;
37   float limits_ratio_lower_bound=0.005;
38   float limits_ratio_upper_bound=10;
# Line 46 | Line 46 | bool wrongwaytodothis=true;
46  
47   string xsecfilename;
48  
49 +
50   void set_range(TH2F *histo, int scantype, bool pushoutlabels);
51   void smooth_line(TGraph *gr);
52 + void draw_diagonal_xchange(int scantype, std::string scanx);
53   TH2F* adjust_histo(TH2F *oldhist, TH2F *refhisto);
54   TGraph* get_mSUGRA_exclusion_line(TH2F *exclusionhisto, int scantype);
55   TGraph* thin_line(TGraph *gr);
56   TGraph *MarcosExclusionLine(TH2F *exclusionshape, int scantype);
57 + TH2F* get_XS(string filename, string mass, TH2F *histo);
58 +
59 + float getSMSxs(float mlsp,float mglu) {
60 +  TH2F *refh  =  new TH2F("ReferenceHisto","ReferenceHisto",(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);
61 +  refh->SetBinContent(refh->FindBin(mglu,mlsp),1);//only compute the cross section for our point
62 +  TFile *xsecfile = new TFile((PlottingSetup::cbafbasedir+"/"+PlottingSetup::SMSReferenceXSFile).c_str());
63 +  if(xsecfile->IsZombie()) {
64 +      write_error(__FUNCTION__,"Cross section file is invalid!!!!");
65 +      return -1;
66 +  }
67 +  xsecfile->Close();
68 +  delete xsecfile;
69 +  TH2F *xsec = adjust_histo(get_XS(PlottingSetup::cbafbasedir+"/"+PlottingSetup::SMSReferenceXSFile,"gluino",refh),refh);
70 +  int GlobalBin = xsec->FindBin(mglu,mlsp);
71 +  float refxs=xsec->GetBinContent(GlobalBin);
72 +  delete refh;
73 +  delete xsec;
74 +  return refxs;
75 + }
76  
77   void write_SMS_text(int scantype, std::string& scanx, float xpos = 0.22 ) {
78    string legT5zz="pp #rightarrow  #tilde{g} #tilde{g}, #tilde{g} #rightarrow 2j + #chi^{0}_{2}, #chi^{0}_{2} #rightarrow Z #chi^{0}_{1}";
# Line 76 | Line 97 | void write_SMS_text(int scantype, std::s
97    //  if(scantype==PlottingSetup::GMSB) title3->Draw("same");
98   }
99  
100 + void draw_diagonal_xchange(int scantype, std::string scanx = "" ) {
101 +  // Line marking the diagonal
102 +  TLine *line;
103 +  float verticaloffset=0.0;
104 +  if(scantype==PlottingSetup::GMSB) verticaloffset=75.0;
105 +  line = new TLine(50.+75.0, 50.0+verticaloffset, 1200., 1200.0-75.0+verticaloffset);
106 +  line->SetLineStyle(7);
107 +  line->SetLineWidth(4);
108 +  //line->Draw("same"); // Do not draw: draw the other one instead
109 +  
110 +  // Add a dashed line to indicate where x changes
111 +  float offset = 0.;
112 +  if ( 0 == scanx.compare("0.5") ) { offset = 91.2/0.5; }
113 +  else if ( 0 == scanx.compare("0.25") ) { offset = 91.2/0.25; }
114 +  else if ( 0 == scanx.compare("0.75") ) { offset = 91.2/0.75; }
115 +  else if ( scantype==PlottingSetup::GMSB) { offset = 0; };
116 +  
117 +  if ( offset>0. ) {
118 +    line->DrawLine(50+offset, 50.0, 1175., 1175.0-offset);
119 +  }else if ( scantype==PlottingSetup::GMSB ) {
120 +    line->DrawLine(100, 100, 1175., 1175.0-offset);
121 + }
122 + }
123 +
124   void fill_with_text(TGraph *real, TGraph *down, TGraph *up, TVirtualPad *can, int scantype, std::string scanx = "") {
125    can->cd();
126    float xpos_of_text = 0.22;
127    TLegend* this_leg = new TLegend(xpos_of_text,0.6,0.38,0.75);
128 +  //TLegend* this_leg = new TLegend(xpos_of_text,0.55,0.45,0.75,"n_{jets} #geq 3"); // this was the style of the paper.
129    this_leg->SetFillColor(0);
130    this_leg->SetBorderSize(0);
131    this_leg->SetTextSize(0.035);
132 +  //this_leg->SetTextSize(0.04); // paper style.
133    if(scantype==PlottingSetup::SMS||scantype==PlottingSetup::GMSB) {
134      //this_leg->AddEntry(real,"#sigma^{prod} = #sigma^{NLO-QCD}" , "l");
135      //this_leg->AddEntry(up,"#sigma^{prod} = 3 #times #sigma^{NLO-QCD}" , "l");
# Line 95 | Line 142 | void fill_with_text(TGraph *real, TGraph
142    }
143      
144    this_leg->Draw();
145 <
145 >  TText *title = write_text(xpos_of_text+0.005,0.52,"JZB");
146 >  title->SetTextSize(0.04);
147 >  title->SetTextAlign(13);
148 >  title->SetTextFont(62);
149 >  title->Draw();
150 >  
151    write_SMS_text( scantype, scanx, xpos_of_text );
152    
153   //  //string legT5zz="pp #rightarrow  #tilde{g} #tilde{g}, #tilde{g} #rightarrow 2j + #chi^{0}_{1}, #chi^{0}_{1} #rightarrow Z + #tilde{G}";
# Line 116 | Line 168 | void fill_with_text(TGraph *real, TGraph
168   //  title3->SetTextColor(kRed);
169   ////  if(scantype==PlottingSetup::GMSB) title3->Draw("same");
170    DrawPrelim();
171 <  TLine *line;
120 <  float verticaloffset=0.0;
121 <  if(scantype==PlottingSetup::GMSB) verticaloffset=75.0;
122 <  line = new TLine(50.+75.0, 50.0+verticaloffset, 1200., 1200.0-75.0+verticaloffset);
123 <  line->SetLineStyle(2);
124 <  line->SetLineWidth(2);
125 <  //line->Draw("same");
126 <   // Add a dashed line to indicate where x changes
127 <  float offset = 0.;
128 <  if ( 0 == scanx.compare("0.5") ) { offset = 91.2/0.5; }
129 <  else if ( 0 == scanx.compare("0.25") ) { offset = 91.2/0.25; }
130 <  else if ( 0 == scanx.compare("0.75") ) { offset = 91.2/0.75; }
131 <
132 <  if ( offset>0 ) {
133 <    line->DrawLine(50+offset, 50.0, 1200., 1200.0-offset);
134 <  }
171 >  draw_diagonal_xchange( scantype, scanx );
172   }
173  
174   TH2F* prep_histo(TH2F *oldhist, int scantype) {///DONE
# Line 151 | Line 188 | TH2F* prep_histo(TH2F *oldhist, int scan
188  
189   TH2F *hardlimit(TH2F *limit) {
190    TH2F *co = (TH2F*)limit->Clone("hcopy");
191 <  for(int i=1;i<limit->GetNbinsX();i++) {
192 <    for(int j=1;j<limit->GetNbinsY();j++) {
191 >  for(int i=1;i<=limit->GetNbinsX();i++) {
192 >    for(int j=1;j<=limit->GetNbinsY();j++) {
193         if(limit->GetBinContent(i,j)<1&&limit->GetBinContent(i,j)>0) co->SetBinContent(i,j,1);
194         else co->SetBinContent(i,j,0);
195      }
196    }
197 +  co->GetZaxis()->SetRangeUser(0,100);//this is to make the exclusion shape blue :-)
198    return co;
199   }
200  
# Line 170 | Line 208 | TH2F* make_exclusion_shape(TH2F *excl, i
208    }
209    exclusion->SetLineColor(kBlue);
210    exclusion->SetLineWidth(2);
211 +  //exclusion->SetLineWidth(4); // paper style
212    exclusion->SetLineStyle(isprimary);
213    return exclusion;
214   }
215  
177 void produce_extensive_plots(TH2F *xsec,TH2F *limits,TH2F *rellimits, TH2F *rellimitsd3, TH2F *rellimitst3, int scantype) {
178  TCanvas *ca = new TCanvas("ca","ca",2400,1200);
179  ca->Divide(4,2);
180  ca->cd(1);
181  ca->cd(1)->SetLogz(1);
182  xsec->GetZaxis()->SetRangeUser(0.001,1000);
183  xsec->Draw("COLZ");
184  TText *title0 = write_title("Reference Cross Section");
185  title0->Draw("same");
186  ca->cd(2);
187  ca->cd(2)->SetLogz(1);
188  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
189  limits->Draw("COLZ");
190  TText *title = write_title("Cross Section Upper Limit");
191  title->Draw("same");
192  ca->cd(3);
193  ca->cd(3)->SetLogz(1);
194  TH2F *limit_ref = (TH2F*)limits->Clone("limit_ref");
195  limit_ref->Divide(xsec);
196  limit_ref->GetZaxis()->SetRangeUser(limits_ratio_lower_bound,limits_ratio_upper_bound);
197  limit_ref->Draw("COLZ");
198  TText *title2 = write_title("Cross Section UL / XS");
199  title2->Draw("same");
200  ca->cd(4);
201  ca->cd(4)->SetLogz(1);
202  limits->SetTitle("");
203  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
204  limits->SetZTitle("95% CL upper limit on #sigma [pb]");
205
206 //  limits->GetZaxis()->SetTitleOffset(1.1); // This is set in set_range
207 //  limits->GetZaxis()->CenterTitle(); // This is set in set_range
208  limits->Draw("COLZ");
209
210  TGraph *exclline = MarcosExclusionLine(rellimits, scantype);
211  TGraph *thinexclline = thin_line(exclline);
212
213  TGraph *excllinet3 = MarcosExclusionLine(rellimitst3, scantype);
214  excllinet3->SetLineStyle(2);
215  TGraph *thinexcllinet3 = thin_line(excllinet3);
216
217  TGraph *excllined3 = MarcosExclusionLine(rellimitsd3, scantype);
218  excllined3->SetLineStyle(3);
219  TGraph *thinexcllined3 = thin_line(excllined3);
220
221  ca->cd(4);
222  exclline->Draw();
223  thinexclline->Draw();
224  excllinet3->Draw();
225  thinexcllinet3->Draw();
226  excllined3->Draw();
227  thinexcllined3->Draw();
228  stringstream partial;
229  partial << "Limits/exclusion__" << limits->GetName();
230  fill_with_text(exclline,excllined3,excllinet3,ca->cd(4),scantype);
231  CompleteSave(ca,partial.str());
232
233  ca->cd(5);
234  (hardlimit(rellimits))->Draw("COL");
235  exclline->Draw("same");
236  ca->cd(6);
237  (hardlimit(rellimitst3))->Draw("COL");
238  excllinet3->Draw("same");
239  ca->cd(7);
240  (hardlimit(rellimitsd3))->Draw("COLZ");
241  excllined3->Draw("same");
242  
243  CompleteSave(ca,partial.str()+"__PlusInfo");
244  delete ca;
245 }
216  
217   bool fail(double xs, double xsLimit) {return xsLimit>1 or !xsLimit;}
218  
219   void get_Marias_exclusion_line(TH2F *limit_ref, float pointsX[200], float pointsY[200], int &ixNew, int &counter, int &foundDiag) {
220   // part of Mariarosaria's getRefXsecGraph function
251  double refMult = 3.0;
221    bool enough = false;
222    Int_t  nBinX= limit_ref->GetXaxis()->GetNbins();
223    Int_t  nBinY= limit_ref->GetYaxis()->GetNbins();
# Line 259 | Line 228 | void get_Marias_exclusion_line(TH2F *lim
228        if(limit_ref->GetBinContent(i,j)==0) continue;
229        if( limit_ref->GetBinContent(i,j)>0. && limit_ref->GetBinContent(i,j)<=1.) {
230          double xsLimitAbove = limit_ref->GetBinContent(i, j+1);
262        double xsLimitBelow = limit_ref->GetBinContent(i, j-1);
231  
232          double xsLimit = limit_ref->GetBinContent(i, j);
233          if((fail(1.0,xsLimitAbove)) && (!fail(1.0,xsLimit)) ) {
# Line 361 | Line 329 | TGraph *MarcosExclusionLine(TH2F *exclus
329    }
330    realgraph->SetLineColor(TColor::GetColor("#151515")); //nice black
331    realgraph->SetLineWidth(2);
332 +  //realgraph->SetLineWidth(4);//paper style
333  
334    return realgraph;
335   }
# Line 372 | Line 341 | TGraph* thin_line(TGraph *gr) {
341    return thin;
342   }
343  
344 < void make_SMS_exclusion(TH2F *rawlimits,TH2F *xsec,int scantype,std::string& scanx) {
344 > void make_SMS_exclusion(TH2F *rawlimits,TH2F *xsec,int scantype,std::string& scanx, bool isobserved) {
345    TH2F *limits = prep_histo(rawlimits,scantype); // this is to be independent of the style used at creation time
346    //here we get some limits and the cross section; we want to make an exclusion plot!
347    TH2F *rellimits = (TH2F*)limits->Clone("rellimits");
# Line 403 | Line 372 | void make_SMS_exclusion(TH2F *rawlimits,
372    
373    set_range(xsec,scantype,false);
374    set_range(limits,scantype,false);
375 +  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
376    
377    bool drawdoubleline=false; //draw nice thin line on top of thick outer line
378    TGraph *exclline = MarcosExclusionLine(rellimits, scantype);
379    TGraph *thinexcline = thin_line(exclline);
380 <
380 >  
381    TGraph *excllinet3 = MarcosExclusionLine(rellimitst3, scantype);
382    excllinet3->SetLineStyle(2);
383    TGraph *thinexclinet3 = thin_line(excllinet3);
# Line 416 | Line 386 | void make_SMS_exclusion(TH2F *rawlimits,
386    excllined3->SetLineStyle(3);
387    TGraph *thinexclined3 = thin_line(excllined3);
388  
389 <  produce_extensive_plots(xsec,limits,rellimits, rellimitst3, rellimitsd3,scantype);
389 > //  produce_extensive_plots(xsec,limits,rellimits, rellimitst3, rellimitsd3,scantype);
390    
391    TCanvas *finalcanvas = new TCanvas("finalcanvas","finalcanvas");
392    finalcanvas->SetLogz(1);
393    finalcanvas->cd();
394 +  limits->SetZTitle("95% CL upper limit on #sigma [pb]");
395    limits->Draw("COLZ");
396  
426
397    TLine *desertline;
398    if(drawefficiencydesertline) {
399          desertline = new TLine(375,50,1200,875);
400          desertline->SetLineWidth(3);
401 +        //desertline->SetLineWidth(4); // paper style
402          desertline->SetLineColor(kBlack);
403          desertline->Draw("same");
404    }
405  
435  TH2F *emptyh = new TH2F("emptyh","emptyh",1,1,2,1,1,2);
436  
437  
438  exclline->Draw("c");
406  
407   //  fill_with_text(exclline,excllined3,excllinet3,finalcanvas,scantype,scanx);
408    stringstream real;
409 <  real << "Limits/final_exclusion__" << limits->GetName();
409 >  real << "Limits/";
410 >  if(!isobserved) real << "expected/expected_";
411 >  real << "final_exclusion__" << limits->GetName();
412    
413    if(Contains(limits->GetName(),"bestlimits")) {
414      cout << "----------> " << limits->GetName() << endl;
# Line 458 | Line 427 | void make_SMS_exclusion(TH2F *rawlimits,
427    if(drawdoubleline) thinexclinet3->Draw("");
428    excllined3->Draw("");
429    if(drawdoubleline) thinexclined3->Draw("");
430 +  
431    CompleteSave(finalcanvas,real.str());
432  
433 +  
434 +  
435 +  //-------------------------------------- extensive plots
436 +  
437 +  TCanvas *ca = new TCanvas("ca","ca",2400,1200);
438 +  ca->Divide(4,2);
439 +  ca->cd(1);
440 +  ca->cd(1)->SetLogz(1);
441 +  xsec->GetZaxis()->SetRangeUser(0.001,1000);
442 +  xsec->Draw("COLZ");
443 +  TText *title0 = write_title("Reference Cross Section");
444 +  title0->Draw("same");
445 +  ca->cd(2);
446 +  ca->cd(2)->SetLogz(1);
447 +  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
448 +  limits->Draw("COLZ");
449 +  TText *title = write_title("Cross Section Upper Limit");
450 +  title->Draw("same");
451 +  ca->cd(3);
452 +  ca->cd(3)->SetLogz(1);
453 +  TH2F *limit_ref = (TH2F*)limits->Clone("limit_ref");
454 +  limit_ref->Divide(xsec);
455 +  limit_ref->GetZaxis()->SetRangeUser(limits_ratio_lower_bound,limits_ratio_upper_bound);
456 +  limit_ref->Draw("COLZ");
457 +  TText *title2 = write_title("Cross Section UL / XS");
458 +  title2->Draw("same");
459 +  ca->cd(4);
460 +  ca->cd(4)->SetLogz(1);
461 +  limits->SetTitle("");
462 +  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
463 +  limits->SetZTitle("95% CL upper limit on #sigma [pb]");
464 +
465 +  limits->Draw("COLZ");
466 +
467 +
468 +  ca->cd(4);
469 +  exclline->Draw();
470 +  thinexcline->Draw();
471 +  excllinet3->Draw();
472 +  thinexclinet3->Draw();
473 +  excllined3->Draw();
474 +  thinexclined3->Draw();
475 +  stringstream partial;
476 +  partial << "Limits/";
477 +  if(!isobserved) real << "expected/expected_";
478 +  partial << "exclusion__" << limits->GetName();
479 +  fill_with_text(exclline,excllined3,excllinet3,ca->cd(4),scantype);
480 + //  CompleteSave(ca,partial.str());
481 +
482 +  ca->cd(5);
483 +  (hardlimit(rellimitsd3))->Draw("COL");
484 +  TText *c = write_title("Exclusion shape for #sigma_{ref}/3");
485 +  c->Draw();
486 +  excllined3->Draw("same");
487 +  
488 +  ca->cd(6);
489 +  (hardlimit(rellimits))->Draw("COL");
490 +  exclline->Draw("same");
491 +  TText *b = write_title("Exclusion shape for #sigma_{ref}");
492 +  b->Draw();
493 +  
494 +  ca->cd(7);
495 +  (hardlimit(rellimitst3))->Draw("COL");
496 +  excllinet3->Draw("same");
497 +  TText *a = write_title("Exclusion shape for 3x#sigma_{ref}");
498 +  a->Draw();
499 +  
500 +  CompleteSave(ca,partial.str()+"__PlusInfo");
501 +  delete ca;
502 +  
503 +  //---------------------------------------</extensive plots>
504    delete finalcanvas;
505   }
506  
# Line 470 | Line 511 | TH1* getHisto(char * filename, char* his
511    if(!file0) return hpt_;
512    TDirectory *dir;
513    TH2D * hMuPt;
473  TH1* H;
514  
515    if(dirName == "0") {
516      hMuPt = (TH2D*) file0->Get(histoName);
# Line 603 | Line 643 | TGraph* get_mSUGRA_exclusion_line(TH2F *
643    for(int i=1;i<exclusionhisto->GetNbinsX();i++) {
644      pair<float,float> anything = find_point(exclusionhisto,i);
645      pair<float,float> intthing = find_interpolated_point(exclusionhisto,i);
606    float value=anything.second;
646      if(intthing.second>anything.second) anything.second=intthing.second;
647      if(anything.second>100&&anything.second<1500) points.push_back(anything);
648    }
# Line 621 | Line 660 | TGraph* get_mSUGRA_exclusion_line(TH2F *
660    float lastx2=0;
661    float lasty2=0;
662    
663 <  for(int i=0;i<points.size();i++) {
663 >  for(int i=0;i<(int)points.size();i++) {
664      xpoints[i]=points[i].first;
665      spoints[i]=points[i].second;
666      if(scantype==PlottingSetup::mSUGRA) {
667 <        if(i>1&&i<points.size()-1) spoints[i]=(1.0/3.0)*(points[i-1].second+points[i].second+points[i+1].second);
668 <        if(i>2&&i<points.size()-2) spoints[i]=(1.0/5.0)*(points[i-2].second+points[i-1].second+points[i].second+points[i+1].second+points[i+2].second);
669 <        if(i>3&&i<points.size()-3) spoints[i]=(1.0/7.0)*(points[i-3].second+points[i-2].second+points[i-1].second+points[i].second+points[i+1].second+points[i+2].second+points[i+3].second);
667 >        if(i>1&&i<(int)points.size()-1) spoints[i]=(1.0/3.0)*(points[i-1].second+points[i].second+points[i+1].second);
668 >        if(i>2&&i<(int)points.size()-2) spoints[i]=(1.0/5.0)*(points[i-2].second+points[i-1].second+points[i].second+points[i+1].second+points[i+2].second);
669 >        if(i>3&&i<(int)points.size()-3) spoints[i]=(1.0/7.0)*(points[i-3].second+points[i-2].second+points[i-1].second+points[i].second+points[i+1].second+points[i+2].second+points[i+3].second);
670      }
671  
672      bool usethispoint=true;
# Line 645 | Line 684 | TGraph* get_mSUGRA_exclusion_line(TH2F *
684          pointcounter++;
685      }
686    }
687 <  for(int i=pointcounter;i<=points.size();i++) graph->SetPoint(i,lastx,lasty);
687 >  for(int i=pointcounter;i<=(int)points.size();i++) graph->SetPoint(i,lastx,lasty);
688    if(scantype==PlottingSetup::GMSB||scantype==PlottingSetup::SMS) {
689          //The final point will be a continuation of the last one, towards the diagonal
690          float x,y;
# Line 668 | Line 707 | TH2F* cast_into_shape(TH2F *origin, TH2F
707    return newh;
708   }
709  
710 < void draw_mSUGRA_exclusion(TH2F *ocrosssection, TH2F *oFilterEfficiency, TH2F *oabsXS, TH2F *limitmap, TH2F *expmap, TH2F *expplusmap, TH2F *expminusmap, TH2F *exp2plusmap, TH2F *exp2minusmap) {
710 > void draw_mSUGRA_exclusion(TH2F *ocrosssection, TH2F *oFilterEfficiency, TH2F *oabsXS, TH2F *limitmap, TH2F *expmap, TH2F *expplusmap, TH2F *expminusmap, TH2F *exp2plusmap, TH2F *exp2minusmap, bool isobserved) {
711    TH2F *crosssection = (TH2F*)ocrosssection->Clone("crosssection");
712   //  TH2F *limitmap = (TH2F*)olimitmap->Clone(((string)olimitmap->GetName()+"clone").c_str());
713    TH2F *cleanhisto = (TH2F*)limitmap->Clone("clean");
# Line 759 | Line 798 | void draw_mSUGRA_exclusion(TH2F *ocrosss
798   //  expected->Draw("c");
799   //  observed->Draw("c");
800    stringstream saveas;
801 <  if((int)((string)limitmap->GetName()).find("limitmap")>0) saveas << "Limits/final_exclusion_for_JZB_geq_" << ((string)limitmap->GetName()).substr(((string)limitmap->GetName()).find("limitmap")+8,10);
802 <  else saveas << "Limits/final_exclusion_for_bestlimits";
801 >  if((int)((string)limitmap->GetName()).find("limitmap")>0) {
802 >    saveas << "Limits/";
803 >    if(!isobserved) saveas << "expected/expected_";
804 >    saveas << "final_exclusion_for_JZB_geq_" << ((string)limitmap->GetName()).substr(((string)limitmap->GetName()).find("limitmap")+8,10);
805 >  } else {
806 >    saveas << "Limits/";
807 >    if(!isobserved) saveas << "expected/expected";
808 >    saveas << "final_exclusion_for_bestlimits";
809 >  }
810    CompleteSave(te,saveas.str());
811    delete te;
812    
# Line 770 | Line 816 | void draw_mSUGRA_exclusion(TH2F *ocrosss
816    set_range(limits,true,false);
817    set_range(limitmap,true,false);
818    
773  TGraph *emptygraph = new TGraph(0);
774  
819    overview->Divide(3,2);
820    overview->cd(1);
821    overview->cd(1)->SetLogz(1);
# Line 808 | Line 852 | void draw_mSUGRA_exclusion(TH2F *ocrosss
852    SugarCoatThis(overview->cd(6),10,noh,observed);
853   //  observed->Draw("c");
854    stringstream saveas2;
855 <  if((int)((string)limitmap->GetName()).find("limitmap")>0) saveas2 << "Limits/exclusion_overview_for_JZB_geq_" << ((string)limitmap->GetName()).substr(((string)limitmap->GetName()).find("limitmap")+8,10);
856 <  else saveas2 << "Limits/exclusion_overview_for_bestlimits";
855 >  if((int)((string)limitmap->GetName()).find("limitmap")>0) {
856 >    saveas2 << "Limits/";
857 >    if(!isobserved) saveas << "expected/expected_";
858 >    saveas2 << "exclusion_overview_for_JZB_geq_" << ((string)limitmap->GetName()).substr(((string)limitmap->GetName()).find("limitmap")+8,10);
859 >  } else {
860 >    saveas2 << "Limits/";
861 >    if(!isobserved) saveas << "expected/expected_";
862 >    saveas2 << "exclusion_overview_for_bestlimits";
863 >  }
864    CompleteSave(overview,saveas2.str());
865    delete overview;
866    delete noh;
# Line 834 | Line 885 | string give_nice_source_label(string nam
885    int mappoint=name.find("map");
886    if(mappoint<0||mappoint>500) return name; // this mean that something weird is happening
887    stringstream nice_label;
888 <  nice_label << "JZB > " << name.substr(mappoint+3,name.size()) << " GeV";
888 >  string identifier=name.substr(mappoint+3,name.size());
889 >  if(identifier!="0") nice_label << "JZB > " << name.substr(mappoint+3,name.size()) << " GeV";
890 >  else nice_label << "JZB shape";
891    return nice_label.str();
892   }
893  
# Line 862 | Line 915 | Int_t get_exclusion_region_color(double
915  
916   float findmaxentry(vector<TH2F*> histos, int i, int j) {
917    float max = histos[0]->GetBinContent(i,j);
918 <  for(int k=0;k<histos.size();k++) {
918 >  for(int k=0;k<(int)histos.size();k++) {
919      float entry = histos[k]->GetBinContent(i,j);
920      if(entry>=max) max=entry;
921    }
# Line 878 | Line 931 | TH2F *make_best_limits(vector<TH2F*> exp
931    }
932    if(explimits.size()==0) {
933      write_warning(__FUNCTION__,"There are no expected limits! Will compute best limits based on observed limits! (WATCH OUT THIS IS DISCOURAGED!");
934 <    for(int i=0;i<obslimits.size();i++) explimits.push_back(obslimits[i]);
934 >    for(int i=0;i<(int)obslimits.size();i++) explimits.push_back(obslimits[i]);
935    }
936    TH2F *bestlimit=(TH2F*)obslimits[0]->Clone("bestlimits");
937    TH2F *bestexplimit=(TH2F*)obslimits[0]->Clone("bestexplimits");
# Line 893 | Line 946 | TH2F *make_best_limits(vector<TH2F*> exp
946        float min=findmaxentry(explimits,i,j);
947        float omin=obslimits[0]->GetBinContent(i,j);
948        int source=0;
949 <      for(int k=0;k<explimits.size();k++) {
949 >      for(int k=0;k<(int)explimits.size();k++) {
950          float currlim=explimits[k]->GetBinContent(i,j);
951          if(currlim<=min&&currlim>0) {
952            min=currlim;
# Line 926 | Line 979 | TH2F *make_best_limits(vector<TH2F*> exp
979    bestlimitsource->Draw("COL");
980    gPad->Update();
981    TLegend *sourceleg = new TLegend(0.2,0.5,0.55,0.75);
982 <  for(int i=0;i<explimits.size();i++) {
982 >  for(int i=0;i<(int)explimits.size();i++) {
983      stringstream legendentry;
984 <    legendentry << i+1 << " = " << give_nice_source_label(explimits[i]->GetName());
984 >    legendentry << give_nice_source_label(explimits[i]->GetName());
985      Int_t currcol=get_exclusion_region_color(i+1,bestlimitsource);
986      explimits[i]->SetFillColor(currcol);
987      explimits[i]->SetLineColor(currcol);
# Line 964 | Line 1017 | void create_exclusion_plots(vector<TH2F*
1017      }
1018      xsecfile->Close();
1019    }
1020 <  if(scantype!=PlottingSetup::mSUGRA) for(int i=0;i<limits.size();i++) limits[i]->Scale(1./0.19); // because for T5zz we forced one z to decay leptonically
1020 >  if(scantype!=PlottingSetup::mSUGRA) for(int i=0;i<(int)limits.size();i++) limits[i]->Scale(1./0.19); // because for T5zz we forced one z to decay leptonically
1021      
1022    vector<TH2F*> explimits;
1023    vector<TH2F*> exp1mlimits;
# Line 976 | Line 1029 | void create_exclusion_plots(vector<TH2F*
1029    vector<TH2F*> crosssections;
1030    vector<TH2F*> AbsCrossSection;
1031    vector<TH2F*> FilterEfficiencies;
1032 <  for(int ilim=0;ilim<limits.size();ilim++) {
1032 >  for(int ilim=0;ilim<(int)limits.size();ilim++) {
1033      if(TString(limits[ilim]->GetName()).Contains("_explimitmap")) explimits.push_back(limits[ilim]);
1034      if(scantype==PlottingSetup::mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1plimitmap")) exp1plimits.push_back(limits[ilim]);
1035      if(scantype==PlottingSetup::mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1mlimitmap")) exp1mlimits.push_back(limits[ilim]);
# Line 996 | Line 1049 | void create_exclusion_plots(vector<TH2F*
1049      
1050   cout << "Size: " << AbsCrossSection.size() << endl;
1051    TH2F *xsec;
1052 <  if(scantype!=PlottingSetup::mSUGRA) xsec = adjust_histo(get_XS(xsecfilename,"gluino",limits[0]),limits[0]);
1052 >  if(scantype!=PlottingSetup::mSUGRA) xsec = adjust_histo(get_XS(xsecfilename,"gluino",obslimits[0]),obslimits[0]);
1053    vector<TH2F*> bestexplimits;
1054    TH2F *bestlimits = make_best_limits(explimits,obslimits,scantype, scanx, exp1mlimits, exp1plimits, exp2mlimits, exp2plimits, bestexplimits);
1055    bestlimits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
1056  
1057 <  for(int ilim=0;ilim<limits.size();ilim++) {
1057 >  for(int ilim=0;ilim<(int)limits.size();ilim++) {
1058      limits[ilim]->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
1059    }
1060    
1061    if(scantype!=PlottingSetup::mSUGRA) {
1062 <    for(int ilim=0;ilim<obslimits.size();ilim++) make_SMS_exclusion(obslimits[ilim],xsec,scantype,scanx);
1063 <    make_SMS_exclusion(bestlimits,xsec,scantype,scanx);
1062 >    for(int ilim=0;ilim<(int)obslimits.size();ilim++) make_SMS_exclusion(obslimits[ilim],xsec,scantype,scanx,true);
1063 >    for(int ilim=0;ilim<(int)obslimits.size();ilim++) make_SMS_exclusion(explimits[ilim],xsec,scantype,scanx,false);//plotting expected limits
1064 >    make_SMS_exclusion(bestlimits,xsec,scantype,scanx,true);
1065    } else {
1066 <    for(int ilim=0;ilim<obslimits.size();ilim++) {
1067 <      draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],obslimits[ilim], explimits[ilim], exp1mlimits[ilim], exp1plimits[ilim], exp2mlimits[ilim], exp2plimits[ilim]);
1066 >    for(int ilim=0;ilim<(int)obslimits.size();ilim++) {
1067 >      draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],obslimits[ilim], explimits[ilim], exp1mlimits[ilim], exp1plimits[ilim], exp2mlimits[ilim], exp2plimits[ilim],true);
1068 >      draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],explimits[ilim], explimits[ilim], exp1mlimits[ilim], exp1plimits[ilim], exp2mlimits[ilim], exp2plimits[ilim],false);
1069      }
1070 <    draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],bestlimits, bestexplimits[0], bestexplimits[1], bestexplimits[2], bestexplimits[3], bestexplimits[4]);
1070 >    draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],bestlimits, bestexplimits[0], bestexplimits[1], bestexplimits[2], bestexplimits[3], bestexplimits[4],true);
1071    }
1072    delete bestlimits;
1073   }
# Line 1025 | Line 1080 | void smooth_line_once(TGraph *gr) {
1080    int sign=1;
1081    for(int i=0;i<gr->GetN();i++) {
1082      Double_t x,y,x1,y1,x2,y2;
1028    bool turning=false;
1083      gr->GetPoint(i,x,y);
1084      gr->GetPoint(i+1,x1,y1);//need to handle exception here
1085      gr->GetPoint(i-1,x2,y2);//need to handle exception here
# Line 1052 | Line 1106 | void smooth_line(TGraph *gr) {
1106   void set_range(TH2F *histo, int scantype, bool pushoutyz=false) {
1107    gStyle->SetPadLeftMargin(0.18);
1108    gStyle->SetPadRightMargin(0.19);
1109 +  // histo->GetXaxis()->SetLabelSize(0.035); //paper style
1110 +  // histo->GetYaxis()->SetLabelSize(0.035); //paper style
1111    if(scantype==PlottingSetup::mSUGRA) {
1112      histo->GetXaxis()->SetRangeUser(0,PlottingSetup::m0end);
1113      histo->GetYaxis()->SetRangeUser(0,PlottingSetup::m12end);
# Line 1160 | Line 1216 | void process_syst_plot(TH2F *rhisto,stri
1216      TPRegexp pat("\\d+$");
1217      size_t index = name.Index(pat,0);
1218      string cut = string("JZB > ")+(name(index,name.Length()-index).Data())+" GeV";
1219 +    //string cut = string("#splitline{JZB > ")+(name(index,name.Length()-index).Data())+" GeV}{n_{jets} #geq 3}"; //paper style
1220      TText *text = write_text(xpos_of_text,0.73,cut);
1221      text->SetTextAlign(11);
1222      text->SetTextSize(0.035);
1223      text->Draw();
1224 +    draw_diagonal_xchange( scantype, scanx );
1225    }
1226    
1227    CompleteSave(can,(saveto+(string)histo->GetName()));
# Line 1175 | Line 1233 | void process_syst_plot(TH2F *rhisto,stri
1233  
1234   void make_all_syst_plots(vector<TH2F*> all_histos,int scantype,std::string& scanx) {
1235    string saveto="Systematics/";
1236 <  for(int iplot=0;iplot<all_histos.size();iplot++) {
1236 >  for(int iplot=0;iplot<(int)all_histos.size();iplot++) {
1237        process_syst_plot(all_histos[iplot],saveto,scantype,scanx);
1238    }
1239   }
1240  
1241 + string IdentifyScan(TString histoname) {
1242 +  if (histoname.Contains("T5zzl")) return "0.75";
1243 +  if(histoname.Contains("T5zzh")) return "0.25";
1244 +  if(histoname.Contains("T5zz")) return "0.5";
1245 +  
1246 +  return "IdentifyScanError"+string(histoname.Data());
1247 + }
1248 +
1249   void process_file(TFile* file, float stdmargin) {
1250    standardmargin=stdmargin;
1251    xsecfilename=PlottingSetup::cbafbasedir+"/"+PlottingSetup::SMSReferenceXSFile;
# Line 1190 | Line 1256 | void process_file(TFile* file, float std
1256    
1257    int scantype=PlottingSetup::SMS;
1258    std::string scanx = "0"; // Just for the legend
1193  if (TString(file->GetName()).Contains("T5zzl")) scanx = "0.75";
1194  else  if(TString(file->GetName()).Contains("T5zzh")) scanx = "0.25";
1195  else if(TString(file->GetName()).Contains("T5zz")) scanx = "0.5";
1259    
1260    vector<TH2F*> systematics_histos;
1261    vector<TH2F*> limits_histos;
# Line 1233 | Line 1296 | void process_file(TFile* file, float std
1296        if(name.Contains("timemap")) is_systematic=true;
1297        if(name.Contains("flipmap")) is_systematic=true;
1298  
1299 +      if(name.Contains("limitmap0")) continue;
1300        if(is_limit) limits_histos.push_back((TH2F*) obj);
1301        else if(is_systematic) systematics_histos.push_back((TH2F*) obj);
1302        if(name.Contains("mSUGRA")) scantype=PlottingSetup::mSUGRA;
1303        if(name.Contains("GMSB")) scantype=PlottingSetup::GMSB;
1304 +      if(name.Contains("ScanIdentifier")) scanx=IdentifyScan(name);
1305      }
1306 + //  if (TString(file->GetName()).Contains("T5zzl")) scanx = "0.75";
1307 + //  else  if(TString(file->GetName()).Contains("T5zzh")) scanx = "0.25";
1308 + //  else if(TString(file->GetName()).Contains("T5zz")) scanx = "0.5";
1309      write_warning(__FUNCTION__,"Deactivated systematics plots");
1310   //  if(systematics_histos.size()>0) make_all_syst_plots(systematics_histos,scantype,scanx);
1311    if(limits_histos.size()>0) create_exclusion_plots(limits_histos,scantype,scanx);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines