36 Double_t
mybw(Double_t *, Double_t *);
37 Double_t
mygauss(Double_t *, Double_t *);
53 : prefixME_(iConfig.getUntrackedParameter<
std::
string>(
"prefixME",
"")) {}
69 h_fitres1 = _ibooker.
book1D(
"Gaussian mean WP80 EB-EB",
"Gaussian mean WP80 EB-EB", 1, 0, 1);
70 h_fitres1bis = _ibooker.
book1D(
"Gaussian sigma WP80 EB-EB",
"Gaussian sigma WP80 EB-EB", 1, 0, 1);
71 h_fitres1Chi2 = _ibooker.
book1D(
72 "Gaussian Chi2 result over NDF WP80 EB-EB",
"Gaussian Chi2 result over NDF WP80 EB-EB", 1, 0, 1);
74 h_fitres3 = _ibooker.
book1D(
"Gaussian mean WP80 EB-EE",
"Gaussian mean result WP80 EB-EE", 1, 0, 1);
75 h_fitres3bis = _ibooker.
book1D(
"Gaussian sigma WP80 EB-EE",
"Gaussian sigma WP80 EB-EE", 1, 0, 1);
77 _ibooker.
book1D(
"Gaussian Chi2 result over NDF WP80 EB-EE",
"Gaussian Chi2 result over NDF WP80 EB-EE", 1, 0, 1);
79 h_fitres2 = _ibooker.
book1D(
"Gaussian mean WP80 EE-EE",
"Gaussian mean WP80 EE-EE", 1, 0, 1);
80 h_fitres2bis = _ibooker.
book1D(
"Gaussian sigma WP80 EE-EE",
"Gaussian sigma WP80 EE-EE", 1, 0, 1);
82 _ibooker.
book1D(
"Gaussian Chi2 result over NDF WP80 EE-EE",
"Gaussian Chi2 result over NDF WP80 EE-EE", 1, 0, 1);
84 LogTrace(
"EwkAnalyzer") <<
"Parameters initialization";
91 TH1F *
B =
me1->getTH1F();
92 TH1F *R1 = h_fitres1->
getTH1F();
93 int division =
B->GetNbinsX();
94 float massMIN =
B->GetBinLowEdge(1);
95 float massMAX =
B->GetBinLowEdge(division + 1);
99 func->SetParameter(0, 1.0);
100 func->SetParName(0,
"const");
101 func->SetParameter(1, 95.0);
102 func->SetParName(1,
"mean");
103 func->SetParameter(2, 5.0);
104 func->SetParName(2,
"sigma");
115 B->Fit(
"mygauss",
"QR");
120 if (
N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20) {
127 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
142 if (
me1 !=
nullptr) {
143 TH1F *Bbis =
me1->getTH1F();
144 TH1F *R1bis = h_fitres1bis->
getTH1F();
145 int division = Bbis->GetNbinsX();
146 float massMIN = Bbis->GetBinLowEdge(1);
147 float massMAX = Bbis->GetBinLowEdge(division + 1);
151 func->SetParameter(0, 1.0);
152 func->SetParName(0,
"const");
153 func->SetParameter(1, 95.0);
154 func->SetParName(1,
"mean");
155 func->SetParameter(2, 5.0);
156 func->SetParName(2,
"sigma");
159 R1bis->GetStats(
stats);
163 N = Bbis->GetEntries();
167 Bbis->Fit(
"mygauss",
"QR");
172 if (
N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50) {
179 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
190 R1bis->SetEntries(
N);
191 R1bis->PutStats(
stats);
195 if (
me2 !=
nullptr) {
196 TH1F *E =
me2->getTH1F();
197 TH1F *R2 = h_fitres2->
getTH1F();
198 int division = E->GetNbinsX();
199 float massMIN = E->GetBinLowEdge(1);
200 float massMAX = E->GetBinLowEdge(division + 1);
204 func->SetParameter(0, 1.0);
205 func->SetParName(0,
"const");
206 func->SetParameter(1, 95.0);
207 func->SetParName(1,
"mean");
208 func->SetParameter(2, 5.0);
209 func->SetParName(2,
"sigma");
220 E->Fit(
"mygauss",
"QR");
225 if (
N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20) {
232 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
248 if (
me2 !=
nullptr) {
249 TH1F *Ebis =
me2->getTH1F();
250 TH1F *R2bis = h_fitres2bis->
getTH1F();
251 int division = Ebis->GetNbinsX();
252 float massMIN = Ebis->GetBinLowEdge(1);
253 float massMAX = Ebis->GetBinLowEdge(division + 1);
257 func->SetParameter(0, 1.0);
258 func->SetParName(0,
"const");
259 func->SetParameter(1, 95.0);
260 func->SetParName(1,
"mean");
261 func->SetParameter(2, 5.0);
262 func->SetParName(2,
"sigma");
265 R2bis->GetStats(
stats);
269 N = Ebis->GetEntries();
273 Ebis->Fit(
"mygauss",
"QR");
278 if (
N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50) {
285 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
296 R2bis->SetEntries(
N);
297 R2bis->PutStats(
stats);
301 if (me3 !=
nullptr) {
302 TH1F *R3 = h_fitres3->
getTH1F();
304 int division = M->GetNbinsX();
305 float massMIN = M->GetBinLowEdge(1);
306 float massMAX = M->GetBinLowEdge(division + 1);
310 func->SetParameter(0, 1.0);
311 func->SetParName(0,
"const");
312 func->SetParameter(1, 95.0);
313 func->SetParName(1,
"mean");
314 func->SetParameter(2, 5.0);
315 func->SetParName(2,
"sigma");
326 M->Fit(
"mygauss",
"QR");
330 if (
N == 0 || mean < 50 || mean > 100 || sigma <= 0 || sigma > 20) {
337 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
353 if (me3 !=
nullptr) {
355 TH1F *R3bis = h_fitres3bis->
getTH1F();
356 int division = Mbis->GetNbinsX();
357 float massMIN = Mbis->GetBinLowEdge(1);
358 float massMAX = Mbis->GetBinLowEdge(division + 1);
362 func->SetParameter(0, 1.0);
363 func->SetParName(0,
"const");
364 func->SetParameter(1, 95.0);
365 func->SetParName(1,
"mean");
366 func->SetParameter(2, 5.0);
367 func->SetParName(2,
"sigma");
370 R3bis->GetStats(
stats);
374 N = Mbis->GetEntries();
378 Mbis->Fit(
"mygauss",
"QR");
383 if (
N == 0 || rms < 0 || rms > 50 || rmsErr <= 0 || rmsErr > 50) {
390 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
401 R3bis->SetEntries(
N);
402 R3bis->PutStats(
stats);
407 if (
me1 !=
nullptr) {
408 TH1F *C1 =
me1->getTH1F();
409 TH1F *S1 = h_fitres1Chi2->
getTH1F();
410 int division = C1->GetNbinsX();
411 float massMIN = C1->GetBinLowEdge(1);
412 float massMAX = C1->GetBinLowEdge(division + 1);
416 func->SetParameter(0, 1.0);
417 func->SetParName(0,
"const");
418 func->SetParameter(1, 95.0);
419 func->SetParName(1,
"mean");
420 func->SetParameter(2, 5.0);
421 func->SetParName(2,
"sigma");
428 N = C1->GetEntries();
432 C1->Fit(
"mygauss",
"QR");
433 if ((
func->GetNDF() != 0)) {
439 if (
N == 0 ||
Chi2 < 0 || NDF < 0) {
446 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
462 if (
me2 !=
nullptr) {
463 TH1F *C2 =
me2->getTH1F();
464 TH1F *S2 = h_fitres2Chi2->
getTH1F();
465 int division = C2->GetNbinsX();
466 float massMIN = C2->GetBinLowEdge(1);
467 float massMAX = C2->GetBinLowEdge(division + 1);
471 func->SetParameter(0, 1.0);
472 func->SetParName(0,
"const");
473 func->SetParameter(1, 95.0);
474 func->SetParName(1,
"mean");
475 func->SetParameter(2, 5.0);
476 func->SetParName(2,
"sigma");
483 N = C2->GetEntries();
487 C2->Fit(
"mygauss",
"QR");
488 if (
func->GetNDF() != 0) {
494 if (
N == 0 ||
Chi2 < 0 || NDF < 0) {
501 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
516 if (me3 !=
nullptr) {
518 TH1F *S3 = h_fitres3Chi2->
getTH1F();
519 int division = C3->GetNbinsX();
520 float massMIN = C3->GetBinLowEdge(1);
521 float massMAX = C3->GetBinLowEdge(division + 1);
525 func->SetParameter(0, 1.0);
526 func->SetParName(0,
"const");
527 func->SetParameter(1, 95.0);
528 func->SetParName(1,
"mean");
529 func->SetParameter(2, 5.0);
530 func->SetParName(2,
"sigma");
537 N = C3->GetEntries();
541 C3->Fit(
"mygauss",
"QR");
542 if ((
func->GetNDF() != 0)) {
548 if (
N == 0 ||
Chi2 < 0 || NDF < 0) {
555 edm::LogError(
"ZFitter") <<
"[Zfitter]: Exception when fitting..." <<
e.what();
572 Double_t
mybw(Double_t *
x, Double_t *par) {
573 Double_t arg1 = 14.0 / 22.0;
574 Double_t arg2 = par[1] * par[1] * par[2] * par[2];
575 Double_t arg3 = ((
x[0] *
x[0]) - (par[1] * par[1])) * ((
x[0] *
x[0]) - (par[1] * par[1]));
576 Double_t arg4 =
x[0] *
x[0] *
x[0] *
x[0] * ((par[2] * par[2]) / (par[1] * par[1]));
577 return par[0] * arg1 * arg2 / (arg3 + arg4);
586 arg = (
x[0] - par[1]) / par[2];
587 return par[0] * TMath::Exp(-0.5 *
arg *
arg) / (TMath::Sqrt(2 *
TMath::Pi()) * par[2]);