35 #include "tools/histo/h3d"
39 using namespace G4Analysis;
78 void AddH3Annotation(tools::histo::h3d* h3d,
92 h3d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
93 h3d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
94 h3d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
98 tools::histo::h3d* CreateToolsH3(
129 <<
" User binning scheme setting was ignored." <<
G4endl
130 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
134 return new tools::histo::h3d(title,
135 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
136 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
137 nzbins, zfcn(zmin/zunit), zfcn(zmax/zunit));
143 std::vector<G4double> xedges;
144 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
145 std::vector<G4double> yedges;
146 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
147 std::vector<G4double> zedges;
148 ComputeEdges(nzbins, zmin, zmax, zunit, zfcn, zbinScheme, zedges);
149 return new tools::histo::h3d(title, xedges, yedges, zedges);
154 tools::histo::h3d* CreateToolsH3(
156 const std::vector<G4double>& xedges,
157 const std::vector<G4double>& yedges,
158 const std::vector<G4double>& zedges,
174 std::vector<G4double> xnewEdges;
176 std::vector<G4double> ynewEdges;
178 std::vector<G4double> znewEdges;
181 return new tools::histo::h3d(title, xnewEdges, ynewEdges, znewEdges);
187 void ConfigureToolsH3(tools::histo::h3d* h3d,
217 <<
" User binning scheme setting was ignored." <<
G4endl
218 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
222 h3d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
223 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
224 nzbins, zfcn(zmin/zunit), zfcn(zmax/zunit));
228 std::vector<G4double> xedges;
229 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
230 std::vector<G4double> yedges;
231 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
232 std::vector<G4double> zedges;
233 ComputeEdges(nzbins, zmin, zmax, zunit, zfcn, zbinScheme, zedges);
234 h3d->configure(xedges, yedges, zedges);
239 void ConfigureToolsH3(tools::histo::h3d* h3d,
240 const std::vector<G4double>& xedges,
241 const std::vector<G4double>& yedges,
242 const std::vector<G4double>& zedges,
252 std::vector<G4double> xnewEdges;
257 std::vector<G4double> ynewEdges;
262 std::vector<G4double> znewEdges;
265 h3d->configure(xnewEdges, ynewEdges, znewEdges);
287 auto hnInformation =
fHnManager->AddHnInformation(name, 3);
288 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
289 hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
290 hnInformation->
AddDimension(zunitName, zfcnName, zbinScheme);
315 tools::histo::h3d* h3d
316 = CreateToolsH3(title,
317 nxbins, xmin, xmax, nybins, ymin, ymax, nzbins, zmin, zmax,
318 xunitName, yunitName, zunitName,
319 xfcnName, yfcnName, zfcnName,
320 xbinSchemeName, ybinSchemeName, zbinSchemeName);
323 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
324 xfcnName, yfcnName, zfcnName);
331 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
332 xbinScheme, ybinScheme, zbinScheme);
347 const std::vector<G4double>& xedges,
348 const std::vector<G4double>& yedges,
349 const std::vector<G4double>& zedges,
360 tools::histo::h3d* h3d
361 = CreateToolsH3(title, xedges, yedges, zedges,
362 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
365 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
366 xfcnName, yfcnName, zfcnName);
370 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
398 if ( ! h3d )
return false;
408 h3d, nxbins, xmin, xmax, nybins, ymin, ymax, nzbins, zmin, zmax,
409 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
410 xbinSchemeName, ybinSchemeName, zbinSchemeName);
413 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
414 xfcnName, yfcnName, zfcnName);
421 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
422 xbinScheme, ybinScheme, zbinScheme);
432 const std::vector<G4double>& xedges,
433 const std::vector<G4double>& yedges,
434 const std::vector<G4double>& zedges,
441 if ( ! h3d )
return false;
450 ConfigureToolsH3(h3d, xedges, yedges, zedges,
451 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
454 AddH3Annotation(h3d, xunitName, yunitName, zunitName,
455 xfcnName, yfcnName, zfcnName);
459 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
472 if ( ! h3d )
return false;
474 return h3d->scale(factor);
483 if ( ! h3d )
return false;
490 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillH3");
492 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillH3");
494 =
fHnManager->GetHnDimensionInformation(
id,
kZ,
"FillH3");
496 h3d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
502 description <<
" id " <<
id
503 <<
" xvalue " << xvalue
504 <<
" xfcn(xvalue/xunit) " << xInfo->
fFcn(xvalue/xInfo->
fUnit)
505 <<
" yvalue " << yvalue
506 <<
" yfcn(yvalue/yunit) " << yInfo->
fFcn(yvalue/yInfo->
fUnit)
507 <<
" zvalue " << zvalue
508 <<
" zfcn(zvalue/zunit) " << zInfo->
fFcn(zvalue/zInfo->
fUnit)
519 return GetTId(name, warn);
526 if ( ! h3d )
return 0;
537 if ( ! h3d )
return 0.;
546 if ( ! h3d )
return 0.;
555 if ( ! h3d )
return 0.;
564 if ( ! h3d )
return 0;
575 if ( ! h3d )
return 0.;
584 if ( ! h3d )
return 0.;
593 if ( ! h3d )
return 0.;
602 if ( ! h3d )
return 0;
613 if ( ! h3d )
return 0.;
622 if ( ! h3d )
return 0.;
631 if ( ! h3d )
return 0.;
640 if ( ! h3d )
return false;
649 if ( ! h3d )
return false;
658 if ( ! h3d )
return false;
667 if ( ! h3d )
return false;
676 if ( ! h3d )
return "";
685 if ( ! h3d )
return "";
694 if ( ! h3d )
return "";
703 if ( ! h3d )
return "";
732 AddH3Annotation(h3d,
"none",
"none",
"none",
"none",
"none",
"none");
749 const std::vector<tools::histo::h3d*>& h3Vector)
756 G4bool onlyIfActive)
const
G4int RegisterT(tools::histo::h3d *t, const G4String &name)
const XML_Char XML_Encoding * info
const G4AnalysisVerbose * GetVerboseL2() const
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)
std::ostringstream G4ExceptionDescription
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
G4int GetTId(const G4String &name, G4bool warn=true) const
G4bool GetIsActivation() const
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4double unit, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)
gr1 SetTitle("Dose rate distribution")
G4double GetUnitValue(const G4String &unit)
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)
const G4AnalysisVerbose * GetVerboseL4() const
tools::histo::h3d * GetTInFunction(G4int id, G4String functionName, G4bool warn=true, G4bool onlyIfActive=true) const
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)
const G4AnalysisManagerState & fState
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
G4Fcn GetFunction(const G4String &fcnName)
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
void AddTVector(const std::vector< tools::histo::h3d * > &tVector)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
std::shared_ptr< G4HnManager > fHnManager
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)