35 #include "tools/histo/p2d"
77 void AddP2Annotation(tools::histo::p2d* p2d,
91 p2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
92 p2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
93 p2d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
97 tools::histo::p2d* CreateToolsP2(
126 <<
" User binning scheme setting was ignored." <<
G4endl
127 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
131 return new tools::histo::p2d(title,
132 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
133 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
134 zfcn(zmin/zunit), zfcn(zmax/zunit));
140 std::vector<G4double> xedges;
141 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
142 std::vector<G4double> yedges;
143 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
144 return new tools::histo::p2d(title, xedges, yedges,
145 zfcn(zmin/zunit), zfcn(zmax/zunit));
150 tools::histo::p2d* CreateToolsP2(
152 const std::vector<G4double>& xedges,
153 const std::vector<G4double>& yedges,
170 std::vector<G4double> xnewEdges;
172 std::vector<G4double> ynewEdges;
175 return new tools::histo::p2d(title, xnewEdges, ynewEdges,
176 zfcn(zmin/zunit), zfcn(zmax/zunit));
182 void ConfigureToolsP2(tools::histo::p2d* p2d,
210 <<
" User binning scheme setting was ignored." <<
G4endl
211 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
215 p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
216 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
217 zfcn(zmin/zunit), zfcn(zmax/zunit));
221 std::vector<G4double> xedges;
222 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
223 std::vector<G4double> yedges;
224 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
225 p2d->configure(xedges, yedges, zfcn(zmin/zunit), zfcn(zmax/zunit));
230 void ConfigureToolsP2(tools::histo::p2d* p2d,
231 const std::vector<G4double>& xedges,
232 const std::vector<G4double>& yedges,
244 std::vector<G4double> xnewEdges;
249 std::vector<G4double> ynewEdges;
254 p2d->configure(xnewEdges, ynewEdges, zfcn(zmin/zunit), zfcn(zmax/zunit));
275 auto hnInformation =
fHnManager->AddHnInformation(name, 3);
276 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
277 hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
302 tools::histo::p2d* p2d
303 = CreateToolsP2(title,
304 nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
305 xunitName, yunitName, zunitName,
306 xfcnName, yfcnName, zfcnName,
307 xbinSchemeName, ybinSchemeName);
310 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
311 xfcnName, yfcnName, zfcnName);
317 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
318 xbinScheme, ybinScheme);
333 const std::vector<G4double>& xedges,
334 const std::vector<G4double>& yedges,
346 tools::histo::p2d* p2d
347 = CreateToolsP2(title, xedges, yedges, zmin, zmax,
348 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
352 p2d, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
356 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
383 if ( ! p2d )
return false;
385 auto info =
fHnManager->GetHnInformation(
id,
"SetP2");
393 p2d, nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
394 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
395 xbinSchemeName, ybinSchemeName);
398 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
399 xfcnName, yfcnName, zfcnName);
405 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
406 xbinScheme, ybinScheme);
416 const std::vector<G4double>& xedges,
417 const std::vector<G4double>& yedges,
425 if ( ! p2d )
return false;
427 auto info =
fHnManager->GetHnInformation(
id,
"SetP2");
434 ConfigureToolsP2(p2d, xedges, yedges, zmin, zmax,
435 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
438 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
439 xfcnName, yfcnName, zfcnName);
443 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
456 if ( ! p2d )
return false;
458 return p2d->scale(factor);
467 if ( ! p2d )
return false;
474 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillP2");
476 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillP2");
478 =
fHnManager->GetHnDimensionInformation(
id,
kZ,
"FillP2");
480 p2d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
481 yInfo->fFcn(yvalue/yInfo->fUnit),
482 zInfo->fFcn(zvalue/zInfo->fUnit), weight);
488 description <<
" id " <<
id
489 <<
" xvalue " << xvalue
490 <<
" xfcn(xvalue/xunit) " << xInfo->fFcn(xvalue/xInfo->fUnit)
491 <<
" yvalue " << yvalue
492 <<
" yfcn(yvalue/yunit) " << yInfo->fFcn(yvalue/yInfo->fUnit)
493 <<
" zvalue " << zvalue
494 <<
" zfcn(zvalue/zunit) " << zInfo->fFcn(zvalue/zInfo->fUnit)
495 <<
" weight " << weight;
505 return GetTId(name, warn);
512 if ( ! p2d )
return 0;
523 if ( ! p2d )
return 0;
532 if ( ! p2d )
return 0;
541 if ( ! p2d )
return 0;
550 if ( ! p2d )
return 0;
561 if ( ! p2d )
return 0;
570 if ( ! p2d )
return 0;
579 if ( ! p2d )
return 0;
590 if ( ! p2d )
return 0;
599 if ( ! p2d )
return 0;
608 if ( ! p2d )
return false;
617 if ( ! p2d )
return false;
626 if ( ! p2d )
return false;
635 if ( ! p2d )
return false;
644 if ( ! p2d )
return "";
653 if ( ! p2d )
return "";
662 if ( ! p2d )
return "";
671 if ( ! p2d )
return "";
700 AddP2Annotation(p2d,
"none",
"none",
"none",
"none",
"none",
"none");
717 const std::vector<tools::histo::p2d*>& p2Vector)
724 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::p2d *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::p2d * 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::p2d * > &tVector)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4bool GetIsActivation() const