ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/various_studies.C
Revision: 1.25
Committed: Wed Sep 7 13:30:58 2011 UTC (13 years, 8 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Changes since 1.24: +1 -1 lines
Log Message:
Making Systematics.C compile on Macs as well

File Contents

# User Rev Content
1 buchmann 1.24 /*
2    
3     to compile: just run make ... that should take care of it.
4    
5     */
6 buchmann 1.1 #include <iostream>
7     #include <vector>
8     #include <sys/stat.h>
9     #include "Modules/GeneralToolBox.C"
10     #include "Modules/SampleClass.C"
11 buchmann 1.21 #include "Modules/Setup.C"
12 buchmann 1.1 #include "Modules/PeakFinder.C"
13     #include "Modules/Poisson_Calculator.C"
14     #include "Modules/setTDRStyle.C"
15     #include "Modules/ActiveSamples.C"
16     #include "Modules/UpperLimitsWithShape.C"
17 buchmann 1.23 //#include "Modules/external/roostats_cl95.C"
18 buchmann 1.25 //#include "Modules/external/cl95cms.c"
19 buchmann 1.1 #include "Modules/Plotting_Functions.C" //also included for peak finding etc.
20 buchmann 1.20 #include "Modules/ResultModule.C"
21     #include "Modules/ExperimentalModule.C"
22 buchmann 1.1 #include "Modules/StudyModule.C" //also included for peak finding etc.
23 buchmann 1.8 #include "Modules/LimitCalculation.C"
24 buchmann 1.9 #include "Modules/Systematics.C"
25     #include "Modules/SUSYScan.C"
26 buchmann 1.1
27     #include <TCut.h>
28     #include <TROOT.h>
29     #include <TCanvas.h>
30     #include <TMath.h>
31     #include <TColor.h>
32     #include <TPaveText.h>
33     #include <TRandom.h>
34     #include <TH1.h>
35     #include <TH2.h>
36     #include <TF1.h>
37     #include <TSQLResult.h>
38    
39     #ifndef Verbosity
40     #define Verbosity 0
41     #endif
42     #ifndef HUSH
43     #define HUSH 1
44     #endif
45    
46     using namespace std;
47    
48     using namespace PlottingSetup;
49    
50     int main()
51     {
52     gROOT->SetStyle("Plain");
53 buchmann 1.18 bool do_fat_line=false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2
54     setTDRStyle(do_fat_line);
55 buchmann 1.1 gStyle->SetTextFont(42);
56     bool showList=false;
57     set_treename("events");//you can set the treename here to be used; options are "events" (for reco) for "PFevents" (for particle flow)
58 buchmann 1.9 define_samples(showList,allsamples,signalsamples,scansample);
59 buchmann 1.1 setlumi(luminosity);
60     do_png(true);
61 buchmann 1.22 do_pdf(false);
62 buchmann 1.15 do_eps(false);
63     do_C(false);
64 buchmann 1.21 set_directory(directoryname);//Indicate the directory name where you'd like to save the output files in Setup.C
65 buchmann 1.1 setessentialcut(essential);//this sets the essential cut; this one is used in the draw command so it is AUTOMATICALLY applied everywhere. IMPORTANT: Do NOT store weights here!
66     stringstream resultsummary;
67    
68     //what to do :
69     bool do_all=false;/// DONE
70 buchmann 1.20 bool do_peak_finding=true; /// DONE
71 buchmann 1.1 bool calculate_pred_and_observed=false; /// DONE
72 buchmann 1.5 bool study_sidebands=false; /// FOR REAL
73 buchmann 1.1 bool do_test=false;/// DONE (just any test you wish)
74     bool do_jzb_correction=false; //use this to find out the correction factor; originally this was done automatically but now you should do this separately and update Modules/Setup.C
75 buchmann 1.14 bool do_find_sideband_definition=false;
76 buchmann 1.9 bool do_pick_up_events=false; ///DONE
77 buchmann 1.8 bool do_ttbar_with_shapes=false;
78     bool do_upper_limits=false;
79 buchmann 1.14 bool do_run_check=false;
80 buchmann 1.19 bool do_kinematic_dist_of_pred_and_obs=false;//former do_plot_list
81 buchmann 1.14
82 buchmann 1.20 bool do_show_dibosons=false;
83 buchmann 1.1
84 buchmann 1.21 bool overlay_signal=false;
85    
86 buchmann 1.12 bool do_efficiency_scan_in_susy_space=false; /// NOW OUTSOURCED TO T3
87 buchmann 1.9 bool requireZ=true;
88 buchmann 1.12
89 buchmann 1.21 bool do_beautiful_ratio_plots=false;
90 buchmann 1.20
91 buchmann 1.1 //**** part 1 : peak finding
92     float MCPeak=0,MCPeakError=0,DataPeak=0,DataPeakError=0,MCSigma=10,DataSigma=10;
93     method=Kostasmethod;//Kostasmethod;//dogaus3sigma;// options: dogaus,doKM,dogaus2sigma,dogaus3sigma
94 buchmann 1.14 if(do_peak_finding||do_show_dibosons||calculate_pred_and_observed||do_all) find_peaks(MCPeak,MCPeakError, DataPeak, DataPeakError,MCSigma,DataSigma,resultsummary);
95 buchmann 1.1
96     stringstream datajzb;
97     if(DataPeak>0) datajzb<<"("<<jzbvariabledata<<"-"<<TMath::Abs(DataPeak)<<")";
98     else datajzb<<"("<<jzbvariabledata<<"+"<<TMath::Abs(DataPeak)<<")";
99     stringstream mcjzb;
100     if(MCPeak>0) mcjzb<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeak)<<")";
101     else mcjzb<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeak)<<")";
102    
103 buchmann 1.6 dout << "With peak correction, we get : " << endl;
104     dout << " Data : " << datajzb.str() << endl;
105 fronga 1.16 dout << " MC : " << mcjzb.str() << endl;
106 buchmann 1.1
107 buchmann 1.3 if(do_find_sideband_definition) find_sideband_definition();
108    
109     if(do_jzb_correction) {
110     find_correction_factors(jzbvariabledata,jzbvariablemc);
111 buchmann 1.6 dout << "Please update Modules/Setup.C to reflect the following values (round them first ... )" <<endl;
112     dout << "Corrected JZB variable definition " << endl << " Data: " << jzbvariabledata << " and MC: " << jzbvariablemc << endl;
113     dout << endl;
114     dout << "If you're feeling lazy, copy & paste this : " << endl;
115     dout << " string jzbvariabledata=\""<<jzbvariabledata<<"\";"<<endl;
116     dout << " string jzbvariablemc=\"" <<jzbvariablemc<<"\";"<<endl;
117 buchmann 1.3 }
118 buchmann 1.1
119     if(study_sidebands) look_at_sidebands(mcjzb.str(),datajzb.str());
120    
121 buchmann 1.8 vector<float>jzb_limit_bins;
122 buchmann 1.10 jzb_limit_bins.push_back(50);
123     //jzb_limit_bins.push_back(75);jzb_limit_bins.push_back(100);
124     //jzb_limit_bins.push_back(150);jzb_limit_bins.push_back(200);jzb_limit_bins.push_back(500);
125 buchmann 1.8
126    
127     if(do_ttbar_with_shapes) prepare_ttbar_limits(mcjzb.str(),datajzb.str(),DataPeakError,MCPeakError,jzb_limit_bins);
128    
129     if(do_upper_limits) calculate_upper_limits(mcjzb.str(),datajzb.str());
130    
131 buchmann 1.5 if(do_pick_up_events) {
132    
133 buchmann 1.6 dout << "Observed: " << endl;
134 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
135 buchmann 1.6 dout << "Predicted (JZB<-100) OSSF" << endl;
136 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
137 buchmann 1.6 dout << "Predicted (emu, JZB>100) OSOF" << endl;
138 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
139 buchmann 1.6 dout << "Predicted (emu, JZB<-100) OSOF" << endl;
140 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
141 buchmann 1.6 dout << "Predicted (SB emu, JZB>100) OSOF" << endl;
142 buchmann 1.5 pick_up_events((const char*)(sidebandcut&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
143 buchmann 1.6 dout << "Predicted (SB emu, JZB<-100) OSOF" << endl;
144 buchmann 1.5 pick_up_events((const char*)(cutOSOF&&cutnJets&&basiccut&&sidebandcut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
145 buchmann 1.6 dout << "Predicted (SB SF, JZB>100) OSSF" << endl;
146 buchmann 1.5 pick_up_events((const char*)(sidebandcut&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
147 buchmann 1.6 dout << "Predicted (SB SF, JZB<-100) OSSF" << endl;
148 buchmann 1.5 pick_up_events((const char*)(sidebandcut&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
149     }
150    
151 buchmann 1.14 if(do_run_check) run_check();
152     if(do_show_dibosons) show_dibosons(datajzb.str(),mcjzb.str());
153    
154 buchmann 1.17 if(do_kinematic_dist_of_pred_and_obs) kinematic_dist_of_pred_and_obs();
155 buchmann 1.15
156 buchmann 1.1 if(do_test) test();
157    
158 buchmann 1.20 vector<float> ratio_binning;
159     ratio_binning.push_back(0);
160     ratio_binning.push_back(5);
161     ratio_binning.push_back(10);
162     ratio_binning.push_back(20);
163     ratio_binning.push_back(50);
164     ratio_binning.push_back(100);
165     ratio_binning.push_back(200);
166     ratio_binning.push_back(350);
167 buchmann 1.22 //ratio_binning.push_back(500);
168 buchmann 1.20 if(do_beautiful_ratio_plots) Poisson_ratio_plots(mcjzb.str(),datajzb.str(),ratio_binning,MCPeakError,DataPeakError);
169    
170 buchmann 1.22 write_warning(__FUNCTION__,"Need to remove the next line:");
171     // do_new_prediction_plots(mcjzb.str(),datajzb.str(),DataSigma,MCSigma,overlay_signal);
172 buchmann 1.21
173 buchmann 1.22 // ttbar_sidebands_comparison(mcjzb.str());
174    
175     lm0_illustration();
176 buchmann 1.1 return 0;
177     }
178    
179