31#include "tools/histo/h3d"
44 const std::array<G4HnDimension, kDim3>& bins,
45 const std::array<G4HnDimensionInformation, kDim3>& hnInfo)
48 auto newXBins(bins[
kX]);
50 auto newYBins(bins[
kY]);
52 auto newZBins(bins[
kZ]);
58 return new tools::histo::h3d(title,
59 newXBins.fNBins, newXBins.fMinValue, newXBins.fMaxValue,
60 newYBins.fNBins, newYBins.fMinValue, newYBins.fMaxValue,
61 newZBins.fNBins, newZBins.fMinValue, newZBins.fMaxValue);
64 return new tools::histo::h3d(title,
65 newXBins.fEdges, newYBins.fEdges, newZBins.fEdges);
71 tools::histo::h3d* ht,
72 const std::array<G4HnDimension, kDim3>& bins,
73 const std::array<G4HnDimensionInformation, kDim3>& hnInfo)
76 auto newXBins(bins[
kX]);
78 auto newYBins(bins[
kY]);
80 auto newZBins(bins[
kZ]);
87 newXBins.fNBins, newXBins.fMinValue, newXBins.fMaxValue,
88 newYBins.fNBins, newYBins.fMinValue, newYBins.fMaxValue,
89 newZBins.fNBins, newZBins.fMinValue, newZBins.fMaxValue);
93 ht->configure(newXBins.fEdges, newYBins.fEdges, newZBins.fEdges);
100 std::array<G4double, kDim3>& value,
G4double weight)
112 ht->fill(value[
kX], value[
kY], value[
kZ], weight);
120 std::ofstream& output)
127 if ( ! GetHnManager()->IsAscii() )
return true;
130 auto id = GetHnManager()->GetFirstId();
131 for (
const auto& [h3, info] : *GetTHnVector()) {
133 if ( (h3 ==
nullptr) || (! info->GetAscii()) ) {
140 Message(
kVL3,
"write on ascii",
"h3d", info->GetName());
142 output <<
"\n 3D histogram " <<
id++ <<
": " << h3->title()
143 <<
"\n \n \t \t \t X \t\t Y \t\t Z \t\t Bin Height" <<
G4endl;
145 for (
G4int j=0; j<
G4int(h3->axis_x().bins()); ++j) {
146 for (
G4int k=0; k<
G4int(h3->axis_y().bins()); ++k) {
147 for (
G4int l=0; l<
G4int(h3->axis_y().bins()); ++l) {
148 output <<
" " << j <<
"\t" << k <<
"\t" << l <<
"\t"
149 << h3->axis_x().bin_center(j) <<
"\t"
150 << h3->axis_y().bin_center(k) <<
"\t"
151 << h3->axis_y().bin_center(l) <<
"\t"
152 << h3->bin_height(j, k, l) <<
G4endl;
158 return output.good();
void Update(G4double &value, const G4HnDimensionInformation &hnInfo)