ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/ZbAnalysis.C
Revision: 1.14
Committed: Mon Mar 18 16:05:23 2013 UTC (12 years, 1 month ago) by buchmann
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +1 -1 lines
Log Message:
Replaced cout's by dout's (i.e. writing a lot more information to the log file); Changed the way the fit error band is computed (PandiTools); added possibility to define global lower and upper range boundaries; improved printing of results; improved roofit plots (so they're similar to the standard ones); added a lot more bins for roofit so the fit has more information

File Contents

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