37int main(
int argc,
char **argv)
55 JParser<> zap(
"Auxiliary program to model transition time distribution generator from data.");
57 zap[
'f'] =
make_field(inputFile,
"input file (output from JPulsar)");
61 zap[
'P'] =
make_field(pdf,
"PDF output file; for inclusion in JPMTTransitTimeProbability.hh") =
"";
62 zap[
'C'] =
make_field(
cdf,
"CDF output file; for inclusion in JPMTTransitTimeGenerator.hh") =
"";
63 zap[
'T'] =
make_field(T_ns,
"time range for PDF and CDF") = JRange_t(-20.0, +100.0);
68 catch(
const exception &error) {
75 TFile in(inputFile.c_str(),
"exist");
78 FATAL(
"File " << inputFile <<
" not opened." <<
endl);
81 h1 =
dynamic_cast<TH1D*
>(in.Get(
h0_1));
90 TF1 f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2])) + [3]");
99 for (
Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
101 const Double_t x = h1->GetBinCenter (i);
102 const Double_t y = h1->GetBinContent(i);
110 f1.SetParameter(0,
ymax);
111 f1.SetParameter(1, x0);
112 f1.SetParameter(2, sigma);
113 f1.SetParameter(3,
ymin);
117 h1->Fit(&f1,
"LL",
"same", x0 - 5 * sigma, x0 + 5 * sigma);
121 ymax = f1.GetParameter(0);
122 x0 = f1.GetParameter(1);
123 sigma = f1.GetParameter(2);
124 ymin = f1.GetParameter(3);
136 for (
Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
138 const Double_t x = h1->GetBinCenter (i);
139 const Double_t y = h1->GetBinContent(i);
145 if (x < x0 - 5.0 * sigma)
147 else if (x > x0 + 5.0 * sigma)
181 for (
Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
183 const Double_t x = h1->GetBinCenter (i) - x0;
184 const Double_t y = h1->GetBinContent(i) - y0;
190 EY.push_back(sqrt(y));
194 const int N = X.size();
201 TGraphErrors
g0(N, X.data(), Y.data(), EX.data(), EY.data());
212 for (
int i = 0; i != N; ++i) {
231 for (
int i = 0; i != N; ++i) {
232 g1.GetY()[i] =
gout->GetY()[i];
238 for (
int i = 0; i != N; ++i) {
256 for (
int i = 0; i != N; ++i) {
260 for (
int i = 0; i != N; ++i) {
264 ofstream out(pdf.c_str());
266 out <<
"\t// produced by JLegolas.cc" <<
endl;
268 const Double_t xmin = T_ns.getLowerLimit();
269 const Double_t xmax = T_ns.getUpperLimit();
297 for (
int i = 0; i+1 != N; ++i) {
298 g2.GetY()[i+1] += g2.GetY()[i];
302 const Double_t xmin = g2.GetX()[ 0 ];
303 const Double_t xmax = g2.GetX()[N-1];
309 for (
int i = 0; i != N; ++i) {
315 g2.GetY()[i] = x + 0.5 *
dx;
319 ofstream out(
cdf.c_str());
321 out <<
"\t// produced by JLegolas.cc" <<
endl;
357 for (
int i = 0; i != N; ++i) {
363 for (
int i = 0; i != N; ++i) {
365 h2.SetBinContent(i+1, Y [i]/W);
366 h2.SetBinError (i+1, EY[i]/W);