34#include "tools/histo/p1d"
80 p1d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
81 p1d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
105 Warn(
"User binning scheme setting was ignored.\n"
106 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
109 if ( ymin == 0. && ymax == 0.) {
110 return new tools::histo::p1d(title,
111 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
113 return new tools::histo::p1d(title,
114 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
115 yfcn(ymin/yunit), yfcn(ymax/yunit));
120 std::vector<G4double> edges;
121 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
122 if ( ymin == 0. && ymax == 0.) {
123 return new tools::histo::p1d(title, edges);
125 return new tools::histo::p1d(title, edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
132 const std::vector<G4double>& edges,
145 std::vector<G4double> newEdges;
148 return new tools::histo::p1d(title, newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
172 Warn(
"User binning scheme setting was ignored.\n"
173 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
176 if ( ymin == 0. && ymax == 0. ) {
177 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
179 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
180 yfcn(ymin/yunit), yfcn(ymax/yunit));
185 std::vector<G4double> edges;
186 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
187 if ( ymin == 0. && ymax == 0. ) {
188 p1d->configure(edges);
190 p1d->configure(edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
197 const std::vector<G4double>& edges,
209 std::vector<G4double> newEdges;
212 if ( ymin == 0. && ymax == 0. ) {
213 p1d->configure(newEdges);
215 p1d->configure(newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
234 hnInformation->AddDimension(xunitName, xfcnName, xbinScheme);
252 tools::histo::p1d* p1d
254 xunitName, yunitName, xfcnName, yfcnName,
263 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
275 const std::vector<G4double>& edges,
282 tools::histo::p1d* p1d
284 xunitName, yunitName, xfcnName, yfcnName);
310 if ( ! p1d )
return false;
312 auto info =
fHnManager->GetHnInformation(
id,
"SetP1");
318 p1d, nbins, xmin, xmax, ymin, ymax,
319 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName,
fkClass);
327 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
337 const std::vector<G4double>& edges,
343 if ( ! p1d )
return false;
345 auto info =
fHnManager->GetHnInformation(
id,
"SetP1");
351 xunitName, yunitName, xfcnName, yfcnName);
371 if ( ! p1d )
return false;
373 return p1d->scale(factor);
381 if ( ! p1d )
return false;
389 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillP1");
391 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillP1");
393 p1d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
394 yInfo->fFcn(yvalue/yInfo->fUnit), weight);
398 " id " + to_string(
id) +
399 " xvalue " + to_string(xvalue) +
400 " xfcn(xvalue/xunit) " + to_string(xInfo->fFcn(xvalue/xInfo->fUnit)) +
401 " yvalue " + to_string(yvalue) +
402 " yfcn(yvalue/yunit) " + to_string(yInfo->fFcn(yvalue/yInfo->fUnit)) +
403 " weight " + to_string(weight));
419 if ( ! p1d )
return 0;
430 if ( ! p1d )
return 0.;
439 if ( ! p1d )
return 0.;
448 if ( ! p1d )
return 0.;
459 if ( ! p1d )
return 0.;
468 if ( ! p1d )
return 0.;
477 if ( ! p1d )
return false;
486 if ( ! p1d )
return false;
495 if ( ! p1d )
return false;
504 if ( ! p1d )
return "";
514 if ( ! p1d )
return "";
523 if ( ! p1d )
return "";
539 auto info =
fHnManager->GetHnInformation(
id,
"WriteOnAscii");
541 if ( ! info->GetAscii() )
continue;
544 Message(
kVL3,
"write on ascii",
"p1d", info->GetName());
546 output <<
"\n 1D profile " <<
id <<
": " << p1->title()
547 <<
"\n \n \t X \t\t MeanY" <<
G4endl;
549 for (
G4int j=0; j<
G4int(p1->axis().bins()); ++j) {
550 auto sw = p1->bin_Sw(j);
551 auto svw = p1->bin_Svw(j);
552 auto mean = ( sw != 0. ) ? (svw / sw) : 0.;
553 output <<
" " << j <<
"\t"
554 << p1->axis().bin_center(j) <<
"\t"
559 return output.good();
586 const std::vector<tools::histo::p1d*>& p1Vector)
593 G4bool onlyIfActive)
const
G4bool GetIsActivation() const
std::vector< tools::histo::p1d * > fTVector
tools::histo::p1d * 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::p1d *t, const G4String &name)
void AddTVector(const std::vector< tools::histo::p1d * > &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)