ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/ZbAnalysis.C
Revision: 1.12
Committed: Thu Jan 17 16:25:46 2013 UTC (12 years, 3 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Changes since 1.11: +2 -12 lines
Log Message:
Uploaded version of ZbAnalysis on Pablo's request

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