35 #include "tools/histo/p2d"
44 fBaseToolsManager(
"P2"),
53 std::vector<tools::histo::p2d*>::iterator it;
87 xInformation->
fUnit = xunit;
88 xInformation->
fFcn = xfcn;
95 yInformation->
fUnit = yunit;
96 yInformation->
fFcn = yfcn;
103 zInformation->
fUnit = zunit;
104 zInformation->
fFcn = zfcn;
109 void AddP2Annotation(tools::histo::p2d* p2d,
123 p2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
124 p2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
125 p2d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
129 tools::histo::p2d* CreateToolsP2(
158 <<
" User binning scheme setting was ignored." <<
G4endl
159 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
163 return new tools::histo::p2d(title,
164 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
165 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
166 zfcn(zmin/zunit), zfcn(zmax/zunit));
172 std::vector<G4double> xedges;
173 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
174 std::vector<G4double> yedges;
175 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
176 return new tools::histo::p2d(title, xedges, yedges,
177 zfcn(zmin/zunit), zfcn(zmax/zunit));
182 tools::histo::p2d* CreateToolsP2(
184 const std::vector<G4double>& xedges,
185 const std::vector<G4double>& yedges,
202 std::vector<G4double> xnewEdges;
204 std::vector<G4double> ynewEdges;
207 return new tools::histo::p2d(title, xnewEdges, ynewEdges,
208 zfcn(zmin/zunit), zfcn(zmax/zunit));
214 void ConfigureToolsP2(tools::histo::p2d* p2d,
242 <<
" User binning scheme setting was ignored." <<
G4endl
243 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
247 p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
248 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
249 zfcn(zmin/zunit), zfcn(zmax/zunit));
253 std::vector<G4double> xedges;
254 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
255 std::vector<G4double> yedges;
256 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
257 p2d->configure(xedges, yedges, zfcn(zmin/zunit), zfcn(zmax/zunit));
262 void ConfigureToolsP2(tools::histo::p2d* p2d,
263 const std::vector<G4double>& xedges,
264 const std::vector<G4double>& yedges,
276 std::vector<G4double> xnewEdges;
281 std::vector<G4double> ynewEdges;
286 p2d->configure(xnewEdges, ynewEdges, zfcn(zmin/zunit), zfcn(zmax/zunit));
299 G4bool onlyIfActive)
const
304 G4String inFunction =
"G4P2ToolsManager::";
305 inFunction += functionName;
307 description <<
" " <<
"profile " <<
id <<
" does not exist.";
342 xfcnName, yfcnName, zfcnName,
343 xunit, yunit, zunit, xfcn, yfcn, zfcn,
380 tools::histo::p2d* p2d
381 = CreateToolsP2(title,
382 nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
383 xunitName, yunitName, zunitName,
384 xfcnName, yfcnName, zfcnName,
385 xbinSchemeName, ybinSchemeName);
388 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
389 xfcnName, yfcnName, zfcnName);
395 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
396 xbinScheme, ybinScheme);
411 const std::vector<G4double>& xedges,
412 const std::vector<G4double>& yedges,
424 tools::histo::p2d* p2d
425 = CreateToolsP2(title, xedges, yedges, zmin, zmax,
426 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
430 p2d, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
434 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
461 if ( ! p2d )
return false;
471 p2d, nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
472 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
473 xbinSchemeName, ybinSchemeName);
476 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
477 xfcnName, yfcnName, zfcnName);
483 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
484 xbinScheme, ybinScheme);
494 const std::vector<G4double>& xedges,
495 const std::vector<G4double>& yedges,
503 if ( ! p2d )
return false;
512 ConfigureToolsP2(p2d, xedges, yedges, zmin, zmax,
513 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
516 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
517 xfcnName, yfcnName, zfcnName);
521 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
534 if ( ! p2d )
return false;
536 return p2d->scale(factor);
545 if ( ! p2d )
return false;
558 p2d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
560 zInfo->
fFcn(zvalue/zInfo->
fUnit), weight);
566 description <<
" id " <<
id
567 <<
" xvalue " << xvalue
568 <<
" xfcn(xvalue/xunit) " << xInfo->
fFcn(xvalue/xInfo->
fUnit)
569 <<
" yvalue " << yvalue
570 <<
" yfcn(yvalue/yunit) " << yInfo->
fFcn(yvalue/yInfo->
fUnit)
571 <<
" zvalue " << zvalue
572 <<
" zfcn(zvalue/zunit) " << zInfo->
fFcn(zvalue/zInfo->
fUnit)
573 <<
" weight " << weight;
583 std::map<G4String, G4int>::const_iterator it =
fP2NameIdMap.find(name);
586 G4String inFunction =
"G4P2ToolsManager::GetP2Id";
588 description <<
" " <<
"profile " << name <<
" does not exist.";
600 if ( ! p2d )
return 0;
611 if ( ! p2d )
return 0;
620 if ( ! p2d )
return 0;
628 tools::histo::p2d* p2d =
GetP2InFunction(
id,
"GetP2XWidth",
true,
false);
629 if ( ! p2d )
return 0;
638 if ( ! p2d )
return 0;
649 if ( ! p2d )
return 0;
658 if ( ! p2d )
return 0;
666 tools::histo::p2d* p2d =
GetP2InFunction(
id,
"GetP2YWidth",
true,
false);
667 if ( ! p2d )
return 0;
678 if ( ! p2d )
return 0;
687 if ( ! p2d )
return 0;
696 if ( ! p2d )
return false;
705 if ( ! p2d )
return false;
714 if ( ! p2d )
return false;
723 if ( ! p2d )
return false;
732 if ( ! p2d )
return "";
741 if ( ! p2d )
return "";
750 if ( ! p2d )
return "";
759 if ( ! p2d )
return "";
788 AddP2Annotation(p2d,
"none",
"none",
"none",
"none",
"none",
"none");
805 const std::vector<tools::histo::p2d*>& p2Vector)
811 std::vector<tools::histo::p2d*>::const_iterator itw = p2Vector.begin();
812 std::vector<tools::histo::p2d*>::iterator it;
814 (*it)->add(*(*itw++));
827 G4bool finalResult =
true;
829 std::vector<tools::histo::p2d*>::iterator it;
831 G4bool result = (*it)->reset();
832 if ( ! result ) finalResult =
false;
846 G4bool onlyIfActive)
const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4double unit, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)
G4double(* G4Fcn)(G4double)
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
G4bool GetActivation(G4int id) const
const G4AnalysisVerbose * GetVerboseL2() const
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
const G4AnalysisVerbose * GetVerboseL4() const
G4double GetUnitValue(const G4String &unit)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void AddH3Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, G4double xunit, G4double yunit, G4double zunit, G4Fcn fx, G4Fcn fy, G4Fcn fz, G4BinScheme xBinScheme, G4BinScheme yBinScheme, G4BinScheme zBinScheme)
static const G4double factor
G4Fcn GetFunction(const G4String &fcnName)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
G4bool GetIsActivation() const
const G4AnalysisVerbose * GetVerboseL1() const
void SetActivation(G4bool activation)
const G4AnalysisManagerState & fState
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const