35 #include "tools/histo/h2d" 
   39 using namespace G4Analysis;
 
   52   std::vector<tools::histo::h2d*>::iterator it;
 
   53   for (it = fH2Vector.begin(); it != fH2Vector.end(); it++ ) {
 
   81   information->
fXUnit = xunit;
 
   82   information->
fYUnit = yunit;
 
   83   information->
fXFcn = xfcn;
 
   84   information->
fYFcn = yfcn;
 
   90 void AddH2Annotation(tools::histo::h2d* h2d,
 
  100   h2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
 
  101   h2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
 
  105 tools::histo::h2d* CreateToolsH2(
 
  125         << 
"    User binning scheme setting was ignored." << 
G4endl 
  126         << 
"    Linear binning will be applied with given (nbins, xmin, xmax) values";
 
  130     return new tools::histo::h2d(title, 
 
  131                                  nxbins, xfcn(xmin), xfcn(xmax), 
 
  132                                  nybins, yfcn(ymin), yfcn(ymax));
 
  138     std::vector<G4double> xedges;
 
  139     ComputeEdges(nxbins, xmin, xmax, xfcn, xbinScheme, xedges);
 
  140     std::vector<G4double> yedges;
 
  141     ComputeEdges(nybins, ymin, ymax, yfcn, ybinScheme, yedges);
 
  142     return new tools::histo::h2d(title, xedges, yedges); 
 
  147 tools::histo::h2d* CreateToolsH2(
 
  149                          const std::vector<G4double>& xedges,
 
  150                          const std::vector<G4double>& yedges,
 
  158   std::vector<G4double> xnewEdges;
 
  160   std::vector<G4double> ynewEdges;
 
  163   return new tools::histo::h2d(title, xnewEdges, ynewEdges); 
 
  169 void  ConfigureToolsH2(tools::histo::h2d* h2d,
 
  188         << 
"    User binning scheme setting was ignored." << 
G4endl 
  189         << 
"    Linear binning will be applied with given (nbins, xmin, xmax) values";
 
  193     h2d->configure(nxbins, xfcn(xmin), xfcn(xmax), 
 
  194                    nybins, yfcn(ymin), yfcn(ymax));
 
  198     std::vector<G4double> xedges;
 
  199     ComputeEdges(nxbins, xmin, xmax, xfcn, xbinScheme, xedges);
 
  200     std::vector<G4double> yedges;
 
  201     ComputeEdges(nybins, ymin, ymax, yfcn, ybinScheme, yedges);
 
  202     h2d->configure(xedges, yedges);
 
  207 void  ConfigureToolsH2(tools::histo::h2d* h2d,
 
  208                        const std::vector<G4double>& xedges,
 
  209                        const std::vector<G4double>& yedges,
 
  214   std::vector<G4double> xnewEdges;
 
  218   std::vector<G4double> ynewEdges;
 
  221   h2d->configure(xnewEdges, ynewEdges);
 
  232 tools::histo::h2d*  G4H2ToolsManager::GetH2InFunction(
G4int id, 
 
  234                                       G4bool onlyIfActive)
 const 
  237   if ( index < 0 || index >= 
G4int(fH2Vector.size()) ) {
 
  239       G4String inFunction = 
"G4H2ToolsManager::";
 
  240       inFunction += functionName;
 
  242       description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
 
  254   return fH2Vector[
index];
 
  259 void G4H2ToolsManager::AddH2Information(
const G4String& 
name,  
 
  273                        xunit, yunit, xfcn, yfcn, 
 
  274                        xbinScheme, ybinScheme);
 
  278 G4int G4H2ToolsManager::RegisterToolsH2(tools::histo::h2d* h2d, 
 
  281   G4int index = fH2Vector.size();
 
  282   fH2Vector.push_back(h2d);
 
  307   tools::histo::h2d* h2d
 
  308     = CreateToolsH2(title, nxbins, xmin, xmax, nybins, ymin, ymax, 
 
  309                     xfcnName, yfcnName, xbinSchemeName, ybinSchemeName);
 
  312   AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);        
 
  318     name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
 
  321   G4int id = RegisterToolsH2(h2d, name); 
 
  333                           const std::vector<G4double>& xedges,
 
  334                           const std::vector<G4double>& yedges,
 
  343   tools::histo::h2d* h2d
 
  344     = CreateToolsH2(title, xedges, yedges, xfcnName, yfcnName); 
 
  347   AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);        
 
  354   G4int id = RegisterToolsH2(h2d, name); 
 
  373   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"SetH2", 
false, 
false);
 
  374   if ( ! h2d ) 
return false;
 
  384     h2d, nxbins, xmin, xmax, nybins, ymin, ymax, xfcnName, yfcnName, 
 
  385     xbinSchemeName, xbinSchemeName);
 
  388   AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);        
 
  394     info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
 
  404                             const std::vector<G4double>& xedges,
 
  405                             const std::vector<G4double>& yedges,
 
  409   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"SetH2", 
false, 
false);
 
  410   if ( ! h2d ) 
return false;
 
  419   ConfigureToolsH2(h2d, xedges, yedges, xfcnName, yfcnName);
 
  422   AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);        
 
  437   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"ScaleH2", 
false, 
false);
 
  438   if ( ! h2d ) 
return false;
 
  440   return h2d->scale(factor);
 
  448   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"FillH2", 
true, 
false);
 
  449   if ( ! h2d ) 
return false;
 
  461     description << 
