34#include "tools/histo/h3d"
85 h3d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
86 h3d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
87 h3d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
121 Warn(
"User binning scheme setting was ignored.\n"
122 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
125 return new tools::histo::h3d(title,
126 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
127 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
128 nzbins, zfcn(zmin/zunit), zfcn(zmax/zunit));
134 std::vector<G4double> xedges;
135 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
136 std::vector<G4double> yedges;
137 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
138 std::vector<G4double> zedges;
139 ComputeEdges(nzbins, zmin, zmax, zunit, zfcn, zbinScheme, zedges);
140 return new tools::histo::h3d(title, xedges, yedges, zedges);
147 const std::vector<G4double>& xedges,
148 const std::vector<G4double>& yedges,
149 const std::vector<G4double>& zedges,
165 std::vector<G4double> xnewEdges;
167 std::vector<G4double> ynewEdges;
169 std::vector<G4double> znewEdges;
172 return new tools::histo::h3d(title, xnewEdges, ynewEdges, znewEdges);
207 Warn(
"User binning scheme setting was ignored.\n"
208 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
211 h3d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
212 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
213 nzbins, zfcn(zmin/zunit), zfcn(zmax/zunit));
217 std::vector<G4double> xedges;
218 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
219 std::vector<G4double> yedges;
220 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
221 std::vector<G4double> zedges;
222 ComputeEdges(nzbins, zmin, zmax, zunit, zfcn, zbinScheme, zedges);
223 h3d->configure(xedges, yedges, zedges);
229 const std::vector<G4double>& xedges,
230 const std::vector<G4double>& yedges,
231 const std::vector<G4double>& zedges,
241 std::vector<G4double> xnewEdges;
246 std::vector<G4double> ynewEdges;
251 std::vector<G4double> znewEdges;
254 h3d->configure(xnewEdges, ynewEdges, znewEdges);
277 hnInformation->AddDimension(xunitName, xfcnName, xbinScheme);
278 hnInformation->AddDimension(yunitName, yfcnName, ybinScheme);
279 hnInformation->AddDimension(zunitName, zfcnName, zbinScheme);
302 tools::histo::h3d* h3d
304 nxbins, xmin, xmax, nybins, ymin, ymax, nzbins, zmin, zmax,
305 xunitName, yunitName, zunitName,
306 xfcnName, yfcnName, zfcnName,
307 xbinSchemeName, ybinSchemeName, zbinSchemeName,
fkClass);
311 xfcnName, yfcnName, zfcnName);
318 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
319 xbinScheme, ybinScheme, zbinScheme);
331 const std::vector<G4double>& xedges,
332 const std::vector<G4double>& yedges,
333 const std::vector<G4double>& zedges,
342 tools::histo::h3d* h3d
344 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
348 xfcnName, yfcnName, zfcnName);
352 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
377 if ( ! h3d )
return false;
379 auto info =
fHnManager->GetHnInformation(
id,
"SetH3");
385 h3d, nxbins, xmin, xmax, nybins, ymin, ymax, nzbins, zmin, zmax,
386 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
387 xbinSchemeName, ybinSchemeName, zbinSchemeName,
fkClass);
391 xfcnName, yfcnName, zfcnName);
398 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
399 xbinScheme, ybinScheme, zbinScheme);
409 const std::vector<G4double>& xedges,
410 const std::vector<G4double>& yedges,
411 const std::vector<G4double>& zedges,
418 if ( ! h3d )
return false;
420 auto info =
fHnManager->GetHnInformation(
id,
"SetH3");
426 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
430 xfcnName, yfcnName, zfcnName);
434 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
447 if ( ! h3d )
return false;
449 return h3d->scale(factor);
458 if ( ! h3d )
return false;
465 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillH3");
467 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillH3");
469 =
fHnManager->GetHnDimensionInformation(
id,
kZ,
"FillH3");
471 h3d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
473 zInfo->
fFcn(zvalue/zInfo->
fUnit), weight);
477 " id " + to_string(
id) +
478 " xvalue " + to_string(xvalue) +
479 " xfcn(xvalue/xunit) " + to_string(xInfo->
fFcn(xvalue/xInfo->
fUnit)) +
480 " yvalue " + to_string(yvalue) +
481 " yfcn(yvalue/yunit) " + to_string(yInfo->
fFcn(yvalue/yInfo->
fUnit)) +
482 " zvalue " + to_string(zvalue) +
483 " zfcn(zvalue/zunit) " + to_string(zInfo->
fFcn(zvalue/zInfo->
fUnit)) +
484 " weight " + to_string(weight));
500 if ( ! h3d )
return 0;
511 if ( ! h3d )
return 0.;
520 if ( ! h3d )
return 0.;
529 if ( ! h3d )
return 0.;
538 if ( ! h3d )
return 0;
549 if ( ! h3d )
return 0.;
558 if ( ! h3d )
return 0.;
567 if ( ! h3d )
return 0.;
576 if ( ! h3d )
return 0;
587 if ( ! h3d )
return 0.;
596 if ( ! h3d )
return 0.;
605 if ( ! h3d )
return 0.;
614 if ( ! h3d )
return false;
623 if ( ! h3d )
return false;
632 if ( ! h3d )
return false;
641 if ( ! h3d )
return false;
650 if ( ! h3d )
return "";
659 if ( ! h3d )
return "";
668 if ( ! h3d )
return "";
677 if ( ! h3d )
return "";
693 auto info =
fHnManager->GetHnInformation(
id,
"WriteOnAscii");
695 if ( ! info->GetAscii() )
continue;
698 Message(
kVL3,
"write on ascii",
"h3d", info->GetName());
700 output <<
"\n 3D histogram " <<
id <<
": " << h3->title()
701 <<
"\n \n \t \t \t X \t\t Y \t\t Z \t\t Bin Height" <<
G4endl;
703 for (
G4int j=0; j<
G4int(h3->axis_x().bins()); ++j) {
704 for (
G4int k=0; k<
G4int(h3->axis_y().bins()); ++k) {
705 for (
G4int l=0; l<
G4int(h3->axis_y().bins()); ++l) {
706 output <<
" " << j <<
"\t" << k <<
"\t" << l <<
"\t"
707 << h3->axis_x().bin_center(j) <<
"\t"
708 << h3->axis_y().bin_center(k) <<
"\t"
709 << h3->axis_y().bin_center(l) <<
"\t"
710 << h3->bin_height(j, k, l) <<
G4endl;
716 return output.good();
744 const std::vector<tools::histo::h3d*>& h3Vector)
751 G4bool onlyIfActive)
const
G4bool GetIsActivation() const
std::vector< tools::histo::h3d * > fTVector
tools::histo::h3d * GetTInFunction(G4int id, std::string_view functionName, G4bool warn=true, G4bool onlyIfActive=true) const
const G4AnalysisManagerState & fState
G4int GetTId(const G4String &name, G4bool warn=true) const
G4int RegisterT(tools::histo::h3d *t, const G4String &name)
void AddTVector(const std::vector< tools::histo::h3d * > &tVector)
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
std::shared_ptr< G4HnManager > fHnManager
G4bool IsVerbose(G4int verboseLevel) const
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4double GetUnitValue(const G4String &unit)
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4double unit, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)
G4Fcn GetFunction(const G4String &fcnName)
const char * name(G4int ptype)