ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/ZbAnalysis.C
Revision: 1.5
Committed: Mon Nov 5 15:25:01 2012 UTC (12 years, 6 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Changes since 1.4: +10 -2 lines
Log Message:
Updated Zb analysis wrapper

File Contents

# Content
1 #include <iostream>
2 #include <vector>
3 #include <sys/stat.h>
4 #include <getopt.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include "Modules/GeneralToolBox.C"
8 #include "Modules/SampleClass.C"
9 #include "Modules/setTDRStyle.C"
10 #include "Modules/Setup.C"
11 //#include "Modules/Poisson_Calculator.C"
12 #include "Modules/ActiveSamples.C"
13 //#include "Modules/PeakFinder.C"
14 //#include "Modules/UpperLimitsWithShape.C"
15 //#include "Modules/Plotting_Functions.C"
16 //#include "Modules/LimitCalculation.C"
17 //#include "Modules/ResultModule.C"
18 //#include "Modules/CrossSectionReader.C"
19 //#include "Modules/Systematics.C"
20 //#include "Modules/SugarCoating.C"
21 //#include "Modules/ExclusionPlot.C"
22 //#include "Modules/SUSYScan.C"
23
24 #include "Modules/ValueClass.C"
25 #include "Modules/ZbTools.C"
26
27
28 #include <TCut.h>
29 #include <TROOT.h>
30 #include <TCanvas.h>
31 #include <TMath.h>
32 #include <TColor.h>
33 #include <TPaveText.h>
34 #include <TRandom.h>
35 #include <TH1.h>
36 #include <TH2.h>
37 #include <TF1.h>
38 #include <TSQLResult.h>
39
40 #ifndef Verbosity
41 #define Verbosity 0
42 #endif
43 #ifndef HUSH
44 #define HUSH 1
45 #endif
46
47 using namespace PlottingSetup;
48
49
50 void usage(int passed=0 ) {
51 std::cout << "USAGE : " << std::endl;
52 std::cout << "You can use different options when running this program : " << std::endl;
53 std::cout << std::endl;
54 std::cout << "\033[1;34m all\033[0m \t\t All processes of the standard workflow" << std::endl;
55 std::cout << "\033[1;34m png\033[0m \t\t Save all plots as pngs (also available: --pdf, --root, --eps, --C) standard: png&pdf" << std::endl;
56 std::cout << std::endl;
57 std::cout << "\033[1;34m dir (d)\033[0m\t Directory where all plots will be saved" << std::endl;
58 std::cout << std::endl;
59 std::cout << std::endl;
60 exit(-1);
61 }
62
63
64 int main (int argc, char ** argv)
65 {
66 int do_all=true;
67
68 int savepdf=true;
69 int saveC=true;
70 int saveRoot=true;
71 int savepng=true;
72 int saveeps=false;
73
74 std::string directory="";
75 int option_iterator;
76 int option_counter=0;
77 bool moreoptions=true;
78
79 string jzbcuts_string="";
80
81 while(moreoptions) {
82 static struct option long_options[] =
83 {
84 /* These options set a flag. */
85 {"all", no_argument, &do_all, 1},
86 {"png", no_argument, &savepng,1},
87 {"eps", no_argument, &saveeps,1},
88 {"pdf", no_argument, &savepdf,1},
89 {"root", no_argument, &saveRoot,1},
90 {"C", no_argument, &saveC,1},
91 /* The following options store values.*/
92 {"dir", required_argument, 0, 'd'},
93 {0, 0, 0, 0}
94 };
95 int option_index = 0;
96 option_iterator = getopt_long(argc, argv, "d:",long_options, &option_index);
97 if(option_iterator == -1) moreoptions=false;
98 else {
99 option_counter++;
100 switch (option_iterator)
101 {
102 case 0:
103 if (long_options[option_index].flag != 0)
104 break;
105 printf ("option %s", long_options[option_index].name);
106 if (optarg)
107 printf (" with arg %s", optarg);
108 printf ("\n");
109 break;
110 case 'd':
111 directory=(std::string)optarg;
112 std::cout<<"Option directory was passed with argument " << optarg << std::endl;
113 break;
114 case '?':
115 usage(option_iterator);
116 break;
117 default:
118 usage(option_iterator);
119 }
120 }
121 }
122
123 if(directory!="") PlottingSetup::directoryname=directory;
124 if(option_counter==0) usage();
125
126 PlottingSetup::publicmode=true; // suppressing the whole JZB header
127
128
129 ///----------------------------------- BELOW THIS LINE: NO MORE OPTIONS BUT ACTUAL FUNCTION CALLS! ---------------------------------------------------------
130 gROOT->SetStyle("Plain");
131 bool do_fat_line=false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2
132 setTDRStyle(do_fat_line);
133 gStyle->SetTextFont(42);
134 bool showList=true;
135 set_directory(directoryname);//Indicate the directory name where you'd like to save the output files in Setup.C
136 set_treename("events");//you can set the treename here to be used; options are "events" (for reco) for "PFevents" (for particle flow)
137
138 PlottingSetup::RestrictToMassPeak=true;
139
140 //define_Zb_samples(showList,allsamples,signalsamples,scansample,raresample,systsamples,qcdsamples);
141 write_warning(__FUNCTION__,"Need to adapt sample collection!");
142 write_warning(__FUNCTION__,"Where the hell are the b efficiency corrections?!");
143 define_samples(showList,allsamples,signalsamples,scansample,raresample,systsamples,qcdsamples,comparesamples);
144 setlumi(luminosity);
145 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!
146 stringstream resultsummary;
147
148 do_png(savepng);
149 do_pdf(savepdf);
150 do_eps(saveeps);
151 do_C(saveC);
152 do_root(saveRoot);
153
154
155
156
157
158
159
160 TCut bTagWeight=TCut("((EventFlavor!=5&&EventFlavor!=4)+(EventFlavor==5||EventFlavor==4)*(((Zb30_bTagProbCSVBP[0]>0.15&&Zb30_bTagProbCSVBP[0]<0.95)*(-0.113472343605*Zb30_bTagProbCSVBP[0] + 1.04926963159)) + ((Zb30_bTagProbCSVBP[0]>1.2&&Zb30_bTagProbCSVBP[0]<20.0)*(0.00066342906116*Zb30_bTagProbCSVBP[0] + 0.93334455507)) + (Zb30_bTagProbCSVBP[0]<0.15||Zb30_bTagProbCSVBP[0]>20) + (Zb30_bTagProbCSVBP[0]>0.95&&Zb30_bTagProbCSVBP[0]<1.2)))");
161
162 cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)*((id1==id2&&id1==0)*0.95+(id1==id2&&id1==1)*0.88+(id1!=id2)*0.92)))"*bTagWeight);
163
164 write_warning(__FUNCTION__,"Everything missing so far goes here: ");
165 cout << " Still need to carry out cross - checks" << endl;
166 cout << " Still need to define errors in final plot " << endl;
167 cout << " Still need to make PU cut " << endl;
168
169
170 do_basic_ZB_analysis();
171 return 0;
172 }
173
174
175
176
177