" id " << 
id  
  462                 << 
" xvalue " << xvalue << 
" yvalue " << yvalue;
 
  472   std::map<G4String, G4int>::const_iterator it = fH2NameIdMap.find(name);
 
  473   if ( it ==  fH2NameIdMap.end() ) {  
 
  475       G4String inFunction = 
"G4H2ToolsManager::GetH2Id";
 
  477       description << 
"      " << 
"histogram " << name << 
" does not exist.";
 
  488   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2NXbins");
 
  489   if ( ! h2d ) 
return 0;
 
  491   return h2d->axis_x().bins();
 
  499   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2Xmin");
 
  500   if ( ! h2d ) 
return 0;
 
  503   return info->
fXFcn(h2d->axis_x().lower_edge()*info->
fXUnit);
 
  509   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2Xmax");
 
  510   if ( ! h2d ) 
return 0;
 
  513   return info->
fXFcn(h2d->axis_x().upper_edge()*info->
fXUnit);
 
  519   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2XWidth", 
true, 
false);
 
  520   if ( ! h2d ) 
return 0;
 
  522   G4int nbins = h2d->axis_x().bins();
 
  525     description << 
"    nbins = 0 (for h2 id = " << 
id << 
").";
 
  532   return ( info->
fXFcn(h2d->axis_x().upper_edge()) 
 
  533            - info->
fXFcn(h2d->axis_x().lower_edge()))*info->
fXUnit/nbins;
 
  539   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2NYbins");
 
  540   if ( ! h2d ) 
return 0;
 
  542   return h2d->axis_y().bins();
 
  550   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2Ymin");
 
  551   if ( ! h2d ) 
return 0;
 
  554   return info->
fYFcn(h2d->axis_y().lower_edge()*info->
fYUnit);
 
  560   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2Ymax");
 
  561   if ( ! h2d ) 
return 0;
 
  564   return info->
fYFcn(h2d->axis_y().upper_edge()*info->
fYUnit);
 
  570   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2YWidth", 
true, 
false);
 
  571   if ( ! h2d ) 
return 0;
 
  573   G4int nbins = h2d->axis_y().bins();
 
  576     description << 
"    nbins = 0 (for h2 id = " << 
id << 
").";
 
  583   return ( info->
fYFcn(h2d->axis_y().upper_edge()) 
 
  584            - info->
fYFcn(h2d->axis_y().lower_edge()))*info->
fYUnit/nbins;
 
  590   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"SetH2Title");
 
  591   if ( ! h2d ) 
return false;
 
  593   return h2d->set_title(title);
 
  599   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"SetH2XAxisTitle");
 
  600   if ( ! h2d ) 
return false;
 
  602   h2d->add_annotation(tools::histo::key_axis_x_title(), title);
 
  609   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"SetH2YAxisTitle");
 
  610   if ( ! h2d ) 
return false;
 
  612   h2d->add_annotation(tools::histo::key_axis_x_title(), title);
 
  619   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"SetH2ZAxisTitle");
 
  620   if ( ! h2d ) 
return false;
 
  622   h2d->add_annotation(tools::histo::key_axis_z_title(), title);
 
  629   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2Title");
 
  630   if ( ! h2d ) 
return "";
 
  638   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2XAxisTitle");
 
  639   if ( ! h2d ) 
return "";
 
  642   G4bool result = h2d->annotation(tools::histo::key_axis_x_title(), title);
 
  645     description << 
"    Failed to get x_axis title for h2 id = " << 
id << 
").";
 
  657   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2YAxisTitle");
 
  658   if ( ! h2d ) 
return "";
 
  661   G4bool result = h2d->annotation(tools::histo::key_axis_y_title(), title);
 
  664     description << 
"    Failed to get y_axis title for h2 id = " << 
id << 
").";
 
  676   tools::histo::h2d* h2d = GetH2InFunction(
id, 
"GetH2ZAxisTitle");
 
  677   if ( ! h2d ) 
return "";
 
  680   G4bool result = h2d->annotation(tools::histo::key_axis_z_title(), title);
 
  683     description << 
"    Failed to get z_axis title for h2 id = " << 
id << 
").";
 
  709                           const std::vector<tools::histo::h2d*>& h2Vector)
 
  715   std::vector<tools::histo::h2d*>::const_iterator itw = h2Vector.begin();
 
  716   std::vector<tools::histo::h2d*>::iterator it;
 
  717   for (it = fH2Vector.begin(); it != fH2Vector.end(); it++ ) {
 
  718     (*it)->add(*(*itw++));
 
  731   G4bool finalResult = 
true;
 
  733   std::vector<tools::histo::h2d*>::iterator it;
 
  734   for (it = fH2Vector.begin(); it != fH2Vector.end(); it++ ) {
 
  736     if ( ! result ) finalResult = 
false;
 
  745   return ! fH2Vector.size();
 
  750                                                  G4bool onlyIfActive)
 const  
  752   return GetH2InFunction(
id, 
"GetH2", warn, onlyIfActive);
 
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const 
 
std::ostringstream G4ExceptionDescription
 
G4double(* G4Fcn)(G4double)
 
G4double G4NeutronHPJENDLHEData::G4double result
 
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)
 
G4Fcn GetFunction(const G4String &fcnName)
 
subroutine title(NA, NB, NCA, NCB)
 
G4BinScheme GetBinScheme(const G4String &binSchemeName)
 
const XML_Char XML_Encoding * info
 
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)
 
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