35 #include "tools/histo/p1d" 
   39 using namespace G4Analysis;
 
   42 const G4int G4P1ToolsManager::kDimension = 1;
 
   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     if ( ymin == 0. && ymax == 0.) {            
 
  119       return new tools::histo::p1d(title, 
 
  120                                  nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
 
  122       return new tools::histo::p1d(title, 
 
  123                                  nbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
 
  124                                  yfcn(ymin/yunit), yfcn(ymax/yunit));
 
  129     std::vector<G4double> edges;
 
  130     ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
 
  131     if ( ymin == 0. && ymax == 0.) {            
 
  132       return new tools::histo::p1d(title, edges);
 
  134       return new tools::histo::p1d(title, edges, yfcn(ymin/yunit), yfcn(ymax/yunit)); 
 
  140 tools::histo::p1d* CreateToolsP1(
const G4String& title,
 
  141                          const std::vector<G4double>& edges,
 
  154   std::vector<G4double> newEdges;
 
  157   return new tools::histo::p1d(title, newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit)); 
 
  161 void ConfigureToolsP1(tools::histo::p1d* p1d,
 
  182         << 
"    User binning scheme setting was ignored." << 
G4endl 
  183         << 
"    Linear binning will be applied with given (nbins, xmin, xmax) values";
 
  187     if ( ymin == 0. && ymax == 0. ) {
 
  188       p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
 
  190       p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
 
  191                      yfcn(ymin/yunit), yfcn(ymax/yunit));
 
  196     std::vector<G4double> edges;
 
  197     ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
 
  198     if ( ymin == 0. && ymax == 0. ) {
 
  199       p1d->configure(edges);
 
  201       p1d->configure(edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
 
  207 void ConfigureToolsP1(tools::histo::p1d* p1d,
 
  208                       const std::vector<G4double>& edges,
 
  220   std::vector<G4double> newEdges;
 
  223   if ( ymin == 0. && ymax == 0. ) {
 
  224     p1d->configure(newEdges);
 
  226     p1d->configure(newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
 
  237 void G4P1ToolsManager::AddP1Information(
const G4String& 
name,  
 
  244   auto hnInformation = 
fHnManager->AddHnInformation(name, 2);
 
  245   hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
 
  265   tools::histo::p1d* p1d
 
  266     = CreateToolsP1(title, nbins, xmin, xmax, ymin, ymax, 
 
  267                     xunitName, yunitName, xfcnName, yfcnName, 
 
  271   AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);        
 
  276     name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
 
  290                           const std::vector<G4double>& edges,
 
  299   tools::histo::p1d* p1d 
 
  300     = CreateToolsP1(title, edges, ymin, ymax, 
 
  301                     xunitName, yunitName, xfcnName, yfcnName);
 
  304   AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);        
 
  329   if ( ! p1d ) 
return false;
 
  339     p1d, nbins, xmin, xmax, ymin, ymax, 
 
  340     xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName);
 
  343   AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);        
 
  348     info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
 
  358                            const std::vector<G4double>& edges,
 
  364   if ( ! p1d ) 
return false;
 
  373   ConfigureToolsP1(p1d, edges, ymin, ymax, 
 
  374                    xunitName, yunitName, xfcnName, yfcnName);
 
  377   AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);        
 
  394   if ( ! p1d ) 
return false;
 
  396   return p1d->scale(factor);
 
  404   if ( ! p1d ) 
return false;
 
  412     = 
fHnManager->GetHnDimensionInformation(
id, 
kX, 
"FillP1");
 
  414     = 
fHnManager->GetHnDimensionInformation(
id, 
kY, 
"FillP1");
 
  416   p1d->fill(xInfo->fFcn(xvalue/xInfo->fUnit), 
 
  417             yInfo->fFcn(yvalue/yInfo->fUnit), weight);
 
  422     description << 
" id " << 
id  
  423                 << 
" xvalue " << xvalue 
 
  424                 << 
" xfcn(xvalue/xunit) " <<  xInfo->fFcn(xvalue/xInfo->fUnit) 
 
  425                 << 
" yvalue " << yvalue
 
  426                 << 
" yfcn(yvalue/yunit) " <<  yInfo->fFcn(yvalue/yInfo->fUnit) 
 
  427                 << 
" weight " << weight;
 
  437   return GetTId(name, warn);
 
  444   if ( ! p1d ) 
return 0;
 
  455   if ( ! p1d ) 
return 0.;
 
  464   if ( ! p1d ) 
return 0.;
 
  473   if ( ! p1d ) 
return 0.;
 
  484   if ( ! p1d ) 
return 0.;
 
  493   if ( ! p1d ) 
return 0.;
 
  502   if ( ! p1d ) 
return false;
 
  511   if ( ! p1d ) 
return false;
 
  520   if ( ! p1d ) 
return false;
 
  529   if ( ! p1d ) 
return "";
 
  539   if ( ! p1d ) 
return "";
 
  548   if ( ! p1d ) 
return "";
 
  566   AddP1Annotation(p1d, 
"none", 
"none", 
"none", 
"none");        
 
  582                           const std::vector<tools::histo::p1d*>& p1Vector)
 
  589                                             G4bool onlyIfActive)
 const  
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
 
const XML_Char XML_Encoding * info
 
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)
 
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