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.9 by buchmann, Mon Apr 30 08:39:44 2012 UTC

# 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 170 | Line 207 | TH2F* make_exclusion_shape(TH2F *excl, i
207    }
208    exclusion->SetLineColor(kBlue);
209    exclusion->SetLineWidth(2);
210 +  //exclusion->SetLineWidth(4); // paper style
211    exclusion->SetLineStyle(isprimary);
212    return exclusion;
213   }
# Line 248 | Line 286 | bool fail(double xs, double xsLimit) {re
286  
287   void get_Marias_exclusion_line(TH2F *limit_ref, float pointsX[200], float pointsY[200], int &ixNew, int &counter, int &foundDiag) {
288   // part of Mariarosaria's getRefXsecGraph function
251  double refMult = 3.0;
289    bool enough = false;
290    Int_t  nBinX= limit_ref->GetXaxis()->GetNbins();
291    Int_t  nBinY= limit_ref->GetYaxis()->GetNbins();
# Line 259 | Line 296 | void get_Marias_exclusion_line(TH2F *lim
296        if(limit_ref->GetBinContent(i,j)==0) continue;
297        if( limit_ref->GetBinContent(i,j)>0. && limit_ref->GetBinContent(i,j)<=1.) {
298          double xsLimitAbove = limit_ref->GetBinContent(i, j+1);
262        double xsLimitBelow = limit_ref->GetBinContent(i, j-1);
299  
300          double xsLimit = limit_ref->GetBinContent(i, j);
301          if((fail(1.0,xsLimitAbove)) && (!fail(1.0,xsLimit)) ) {
# Line 361 | Line 397 | TGraph *MarcosExclusionLine(TH2F *exclus
397    }
398    realgraph->SetLineColor(TColor::GetColor("#151515")); //nice black
399    realgraph->SetLineWidth(2);
400 +  //realgraph->SetLineWidth(4);//paper style
401  
402    return realgraph;
403   }
# Line 428 | Line 465 | void make_SMS_exclusion(TH2F *rawlimits,
465    if(drawefficiencydesertline) {
466          desertline = new TLine(375,50,1200,875);
467          desertline->SetLineWidth(3);
468 +        //desertline->SetLineWidth(4); // paper style
469          desertline->SetLineColor(kBlack);
470          desertline->Draw("same");
471    }
472  
435  TH2F *emptyh = new TH2F("emptyh","emptyh",1,1,2,1,1,2);
436  
437  
473    exclline->Draw("c");
474  
475   //  fill_with_text(exclline,excllined3,excllinet3,finalcanvas,scantype,scanx);
# Line 470 | Line 505 | TH1* getHisto(char * filename, char* his
505    if(!file0) return hpt_;
506    TDirectory *dir;
507    TH2D * hMuPt;
473  TH1* H;
508  
509    if(dirName == "0") {
510      hMuPt = (TH2D*) file0->Get(histoName);
# Line 603 | Line 637 | TGraph* get_mSUGRA_exclusion_line(TH2F *
637    for(int i=1;i<exclusionhisto->GetNbinsX();i++) {
638      pair<float,float> anything = find_point(exclusionhisto,i);
639      pair<float,float> intthing = find_interpolated_point(exclusionhisto,i);
606    float value=anything.second;
640      if(intthing.second>anything.second) anything.second=intthing.second;
641      if(anything.second>100&&anything.second<1500) points.push_back(anything);
642    }
# Line 621 | Line 654 | TGraph* get_mSUGRA_exclusion_line(TH2F *
654    float lastx2=0;
655    float lasty2=0;
656    
657 <  for(int i=0;i<points.size();i++) {
657 >  for(int i=0;i<(int)points.size();i++) {
658      xpoints[i]=points[i].first;
659      spoints[i]=points[i].second;
660      if(scantype==PlottingSetup::mSUGRA) {
661 <        if(i>1&&i<points.size()-1) spoints[i]=(1.0/3.0)*(points[i-1].second+points[i].second+points[i+1].second);
662 <        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);
663 <        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);
661 >        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);
662 >        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);
663 >        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);
664      }
665  
666      bool usethispoint=true;
# Line 645 | Line 678 | TGraph* get_mSUGRA_exclusion_line(TH2F *
678          pointcounter++;
679      }
680    }
681 <  for(int i=pointcounter;i<=points.size();i++) graph->SetPoint(i,lastx,lasty);
681 >  for(int i=pointcounter;i<=(int)points.size();i++) graph->SetPoint(i,lastx,lasty);
682    if(scantype==PlottingSetup::GMSB||scantype==PlottingSetup::SMS) {
683          //The final point will be a continuation of the last one, towards the diagonal
684          float x,y;
# Line 770 | Line 803 | void draw_mSUGRA_exclusion(TH2F *ocrosss
803    set_range(limits,true,false);
804    set_range(limitmap,true,false);
805    
773  TGraph *emptygraph = new TGraph(0);
774  
806    overview->Divide(3,2);
807    overview->cd(1);
808    overview->cd(1)->SetLogz(1);
# Line 862 | Line 893 | Int_t get_exclusion_region_color(double
893  
894   float findmaxentry(vector<TH2F*> histos, int i, int j) {
895    float max = histos[0]->GetBinContent(i,j);
896 <  for(int k=0;k<histos.size();k++) {
896 >  for(int k=0;k<(int)histos.size();k++) {
897      float entry = histos[k]->GetBinContent(i,j);
898      if(entry>=max) max=entry;
899    }
# Line 878 | Line 909 | TH2F *make_best_limits(vector<TH2F*> exp
909    }
910    if(explimits.size()==0) {
911      write_warning(__FUNCTION__,"There are no expected limits! Will compute best limits based on observed limits! (WATCH OUT THIS IS DISCOURAGED!");
912 <    for(int i=0;i<obslimits.size();i++) explimits.push_back(obslimits[i]);
912 >    for(int i=0;i<(int)obslimits.size();i++) explimits.push_back(obslimits[i]);
913    }
914    TH2F *bestlimit=(TH2F*)obslimits[0]->Clone("bestlimits");
915    TH2F *bestexplimit=(TH2F*)obslimits[0]->Clone("bestexplimits");
# Line 893 | Line 924 | TH2F *make_best_limits(vector<TH2F*> exp
924        float min=findmaxentry(explimits,i,j);
925        float omin=obslimits[0]->GetBinContent(i,j);
926        int source=0;
927 <      for(int k=0;k<explimits.size();k++) {
927 >      for(int k=0;k<(int)explimits.size();k++) {
928          float currlim=explimits[k]->GetBinContent(i,j);
929          if(currlim<=min&&currlim>0) {
930            min=currlim;
# Line 926 | Line 957 | TH2F *make_best_limits(vector<TH2F*> exp
957    bestlimitsource->Draw("COL");
958    gPad->Update();
959    TLegend *sourceleg = new TLegend(0.2,0.5,0.55,0.75);
960 <  for(int i=0;i<explimits.size();i++) {
960 >  for(int i=0;i<(int)explimits.size();i++) {
961      stringstream legendentry;
962      legendentry << i+1 << " = " << give_nice_source_label(explimits[i]->GetName());
963      Int_t currcol=get_exclusion_region_color(i+1,bestlimitsource);
# Line 964 | Line 995 | void create_exclusion_plots(vector<TH2F*
995      }
996      xsecfile->Close();
997    }
998 <  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
998 >  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
999      
1000    vector<TH2F*> explimits;
1001    vector<TH2F*> exp1mlimits;
# Line 976 | Line 1007 | void create_exclusion_plots(vector<TH2F*
1007    vector<TH2F*> crosssections;
1008    vector<TH2F*> AbsCrossSection;
1009    vector<TH2F*> FilterEfficiencies;
1010 <  for(int ilim=0;ilim<limits.size();ilim++) {
1010 >  for(int ilim=0;ilim<(int)limits.size();ilim++) {
1011      if(TString(limits[ilim]->GetName()).Contains("_explimitmap")) explimits.push_back(limits[ilim]);
1012      if(scantype==PlottingSetup::mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1plimitmap")) exp1plimits.push_back(limits[ilim]);
1013      if(scantype==PlottingSetup::mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1mlimitmap")) exp1mlimits.push_back(limits[ilim]);
# Line 1001 | Line 1032 | cout << "Size: " << AbsCrossSection.size
1032    TH2F *bestlimits = make_best_limits(explimits,obslimits,scantype, scanx, exp1mlimits, exp1plimits, exp2mlimits, exp2plimits, bestexplimits);
1033    bestlimits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
1034  
1035 <  for(int ilim=0;ilim<limits.size();ilim++) {
1035 >  for(int ilim=0;ilim<(int)limits.size();ilim++) {
1036      limits[ilim]->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
1037    }
1038    
1039    if(scantype!=PlottingSetup::mSUGRA) {
1040 <    for(int ilim=0;ilim<obslimits.size();ilim++) make_SMS_exclusion(obslimits[ilim],xsec,scantype,scanx);
1040 >    for(int ilim=0;ilim<(int)obslimits.size();ilim++) make_SMS_exclusion(obslimits[ilim],xsec,scantype,scanx);
1041      make_SMS_exclusion(bestlimits,xsec,scantype,scanx);
1042    } else {
1043 <    for(int ilim=0;ilim<obslimits.size();ilim++) {
1043 >    for(int ilim=0;ilim<(int)obslimits.size();ilim++) {
1044        draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],obslimits[ilim], explimits[ilim], exp1mlimits[ilim], exp1plimits[ilim], exp2mlimits[ilim], exp2plimits[ilim]);
1045      }
1046      draw_mSUGRA_exclusion(crosssections[0],FilterEfficiencies[0],AbsCrossSection[0],bestlimits, bestexplimits[0], bestexplimits[1], bestexplimits[2], bestexplimits[3], bestexplimits[4]);
# Line 1025 | Line 1056 | void smooth_line_once(TGraph *gr) {
1056    int sign=1;
1057    for(int i=0;i<gr->GetN();i++) {
1058      Double_t x,y,x1,y1,x2,y2;
1028    bool turning=false;
1059      gr->GetPoint(i,x,y);
1060      gr->GetPoint(i+1,x1,y1);//need to handle exception here
1061      gr->GetPoint(i-1,x2,y2);//need to handle exception here
# Line 1052 | Line 1082 | void smooth_line(TGraph *gr) {
1082   void set_range(TH2F *histo, int scantype, bool pushoutyz=false) {
1083    gStyle->SetPadLeftMargin(0.18);
1084    gStyle->SetPadRightMargin(0.19);
1085 +  // histo->GetXaxis()->SetLabelSize(0.035); //paper style
1086 +  // histo->GetYaxis()->SetLabelSize(0.035); //paper style
1087    if(scantype==PlottingSetup::mSUGRA) {
1088      histo->GetXaxis()->SetRangeUser(0,PlottingSetup::m0end);
1089      histo->GetYaxis()->SetRangeUser(0,PlottingSetup::m12end);
# Line 1160 | Line 1192 | void process_syst_plot(TH2F *rhisto,stri
1192      TPRegexp pat("\\d+$");
1193      size_t index = name.Index(pat,0);
1194      string cut = string("JZB > ")+(name(index,name.Length()-index).Data())+" GeV";
1195 +    //string cut = string("#splitline{JZB > ")+(name(index,name.Length()-index).Data())+" GeV}{n_{jets} #geq 3}"; //paper style
1196      TText *text = write_text(xpos_of_text,0.73,cut);
1197      text->SetTextAlign(11);
1198      text->SetTextSize(0.035);
1199      text->Draw();
1200 +    draw_diagonal_xchange( scantype, scanx );
1201    }
1202    
1203    CompleteSave(can,(saveto+(string)histo->GetName()));
# Line 1175 | Line 1209 | void process_syst_plot(TH2F *rhisto,stri
1209  
1210   void make_all_syst_plots(vector<TH2F*> all_histos,int scantype,std::string& scanx) {
1211    string saveto="Systematics/";
1212 <  for(int iplot=0;iplot<all_histos.size();iplot++) {
1212 >  for(int iplot=0;iplot<(int)all_histos.size();iplot++) {
1213        process_syst_plot(all_histos[iplot],saveto,scantype,scanx);
1214    }
1215   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines