ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/various_assignments/SimPa/AdditionalTools/MassHierarchyT5zz.C
Revision: 1.2
Committed: Tue Apr 10 15:40:36 2012 UTC (13 years ago) by pablom
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +9 -0 lines
Error occurred while calculating annotation data.
Log Message:
Updated style in 2D plots

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 "../../../Plotting/Modules//GeneralToolBox.C"
8 #include "../../../Plotting/Modules//SampleClass.C"
9 #include "../../../Plotting/Modules//setTDRStyle.C"
10 //#include "../../../Plotting/Modules//Setup.C"
11 //#include "../../../Plotting/Modules//Poisson_Calculator.C"
12 //#include "../../../Plotting/Modules//ActiveSamples.C"
13 //#include "../../../Plotting/Modules//PeakFinder.C"
14 //#include "../../../Plotting/Modules//UpperLimitsWithShape.C"
15 //#include "../../../Plotting/Modules//Plotting_Functions.C"
16 //#include "../../../Plotting/Modules//LimitCalculation.C"
17 //#include "../../../Plotting/Modules//ResultModule.C"
18 //#include "../../../Plotting/Modules//CrossSectionReader.C"
19 //#include "../../../Plotting/Modules//Systematics.C"
20 //#include "../../../Plotting/Modules//SUSYScan.C"
21 #include <TCut.h>
22 #include <TROOT.h>
23 #include <TCanvas.h>
24 #include <TMath.h>
25 #include <TColor.h>
26 #include <TPaveText.h>
27 #include <TRandom.h>
28 #include <TH1.h>
29 #include <TH2.h>
30 #include <TF1.h>
31 #include <TSQLResult.h>
32
33 using namespace std;
34
35 void runEfficiency(string, string);
36 void plots_for_config(string);
37
38
39 int main(int argc, char *argv[]) {
40
41 if(argc != 3 && argc != 2) {
42 cout << "Usage: ./MassHierarchy.exec inputFile.root" << endl;
43 cout << "Usage: ./MassHierarchy.exec inputFile.root outputFile.root" << endl;
44 return -1;
45 }
46
47 if(argc == 3) {
48 string inputFile(argv[1]);
49 string outputFile(argv[2]);
50 runEfficiency(inputFile, outputFile);
51 } else {
52 string inputFile(argv[1]);
53 do_png(1);
54 do_pdf(1);
55 char currentpath[1024];
56 char *path = getcwd(currentpath, 1024);
57 PlottingSetup::basedirectory=string(currentpath)+"/";
58 plots_for_config(inputFile);
59 }
60
61 return 0;
62
63 }
64
65
66 void plots_for_config(string inputFile) {
67
68 gROOT->SetStyle("Plain");
69 bool do_fat_line=false; // if you want to have HistLineWidth=1 and FuncWidth=1 as it was before instead of 2
70 setTDRStyle(do_fat_line);
71 gStyle->SetTextFont(42);
72
73 TFile *_file = TFile::Open(inputFile.c_str());
74
75 for(int cut = 50; cut < 260; cut += 50) {
76 char name[50];
77 sprintf(name, "eff_%d", cut);
78 string name_(name);
79 TH2F *histo = (TH2F *) _file->Get(name);
80 if(histo == NULL) continue;
81 TCanvas *m1 = new TCanvas("m1");
82 m1->SetRightMargin(0.17);
83 m1->cd();
84 histo->GetXaxis()->SetTitle("m_{glu}-m_{LSP} [GeV]");
85 histo->GetYaxis()->SetTitle("m_{#Chi^{0}_{2}}-m_{LSP}/m_{glu}-m_{LSP}");
86 histo->GetZaxis()->SetTitle("A #times #varepsilon (#geq 1 Z(ll))");
87 histo->GetYaxis()->SetTitleOffset(1.4);
88 histo->GetZaxis()->SetTitleOffset(1.5);
89 histo->GetXaxis()->CenterTitle();
90 histo->GetYaxis()->CenterTitle();
91 histo->GetZaxis()->CenterTitle();
92 histo->Draw("COLZ");
93 CompleteSave(m1, "Plots/" + name_);
94 delete m1;
95 }
96
97 }
98
99
100 void runEfficiency(string inputFile, string outputFile) {
101
102 //INPUT: File with events
103 TFile f(inputFile.c_str());
104 TTree *s = (TTree *) f.Get("events");
105
106 //OUTPUT: File with histos
107 TFile f2(outputFile.c_str(), "RECREATE");
108 f2.cd();
109
110 float massLSP = 200;
111 for(int cut = 50; cut < 260; cut += 50) {
112 char nameHisto[100], theJZBCutP[100], theJZBCutN[100];
113 int cut_ = (int)cut;
114 sprintf(nameHisto, "eff_%d", cut_);
115 sprintf(theJZBCutP, "jzb > %d", cut_);
116 sprintf(theJZBCutN, "jzb < -%d", cut_);
117 TCut JZBP(theJZBCutP);
118 TCut JZBN(theJZBCutN);
119 TH2F *eff = new TH2F(nameHisto, "", 40, 0, 1000, 20, 0, 1);
120 eff->GetXaxis()->SetTitle("m_{Glu}-m_{LSP} [GeV]");
121 eff->GetYaxis()->SetTitle("(m_{#chi}-m_{LSP})/(m_{Glu}-m_{LSP})");
122 for(float massGlu = 1200; massGlu > massLSP + 100; massGlu -= 25.0) {
123 for(float x = 0.1; x < 0.99; x += 0.05) {
124 float massChi = massLSP+x*(massGlu-massLSP);
125 if(massChi < massLSP + 100.0 || massGlu < massChi + 2) continue;
126 char theCut_[250];
127 sprintf(theCut_, "abs(massGlu-%f) < 1 && abs(massChi-%f) < 1 && abs(massLSP-%f) < 1", massGlu, massChi, massLSP);
128 TCut theCut(theCut_);
129 float npos = s->Draw("jzb", JZBP+theCut, "OF");
130 float nneg = s->Draw("jzb", JZBN+theCut, "OF");
131 float efficiency = (npos-nneg)/20000.0;
132 cout << "Delta M: " << massGlu-massLSP << " x: " << x << " Efficiency: " << efficiency << endl;
133 if(efficiency < 0) {
134 cout << "Lower than 0" << endl;
135 }
136 eff->SetBinContent(eff->FindBin(massGlu-massLSP, x), efficiency);
137 }
138 }
139 }
140
141 f2.Write();
142 f2.Close();
143 f.Close();
144
145 return;
146
147 }