34 #include "tools/histo/h2d"
38 using namespace G4Analysis;
73 void AddH2Annotation(tools::histo::h2d* h2d,
83 h2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
84 h2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
88 tools::histo::h2d* CreateToolsH2(
106 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
107 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
112 <<
" User binning scheme setting was ignored." <<
G4endl
113 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
117 return new tools::histo::h2d(title,
118 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
119 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
125 std::vector<G4double> xedges;
126 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
127 std::vector<G4double> yedges;
128 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
129 return new tools::histo::h2d(title, xedges, yedges);
134 tools::histo::h2d* CreateToolsH2(
136 const std::vector<G4double>& xedges,
137 const std::vector<G4double>& yedges,
149 std::vector<G4double> xnewEdges;
151 std::vector<G4double> ynewEdges;
154 return new tools::histo::h2d(title, xnewEdges, ynewEdges);
160 void ConfigureToolsH2(tools::histo::h2d* h2d,
177 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
178 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
183 <<
" User binning scheme setting was ignored." <<
G4endl
184 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
188 h2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
189 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
193 std::vector<G4double> xedges;
194 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
195 std::vector<G4double> yedges;
196 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
197 h2d->configure(xedges, yedges);
202 void ConfigureToolsH2(tools::histo::h2d* h2d,
203 const std::vector<G4double>& xedges,
204 const std::vector<G4double>& yedges,
212 std::vector<G4double> xnewEdges;
217 std::vector<G4double> ynewEdges;
220 h2d->configure(xnewEdges, ynewEdges);
239 auto hnInformation =
fHnManager->AddHnInformation(name, 2);
240 hnInformation->
AddDimension(xunitName, xfcnName, xbinScheme);
241 hnInformation->
AddDimension(yunitName, yfcnName, ybinScheme);
262 tools::histo::h2d* h2d
263 = CreateToolsH2(title, nxbins, xmin, xmax, nybins, ymin, ymax,
264 xunitName, yunitName, xfcnName, yfcnName,
265 xbinSchemeName, ybinSchemeName);
268 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
274 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
289 const std::vector<G4double>& xedges,
290 const std::vector<G4double>& yedges,
299 tools::histo::h2d* h2d
300 = CreateToolsH2(title, xedges, yedges,
301 xunitName, yunitName, xfcnName, yfcnName);
304 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
308 name, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser, G4BinScheme::kUser);
331 if ( ! h2d )
return false;
341 h2d, nxbins, xmin, xmax, nybins, ymin, ymax,
342 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName, ybinSchemeName);
345 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
351 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
361 const std::vector<G4double>& xedges,
362 const std::vector<G4double>& yedges,
367 if ( ! h2d )
return false;
376 ConfigureToolsH2(h2d, xedges, yedges, xunitName, yunitName, xfcnName, yfcnName);
379 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
383 info, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser, G4BinScheme::kUser);
395 if ( ! h2d )
return false;
397 return h2d->scale(factor);
406 if ( ! h2d )
return false;
413 =
fHnManager->GetHnDimensionInformation(
id,
kX,
"FillH2");
415 =
fHnManager->GetHnDimensionInformation(
id,
kY,
"FillH2");
417 h2d->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit),
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)
437 return GetTId(name, warn);
444 if ( ! h2d )
return 0;
455 if ( ! h2d )
return 0.;
464 if ( ! h2d )
return 0.;
473 if ( ! h2d )
return 0.;
482 if ( ! h2d )
return 0;
493 if ( ! h2d )
return 0.;
502 if ( ! h2d )
return 0.;
511 if ( ! h2d )
return 0.;
520 if ( ! h2d )
return false;
529 if ( ! h2d )
return false;
538 if ( ! h2d )
return false;
547 if ( ! h2d )
return false;
556 if ( ! h2d )
return "";
565 if ( ! h2d )
return "";
574 if ( ! h2d )
return "";
583 if ( ! h2d )
return "";
612 AddH2Annotation(h2d,
"none",
"none",
"none",
"none");
615 G4BinScheme::kLinear, G4BinScheme::kLinear);
629 const std::vector<tools::histo::h2d*>& h2Vector)
635 G4bool onlyIfActive)
const