34 #include "tools/histo/p2d"
38 using namespace G4Analysis;
72 hnInformation->
SetDimension(
kZ, zunitName, zfcnName, G4BinScheme::kLinear);
76 void AddP2Annotation(tools::histo::p2d* p2d,
90 p2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
91 p2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
92 p2d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
96 tools::histo::p2d* CreateToolsP2(
119 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
120 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser ) {
125 <<
" User binning scheme setting was ignored." <<
G4endl
126 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
130 if ( zmin == 0. && zmax == 0.) {
131 return new tools::histo::p2d(title,
132 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
133 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
137 return new tools::histo::p2d(title,
138 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
139 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
140 zfcn(zmin/zunit), zfcn(zmax/zunit));
147 std::vector<G4double> xedges;
148 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
149 std::vector<G4double> yedges;
150 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
151 if ( zmin == 0. && zmax == 0.) {
152 return new tools::histo::p2d(title, xedges, yedges);
154 return new tools::histo::p2d(title, xedges, yedges,
155 zfcn(zmin/zunit), zfcn(zmax/zunit));
161 tools::histo::p2d* CreateToolsP2(
163 const std::vector<G4double>& xedges,
164 const std::vector<G4double>& yedges,
181 std::vector<G4double> xnewEdges;
183 std::vector<G4double> ynewEdges;
186 if ( zmin == 0. && zmax == 0.) {
187 return new tools::histo::p2d(title, xnewEdges, ynewEdges);
191 return new tools::histo::p2d(title, xnewEdges, ynewEdges,
192 zfcn(zmin/zunit), zfcn(zmax/zunit));
199 void ConfigureToolsP2(tools::histo::p2d* p2d,
221 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
222 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
227 <<
" User binning scheme setting was ignored." <<
G4endl
228 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
232 if ( zmin == 0. && zmax == 0. ) {
233 p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
234 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
236 p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
237 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
238 zfcn(zmin/zunit), zfcn(zmax/zunit));
243 std::vector<G4double> xedges;
244 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
245 std::vector<G4double> yedges;
246 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
247 if ( zmin == 0. && zmax == 0. ) {
248 p2d->configure(xedges, yedges);
250 p2d->configure(xedges, yedges, zfcn(zmin/zunit), zfcn(zmax/zunit));
256 void ConfigureToolsP2(tools::histo::p2d* p2d,
257 const std::vector<G4double>& xedges,
258 const std::vector<G4double>& yedges,
270 std::vector<G4double> xnewEdges;
275 std::vector<G4double> ynewEdges;
280 if ( zmin == 0. && zmax == 0. ) {
281 p2d->configure(xnewEdges, ynewEdges);
283 p2d->configure(xnewEdges, ynewEdges, zfcn(zmin/zunit), zfcn(zmax/zunit));
305 auto hnInformation =
fHnManager->AddHnInformation(name, 3);
306 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
307 hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
308 hnInformation->
AddDimension(zunitName, zfcnName, G4BinScheme::kLinear);
332 tools::histo::p2d* p2d
333 = CreateToolsP2(title,
334 nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
335 xunitName, yunitName, zunitName,
336 xfcnName, yfcnName, zfcnName,
337 xbinSchemeName, ybinSchemeName);
340 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
341 xfcnName, yfcnName, zfcnName);
347 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
348 xbinScheme, ybinScheme);
363 const std::vector<G4double>& xedges,
364 const std::vector<G4double>& yedges,
376 tools::histo::p2d* p2d
377 = CreateToolsP2(title, xedges, yedges, zmin, zmax,
378 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
382 p2d, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
386 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
387 G4BinScheme::kUser, G4BinScheme::kUser);
413 if ( ! p2d )
return false;
423 p2d, nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
424 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
425 xbinSchemeName, ybinSchemeName);
428 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
429 xfcnName, yfcnName, zfcnName);
435 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
436 xbinScheme, ybinScheme);
446 const std::vector<G4double>& xedges,
447 const std::vector<G4double>& yedges,
455 if ( ! p2d )
return false;
464 ConfigureToolsP2(p2d, xedges, yedges, zmin, zmax,
465 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
468 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
469 xfcnName, yfcnName, zfcnName);
473 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
474 G4BinScheme::kUser, G4BinScheme::kUser);
486 if ( ! p2d )
return false;
488 return p2d->scale(factor);
497 if ( ! p2d )
return false;
504 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillP2");
506 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillP2");
508 =
fHnManager->GetHnDimensionInformation(
id,
kZ,
"FillP2");
510 p2d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
511 yInfo->fFcn(yvalue/yInfo->fUnit),
512 zInfo->fFcn(zvalue/zInfo->fUnit),
weight);
518 description <<
" id " <<
id
519 <<
" xvalue " << xvalue
520 <<
" xfcn(xvalue/xunit) " << xInfo->fFcn(xvalue/xInfo->fUnit)
521 <<
" yvalue " << yvalue
522 <<
" yfcn(yvalue/yunit) " << yInfo->fFcn(yvalue/yInfo->fUnit)
523 <<
" zvalue " << zvalue
524 <<
" zfcn(zvalue/zunit) " << zInfo->fFcn(zvalue/zInfo->fUnit)
535 return GetTId(name, warn);
542 if ( ! p2d )
return 0;
553 if ( ! p2d )
return 0.;
562 if ( ! p2d )
return 0.;
571 if ( ! p2d )
return 0.;
580 if ( ! p2d )
return 0;
591 if ( ! p2d )
return 0.;
600 if ( ! p2d )
return 0.;
609 if ( ! p2d )
return 0.;
620 if ( ! p2d )
return 0.;
629 if ( ! p2d )
return 0.;
638 if ( ! p2d )
return false;
647 if ( ! p2d )
return false;
656 if ( ! p2d )
return false;
665 if ( ! p2d )
return false;
674 if ( ! p2d )
return "";
683 if ( ! p2d )
return "";
692 if ( ! p2d )
return "";
701 if ( ! p2d )
return "";
730 AddP2Annotation(p2d,
"none",
"none",
"none",
"none",
"none",
"none");
733 G4BinScheme::kLinear, G4BinScheme::kLinear);
747 const std::vector<tools::histo::p2d*>& p2Vector)
754 G4bool onlyIfActive)
const