35 #include "tools/histo/h2d"
74 void AddH2Annotation(tools::histo::h2d* h2d,
84 h2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
85 h2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
89 tools::histo::h2d* CreateToolsH2(
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::h2d(title,
119 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
120 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
126 std::vector<G4double> xedges;
127 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
128 std::vector<G4double> yedges;
129 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
130 return new tools::histo::h2d(title, xedges, yedges);
135 tools::histo::h2d* CreateToolsH2(
137 const std::vector<G4double>& xedges,
138 const std::vector<G4double>& yedges,
150 std::vector<G4double> xnewEdges;
152 std::vector<G4double> ynewEdges;
155 return new tools::histo::h2d(title, xnewEdges, ynewEdges);
161 void ConfigureToolsH2(tools::histo::h2d* h2d,
184 <<
" User binning scheme setting was ignored." <<
G4endl
185 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
189 h2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
190 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
194 std::vector<G4double> xedges;
195 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
196 std::vector<G4double> yedges;
197 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
198 h2d->configure(xedges, yedges);
203 void ConfigureToolsH2(tools::histo::h2d* h2d,
204 const std::vector<G4double>& xedges,
205 const std::vector<G4double>& yedges,
213 std::vector<G4double> xnewEdges;
218 std::vector<G4double> ynewEdges;
221 h2d->configure(xnewEdges, ynewEdges);
240 auto hnInformation =
fHnManager->AddHnInformation(name, 2);
241 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
242 hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
263 tools::histo::h2d* h2d
264 = CreateToolsH2(title, nxbins, xmin, xmax, nybins, ymin, ymax,
265 xunitName, yunitName, xfcnName, yfcnName,
266 xbinSchemeName, ybinSchemeName);
269 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
275 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
290 const std::vector<G4double>& xedges,
291 const std::vector<G4double>& yedges,
300 tools::histo::h2d* h2d
301 = CreateToolsH2(title, xedges, yedges,
302 xunitName, yunitName, xfcnName, yfcnName);
305 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
332 if ( ! h2d )
return false;
334 auto info =
fHnManager->GetHnInformation(
id,
"SetH2");
342 h2d, nxbins, xmin, xmax, nybins, ymin, ymax,
343 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName, ybinSchemeName);
346 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
352 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
362 const std::vector<G4double>& xedges,
363 const std::vector<G4double>& yedges,
368 if ( ! h2d )
return false;
370 auto info =
fHnManager->GetHnInformation(
id,
"SetH2");
377 ConfigureToolsH2(h2d, xedges, yedges, xunitName, yunitName, xfcnName, yfcnName);
380 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
396 if ( ! h2d )
return false;
398 return h2d->scale(factor);
407 if ( ! h2d )
return false;
414 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillH2");
416 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillH2");
418 h2d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
419 yInfo->
fFcn(yvalue/yInfo->
fUnit), weight);
423 description <<
" id " <<
id
424 <<
" xvalue " << xvalue
425 <<
" xfcn(xvalue/xunit) " << xInfo->
fFcn(xvalue/xInfo->
fUnit)
426 <<
" yvalue " << yvalue
427 <<
" yfcn(yvalue/yunit) " << yInfo->
fFcn(yvalue/yInfo->
fUnit)
428 <<
" weight " << weight;
438 return GetTId(name, warn);
445 if ( ! h2d )
return 0;
456 if ( ! h2d )
return 0;
465 if ( ! h2d )
return 0;
474 if ( ! h2d )
return 0;
483 if ( ! h2d )
return 0;
494 if ( ! h2d )
return 0;
503 if ( ! h2d )
return 0;
512 if ( ! h2d )
return 0;
521 if ( ! h2d )
return false;
530 if ( ! h2d )
return false;
539 if ( ! h2d )
return false;
548 if ( ! h2d )
return false;
557 if ( ! h2d )
return "";
566 if ( ! h2d )
return "";
575 if ( ! h2d )
return "";
584 if ( ! h2d )
return "";
613 AddH2Annotation(h2d,
"none",
"none",
"none",
"none");
630 const std::vector<tools::histo::h2d*>& h2Vector)
636 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::h2d *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::h2d * 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::h2d * > &tVector)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4bool GetIsActivation() const