31#include "tools/histo/h1d"
44 const std::array<G4HnDimension, kDim1>& bins,
45 const std::array<G4HnDimensionInformation, kDim1>& hnInfo)
48 auto newBins(bins[
kX]);
52 return new tools::histo::h1d(title, newBins.fNBins, newBins.fMinValue, newBins.fMaxValue);
55 return new tools::histo::h1d(title, newBins.fEdges);
61 tools::histo::h1d* ht,
62 const std::array<G4HnDimension, kDim1>& bins,
63 const std::array<G4HnDimensionInformation, kDim1>& hnInfo)
66 auto newBins(bins[
kX]);
70 ht->configure(newBins.fNBins, newBins.fMinValue, newBins.fMaxValue);
74 ht->configure(newBins.fEdges);
81 std::array<G4double, kDim1>& value,
G4double weight)
89 ht->fill(value[
kX], weight);
97 std::ofstream& output)
104 if ( ! GetHnManager()->IsAscii() )
return true;
107 auto id = GetHnManager()->GetFirstId();
108 for (
const auto& [h1, info] : *GetTHnVector()) {
110 if ( (h1 ==
nullptr) || (! info->GetAscii()) ) {
117 Message(
kVL3,
"write on ascii",
"h1d", info->GetName());
119 output <<
"\n 1D histogram " <<
id++ <<
": " << h1->title()
120 <<
"\n \n \t X \t\t Bin Height" <<
G4endl;
122 for (
G4int j=0; j<
G4int(h1->axis().bins()); ++j) {
123 output <<
" " << j <<
"\t"
124 << h1->axis().bin_center(j) <<
"\t"
125 << h1->bin_height(j) <<
G4endl;
129 return output.good();
void Update(G4double &value, const G4HnDimensionInformation &hnInfo)