11auto checkH1 = [](
TList *out) {
15 std::cout <<
"checkH1 >>> Test failure: output list not found\n";
20 auto hdmd =
dynamic_cast<TH1F *
>(out->FindObject(
"hdmd"));
22 std::cout <<
"checkH1 >>> Test failure: 'hdmd' histo not found\n";
25 if ((
Int_t)(hdmd->GetEntries()) != 7525) {
26 std::cout <<
"checkH1 >>> Test failure: 'hdmd' histo: wrong number"
28 << (
Int_t)(hdmd->GetEntries()) <<
": expected 7525) \n";
31 if (
TMath::Abs((hdmd->GetMean() - 0.15512023) / 0.15512023) > 0.001) {
32 std::cout <<
"checkH1 >>> Test failure: 'hdmd' histo: wrong mean (" << hdmd->GetMean()
33 <<
": expected 0.15512023) \n";
37 auto h2 =
dynamic_cast<TH2F *
>(out->FindObject(
"h2"));
39 std::cout <<
"checkH1 >>> Test failure: 'h2' histo not found\n";
42 if ((
Int_t)(h2->GetEntries()) != 7525) {
43 std::cout <<
"checkH1 >>> Test failure: 'h2' histo: wrong number"
45 << (
Int_t)(h2->GetEntries()) <<
": expected 7525) \n";
48 if (
TMath::Abs((h2->GetMean() - 0.15245688) / 0.15245688) > 0.001) {
49 std::cout <<
"checkH1 >>> Test failure: 'h2' histo: wrong mean (" << h2->GetMean() <<
": expected 0.15245688) \n";
58auto doFit = [](
TList *out,
const char *lfn = 0) ->
Int_t {
62 gSystem->RedirectOutput(lfn,
"a", &redH);
68 if (hdmd == 0 || h2 == 0) {
69 std::cout <<
"doFit: hdmd = " << hdmd <<
" , h2 = " << h2 <<
"\n";
72 gSystem->RedirectOutput(0, 0, &redH);
78 c1->SetBottomMargin(0.15);
79 hdmd->GetXaxis()->SetTitle(
"m_{K#pi#pi} - m_{K#pi}[GeV/c^{2}]");
80 hdmd->GetXaxis()->SetTitleOffset(1.4);
83 if (
gROOT->GetListOfFunctions()->FindObject(
"f5"))
84 delete gROOT->GetFunction(
"f5");
93 par[2] / 2.5066 / par[4] *
TMath::Exp(-xp3 / 2 / par[4] / par[4]));
97 auto f5 =
new TF1(
"f5",
fdm5, 0.139, 0.17, 5);
98 f5->SetParameters(1000000, .25, 2000, .1454, .001);
99 hdmd->Fit(
"f5",
"lr");
102 Double_t ref_f5[4] = {959915.0, 0.351114, 1185.03, 0.145569};
103 for (
int i : {0, 1, 2, 3}) {
104 if ((
TMath::Abs((f5->GetParameters())[i] - ref_f5[i]) / ref_f5[i]) > 0.001) {
105 std::cout <<
"\n >>> Test failure: fit to 'f5': parameter '" << f5->GetParName(i) <<
"' has wrong value ("
106 << (f5->GetParameters())[i] <<
": expected" << ref_f5[i] <<
") \n";
108 gSystem->RedirectOutput(0, 0, &redH);
116 auto c2 =
new TCanvas(
"c2",
"tauD0", 100, 100, 800, 600);
118 c2->SetBottomMargin(0.15);
124 if (
gROOT->GetListOfFunctions()->FindObject(
"f2"))
125 delete gROOT->GetFunction(
"f2");
128 const auto dxbin = (0.17 - 0.13) / 40;
129 const auto sigma = 0.0012;
139 auto f2 =
new TF1(
"f2",
fdm2, 0.139, 0.17, 2);
140 f2->SetParameters(10000, 10);
143 std::cout <<
"doFit: restricting fit to two bins only in this example...\n";
145 h2->FitSlicesX(f2, 10, 20, 10,
"g5 l");
148 Double_t ref_f2[2] = {52432.2, 105.481};
149 for (
int i : {0, 1}) {
150 if ((
TMath::Abs((f2->GetParameters())[i] - ref_f2[i]) / ref_f2[i]) > 0.001) {
151 std::cout <<
"\n >>> Test failure: fit to 'f2': parameter '" << f2->GetParName(i) <<
"' has wrong value ("
152 << (f2->GetParameters())[i] <<
": expected" << ref_f2[i] <<
") \n";
154 gSystem->RedirectOutput(0, 0, &redH);
160 h2_1->GetXaxis()->SetTitle(
"#tau[ps]");
161 h2_1->SetMarkerStyle(21);
169 auto psdmd = (
TPaveStats *)hdmd->GetListOfFunctions()->FindObject(
"stats");
170 psdmd->SetOptStat(1110);
174 gSystem->RedirectOutput(0, 0, &redH);
183 auto hdmd =
new TH1F(
"hdmd",
"Dm_d", 40, 0.13, 0.17);
184 auto h2 =
new TH2F(
"h2",
"ptD0 vs Dm_d", 30, 0.135, 0.165, 30, -3, 6);
202 while (reader.Next()) {
214 if (fNhitrp.At(*fIk) * fNhitrp.At(*fIpi) <= 1)
217 if (fRend.At(*fIk) - fRstart.At(*fIk) <= 22)
219 if (fRend.At(*fIpi) - fRstart.At(*fIpi) <= 22)
221 if (fNlhk.At(*fIk) <= 0.1)
223 if (fNlhpi.At(*fIpi) <= 0.1)
226 if (fNlhpi.At(*fIpis) <= 0.1)
233 h2->Fill(*fDm_d, *fRpd0_t / 0.029979 * 1.8646 / *fPtd0_d);
249 auto elist =
new TEntryList(
"elist",
"H1 selection from Cut");
264 while (reader.Next()) {
276 if (fNhitrp.At(*fIk) * fNhitrp.At(*fIpi) <= 1)
279 if (fRend.At(*fIk) - fRstart.At(*fIk) <= 22)
281 if (fRend.At(*fIpi) - fRstart.At(*fIpi) <= 22)
283 if (fNlhk.At(*fIk) <= 0.1)
285 if (fNlhpi.At(*fIpi) <= 0.1)
288 if (fNlhpi.At(*fIpis) <= 0.1)
294 elist->Enter(reader.GetCurrentEntry(), reader.GetTree());
304 auto hdmd =
new TH1F(
"hdmd",
"Dm_d", 40, 0.13, 0.17);
305 auto h2 =
new TH2F(
"h2",
"ptD0 vs Dm_d", 30, 0.135, 0.165, 30, -3, 6);
311 while (reader.Next()) {
314 h2->Fill(*fDm_d, *fRpd0_t / 0.029979 * 1.8646 / *fPtd0_d);
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
1-D histogram with a double per channel (see TH1 documentation)
1-D histogram with a float per channel (see TH1 documentation)
2-D histogram with a float per channel (see TH1 documentation)
Use the TLine constructor to create a simple line.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
An interface for reading collections stored in ROOT columnar datasets.
An interface for reading values stored in ROOT columnar datasets.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Double_t fdm5(Double_t *xx, Double_t *par)
Double_t fdm2(Double_t *xx, Double_t *par)
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.