11 (ea/a)*(ea/a) + (eb/b)*(eb/b)
21 return sqrt(r*(1-r)/b);
29 TH1D *h = h1->Clone(hname);
30 int nbin = h->GetNbinsX();
31 for(
int ibin=1; ibin<=nbin; ++ibin) {
32 double a = h1->GetBinContent(ibin);
33 double b = h2->GetBinContent(ibin);
36 h->SetBinContent(ibin, r);
37 h->SetBinError(ibin, e);
52 float gap_size[] = { 1, 2, 5, 10};
53 float gap_size_error[] = {0, 0, 0, 0, 0, 0, 0, 0};
58 float mean[] = {0, 0, 0, 0, 0, 0, 0, 0};
59 float mean_error[] = {0, 0, 0, 0, 0, 0, 0, 0};
61 float mean_error0 = 0;
62 for (
int i=0; i<nfiles; ++i) {
63 TFile *f = TFile::Open(inputs[i],
"read");
64 TH1D *h =
new TH1D(
"h",
"h",3,0,3);
66 T->Project(
"h",
"Sum$(ntruhits>0)>=2");
67 mean[i] = h->GetMean();
68 mean_error[i] = h->GetMeanError();
71 mean_error0 = mean_error[i];
73 mean[i] = mean[i]/mean0;
74 mean_error[i] = mean_error[i]/mean0;
77 TCanvas *drawRelAcc_c0 =
new TCanvas(
"drawRelAcc_c0",
"drawRelAcc_c0");
78 drawRelAcc_c0->SetGrid();
80 TGraphErrors* gr =
new TGraphErrors(nfiles, gap_size, mean, gap_size_error, mean_error);
81 gr->SetTitle(
";H1 gap size (cm); Drell-Yan Acc.");
82 gr->SetMarkerStyle(20);
84 gr->GetXaxis()->SetRangeUser(-5,11);
86 float data_mean[] = {1, 0.982, 0.954, 0.917};
87 float data_gap[] = {1, 2, 4, 6};
88 TGraph* data_gr =
new TGraph(4, data_gap, data_mean);
89 data_gr->SetMarkerStyle(4);
90 data_gr->SetMarkerColor(kRed);
91 data_gr->Draw(
"same,p");
95 TCanvas *c0 =
new TCanvas(
"c0",
"c0"); c0->SetGrid();
96 TCanvas *
c1 =
new TCanvas(
"c1",
"c1"); c1->SetGrid();
97 TCanvas *c2 =
new TCanvas(
"c2",
"c2"); c2->SetGrid();
98 TCanvas *c3 =
new TCanvas(
"c3",
"c3"); c3->SetGrid();
100 float mod[] = {0, 0, 0, 0, 0, 0, 0, 0};
101 float mod_error[] = {0, 0, 0, 0, 0, 0, 0, 0};
103 for (
int i=0; i<nfiles; ++i) {
104 TFile *f = TFile::Open(inputs[i],
"read");
105 TH1D *hnum =
new TH1D(
"hnum",
"hnum",16, -3.14, 3.14);
106 TH1D *hden =
new TH1D(
"hden",
"hden",16, -3.14, 3.14);
109 T->Project(
"hnum",
"dimu_gphi",
"Sum$(gnhodo>=8)>=2");
110 T->Project(
"hden",
"dimu_gphi");
116 hnum->SetMarkerStyle(20);
117 hden->SetMarkerStyle(20);
118 hrat->SetMarkerStyle(20);
127 hnum->SetTitle(
"nDimu-trig. vs. #phi; #phi [rad]; nDimu-trig.");
128 hnum->SetMarkerColor(color);
129 hnum->SetLineColor(color);
134 hden->SetTitle(
"nDimu-gen. vs. #phi; #phi [rad]; nDimu-gen.");
135 hden->SetMarkerColor(color);
136 hden->SetLineColor(color);
141 hrat->SetTitle(
"Acc. vs. #phi; #phi [rad]; Acc.");
142 hrat->SetMarkerColor(color);
143 hrat->SetLineColor(color);
145 hrat->SetMaximum(0.1);
148 TF1 *cos =
new TF1(
"cos",
"[0]*cos(2*x)+[1]");
149 cos->SetLineColor(color);
151 mod[i] = cos->GetParameter(0);
152 mod_error[i] = cos->GetParError(0);
158 hnum->SetMarkerColor(color);
159 hnum->SetLineColor(color);
163 hden->SetMarkerColor(color);
164 hden->SetLineColor(color);
168 hrat->SetMarkerColor(color);
169 hrat->SetLineColor(color);
171 TF1 *cos =
new TF1(
"cos",
"[0]*cos(2*x)+[1]");
172 cos->SetLineColor(color);
174 mod[i] = cos->GetParameter(0);
175 mod_error[i] = cos->GetParError(0);
181 TGraphErrors* gr =
new TGraphErrors(nfiles, gap_size, mod, gap_size_error, mod_error);
182 gr->SetTitle(
";H1 gap size (cm); Cos(2x) Mod. Str.");
183 gr->SetMarkerStyle(20);
185 gr->GetXaxis()->SetRangeUser(-5,11);
186 gr->GetYaxis()->SetRangeUser(-0.01, 0);
TH1D * getEffHist(const char *hname, const TH1D *h1, const TH1D *h2)
double binom_error(const double a, const double b)
double ratio_error(const double a, const double b, const double ea, const double eb)