31#include "tools/histo/h1d"
44 const std::array<G4HnDimension, 1>& bins,
45 const std::array<G4HnDimensionInformation, 1>& 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, 1>& bins,
63 const std::array<G4HnDimensionInformation, 1>& hnInfo)
66 auto newBins(bins[
kX]);
70 ht->configure(newBins.fNBins, newBins.fMinValue, newBins.fMaxValue);
74 ht->configure(newBins.fEdges);
81 std::array<G4double, 1>& 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 ( ! info->GetAscii() ) {
116 Message(
kVL3,
"write on ascii",
"h1d", info->GetName());
118 output <<
"\n 1D histogram " <<
id++ <<
": " << h1->title()
119 <<
"\n \n \t X \t\t Bin Height" <<
G4endl;
121 for (
G4int j=0; j<
G4int(h1->axis().bins()); ++j) {
122 output <<
" " << j <<
"\t"
123 << h1->axis().bin_center(j) <<
"\t"
124 << h1->bin_height(j) <<
G4endl;
128 return output.good();
void Update(G4double &value, const G4HnDimensionInformation &hnInfo)