(i) symmetrize the JME-provided tables between plus and minus sides (ii) fit the turn-on with an error function (iii) use the smooth efficiency to correct data
78 cout << __func__ <<
" start" << endl;
81 auto fIn = make_unique<TFile>(
input.c_str(),
"READ");
82 auto fOut = make_unique<TFile>(output.c_str(),
"RECREATE");
84 const vector<TString>
eras {
"16BCD",
"16EF",
"16FGH",
85 "17B",
"17C",
"17D",
"17E",
"17F"};
88 auto hA = make_unique<TH1D>(
"a" ,
";;a" , N, 0.5, 0.5 + N);
89 auto hMu = make_unique<TH1D>(
"mu" ,
";;#mu" , N, 0.5, 0.5 + N);
90 auto hSigma = make_unique<TH1D>(
"sigma" ,
";;#sigma", N, 0.5, 0.5 + N);
91 auto hA2 = make_unique<TH1D>(
"a2" ,
";;a" , N, 0.5, 0.5 + N);
92 auto hMu2 = make_unique<TH1D>(
"mu2" ,
";;#mu" , N, 0.5, 0.5 + N);
93 auto hSigma2 = make_unique<TH1D>(
"sigma2",
";;#sigma", N, 0.5, 0.5 + N);
94 for (TH1 * h: { hA .get(), hMu .get(), hSigma .get(),
95 hA2.get(), hMu2.get(), hSigma2.get() })
96 h->SetDirectory(fOut.get());
99 auto maxPt = 6500/cosh(
maxEta);
100 auto maxPt2 = 6500/cosh(
maxEta+0.5);
102 auto aMin = 0.0, aMax = 1.3;
103 auto muMin = 100., muMax = 200.;
104 auto sigmaMin = 0.1, sigmaMax = 2.;
106 hA->SetMinimum(aMin);
107 hA->SetMaximum(aMax);
108 hMu->SetMinimum(muMin);
109 hMu->SetMaximum(muMax);
110 hSigma->SetMinimum(sigmaMin);
111 hSigma->SetMaximum(sigmaMax);
112 for (
size_t i = 0; i < N; ++i) {
115 hA ->GetXaxis()->SetBinLabel(i+1,
era);
116 hMu ->GetXaxis()->SetBinLabel(i+1,
era);
117 hSigma->GetXaxis()->SetBinLabel(i+1,
era);
119 TString hname =
"L1prefiring_jetpt_20" +
era;
120 auto h2 = unique_ptr<TH2>(fIn->Get<TH2>(hname));
121 if (h2.get() ==
nullptr) {
122 TString what =
"Map " + hname +
" can't be found";
126 int yn = h2->GetXaxis()->FindBin(-
maxEta-0.1),
127 yp = h2->GetXaxis()->FindBin(
maxEta+0.1),
128 yn2 = h2->GetXaxis()->FindBin(-
maxEta-0.6),
129 yp2 = h2->GetXaxis()->FindBin(
maxEta+0.6);
130 auto h = unique_ptr<TH1>(h2->ProjectionY(Form(
"%d", rand()), yn, yn));
131 h->Add( h2->ProjectionY(Form(
"%d", rand()), yp, yp));
133 auto k = unique_ptr<TH1>(h2->ProjectionY(Form(
"%d", rand()), yn2, yn2));
134 k->Add( h2->ProjectionY(Form(
"%d", rand()), yp2, yp2));
139 g->SetLineColor(kBlue);
140 g->SetMarkerColor(kBlue);
141 g2->SetLineColor(kRed);
142 g2->SetMarkerColor(kRed);
146 f->SetTitle(
"2.0 < |y| < 2.5");
147 f->SetLineColor(g->GetLineColor());
149 f2->SetTitle(
"2.5 < |y| < 3.0");
150 f2->SetLineColor(g2->GetLineColor());
153 f->FixParameter(0,0.5*(aMin+aMax)); f2->FixParameter(0,0.5*(aMin+aMax));
154 f->SetParLimits(0,aMin,aMax); f2->SetParLimits(0,aMin,aMax);
156 f->SetParameter(1,0.5*(muMin+muMax)); f2->SetParameter(1,0.5*(muMin+muMax));
157 f->SetParLimits(1,muMin,muMax); f2->SetParLimits(1,muMin,muMax);
159 f->SetParameter(2,0.5*(sigmaMin+sigmaMax)); f2->SetParameter(2,0.5*(sigmaMin+sigmaMax));
160 f->SetParLimits(2,sigmaMin,sigmaMax); f2->SetParLimits(2,sigmaMin,sigmaMax);
162 auto r = g->Fit(
f,
"RS");
163 auto r2 = g2->Fit(f2,
"RS");
169 auto a = r->Parameter(0), Ea = r->Error(0),
170 mu = r->Parameter(1), Emu = r->Error(1),
171 sigma = r->Parameter(2), Esigma = r->Error(2);
173 auto fUp = make_unique<TF1>(Form(
"%d", rand()),
Prefiring::ansatz, 30, maxPt, 3);
174 auto fDn = make_unique<TF1>(Form(
"%d", rand()),
Prefiring::ansatz, 30, maxPt, 3);
175 fUp->SetLineStyle(kDotted);
176 fUp->SetLineColor(kBlue);
177 fUp->SetLineWidth(1);
178 fUp->SetParameter(0,a*1.2);
179 fUp->SetParameter(1,mu);
180 fUp->SetParameter(2,sigma);
181 fDn->SetLineStyle(kDotted);
182 fDn->SetLineColor(kBlue);
183 fDn->SetLineWidth(1);
184 fDn->SetParameter(0,a*0.8);
185 fDn->SetParameter(1,mu);
186 fDn->SetParameter(2,sigma);
188 hA ->SetBinContent(i+1,a); hA ->SetBinError(i+1,Ea);
189 hMu ->SetBinContent(i+1,mu); hMu ->SetBinError(i+1,Emu);
190 hSigma->SetBinContent(i+1,sigma); hSigma->SetBinError(i+1,Esigma);
192 a = r2->Parameter(0); Ea = r2->Error(0);
193 mu = r2->Parameter(1); Emu = r2->Error(1);
194 sigma = r2->Parameter(2); Esigma = r2->Error(2);
196 auto f2Up = make_unique<TF1>(Form(
"%d", rand()),
Prefiring::ansatz, 30, maxPt2, 3);
197 auto f2Dn = make_unique<TF1>(Form(
"%d", rand()),
Prefiring::ansatz, 30, maxPt2, 3);
198 f2Up->SetLineStyle(kDotted);
199 f2Up->SetLineColor(kRed);
200 f2Up->SetLineWidth(1);
201 f2Up->SetParameter(0,a*1.2);
202 f2Up->SetParameter(1,mu);
203 f2Up->SetParameter(2,sigma);
204 f2Dn->SetLineStyle(kDotted);
205 f2Dn->SetLineColor(kRed);
206 f2Dn->SetLineWidth(1);
207 f2Dn->SetParameter(0,a*0.8);
208 f2Dn->SetParameter(1,mu);
209 f2Dn->SetParameter(2,sigma);
211 hA2 ->SetBinContent(i+1,a); hA2 ->SetBinError(i+1,Ea);
212 hMu2 ->SetBinContent(i+1,mu); hMu2 ->SetBinError(i+1,Emu);
213 hSigma2->SetBinContent(i+1,sigma); hSigma2->SetBinError(i+1,Esigma);
216 cout << __func__ <<
" stop" << endl;