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.10 by buchmann, Fri May 4 12:05:03 2012 UTC vs.
Revision 1.14 by buchmann, Wed Sep 19 09:16:24 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 109 | Line 109 | void draw_diagonal_xchange(int scantype,
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; }
112 >  if ( 0 == scanx.compare("0.5") ) { offset = 91/0.5; }
113 >  else if ( 0 == scanx.compare("0.25") ) { offset = 91/0.25; }
114 >  else if ( 0 == scanx.compare("0.75") ) { offset = 91/0.75; }
115    else if ( scantype==PlottingSetup::GMSB) { offset = 0; };
116    
117    if ( offset>0. ) {
# Line 188 | 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 212 | Line 213 | TH2F* make_exclusion_shape(TH2F *excl, i
213    return exclusion;
214   }
215  
215 void produce_extensive_plots(TH2F *xsec,TH2F *limits,TH2F *rellimits, TH2F *rellimitsd3, TH2F *rellimitst3, int scantype) {
216  TCanvas *ca = new TCanvas("ca","ca",2400,1200);
217  ca->Divide(4,2);
218  ca->cd(1);
219  ca->cd(1)->SetLogz(1);
220  xsec->GetZaxis()->SetRangeUser(0.001,1000);
221  xsec->Draw("COLZ");
222  TText *title0 = write_title("Reference Cross Section");
223  title0->Draw("same");
224  ca->cd(2);
225  ca->cd(2)->SetLogz(1);
226  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
227  limits->Draw("COLZ");
228  TText *title = write_title("Cross Section Upper Limit");
229  title->Draw("same");
230  ca->cd(3);
231  ca->cd(3)->SetLogz(1);
232  TH2F *limit_ref = (TH2F*)limits->Clone("limit_ref");
233  limit_ref->Divide(xsec);
234  limit_ref->GetZaxis()->SetRangeUser(limits_ratio_lower_bound,limits_ratio_upper_bound);
235  limit_ref->Draw("COLZ");
236  TText *title2 = write_title("Cross Section UL / XS");
237  title2->Draw("same");
238  ca->cd(4);
239  ca->cd(4)->SetLogz(1);
240  limits->SetTitle("");
241  limits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
242  limits->SetZTitle("95% CL upper limit on #sigma [pb]");
243
244 //  limits->GetZaxis()->SetTitleOffset(1.1); // This is set in set_range
245 //  limits->GetZaxis()->CenterTitle(); // This is set in set_range
246  limits->Draw("COLZ");
247
248  TGraph *exclline = MarcosExclusionLine(rellimits, scantype);
249  TGraph *thinexclline = thin_line(exclline);
250
251  TGraph *excllinet3 = MarcosExclusionLine(rellimitst3, scantype);
252  excllinet3->SetLineStyle(2);
253  TGraph *thinexcllinet3 = thin_line(excllinet3);
254
255  TGraph *excllined3 = MarcosExclusionLine(rellimitsd3, scantype);
256  excllined3->SetLineStyle(3);
257  TGraph *thinexcllined3 = thin_line(excllined3);
258
259  ca->cd(4);
260  exclline->Draw();
261  thinexclline->Draw();
262  excllinet3->Draw();
263  thinexcllinet3->Draw();
264  excllined3->Draw();
265  thinexcllined3->Draw();
266  stringstream partial;
267  partial << "Limits/exclusion__" << limits->GetName();
268  fill_with_text(exclline,excllined3,excllinet3,ca->cd(4),scantype);
269 //  CompleteSave(ca,partial.str());
270
271  ca->cd(5);
272  (hardlimit(rellimits))->Draw("COL");
273  exclline->Draw("same");
274  TText *a = write_title("Exclusion shape for 3x#sigma_{ref}");
275  a->Draw();
276  ca->cd(6);
277  (hardlimit(rellimitst3))->Draw("COL");
278  excllinet3->Draw("same");
279  TText *b = write_title("Exclusion shape for #sigma_{ref}");
280  b->Draw();
281  ca->cd(7);
282  (hardlimit(rellimitsd3))->Draw("COLZ");
283  TText *c = write_title("Exclusion shape for #sigma_{ref}/3");
284  c->Draw();
285  excllined3->Draw("same");
286  
287  CompleteSave(ca,partial.str()+"__PlusInfo");
288  delete ca;
289 }
216  
217   bool fail(double xs, double xsLimit) {return xsLimit>1 or !xsLimit;}
218  
# Line 415 | 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 446 | 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 459 | 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  
469
397    TLine *desertline;
398    if(drawefficiencydesertline) {
399          desertline = new TLine(375,50,1200,875);
# Line 476 | Line 403 | void make_SMS_exclusion(TH2F *rawlimits,
403          desertline->Draw("same");
404    }
405  
479  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 499 | 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 707 | 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 798 | 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 845 | 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 1035 | 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);
# Line 1045 | Line 1059 | cout << "Size: " << AbsCrossSection.size
1059    }
1060    
1061    if(scantype!=PlottingSetup::mSUGRA) {
1062 <    for(int ilim=0;ilim<(int)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<(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]);
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 1223 | Line 1239 | void make_all_syst_plots(vector<TH2F*> a
1239   }
1240  
1241   string IdentifyScan(TString histoname) {
1226  cout << "We are dealing with a histo called " << histoname << endl;
1242    if (histoname.Contains("T5zzl")) return "0.75";
1243    if(histoname.Contains("T5zzh")) return "0.25";
1244    if(histoname.Contains("T5zz")) return "0.5";
# Line 1281 | 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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines