ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/various_studies.C
Revision: 1.8
Committed: Wed Jul 20 14:34:53 2011 UTC (13 years, 9 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Changes since 1.7: +15 -0 lines
Log Message:
Moved functions that were for temporary studies out of the main workflow

File Contents

# User Rev Content
1 buchmann 1.1 /*
2    
3     to compile: just run make ... that should take care of it.
4    
5     */
6     #include <iostream>
7     #include <vector>
8     #include <sys/stat.h>
9     #include "Modules/GeneralToolBox.C"
10     #include "Modules/SampleClass.C"
11     #include "Modules/PeakFinder.C"
12     #include "Modules/Poisson_Calculator.C"
13     #include "Modules/setTDRStyle.C"
14     #include "Modules/ActiveSamples.C"
15     #include "Modules/UpperLimitsWithShape.C"
16     #include "Modules/Setup.C"
17 buchmann 1.8 #include "Modules/external/cl95cms.c"
18 buchmann 1.1 #include "Modules/Plotting_Functions.C" //also included for peak finding etc.
19     #include "Modules/StudyModule.C" //also included for peak finding etc.
20 buchmann 1.8 #include "Modules/ExperimentalModule.C"
21     #include "Modules/ResultModule.C"
22     #include "Modules/LimitCalculation.C"
23 buchmann 1.1
24     #include <TCut.h>
25     #include <TROOT.h>
26     #include <TCanvas.h>
27     #include <TMath.h>
28     #include <TColor.h>
29     #include <TPaveText.h>
30     #include <TRandom.h>
31     #include <TH1.h>
32     #include <TH2.h>
33     #include <TF1.h>
34     #include <TSQLResult.h>
35    
36     #ifndef Verbosity
37     #define Verbosity 0
38     #endif
39     #ifndef HUSH
40     #define HUSH 1
41     #endif
42    
43     using namespace std;
44    
45     using namespace PlottingSetup;
46    
47     int main()
48     {
49     gROOT->SetStyle("Plain");
50     setTDRStyle();
51     gStyle->SetTextFont(42);
52     bool showList=false;
53     set_treename("events");//you can set the treename here to be used; options are "events" (for reco) for "PFevents" (for particle flow)
54 buchmann 1.4 define_samples(showList,allsamples,signalsamples);
55 buchmann 1.1 setlumi(luminosity);
56     do_png(true);
57     do_pdf(false);
58     do_eps(false);
59     do_C(false);
60 buchmann 1.3 set_directory("summer_mc");//here you can give it a name, for instance "1234pb" or whatever you like :-)
61 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!
62     stringstream resultsummary;
63    
64     //what to do :
65     bool do_all=false;/// DONE
66     bool do_peak_finding=false; /// DONE
67     bool calculate_pred_and_observed=false; /// DONE
68 buchmann 1.5 bool study_sidebands=false; /// FOR REAL
69 buchmann 1.1 bool do_test=false;/// DONE (just any test you wish)
70     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
71 buchmann 1.3 bool do_find_sideband_definition=false;
72 buchmann 1.5 bool do_pick_up_events=true; ///DONE
73 buchmann 1.8 bool do_ttbar_with_shapes=false;
74     bool do_upper_limits=false;
75 buchmann 1.1
76     //**** part 1 : peak finding
77     float MCPeak=0,MCPeakError=0,DataPeak=0,DataPeakError=0,MCSigma=10,DataSigma=10;
78     method=Kostasmethod;//Kostasmethod;//dogaus3sigma;// options: dogaus,doKM,dogaus2sigma,dogaus3sigma
79     if(do_peak_finding||calculate_pred_and_observed||do_all) find_peaks(MCPeak,MCPeakError, DataPeak, DataPeakError,MCSigma,DataSigma,resultsummary);
80    
81     stringstream datajzb;
82     if(DataPeak>0) datajzb<<"("<<jzbvariabledata<<"-"<<TMath::Abs(DataPeak)<<")";
83     else datajzb<<"("<<jzbvariabledata<<"+"<<TMath::Abs(DataPeak)<<")";
84     stringstream mcjzb;
85     if(MCPeak>0) mcjzb<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeak)<<")";
86     else mcjzb<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeak)<<")";
87    
88 buchmann 1.6 dout << "With peak correction, we get : " << endl;
89     dout << " Data : " << datajzb.str() << endl;
90     dout << " MC : " << datajzb.str() << endl;
91 buchmann 1.1
92 buchmann 1.3 if(do_find_sideband_definition) find_sideband_definition();
93    
94     if(do_jzb_correction) {
95     find_correction_factors(jzbvariabledata,jzbvariablemc);
96 buchmann 1.6 dout << "Please update Modules/Setup.C to reflect the following values (round them first ... )" <<endl;
97     dout << "Corrected JZB variable definition " << endl << " Data: " << jzbvariabledata << " and MC: " << jzbvariablemc << endl;
98     dout << endl;
99     dout << "If you're feeling lazy, copy & paste this : " << endl;
100     dout << " string jzbvariabledata=\""<<jzbvariabledata<<"\";"<<endl;
101     dout << " string jzbvariablemc=\"" <<jzbvariablemc<<"\";"<<endl;
102 buchmann 1.3 }
103 buchmann 1.1
104     if(study_sidebands) look_at_sidebands(mcjzb.str(),datajzb.str());
105    
106 buchmann 1.8 vector<float>jzb_limit_bins;
107     jzb_limit_bins.push_back(50);jzb_limit_bins.push_back(75);jzb_limit_bins.push_back(100);
108     jzb_limit_bins.push_back(150);jzb_limit_bins.push_back(200);jzb_limit_bins.push_back(500);
109    
110    
111     if(do_ttbar_with_shapes) prepare_ttbar_limits(mcjzb.str(),datajzb.str(),DataPeakError,MCPeakError,jzb_limit_bins);
112    
113     if(do_upper_limits) calculate_upper_limits(mcjzb.str(),datajzb.str());
114    
115 buchmann 1.5 if(do_pick_up_events) {
116    
117 buchmann 1.6 dout << "Observed: " << endl;
118 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
119 buchmann 1.6 dout << "Predicted (JZB<-100) OSSF" << endl;
120 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
121 buchmann 1.6 dout << "Predicted (emu, JZB>100) OSOF" << endl;
122 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
123 buchmann 1.6 dout << "Predicted (emu, JZB<-100) OSOF" << endl;
124 buchmann 1.5 pick_up_events((const char*)(cutmass&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
125 buchmann 1.6 dout << "Predicted (SB emu, JZB>100) OSOF" << endl;
126 buchmann 1.5 pick_up_events((const char*)(sidebandcut&&cutOSOF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
127 buchmann 1.6 dout << "Predicted (SB emu, JZB<-100) OSOF" << endl;
128 buchmann 1.5 pick_up_events((const char*)(cutOSOF&&cutnJets&&basiccut&&sidebandcut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
129 buchmann 1.6 dout << "Predicted (SB SF, JZB>100) OSSF" << endl;
130 buchmann 1.5 pick_up_events((const char*)(sidebandcut&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)>100)"));
131 buchmann 1.6 dout << "Predicted (SB SF, JZB<-100) OSSF" << endl;
132 buchmann 1.5 pick_up_events((const char*)(sidebandcut&&cutOSSF&&cutnJets&&basiccut&&"((jzb[1]+0.06*pt-2.84727)<-100)"));
133     }
134    
135 buchmann 1.1 if(do_test) test();
136    
137    
138    
139     return 0;
140     }
141    
142