34 #include "tools/histo/h3d"
38 using namespace G4Analysis;
77 void AddH3Annotation(tools::histo::h3d* h3d,
91 h3d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
92 h3d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
93 h3d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
97 tools::histo::h3d* CreateToolsH3(
122 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog && zbinScheme != G4BinScheme::kLog) {
123 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser || zbinScheme == G4BinScheme::kUser) {
128 <<
" User binning scheme setting was ignored." <<
G4endl
129 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
133 return new tools::histo::h3d(title,
134 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
135 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
136 nzbins, zfcn(zmin/zunit), zfcn(zmax/zunit));
142 std::vector<G4double> xedges;
143 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
144 std::vector<G4double> yedges;
145 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
146 std::vector<G4double> zedges;
147 ComputeEdges(nzbins, zmin, zmax, zunit, zfcn, zbinScheme, zedges);
148 return new tools::histo::h3d(title, xedges, yedges, zedges);
153 tools::histo::h3d* CreateToolsH3(
155 const std::vector<G4double>& xedges,
156 const std::vector<G4double>& yedges,
157 const std::vector<G4double>& zedges,
173 std::vector<G4double> xnewEdges;
175 std::vector<G4double> ynewEdges;
177 std::vector<G4double> znewEdges;
180 return new tools::histo::h3d(title, xnewEdges, ynewEdges, znewEdges);
186 void ConfigureToolsH3(tools::histo::h3d* h3d,
210 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog && zbinScheme != G4BinScheme::kLog) {
211 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser || zbinScheme == G4BinScheme::kUser) {
216 <<
" User binning scheme setting was ignored." <<
G4endl
217 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
221 h3d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
222 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
223 nzbins, zfcn(zmin/zunit), zfcn(zmax/zunit));
227 std::vector<G4double> xedges;
228 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
229 std::vector<G4double> yedges;
230 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
231 std::vector<G4double> zedges;
232 ComputeEdges(nzbins, zmin, zmax, zunit, zfcn, zbinScheme, zedges);
233 h3d->configure(xedges, yedges, zedges);
238 void ConfigureToolsH3(tools::histo::h3d* h3d,
239 const std::vector<G4double>& xedges,
240 const std::vector<G4double>& yedges,
241 const std::vector<G4double>& zedges,
251 std::vector<G4double> xnewEdges;
256 std::vector<G4double> ynewEdges;
261 std::vector<G4double> znewEdges;
264 h3d->configure(xnewEdges, ynewEdges, znewEdges);
286 auto hnInformation =
fHnManager->AddHnInformation(name, 3);
287 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
288 hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
289 hnInformation->
AddDimension(zunitName, zfcnName, zbinScheme);
314 tools::histo::h3d* h3d
315 = CreateToolsH3(title,
316 nxbins, xmin, xmax, nybins, ymin, ymax, nzbins, zmin, zmax,
317 xunitName, yunitName, zunitName,
318 xfcnName, yfcnName, zfcnName,
319 xbinSchemeName, ybinSchemeName, zbinSchemeName);
322 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
323 xfcnName, yfcnName, zfcnName);
330 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
331 xbinScheme, ybinScheme, zbinScheme);
346 const std::vector<G4double>& xedges,
347 const std::vector<G4double>& yedges,
348 const std::vector<G4double>& zedges,
359 tools::histo::h3d* h3d
360 = CreateToolsH3(title, xedges, yedges, zedges,
361 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
364 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
365 xfcnName, yfcnName, zfcnName);
369 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
370 G4BinScheme::kUser, G4BinScheme::kUser, G4BinScheme::kUser);
397 if ( ! h3d )
return false;
407 h3d, nxbins, xmin, xmax, nybins, ymin, ymax, nzbins, zmin, zmax,
408 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
409 xbinSchemeName, ybinSchemeName, zbinSchemeName);
412 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
413 xfcnName, yfcnName, zfcnName);
420 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
421 xbinScheme, ybinScheme, zbinScheme);
431 const std::vector<G4double>& xedges,
432 const std::vector<G4double>& yedges,
433 const std::vector<G4double>& zedges,
440 if ( ! h3d )
return false;
449 ConfigureToolsH3(h3d, xedges, yedges, zedges,
450 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
453 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
454 xfcnName, yfcnName, zfcnName);
458 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
459 G4BinScheme::kUser, G4BinScheme::kUser, G4BinScheme::kUser);
471 if ( ! h3d )
return false;
473 return h3d->scale(factor);
482 if ( ! h3d )
return false;
489 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillH3");
491 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillH3");
493 =
fHnManager->GetHnDimensionInformation(
id,
kZ,
"FillH3");
495 h3d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
501 description <<
" id " <<
id
502 <<
" xvalue " << xvalue
503 <<
" xfcn(xvalue/xunit) " << xInfo->
fFcn(xvalue/xInfo->
fUnit)
504 <<
" yvalue " << yvalue
505 <<
" yfcn(yvalue/yunit) " << yInfo->
fFcn(yvalue/yInfo->
fUnit)
506 <<
" zvalue " << zvalue
507 <<
" zfcn(zvalue/zunit) " << zInfo->
fFcn(zvalue/zInfo->
fUnit)
518 return GetTId(name, warn);
525 if ( ! h3d )
return 0;
536 if ( ! h3d )
return 0.;
545 if ( ! h3d )
return 0.;
554 if ( ! h3d )
return 0.;
563 if ( ! h3d )
return 0;
574 if ( ! h3d )
return 0.;
583 if ( ! h3d )
return 0.;
592 if ( ! h3d )
return 0.;
601 if ( ! h3d )
return 0;
612 if ( ! h3d )
return 0.;
621 if ( ! h3d )
return 0.;
630 if ( ! h3d )
return 0.;
639 if ( ! h3d )
return false;
648 if ( ! h3d )
return false;
657 if ( ! h3d )
return false;
666 if ( ! h3d )
return false;
675 if ( ! h3d )
return "";
684 if ( ! h3d )
return "";
693 if ( ! h3d )
return "";
702 if ( ! h3d )
return "";
731 AddH3Annotation(h3d,
"none",
"none",
"none",
"none",
"none",
"none");
734 G4BinScheme::kLinear, G4BinScheme::kLinear, G4BinScheme::kLinear);
748 const std::vector<tools::histo::h3d*>& h3Vector)
755 G4bool onlyIfActive)
const