35 #include "tools/histo/p1d"
48 fBaseToolsManager(
"P1"),
57 std::vector<tools::histo::p1d*>::iterator it;
86 xInformation->
fUnit = xunit;
87 xInformation->
fFcn = xfcn;
94 yInformation->
fUnit = yunit;
95 yInformation->
fFcn = yfcn;
100 void AddP1Annotation(tools::histo::p1d* p1d,
110 p1d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
111 p1d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
115 tools::histo::p1d* CreateToolsP1(
const G4String& title,
136 <<
" User binning scheme setting was ignored." <<
G4endl
137 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
141 return new tools::histo::p1d(title,
142 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
143 yfcn(ymin/yunit), yfcn(ymax/yunit));
147 std::vector<G4double> edges;
148 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
149 return new tools::histo::p1d(title, edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
154 tools::histo::p1d* CreateToolsP1(
const G4String& title,
155 const std::vector<G4double>& edges,
168 std::vector<G4double> newEdges;
171 return new tools::histo::p1d(title, newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
175 void ConfigureToolsP1(tools::histo::p1d* p1d,
196 <<
" User binning scheme setting was ignored." <<
G4endl
197 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
201 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
202 yfcn(ymin/yunit), yfcn(ymax/yunit));
206 std::vector<G4double> edges;
207 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
208 p1d->configure(edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
213 void ConfigureToolsP1(tools::histo::p1d* p1d,
214 const std::vector<G4double>& edges,
226 std::vector<G4double> newEdges;
229 p1d->configure(newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
240 G4bool onlyIfActive)
const
245 G4String inFunction =
"G4P1ToolsManager::";
246 inFunction += functionName;
248 description <<
" " <<
"profile " <<
id <<
" does not exist.";
276 xunit, yunit, xfcn, yfcn,
277 xbinScheme, xbinScheme);
308 tools::histo::p1d* p1d
309 = CreateToolsP1(title, nbins, xmin, xmax, ymin, ymax,
310 xunitName, yunitName, xfcnName, yfcnName,
314 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
319 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
333 const std::vector<G4double>& edges,
342 tools::histo::p1d* p1d
343 = CreateToolsP1(title, edges, ymin, ymax,
344 xunitName, yunitName, xfcnName, yfcnName);
347 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
372 if ( ! p1d )
return false;
382 p1d, nbins, xmin, xmax, ymin, ymax,
383 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName);
386 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
391 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
401 const std::vector<G4double>& edges,
407 if ( ! p1d )
return false;
416 ConfigureToolsP1(p1d, edges, ymin, ymax,
417 xunitName, yunitName, xfcnName, yfcnName);
420 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
437 if ( ! p1d )
return false;
439 return p1d->scale(factor);
447 if ( ! p1d )
return false;
459 p1d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
460 yInfo->
fFcn(yvalue/yInfo->
fUnit), weight);
465 description <<
" id " <<
id
466 <<
" xvalue " << xvalue
467 <<
" xfcn(xvalue/xunit) " << xInfo->
fFcn(xvalue/xInfo->
fUnit)
468 <<
" yvalue " << yvalue
469 <<
" yfcn(yvalue/yunit) " << yInfo->
fFcn(yvalue/yInfo->
fUnit)
470 <<
" weight " << weight;
480 std::map<G4String, G4int>::const_iterator it =
fP1NameIdMap.find(name);
483 G4String inFunction =
"G4P1ToolsManager::GetP1Id";
485 description <<
" " <<
"profile " << name <<
" does not exist.";
497 if ( ! p1d )
return 0;
508 if ( ! p1d )
return 0;
517 if ( ! p1d )
return 0;
525 tools::histo::p1d* p1d =
GetP1InFunction(
id,
"GetP1XWidth",
true,
false);
526 if ( ! p1d )
return 0;
537 if ( ! p1d )
return 0;
546 if ( ! p1d )
return 0;
555 if ( ! p1d )
return false;
564 if ( ! p1d )
return false;
573 if ( ! p1d )
return false;
582 if ( ! p1d )
return "";
592 if ( ! p1d )
return "";
601 if ( ! p1d )
return "";
619 AddP1Annotation(p1d,
"none",
"none",
"none",
"none");
635 const std::vector<tools::histo::p1d*>& p1Vector)
641 std::vector<tools::histo::p1d*>::const_iterator itw = p1Vector.begin();
642 std::vector<tools::histo::p1d*>::iterator it;
644 (*it)->add(*(*itw++));
657 G4bool finalResult =
true;
659 std::vector<tools::histo::p1d*>::iterator it;
661 G4bool result = (*it)->reset();
662 if ( ! result ) finalResult =
false;
676 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)
static const G4double factor
G4Fcn GetFunction(const G4String &fcnName)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
void AddH2Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4double xunit, G4double yunit, G4Fcn fx, G4Fcn fy, G4BinScheme xBinScheme, G4BinScheme yBinScheme)
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