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

Comparing UserCode/cbrown/AnalysisFramework/Plotting/Modules/ExclusionPlot.C (file contents):
Revision 1.9 by pablom, Wed Nov 23 16:39:56 2011 UTC vs.
Revision 1.10 by buchmann, Fri Nov 25 17:17:16 2011 UTC

# Line 42 | Line 42 | bool drawefficiencydesertline=false;
42  
43   string xsecfilename;
44  
45 < void set_range(TH2F *histo, bool ismSUGRA, bool pushoutlabels);
45 > void set_range(TH2F *histo, int scantype, bool pushoutlabels);
46   void smooth_line(TGraph *gr);
47   void decorate_mSUGRA(TH2F *cleanhisto, TVirtualPad *cvsSys,TGraph *expected,TGraph *expected2,TGraph *observed);
48   TH2F* adjust_histo(TH2F *oldhist, TH2F *refhisto);
49  
50 < void fill_with_text(TH2F *real, TH2F *down, TH2F *up, TVirtualPad *can, bool ismSUGRA) {
50 > void fill_with_text(TH2F *real, TH2F *down, TH2F *up, TVirtualPad *can, int scantype) {
51    can->cd();
52    TLegend* this_leg = new TLegend(0.18,0.6,0.38,0.75);
53    this_leg->SetFillColor(0);
54    this_leg->SetBorderSize(0);
55    this_leg->SetTextSize(0.035);
56 <  if(!ismSUGRA) {
56 >  if(scantype==SMS||scantype==GMSB) {
57      this_leg->AddEntry(real,"#sigma^{prod} = #sigma^{NLO-QCD}" , "l");
58      this_leg->AddEntry(up,"#sigma^{prod} = 3 #times #sigma^{NLO-QCD}" , "l");
59      this_leg->AddEntry(down,"#sigma^{prod} = 1/3 #times #sigma^{NLO-QCD}" , "l");
# Line 68 | Line 68 | void fill_with_text(TH2F *real, TH2F *do
68    TText *title = write_text(0.18,0.85,legT5zz);
69    title->SetTextAlign(11);
70    title->SetTextSize(0.035);
71 <  if(!ismSUGRA) title->Draw("same");
71 >  if(scantype!=mSUGRA) title->Draw("same");
72    TText *title2 = write_text(0.18,0.79,legT5zzl2);
73    title2->SetTextAlign(11);
74    title2->SetTextSize(0.035);
75 <  if(!ismSUGRA) title2->Draw("same");
75 >  if(scantype!=mSUGRA) title2->Draw("same");
76    DrawPrelim();
77    TLine *line;
78    line = new TLine(50.+75., 50., 1200., 1200-75.);
# Line 81 | Line 81 | void fill_with_text(TH2F *real, TH2F *do
81    line->Draw("same");
82   }
83  
84 < TH2F* prep_histo(TH2F *oldhist, bool ismSUGRA) {///DONE
84 > TH2F* prep_histo(TH2F *oldhist, int scantype) {///DONE
85    TH2F *histo = new TH2F(oldhist->GetName(),oldhist->GetName(),
86                           oldhist->GetNbinsX(),oldhist->GetXaxis()->GetBinLowEdge(1),oldhist->GetXaxis()->GetBinLowEdge(oldhist->GetNbinsX())+oldhist->GetXaxis()->GetBinWidth(oldhist->GetNbinsX()),
87                           oldhist->GetNbinsY(),oldhist->GetYaxis()->GetBinLowEdge(1),oldhist->GetYaxis()->GetBinLowEdge(oldhist->GetNbinsY())+oldhist->GetYaxis()->GetBinWidth(oldhist->GetNbinsY()));
# Line 108 | Line 108 | TH2F* make_exclusion_shape(TH2F *excl, i
108    return exclusion;
109   }
110  
111 < void produce_extensive_plots(TH2F *xsec,TH2F *limits,TH2F *exclusionshape,TH2F *exclusionshapet3,TH2F *exclusionshaped3, bool ismSUGRA) {
111 > void produce_extensive_plots(TH2F *xsec,TH2F *limits,TH2F *exclusionshape,TH2F *exclusionshapet3,TH2F *exclusionshaped3, int scantype) {
112    TCanvas *ca = new TCanvas("ca","ca",1200,1200);
113    ca->Divide(2,2);
114    ca->cd(1);
# Line 150 | Line 150 | void produce_extensive_plots(TH2F *xsec,
150    exclusionshaped3->Draw("CONT1,same");
151    stringstream partial;
152    partial << "Limits/exclusion__" << limits->GetName();
153 <  fill_with_text(exclusionshape,exclusionshaped3,exclusionshapet3,ca->cd(4),ismSUGRA);
153 >  fill_with_text(exclusionshape,exclusionshaped3,exclusionshapet3,ca->cd(4),scantype);
154    CompleteSave(ca,partial.str());
155    delete ca;
156   }
157  
158  
159  
160 < void make_SMS_exclusion(TH2F *rawlimits,TH2F *xsec,bool ismSUGRA) {
161 <  TH2F *limits = prep_histo(rawlimits,ismSUGRA); // this is to be independent of the style used at creation time
160 > void make_SMS_exclusion(TH2F *rawlimits,TH2F *xsec,int scantype) {
161 >  TH2F *limits = prep_histo(rawlimits,scantype); // this is to be independent of the style used at creation time
162    //here we get some limits and the cross section; we want to make an exclusion plot!
163    TH2F *rellimits = (TH2F*)limits->Clone("rellimits");
164    TH2F *rellimitsd3 = (TH2F*)limits->Clone("rellimitsd3"); // one third the cross section ("divided by 3" -> d3)
# Line 185 | Line 185 | void make_SMS_exclusion(TH2F *rawlimits,
185    
186    //Now let's produce the plots!
187    
188 <  set_range(xsec,ismSUGRA,false);
189 <  set_range(limits,ismSUGRA,false);
190 <  set_range(exclusionshape,ismSUGRA,false);
191 <  set_range(exclusionshaped3,ismSUGRA,false);
192 <  set_range(exclusionshapet3,ismSUGRA,false);
188 >  set_range(xsec,scantype,false);
189 >  set_range(limits,scantype,false);
190 >  set_range(exclusionshape,scantype,false);
191 >  set_range(exclusionshaped3,scantype,false);
192 >  set_range(exclusionshapet3,scantype,false);
193    
194 <  produce_extensive_plots(xsec,limits,exclusionshape,exclusionshapet3,exclusionshaped3,ismSUGRA);
194 >  produce_extensive_plots(xsec,limits,exclusionshape,exclusionshapet3,exclusionshaped3,scantype);
195    
196    TCanvas *finalcanvas = new TCanvas("finalcanvas","finalcanvas");
197    finalcanvas->SetLogz(1);
# Line 208 | Line 208 | void make_SMS_exclusion(TH2F *rawlimits,
208          desertline->Draw("same");
209    }
210  
211 <  fill_with_text(exclusionshape,exclusionshaped3,exclusionshapet3,finalcanvas,ismSUGRA);
211 >  fill_with_text(exclusionshape,exclusionshaped3,exclusionshapet3,finalcanvas,scantype);
212    stringstream real;
213    real << "Limits/final_exclusion__" << limits->GetName();
214    CompleteSave(finalcanvas,real.str());
# Line 499 | Line 499 | Int_t get_exclusion_region_color(double
499   }  
500  
501  
502 < TH2F *make_best_limits(vector<TH2F*> explimits,vector<TH2F*> obslimits, bool ismSUGRA, vector<TH2F*> exp1mlimits, vector<TH2F*> exp1plimits, vector<TH2F*> exp2mlimits, vector<TH2F*> exp2plimits, vector<TH2F*> &allbestexplimits) {
502 > TH2F *make_best_limits(vector<TH2F*> explimits,vector<TH2F*> obslimits, int scantype, vector<TH2F*> exp1mlimits, vector<TH2F*> exp1plimits, vector<TH2F*> exp2mlimits, vector<TH2F*> exp2plimits, vector<TH2F*> &allbestexplimits) {
503    if(obslimits.size()==0) {
504      write_warning(__FUNCTION__,"There are no observed limits! Cannot continue!");
505      TH2F *err;
# Line 534 | Line 534 | TH2F *make_best_limits(vector<TH2F*> exp
534          bestlimitsource->SetBinContent(i,j,source);
535          bestlimit->SetBinContent(i,j,omin);
536          bestexplimit->SetBinContent(i,j,min);
537 <        if(ismSUGRA) {
537 >        if(scantype==mSUGRA) {
538            bestexp1plimit->SetBinContent(i,j,exp1plimits[source-1]->GetBinContent(i,j));
539            bestexp1mlimit->SetBinContent(i,j,exp1mlimits[source-1]->GetBinContent(i,j));
540            bestexp2plimit->SetBinContent(i,j,exp2plimits[source-1]->GetBinContent(i,j));
# Line 545 | Line 545 | TH2F *make_best_limits(vector<TH2F*> exp
545    }
546    gStyle->SetPadRightMargin(standardmargin);
547    TCanvas *canlimsource = new TCanvas("limsource","Source of best limits");
548 <  set_range(bestlimitsource,ismSUGRA,false);
548 >  set_range(bestlimitsource,scantype,false);
549    bestlimitsource->SetTitle("Source of limit for best limits");
550    bestlimitsource->GetZaxis()->SetRangeUser(0,explimits.size()+1);
551    bestlimitsource->Draw("COL");
552 <  if(!ismSUGRA) bestlimitsource->Draw("TEXT,same");
552 >  if(scantype!=mSUGRA) bestlimitsource->Draw("TEXT,same");
553    TLegend *sourceleg = new TLegend(0.15,0.6,0.55,0.85);
554    for(int i=0;i<explimits.size();i++) {
555      stringstream legendentry;
# Line 578 | Line 578 | TH2F *make_best_limits(vector<TH2F*> exp
578   }
579  
580  
581 < void create_exclusion_plots(vector<TH2F*> limits, bool ismSUGRA) {
581 > void create_exclusion_plots(vector<TH2F*> limits, int scantype) {
582    TFile *xsecfile;
583 <  if(!ismSUGRA) {
583 >  if(scantype!=mSUGRA) {
584      xsecfile = new TFile(xsecfilename.c_str());
585 <    if(xsecfile->IsZombie()&&!ismSUGRA) {
585 >    if(xsecfile->IsZombie()&&(scantype!=mSUGRA)) {
586        write_error(__FUNCTION__,"Cross section file is invalid!!!!");
587        return;
588      }
589      xsecfile->Close();
590    }
591 <  if(!ismSUGRA) for(int i=0;i<limits.size();i++) limits[i]->Scale(1./0.19); // because for T5zz we forced one z to decay leptonically
591 >  if(scantype!=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
592      
593    vector<TH2F*> explimits;
594    vector<TH2F*> exp1mlimits;
# Line 602 | Line 602 | void create_exclusion_plots(vector<TH2F*
602   cout << __LINE__ << endl;
603    for(int ilim=0;ilim<limits.size();ilim++) {
604      if(TString(limits[ilim]->GetName()).Contains("_explimitmap")) explimits.push_back(limits[ilim]);
605 <    if(ismSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1plimitmap")) exp1plimits.push_back(limits[ilim]);
606 <    if(ismSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1mlimitmap")) exp1mlimits.push_back(limits[ilim]);
607 <    if(ismSUGRA && TString(limits[ilim]->GetName()).Contains("_exp2plimitmap")) exp2plimits.push_back(limits[ilim]);
608 <    if(ismSUGRA && TString(limits[ilim]->GetName()).Contains("_exp2mlimitmap")) exp2mlimits.push_back(limits[ilim]);
609 <    if(ismSUGRA && TString(limits[ilim]->GetName()).Contains("_absolutecrosssectionmap")) crosssections.push_back(limits[ilim]);
605 >    if(scantype==mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1plimitmap")) exp1plimits.push_back(limits[ilim]);
606 >    if(scantype==mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp1mlimitmap")) exp1mlimits.push_back(limits[ilim]);
607 >    if(scantype==mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp2plimitmap")) exp2plimits.push_back(limits[ilim]);
608 >    if(scantype==mSUGRA && TString(limits[ilim]->GetName()).Contains("_exp2mlimitmap")) exp2mlimits.push_back(limits[ilim]);
609 >    if(scantype==mSUGRA && TString(limits[ilim]->GetName()).Contains("_absolutecrosssectionmap")) crosssections.push_back(limits[ilim]);
610      if(TString(limits[ilim]->GetName()).Contains("_limitmap")) obslimits.push_back(limits[ilim]);
611   //    if(TString(limits[ilim]->GetName()).Contains("_limitflipmap")) flipmaps.push_back(limits[ilim]);
612    }
613      
614    TH2F *xsec;
615 <  if(!ismSUGRA) xsec = adjust_histo(get_XS(xsecfilename,"gluino",limits[0]),limits[0]);
615 >  if(scantype!=mSUGRA) xsec = adjust_histo(get_XS(xsecfilename,"gluino",limits[0]),limits[0]);
616    vector<TH2F*> bestexplimits;
617 <  TH2F *bestlimits = make_best_limits(explimits,obslimits,ismSUGRA, exp1mlimits, exp1plimits, exp2mlimits, exp2plimits, bestexplimits);
617 >  TH2F *bestlimits = make_best_limits(explimits,obslimits,scantype, exp1mlimits, exp1plimits, exp2mlimits, exp2plimits, bestexplimits);
618    bestlimits->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
619    
620    for(int ilim=0;ilim<limits.size();ilim++) {
621      limits[ilim]->GetZaxis()->SetRangeUser(limits_lower_bound,limits_upper_bound);
622    }
623    
624 <  if(!ismSUGRA) {
625 <    for(int ilim=0;ilim<obslimits.size();ilim++) make_SMS_exclusion(obslimits[ilim],xsec,ismSUGRA);
626 <    make_SMS_exclusion(bestlimits,xsec,ismSUGRA);
624 >  if(scantype!=mSUGRA) {
625 >    for(int ilim=0;ilim<obslimits.size();ilim++) make_SMS_exclusion(obslimits[ilim],xsec,scantype);
626 >    make_SMS_exclusion(bestlimits,xsec,scantype);
627    } else {
628      for(int ilim=0;ilim<obslimits.size();ilim++) {
629        draw_mSUGRA_exclusion(crosssections[0], obslimits[ilim], explimits[ilim], exp1mlimits[ilim], exp1plimits[ilim], exp2mlimits[ilim], exp2plimits[ilim]);
# Line 803 | Line 803 | void smooth_line(TGraph *gr) {
803    smooth_line_once(gr);
804    smooth_line_once(gr);
805   }
806 < void set_range(TH2F *histo, bool ismSUGRA, bool pushoutyz=false) {
807 <  if(ismSUGRA) {
806 > void set_range(TH2F *histo, int scantype, bool pushoutyz=false) {
807 >  if(scantype==mSUGRA) {
808      histo->GetXaxis()->SetRangeUser(0,2000);
809      histo->GetYaxis()->SetRangeUser(0,800);
810      histo->GetXaxis()->SetTitle("m_{0} [GeV]");
811      histo->GetYaxis()->SetTitle("m_{1/2} [GeV]");
812      histo->GetXaxis()->SetRangeUser(0,2000);
813      histo->GetXaxis()->SetNdivisions(504,true);
814 <  } else {
814 >  if(scantype==SMS) {
815      histo->GetXaxis()->SetRangeUser(50,1200);
816      histo->GetYaxis()->SetRangeUser(50,1200);
817      histo->GetXaxis()->SetTitle("m_{#tilde{g}} [GeV]");
# Line 821 | Line 821 | void set_range(TH2F *histo, bool ismSUGR
821      histo->GetZaxis()->SetTitleSize(0.04);
822      histo->GetXaxis()->SetTitleOffset(1.2);
823      histo->GetYaxis()->SetTitleOffset(1.5);
824 //    if(pushoutyz) histo->GetYaxis()->SetTitleOffset(1.6);
824      if(pushoutyz) histo->GetZaxis()->SetTitleOffset(1.6);
826 //  histo->GetYaxis()->SetTitleOffset(1.2);
827 //  histo->GetZaxis()->SetTitleOffset(1.35);
828
829
825    }
826 +  if(scantype==GMSB) {
827 +    histo->GetXaxis()->SetRangeUser(50,1200);
828 +    histo->GetYaxis()->SetRangeUser(50,1200);
829 +    histo->GetXaxis()->SetTitle("m_{#tilde{g}} [GeV]");
830 +    histo->GetYaxis()->SetTitle("m_{Chi} [GeV]");
831 +    histo->GetXaxis()->SetTitleSize(0.04);
832 +    histo->GetYaxis()->SetTitleSize(0.04);
833 +    histo->GetZaxis()->SetTitleSize(0.04);
834 +    histo->GetXaxis()->SetTitleOffset(1.2);
835 +    histo->GetYaxis()->SetTitleOffset(1.5);
836 +    if(pushoutyz) histo->GetZaxis()->SetTitleOffset(1.6);
837 +  }
838 +
839    histo->GetXaxis()->CenterTitle();
840    histo->GetYaxis()->CenterTitle();
841    histo->SetStats(0);
# Line 847 | Line 855 | TH2F* adjust_histo(TH2F *oldhist, TH2F *
855    return histo;
856   }
857  
858 < void process_syst_plot(TH2F *rhisto,string saveto,bool ismSUGRA) {
859 <  TH2F *histo = prep_histo(rhisto,ismSUGRA); // this is to be independent of the style used at creation time
858 > void process_syst_plot(TH2F *rhisto,string saveto,int scantype) {
859 >  TH2F *histo = prep_histo(rhisto,scantype); // this is to be independent of the style used at creation time
860    float rightmargin=gStyle->GetPadRightMargin();
861    gStyle->SetPadRightMargin(0.20);
862    TString name = rhisto->GetName();
863    if(name.Contains("Nevents")) gStyle->SetPadRightMargin(0.22);
864    TCanvas *can = new TCanvas("syst_plot","Systematics Plot");
865 <  set_range(histo,ismSUGRA,true);
865 >  set_range(histo,scantype,true);
866    
867    
868    if(name.Contains("efficiency")) {
# Line 900 | Line 908 | void process_syst_plot(TH2F *rhisto,stri
908    delete can;
909   }
910  
911 < void make_all_syst_plots(vector<TH2F*> all_histos,bool ismSUGRA) {
911 > void make_all_syst_plots(vector<TH2F*> all_histos,int scantype) {
912    string saveto="Systematics/";
913    for(int iplot=0;iplot<all_histos.size();iplot++) {
914 <      process_syst_plot(all_histos[iplot],saveto,ismSUGRA);
914 >      process_syst_plot(all_histos[iplot],saveto,scantype);
915    }
916   }
917  
# Line 915 | Line 923 | void process_file(TFile* file, float std
923    TIter nextkey(file->GetListOfKeys());
924    TKey *key;
925    
926 <  bool ismSUGRA=false;
926 >  int scantype=SMS;
927    
928    vector<TH2F*> systematics_histos;
929    vector<TH2F*> limits_histos;
# Line 957 | Line 965 | void process_file(TFile* file, float std
965  
966        if(is_limit) limits_histos.push_back((TH2F*) obj);
967        else if(is_systematic) systematics_histos.push_back((TH2F*) obj);
968 <      if(name.Contains("mSUGRA")) ismSUGRA=true;
968 >      if(name.Contains("mSUGRA")) scantype=mSUGRA;
969 >      if(name.Contains("GMSB")) scantype=GMSB;
970      }
971 <  if(systematics_histos.size()>0) make_all_syst_plots(systematics_histos,ismSUGRA);
972 <  if(limits_histos.size()>0) create_exclusion_plots(limits_histos,ismSUGRA);
971 >  if(systematics_histos.size()>0) make_all_syst_plots(systematics_histos,scantype);
972 >  if(limits_histos.size()>0) create_exclusion_plots(limits_histos,scantype);
973   }
974  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines