34 #include "tools/histo/p1d"
38 using namespace G4Analysis;
72 hnInformation->
SetDimension(
kY, yunitName, yfcnName, G4BinScheme::kLinear);
76 void AddP1Annotation(tools::histo::p1d* p1d,
86 p1d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
87 p1d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
106 if ( xbinScheme != G4BinScheme::kLog ) {
107 if ( xbinScheme == G4BinScheme::kUser ) {
112 <<
" User binning scheme setting was ignored." <<
G4endl
113 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
117 if ( ymin == 0. && ymax == 0.) {
118 return new tools::histo::p1d(title,
119 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
121 return new tools::histo::p1d(title,
122 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
123 yfcn(ymin/yunit), yfcn(ymax/yunit));
128 std::vector<G4double> edges;
129 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
130 if ( ymin == 0. && ymax == 0.) {
131 return new tools::histo::p1d(title, edges);
133 return new tools::histo::p1d(title, edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
139 tools::histo::p1d* CreateToolsP1(
const G4String& title,
140 const std::vector<G4double>& edges,
153 std::vector<G4double> newEdges;
156 return new tools::histo::p1d(title, newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
160 void ConfigureToolsP1(tools::histo::p1d* p1d,
175 if ( xbinScheme != G4BinScheme::kLog ) {
176 if ( xbinScheme == G4BinScheme::kUser ) {
181 <<
" User binning scheme setting was ignored." <<
G4endl
182 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
186 if ( ymin == 0. && ymax == 0. ) {
187 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
189 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
190 yfcn(ymin/yunit), yfcn(ymax/yunit));
195 std::vector<G4double> edges;
196 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
197 if ( ymin == 0. && ymax == 0. ) {
198 p1d->configure(edges);
200 p1d->configure(edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
206 void ConfigureToolsP1(tools::histo::p1d* p1d,
207 const std::vector<G4double>& edges,
219 std::vector<G4double> newEdges;
222 if ( ymin == 0. && ymax == 0. ) {
223 p1d->configure(newEdges);
225 p1d->configure(newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
243 auto hnInformation =
fHnManager->AddHnInformation(name, 2);
244 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
245 hnInformation->
AddDimension(yunitName, yfcnName, G4BinScheme::kLinear);
264 tools::histo::p1d* p1d
265 = CreateToolsP1(title, nbins, xmin, xmax, ymin, ymax,
266 xunitName, yunitName, xfcnName, yfcnName,
270 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
275 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
289 const std::vector<G4double>& edges,
298 tools::histo::p1d* p1d
299 = CreateToolsP1(title, edges, ymin, ymax,
300 xunitName, yunitName, xfcnName, yfcnName);
303 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
307 name, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser);
328 if ( ! p1d )
return false;
338 p1d, nbins, xmin, xmax, ymin, ymax,
339 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName);
342 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
347 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
357 const std::vector<G4double>& edges,
363 if ( ! p1d )
return false;
372 ConfigureToolsP1(p1d, edges, ymin, ymax,
373 xunitName, yunitName, xfcnName, yfcnName);
376 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
380 info, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser);
393 if ( ! p1d )
return false;
395 return p1d->scale(factor);
403 if ( ! p1d )
return false;
411 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillP1");
413 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillP1");
415 p1d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
416 yInfo->fFcn(yvalue/yInfo->fUnit),
weight);
421 description <<
" id " <<
id
422 <<
" xvalue " << xvalue
423 <<
" xfcn(xvalue/xunit) " << xInfo->fFcn(xvalue/xInfo->fUnit)
424 <<
" yvalue " << yvalue
425 <<
" yfcn(yvalue/yunit) " << yInfo->fFcn(yvalue/yInfo->fUnit)
436 return GetTId(name, warn);
443 if ( ! p1d )
return 0;
454 if ( ! p1d )
return 0.;
463 if ( ! p1d )
return 0.;
472 if ( ! p1d )
return 0.;
483 if ( ! p1d )
return 0.;
492 if ( ! p1d )
return 0.;
501 if ( ! p1d )
return false;
510 if ( ! p1d )
return false;
519 if ( ! p1d )
return false;
528 if ( ! p1d )
return "";
538 if ( ! p1d )
return "";
547 if ( ! p1d )
return "";
565 AddP1Annotation(p1d,
"none",
"none",
"none",
"none");
567 AddP1Information(name,
"none",
"none",
"none",
"none", G4BinScheme::kLinear);
581 const std::vector<tools::histo::p1d*>& p1Vector)
588 G4bool onlyIfActive)
const