35 #include "tools/histo/p1d"
77 void AddP1Annotation(tools::histo::p1d* p1d,
87 p1d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
88 p1d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
92 tools::histo::p1d* CreateToolsP1(
const G4String& title,
113 <<
" User binning scheme setting was ignored." <<
G4endl
114 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
118 return new tools::histo::p1d(title,
119 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
120 yfcn(ymin/yunit), yfcn(ymax/yunit));
124 std::vector<G4double> edges;
125 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
126 return new tools::histo::p1d(title, edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
131 tools::histo::p1d* CreateToolsP1(
const G4String& title,
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));
152 void ConfigureToolsP1(tools::histo::p1d* p1d,
173 <<
" User binning scheme setting was ignored." <<
G4endl
174 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
178 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
179 yfcn(ymin/yunit), yfcn(ymax/yunit));
183 std::vector<G4double> edges;
184 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
185 p1d->configure(edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
190 void ConfigureToolsP1(tools::histo::p1d* p1d,
191 const std::vector<G4double>& edges,
203 std::vector<G4double> newEdges;
206 p1d->configure(newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
222 auto hnInformation =
fHnManager->AddHnInformation(name, 2);
223 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
243 tools::histo::p1d* p1d
244 = CreateToolsP1(title, nbins, xmin, xmax, ymin, ymax,
245 xunitName, yunitName, xfcnName, yfcnName,
249 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
254 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
268 const std::vector<G4double>& edges,
277 tools::histo::p1d* p1d
278 = CreateToolsP1(title, edges, ymin, ymax,
279 xunitName, yunitName, xfcnName, yfcnName);
282 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
307 if ( ! p1d )
return false;
309 auto info =
fHnManager->GetHnInformation(
id,
"SetP1");
317 p1d, nbins, xmin, xmax, ymin, ymax,
318 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName);
321 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
326 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
336 const std::vector<G4double>& edges,
342 if ( ! p1d )
return false;
344 auto info =
fHnManager->GetHnInformation(
id,
"SetP1");
351 ConfigureToolsP1(p1d, edges, ymin, ymax,
352 xunitName, yunitName, xfcnName, yfcnName);
355 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
372 if ( ! p1d )
return false;
374 return p1d->scale(factor);
382 if ( ! p1d )
return false;
390 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillP1");
392 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillP1");
394 p1d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
395 yInfo->fFcn(yvalue/yInfo->fUnit), weight);
400 description <<
" id " <<
id
401 <<
" xvalue " << xvalue
402 <<
" xfcn(xvalue/xunit) " << xInfo->fFcn(xvalue/xInfo->fUnit)
403 <<
" yvalue " << yvalue
404 <<
" yfcn(yvalue/yunit) " << yInfo->fFcn(yvalue/yInfo->fUnit)
405 <<
" weight " << weight;
415 return GetTId(name, warn);
422 if ( ! p1d )
return 0;
433 if ( ! p1d )
return 0;
442 if ( ! p1d )
return 0;
451 if ( ! p1d )
return 0;
462 if ( ! p1d )
return 0;
471 if ( ! p1d )
return 0;
480 if ( ! p1d )
return false;
489 if ( ! p1d )
return false;
498 if ( ! p1d )
return false;
507 if ( ! p1d )
return "";
517 if ( ! p1d )
return "";
526 if ( ! p1d )
return "";
544 AddP1Annotation(p1d,
"none",
"none",
"none",
"none");
560 const std::vector<tools::histo::p1d*>& p1Vector)
567 G4bool onlyIfActive)
const
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)
std::ostringstream G4ExceptionDescription
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)
std::shared_ptr< G4HnManager > fHnManager
G4int RegisterT(tools::histo::p1d *t, const G4String &name)
const G4AnalysisVerbose * GetVerboseL2() const
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
const G4AnalysisManagerState & fState
G4int GetTId(const G4String &name, G4bool warn=true) const
const G4AnalysisVerbose * GetVerboseL4() const
tools::histo::p1d * GetTInFunction(G4int id, G4String functionName, G4bool warn=true, G4bool onlyIfActive=true) const
G4double GetUnitValue(const G4String &unit)
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const G4double factor
G4Fcn GetFunction(const G4String &fcnName)
void AddTVector(const std::vector< tools::histo::p1d * > &tVector)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4bool GetIsActivation() const