6 #include <TLorentzVector.h>
14 const char* inputs [] = {
18 float gap_size[] = {0, 1, 2, 5, 10};
19 float gap_size_error[] = {0, 0, 0, 0, 0, 0, 0, 0};
27 return sqrt(r*(1-r)/b);
35 TH1D *h = (TH1D*)h1->Clone(hname);
36 int nbin = h->GetNbinsX();
37 for(
int ibin=1; ibin<=nbin; ++ibin) {
38 double a = h1->GetBinContent(ibin);
39 double b = h2->GetBinContent(ibin);
42 h->SetBinContent(ibin, 0);
43 h->SetBinError(ibin, 0);
49 h->SetBinContent(ibin, r);
50 h->SetBinError(ibin, e);
57 TCanvas *c0 =
new TCanvas(
"c0",
"c0"); c0->SetGrid();
58 TCanvas *
c1 =
new TCanvas(
"c1",
"c1"); c1->SetGrid();
59 TCanvas *c2 =
new TCanvas(
"c2",
"c2"); c2->SetGrid();
60 TCanvas *c3 =
new TCanvas(
"c3",
"c3"); c3->SetGrid();
62 float mod[] = {0, 0, 0, 0, 0, 0, 0, 0};
63 float mod_error[] = {0, 0, 0, 0, 0, 0, 0, 0};
64 TH1D* hrelrat0 =
NULL;
66 for (
int i=0; i<nfiles; ++i) {
67 float xbins[] = {4, 5, 7, 10, 20};
68 TH1D *hnum =
new TH1D(
"hnum",
"hnum",4, xbins);
69 TH1D *hden =
new TH1D(
"hden",
"hden",4, xbins);
75 TFile *f = TFile::Open(inputs[i],
"read");
76 TTree *T = (TTree*) f->Get(
"T");
78 #define MAX_PARTICLES 100
83 T->SetBranchAddress(
"gnhodo", &gnhodo);
84 T->SetBranchAddress(
"gpx", &gpx);
85 T->SetBranchAddress(
"gpy", &gpy);
86 T->SetBranchAddress(
"gpz", &gpz);
87 T->SetBranchAddress(
"n_particles", &n_particles);
89 float mu_mass = .105658;
90 for(
int ientry=0; ientry<T->GetEntries(); ++ientry) {
93 if(n_particles!=2) { cout <<
"n_particles!=2 @ " << ientry << endl;
continue;}
95 TLorentzVector mu0, mu1;
96 mu0.SetXYZM(gpx[0], gpy[0], gpz[0], mu_mass);
97 mu1.SetXYZM(gpx[1], gpy[1], gpz[1], mu_mass);
99 TLorentzVector dimu = mu0+mu1;
100 float dimu_gmass = dimu.M();
102 hden->Fill(dimu_gmass);
104 if(gnhodo[0]>=8 && gnhodo[1]>=8)
105 hnum->Fill(dimu_gmass);
111 TH1D* hrelrat = (TH1D*) hrat->Clone(
"hrelrat");
113 hnum->SetMarkerStyle(20);
114 hden->SetMarkerStyle(20);
115 hrat->SetMarkerStyle(20);
116 hrelrat->SetMarkerStyle(20);
126 hnum->SetTitle(
"nDimu-trig. vs. M_{#mu#mu}; M_{#mu#mu} [GeV/c^{2}]; nDimu-trig.");
127 hnum->SetMarkerColor(color);
128 hnum->SetLineColor(color);
135 hden->SetTitle(
"nDimu-gen. vs. M_{#mu#mu}; M_{#mu#mu} [GeV/c^{2}]; nDimu-gen.");
136 hden->SetMarkerColor(color);
137 hden->SetLineColor(color);
143 hrat->SetTitle(
"Acc. vs. M_{#mu#mu}; M_{#mu#mu} [GeV/c^{2}]; Acc.");
144 hrat->SetMarkerColor(color);
145 hrat->SetLineColor(color);
146 hrat->SetMinimum(0.);
147 hrat->SetMaximum(1.1);
151 hrelrat0 = (TH1D*) hrelrat->Clone(
"hrelrat0");
157 hnum->SetMarkerColor(color);
158 hnum->SetLineColor(color);
162 hden->SetMarkerColor(color);
163 hden->SetLineColor(color);
167 hrat->SetMarkerColor(color);
168 hrat->SetLineColor(color);
172 for(
int ibin=1;ibin<=hrelrat->GetNbinsX();++ibin ){
173 double relrat0_val = hrelrat0->GetBinContent(ibin);
175 hrelrat->SetBinContent(ibin,0);
176 hrelrat->SetBinError(ibin,0);
179 hrelrat->SetBinContent(ibin,
180 hrelrat->GetBinContent(ibin)/relrat0_val);
181 hrelrat->SetBinError(ibin,
182 hrelrat->GetBinError(ibin)/relrat0_val);
184 hrelrat->SetTitle(
"Rel. Acc. vs. M_{#mu#mu}; M_{#mu#mu} [GeV/c^{2}]; Rel. Acc.");
185 hrelrat->SetMarkerColor(color);
186 hrelrat->SetLineColor(color);
187 hrelrat->SetStats(0);
191 hrelrat->Draw(
"esame");
TH1D * getEffHist(const char *hname, const TH1D *h1, const TH1D *h2)
double binom_error(const double a, const double b)