34#include "tools/histo/h1d"
74 h1d->add_annotation(tools::histo::key_axis_x_title(), axisTitle);
93 Warn(
"User binning scheme setting was ignored.\n"
94 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
97 return new tools::histo::h1d(title, nbins, fcn(xmin/unit), fcn(xmax/unit));
101 std::vector<G4double> edges;
102 ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, edges);
103 return new tools::histo::h1d(title, edges);
109 const std::vector<G4double>& edges,
117 std::vector<G4double> newEdges;
120 return new tools::histo::h1d(title, newEdges);
139 Warn(
"User binning scheme setting was ignored.\n"
140 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
144 h1d->configure(nbins, fcn(xmin/unit), fcn(xmax/unit));
148 std::vector<G4double> edges;
149 ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, edges);
150 h1d->configure(edges);
156 const std::vector<G4double>& edges,
163 std::vector<G4double> newEdges;
166 h1d->configure(newEdges);
182 hnInformation->AddDimension(unitName, fcnName, binScheme);
199 =
CreateToolsH1(title, nbins, xmin, xmax, unitName, fcnName, binSchemeName,
219 const std::vector<G4double>& edges,
248 if ( ! h1d )
return false;
250 auto info =
fHnManager->GetHnInformation(
id,
"SetH1");
273 const std::vector<G4double>& edges,
278 if ( ! h1d )
return false;
280 auto info =
fHnManager->GetHnInformation(
id,
"SetH1");
304 if ( ! h1d )
return false;
306 return h1d->scale(factor);
313 if ( ! h1d )
return false;
321 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillH1");
322 h1d->fill(info->fFcn(value/info->fUnit), weight);
326 " id " + to_string(
id) +
" value " + to_string(value) +
327 " fcn(value/unit) " + to_string(info->fFcn(value/info->fUnit)) +
328 " weight " + to_string(weight));
344 if ( ! h1d )
return 0;
355 if ( ! h1d )
return 0.;
364 if ( ! h1d )
return 0.;
373 if ( ! h1d )
return 0.;
382 if ( ! h1d )
return false;
391 if ( ! h1d )
return false;
400 if ( ! h1d )
return false;
409 if ( ! h1d )
return "";
419 if ( ! h1d )
return "";
428 if ( ! h1d )
return "";
446 auto info =
fHnManager->GetHnInformation(
id,
"WriteOnAscii");
448 if ( ! info->GetAscii() )
continue;
451 Message(
kVL3,
"write on ascii",
"h1d", info->GetName());
453 output <<
"\n 1D histogram " <<
id <<
": " << h1->title()
454 <<
"\n \n \t X \t\t Bin Height" <<
G4endl;
456 for (
G4int j=0; j<
G4int(h1->axis().bins()); ++j) {
457 output <<
" " << j <<
"\t"
458 << h1->axis().bin_center(j) <<
"\t"
459 << h1->bin_height(j) <<
G4endl;
463 return output.good();
491 const std::vector<tools::histo::h1d*>& h1Vector)
498 G4bool onlyIfActive)
const
G4bool GetIsActivation() const
std::vector< tools::histo::h1d * > fTVector
tools::histo::h1d * 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::h1d *t, const G4String &name)
void AddTVector(const std::vector< tools::histo::h1d * > &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)