auto checkH1 = [](
TList *out) {
if (!out) {
std::cout << "checkH1 >>> Test failure: output list not found\n";
return -1;
}
if (!hdmd) {
std::cout << "checkH1 >>> Test failure: 'hdmd' histo not found\n";
return -1;
}
std::cout << "checkH1 >>> Test failure: 'hdmd' histo: wrong number"
" of entries ("
return -1;
}
std::cout <<
"checkH1 >>> Test failure: 'hdmd' histo: wrong mean (" << hdmd->
GetMean()
<< ": expected 0.15512023) \n";
return -1;
}
if (!h2) {
std::cout << "checkH1 >>> Test failure: 'h2' histo not found\n";
return -1;
}
std::cout << "checkH1 >>> Test failure: 'h2' histo: wrong number"
" of entries ("
return -1;
}
std::cout <<
"checkH1 >>> Test failure: 'h2' histo: wrong mean (" << h2->
GetMean() <<
": expected 0.15245688) \n";
return -1;
}
return 0;
};
auto doFit = [](
TList *out,
const char *lfn = 0) ->
Int_t {
if (hdmd == 0 || h2 == 0) {
std::cout << "doFit: hdmd = " << hdmd << " , h2 = " << h2 << "\n";
return -1;
}
TCanvas *c1 =
new TCanvas(
"c1",
"h1analysis analysis", 10, 10, 800, 600);
if (
gROOT->GetListOfFunctions()->FindObject(
"f5"))
delete gROOT->GetFunction(
"f5");
const Double_t dxbin = (0.17 - 0.13) / 40;
if (x <= 0.13957) return 0;
Double_t xp3 = (x - par[3]) * (x - par[3]);
par[2] / 2.5066 / par[4] *
TMath::Exp(-xp3 / 2 / par[4] / par[4]));
return res;
};
Double_t ref_f5[4] = {959915.0, 0.351114, 1185.03, 0.145569};
for (int i : {0, 1, 2, 3}) {
std::cout <<
"\n >>> Test failure: fit to 'f5': parameter '" << f5->
GetParName(i) <<
"' has wrong value (" << (f5->
GetParameters())[i] <<
": expected" << ref_f5[i] <<
") \n";
return -1;
}
}
if (
gROOT->GetListOfFunctions()->FindObject(
"f2"))
delete gROOT->GetFunction(
"f2");
const Double_t dxbin = (0.17 - 0.13) / 40;
if (x <= 0.13957) return 0;
Double_t xp3 = (x - 0.1454) * (x - 0.1454);
par[1] / 2.5066 / sigma *
TMath::Exp(-xp3 / 2 / sigma / sigma));
return res;
};
std::cout << "doFit: restricting fit to two bins only in this example...\n";
h2->FitSlicesX(f2, 10, 20, 10, "g5 l");
Double_t ref_f2[2] = {52432.2, 105.481};
for (int i : {0, 1}) {
std::cout <<
"\n >>> Test failure: fit to 'f2': parameter '" << f2->
GetParName(i) <<
"' has wrong value (" << (f2->
GetParameters())[i] <<
": expected" << ref_f2[i] <<
") \n";
return -1;
}
}
return 0;
};
auto hdmd =
new TH1F(
"hdmd",
"Dm_d", 40, 0.13, 0.17);
auto h2 =
new TH2F(
"h2",
"ptD0 vs Dm_d", 30, 0.135, 0.165, 30, -3, 6);
if (
TMath::Abs(*fMd0_d - 1.8646) >= 0.04)
continue;
if (*fPtds_d <= 2.5) continue;
(*fIk)--;
(*fIpi)--;
if (fNhitrp.At(*fIk) * fNhitrp.At(*fIpi) <= 1) continue;
if (fRend.At(*fIk) - fRstart.At(*fIk) <= 22) continue;
if (fRend.At(*fIpi) - fRstart.At(*fIpi) <= 22) continue;
if (fNlhk.At(*fIk) <= 0.1) continue;
if (fNlhpi.At(*fIpi) <= 0.1) continue;
(*fIpis)--;
if (fNlhpi.At(*fIpis) <= 0.1) continue;
if (*fNjets < 1) continue;
h2->Fill(*fDm_d, *fRpd0_t / 0.029979 * 1.8646 / *fPtd0_d);
}
l->Add(hdmd);
l->Add(h2);
};
auto elist =
new TEntryList(
"elist",
"H1 selection from Cut");
if (
TMath::Abs(*fMd0_d - 1.8646) >= 0.04)
continue;
if (*fPtds_d <= 2.5) continue;
(*fIk)--;
(*fIpi)--;
if (fNhitrp.At(*fIk) * fNhitrp.At(*fIpi) <= 1) continue;
if (fRend.At(*fIk) - fRstart.At(*fIk) <= 22) continue;
if (fRend.At(*fIpi) - fRstart.At(*fIpi) <= 22) continue;
if (fNlhk.At(*fIk) <= 0.1) continue;
if (fNlhpi.At(*fIpi) <= 0.1) continue;
(*fIpis)--;
if (fNlhpi.At(*fIpis) <= 0.1) continue;
if (*fNjets < 1) continue;
}
return elist;
};
auto hdmd =
new TH1F(
"hdmd",
"Dm_d", 40, 0.13, 0.17);
auto h2 =
new TH2F(
"h2",
"ptD0 vs Dm_d", 30, 0.135, 0.165, 30, -3, 6);
h2->Fill(*fDm_d, *fRpd0_t / 0.029979 * 1.8646 / *fPtd0_d);
}
l->Add(hdmd);
l->Add(h2);
};