35 #include "tools/histo/p2d" 
   39 using namespace G4Analysis;
 
   42 const G4int G4P2ToolsManager::kDimension = 2;
 
   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     if ( zmin == 0. && zmax == 0.) {            
 
  132       return new tools::histo::p2d(title, 
 
  133                                    nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
 
  134                                    nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
 
  138       return new tools::histo::p2d(title, 
 
  139                                    nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
 
  140                                    nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
 
  141                                    zfcn(zmin/zunit), zfcn(zmax/zunit));
 
  148     std::vector<G4double> xedges;
 
  149     ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
 
  150     std::vector<G4double> yedges;
 
  151     ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
 
  152     if ( zmin == 0. && zmax == 0.) {            
 
  153       return new tools::histo::p2d(title, xedges, yedges); 
 
  155       return new tools::histo::p2d(title, xedges, yedges, 
 
  156                                    zfcn(zmin/zunit), zfcn(zmax/zunit)); 
 
  162 tools::histo::p2d* CreateToolsP2(
 
  164                          const std::vector<G4double>& xedges,
 
  165                          const std::vector<G4double>& yedges,
 
  182   std::vector<G4double> xnewEdges;
 
  184   std::vector<G4double> ynewEdges;
 
  187   if ( zmin == 0. && zmax == 0.) {            
 
  188     return new tools::histo::p2d(title, xnewEdges, ynewEdges); 
 
  192     return new tools::histo::p2d(title, xnewEdges, ynewEdges, 
 
  193                                zfcn(zmin/zunit), zfcn(zmax/zunit)); 
 
  200 void  ConfigureToolsP2(tools::histo::p2d* p2d,
 
  228         << 
"    User binning scheme setting was ignored." << 
G4endl 
  229         << 
"    Linear binning will be applied with given (nbins, xmin, xmax) values";
 
  233     if ( zmin == 0. && zmax == 0. ) {
 
  234       p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
 
  235                      nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
 
  237       p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
 
  238                      nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
 
  239                      zfcn(zmin/zunit), zfcn(zmax/zunit));
 
  244     std::vector<G4double> xedges;
 
  245     ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
 
  246     std::vector<G4double> yedges;
 
  247     ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
 
  248     if ( zmin == 0. && zmax == 0. ) {
 
  249       p2d->configure(xedges, yedges);
 
  251       p2d->configure(xedges, yedges, zfcn(zmin/zunit), zfcn(zmax/zunit));
 
  257 void  ConfigureToolsP2(tools::histo::p2d* p2d,
 
  258                        const std::vector<G4double>& xedges,
 
  259                        const std::vector<G4double>& yedges,
 
  271   std::vector<G4double> xnewEdges;
 
  276   std::vector<G4double> ynewEdges;
 
  281   if ( zmin == 0. && zmax == 0. ) {
 
  282     p2d->configure(xnewEdges, ynewEdges);
 
  284     p2d->configure(xnewEdges, ynewEdges, zfcn(zmin/zunit), zfcn(zmax/zunit));
 
  296 void G4P2ToolsManager::AddP2Information(
const G4String& 
name,  
 
  306   auto hnInformation = 
fHnManager->AddHnInformation(name, 3);
 
  307   hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
 
  308   hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
 
  333   tools::histo::p2d* p2d
 
  334     = CreateToolsP2(title, 
 
  335                     nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
 
  336                     xunitName, yunitName, zunitName, 
 
  337                     xfcnName, yfcnName, zfcnName, 
 
  338                     xbinSchemeName, ybinSchemeName);
 
  341   AddP2Annotation(p2d, xunitName, yunitName, zunitName,
 
  342                   xfcnName, yfcnName, zfcnName);        
 
  348     name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName, 
 
  349     xbinScheme, ybinScheme);
 
  364                           const std::vector<G4double>& xedges,
 
  365                           const std::vector<G4double>& yedges,
 
  377   tools::histo::p2d* p2d
 
  378     = CreateToolsP2(title, xedges, yedges, zmin, zmax, 
 
  379         xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName); 
 
  383     p2d, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);        
 
  387     name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName, 
 
  414   if ( ! p2d ) 
return false;
 
  424     p2d, nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
 
  425     xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName, 
 
  426     xbinSchemeName, ybinSchemeName);
 
  429   AddP2Annotation(p2d, xunitName, yunitName, zunitName, 
 
  430                   xfcnName, yfcnName, zfcnName);        
 
  436     info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
 
  437     xbinScheme, ybinScheme);
 
  447                             const std::vector<G4double>& xedges,
 
  448                             const std::vector<G4double>& yedges,
 
  456   if ( ! p2d ) 
return false;
 
  465   ConfigureToolsP2(p2d, xedges, yedges, zmin, zmax, 
 
  466     xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
 
  469   AddP2Annotation(p2d, xunitName, yunitName, zunitName, 
 
  470                   xfcnName, yfcnName, zfcnName);        
 
  474     info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
 
  487   if ( ! p2d ) 
return false;
 
  489   return p2d->scale(factor);
 
  498   if ( ! p2d ) 
return false;
 
  505     = 
fHnManager->GetHnDimensionInformation(
id, 
kX, 
"FillP2");
 
  507     = 
fHnManager->GetHnDimensionInformation(
id, 
kY, 
"FillP2");
 
  509     = 
fHnManager->GetHnDimensionInformation(
id, 
kZ, 
"FillP2");
 
  511   p2d->fill(xInfo->fFcn(xvalue/xInfo->fUnit), 
 
  512             yInfo->fFcn(yvalue/yInfo->fUnit), 
 
  513             zInfo->fFcn(zvalue/zInfo->fUnit), weight);
 
  519     description << 
" id " << 
id  
  520                 << 
" xvalue " << xvalue 
 
  521                 << 
" xfcn(xvalue/xunit) " <<  xInfo->fFcn(xvalue/xInfo->fUnit) 
 
  522                 << 
" yvalue " << yvalue
 
  523                 << 
" yfcn(yvalue/yunit) " <<  yInfo->fFcn(yvalue/yInfo->fUnit)
 
  524                 << 
" zvalue " << zvalue
 
  525                 << 
" zfcn(zvalue/zunit) " <<  zInfo->fFcn(zvalue/zInfo->fUnit)
 
  526                 << 
" weight " << weight;
 
  536   return GetTId(name, warn);
 
  543   if ( ! p2d ) 
return 0;
 
  554   if ( ! p2d ) 
return 0.;
 
  563   if ( ! p2d ) 
return 0.;
 
  572   if ( ! p2d ) 
return 0.;
 
  581   if ( ! p2d ) 
return 0;
 
  592   if ( ! p2d ) 
return 0.;
 
  601   if ( ! p2d ) 
return 0.;
 
  610   if ( ! p2d ) 
return 0.;
 
  621   if ( ! p2d ) 
return 0.;
 
  630   if ( ! p2d ) 
return 0.;
 
  639   if ( ! p2d ) 
return false;
 
  648   if ( ! p2d ) 
return false;
 
  657   if ( ! p2d ) 
return false;
 
  666   if ( ! p2d ) 
return false;
 
  675   if ( ! p2d ) 
return "";
 
  684   if ( ! p2d ) 
return "";
 
  693   if ( ! p2d ) 
return "";
 
  702   if ( ! p2d ) 
return "";
 
  731   AddP2Annotation(p2d, 
"none", 
"none", 
"none", 
"none", 
"none", 
"none");        
 
  733   AddP2Information(name, 
"none", 
"none", 
"none", 
"none", 
"none", 
"none", 
 
  748                           const std::vector<tools::histo::p2d*>& p2Vector)
 
  755                                                  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::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)
 
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