The Gaudi Framework  master (d98a2936)
Gaudi::Utils::Histos Namespace Reference

Namespaces

 Formats
 

Classes

class  HistoStrings
 
class  Table
 

Typedefs

typedef std::vector< std::string > Labels
 Typedef for a list of labels. More...
 
typedef std::pair< unsigned, std::string > BinLabel
 Typedef for a bin number and its associated label. More...
 
typedef std::vector< BinLabelBinLabels
 Typedef for a list of bin numbers and their associated label. More...
 

Functions

GAUDI_API std::string histoDump (const AIDA::IHistogram1D *histo, const std::size_t width=80, const std::size_t height=50, const bool errors=false)
 dump the text representation of the histogram More...
 
GAUDI_API std::string histoDump (const AIDA::IProfile1D *histo, const std::size_t width=80, const std::size_t height=50, const bool spread=true)
 dump the text representation of the 1D-profile More...
 
GAUDI_API std::string histoDump (const TProfile *histo, const std::size_t width=80, const std::size_t height=50)
 dump the text representation of the histogram More...
 
GAUDI_API std::string histoDump (const TH1 *histo, const std::size_t width=80, const std::size_t height=50, const bool errors=false)
 dump the text representation of the histogram More...
 
GAUDI_API bool setBinLabels (AIDA::IHistogram1D *hist, const Labels &labels)
 Set the Bin labels for a given 1D histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IHistogram1D *hist, const BinLabels &labels)
 Set the Bin labels for a given 1D histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IProfile1D *hist, const Labels &labels)
 Set the Bin labels for a given 1D profile histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IProfile1D *hist, const BinLabels &labels)
 Set the Bin labels for a given 1D profile histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IHistogram2D *hist, const Labels &xlabels, const Labels &ylabels)
 Set the Bin labels for a given 2D histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IHistogram2D *hist, const BinLabels &xlabels, const BinLabels &ylabels)
 Set the Bin labels for a given 2D histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IProfile2D *hist, const Labels &xlabels, const Labels &ylabels)
 Set the Bin labels for a given 2D profile histogram. More...
 
GAUDI_API bool setBinLabels (AIDA::IProfile2D *hist, const BinLabels &xlabels, const BinLabels &ylabels)
 Set the Bin labels for a given 2D profile histogram. More...
 
GAUDI_API bool setAxisLabels (AIDA::IHistogram1D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 1D histogram. More...
 
GAUDI_API bool setAxisLabels (AIDA::IProfile1D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 1D profile histogram. More...
 
GAUDI_API bool setAxisLabels (AIDA::IHistogram2D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 2D histogram. More...
 
GAUDI_API bool setAxisLabels (AIDA::IProfile2D *hist, const std::string &xAxis, const std::string &yAxis)
 Set the axis labels for the given 2D profile histogram. More...
 
GAUDI_API std::string path (const AIDA::IBaseHistogram *aida)
 get the path in THS for AIDA histogram More...
 
GAUDI_API std::string format (const AIDA::IHistogram1D *histo, const std::string &fmt)
 Make the string representation of the histogram according to the specified format. More...
 
GAUDI_API std::string format (const AIDA::IProfile1D *histo, const std::string &fmt)
 Make the string representation of the profile histogram according to the specified format. More...
 
GAUDI_API std::string format (const AIDA::IHistogram1D *histo, const std::string &ID, const std::string &fmt1, const std::string &fmt2)
 format a full row in table, including ID, label, path or any other "extra" identifier in string form More...
 
GAUDI_API std::string format (const AIDA::IProfile1D *histo, const std::string &ID, const std::string &fmt1, const std::string &fmt2)
 format a full row in table, including ID, label, path or any other "extra" identifier in string form More...
 
template<class HISTO , class STREAM , class TERMINATOR >
STREAM & printList (HISTO first, HISTO last, const std::string &fmt, STREAM &stream, TERMINATOR term)
 print the simple sequence (list-like) of histograms as table More...
 
template<class LIST , class STREAM , class TERMINATOR >
STREAM & printList (const LIST &histos, const std::string &fmt, STREAM &stream, TERMINATOR term)
 print the simple container of histograms as table More...
 
template<class HISTO , class STREAM , class TERMINATOR >
STREAM & printMap (HISTO begin, HISTO end, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
 Print the "associative sequence" (e.g. More...
 
template<class MAP , class STREAM , class TERMINATOR >
STREAM & printMap (const MAP &histos, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
 Print the "associative sequence" (e.g. More...
 
GAUDI_API std::string format (const std::string &val1, const std::string &val2, const std::string &fmt)
 helper method to merge the headers for short format table More...
 
GAUDI_API std::ostream & toXml (const TH1D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TH2D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TH3D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TProfile &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TProfile2D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const AIDA::IHistogram1D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostream & toXml (const AIDA::IHistogram2D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostream & toXml (const AIDA::IHistogram3D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostream & toXml (const AIDA::IProfile1D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TH1F &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TH2F &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const TH3F &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostream & toXml (const AIDA::IProfile2D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API StatusCode fromXml (TH1D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH2D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH3D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TProfile &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TProfile2D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH1F &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH2F &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH3F &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH1D *&result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH2D *&result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TH3D *&result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TProfile *&result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (TProfile2D *&result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (AIDA::IHistogram1D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (AIDA::IHistogram2D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (AIDA::IHistogram3D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (AIDA::IProfile1D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 
GAUDI_API StatusCode fromXml (AIDA::IProfile2D &result, std::string_view input)
 parse the histogram from standard ROOT XML More...
 

Detailed Description

Collection of useful utilities for manipulations with AIDA hisgograms

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-08

Typedef Documentation

◆ BinLabel

typedef std::pair<unsigned, std::string> Gaudi::Utils::Histos::BinLabel

Typedef for a bin number and its associated label.

Definition at line 34 of file HistoLabels.h.

◆ BinLabels

Typedef for a list of bin numbers and their associated label.

Definition at line 36 of file HistoLabels.h.

◆ Labels

typedef std::vector<std::string> Gaudi::Utils::Histos::Labels

Typedef for a list of labels.

Definition at line 32 of file HistoLabels.h.

Function Documentation

◆ format() [1/5]

std::string Gaudi::Utils::Histos::format ( const AIDA::IHistogram1D *  histo,
const std::string &  fmt 
)

Make the string representation of the histogram according to the specified format.

The method could be used to access/print various quantities

using namespace Gaudi::Utils::Histos ;
const AIDA::IHistogram1D* histo = ... ;
// print title in a free format:
std::cout << format ( histo , "%2%" ) << std::endl ;
// print the path in HTS in a free format:
std::cout << format ( histo , " path in HTS: %1% " ) << std::endl ;
// print the formatted nEntries/Overflow/Underflow:
std::cout <<
format ( histo , " #nEntries/Overflow/Underflow=%3%/%4%/%5%" )
<< std::endl ;
// print the formatted Mean+-ErrorMean:
std::cout <<
format ( histo , " Mean+-Error=(%8%+-%9%)" )
<< std::endl ;
// print the skewness and kurtosis:
std::cout <<
format ( histo , " Skewness/Kurtosis=%12%/%14% " )
<< std::endl ;
Parameters
historeference to the histogram
fmtthe printout format
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-08

Definition at line 233 of file HistoTableFormat.cpp.

233  {
234  if ( !histo ) { return "<NULL>"; }
235  using namespace Gaudi::Utils;
236  using namespace boost::io;
237  boost::format _fmt( fmt );
238  // allow various number of arguments
239  _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
240 
241  _fmt % ( "\"" + path( histo ) + "\"" ) // 1) histogram path
242  % ( "\"" + _title( histo ) + "\"" ) // 2) title
243  % histo->allEntries() // 3) # entries
244  % histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN ) // 4) # underflow
245  % histo->binEntries( AIDA::IAxis::OVERFLOW_BIN ) // 5) # overflow
246  % HistoStats::nEff( histo ) // 6) equivalent entries
247  % histo->sumBinHeights() // 7) integral
248  % HistoStats::mean( histo ) // 8) mean value
249  % HistoStats::meanErr( histo ) // 9) error in mean
250  % HistoStats::rms( histo ) // 10) rms
251  % HistoStats::rmsErr( histo ) // 11) error in rms
252  % HistoStats::skewness( histo ) // 12) skewness
253  % HistoStats::skewnessErr( histo ) // 13) error in skewness
254  % HistoStats::kurtosis( histo ) // 14) kurtosis
255  % HistoStats::kurtosisErr( histo ) // 15) error in kurtosis
256  //
257  % histo->sumAllBinHeights() // 16) full integral (in and out range)
258  % HistoStats::sumAllBinHeightErr( histo ) // 17) error on 16
259  % HistoStats::sumBinHeightErr( histo ) // 18) error on 7
260  //
261  % ( 100 * HistoStats::underflowEntriesFrac( histo ) ) // 19) fraction of underflow entries
262  % ( 100 * HistoStats::underflowEntriesFracErr( histo ) ) // 20) error on 19
263  % ( 100 * HistoStats::overflowEntriesFrac( histo ) ) // 21) fraction of overflow entries
264  % ( 100 * HistoStats::overflowEntriesFracErr( histo ) ) // 22) error on 21
265  //
266  % HistoStats::underflowIntegralFrac( histo ) // 23) fraction of underflow integral
267  % HistoStats::underflowIntegralFracErr( histo ) // 24) error on 23
268  % HistoStats::overflowIntegralFrac( histo ) // 25) fraction of overflow intergal
269  % HistoStats::overflowIntegralFracErr( histo ) // 26) error on 25
270  ;
271 
272  return _fmt.str();
273 }

◆ format() [2/5]

std::string Gaudi::Utils::Histos::format ( const AIDA::IHistogram1D *  histo,
const std::string &  ID,
const std::string &  fmt1,
const std::string &  fmt2 
)

format a full row in table, including ID, label, path or any other "extra" identifier in string form

using namespace Gaudi::Utils::Histos
const AIDA::IHistogram1D* histo = ... ;
// define short format
const std::string fmt1 = " |%1$-30.30s %|33t| %2" ;
// define format for the histogram
const std::string fmt2 = ... ;
info () <<
format ( "My Histo" , histo , fmt1 , fmt2 )
<< endmsg ;
Parameters
histopointer to the histogram
IDhistorgam ID, title, label or other extra information
fmt1"short" format used for the table
fmt2format used for the histogram printout
Returns
formatted row
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-08

Definition at line 325 of file HistoTableFormat.cpp.

326  {
327  using namespace boost::io;
328  boost::format _fmt( fmt1 );
329  // allow various number of arguments
330  _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
331  //
332  _fmt % ID // format ID
333  % format( histo, fmt2 ); // format the histogram
334  //
335  return _fmt.str();
336 }

◆ format() [3/5]

std::string Gaudi::Utils::Histos::format ( const AIDA::IProfile1D *  histo,
const std::string &  fmt 
)

Make the string representation of the profile histogram according to the specified format.

The method could be used to access/print various quantities

using namespace Gaudi::Utils::Histos ;
const AIDA::IProfile1D* histo = ... ;
// print title in a free format:
std::cout << format ( histo , "%2%" ) << std::endl ;
// print the path in HTS in a free format:
std::cout << format ( histo , " path in HTS: %1% " ) << std::endl ;
Parameters
historeference to the histogram
fmtthe printout format
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-08

Definition at line 279 of file HistoTableFormat.cpp.

279  {
280  if ( !histo ) { return "<NULL>"; }
281  using namespace Gaudi::Utils;
282  using namespace boost::io;
283  boost::format _fmt( fmt );
284  // allow various number of arguments
285  _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
286 
287  _fmt % ( "\"" + path( histo ) + "\"" ) // 1) histogram path
288  % ( "\"" + _title( histo ) + "\"" ) // 2) title
289  % histo->allEntries() // 3) # entries
290  % histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN ) // 4) # underflow
291  % histo->binEntries( AIDA::IAxis::OVERFLOW_BIN ) // 5) # overflow
292  % HistoStats::nEff( histo ) // 6) equivalent entries
293  % histo->sumBinHeights() // 7) integral
294  % HistoStats::mean( histo ) // 8) mean value
295  % HistoStats::meanErr( histo ) // 9) error in mean
296  % HistoStats::rms( histo ) // 10) rms
297  % HistoStats::rmsErr( histo ) // 11) error in rms
298  % HistoStats::skewness( histo ) // 12) skewness
299  % HistoStats::skewnessErr( histo ) // 13) error in skewness
300  % HistoStats::kurtosis( histo ) // 14) kurtosis
301  % HistoStats::kurtosisErr( histo ) // 15) error in kurtosis
302  //
303  % histo->sumAllBinHeights() // 16) full integral (in and out range)
304  % HistoStats::sumAllBinHeightErr( histo ) // 17) error on 16
305  % HistoStats::sumBinHeightErr( histo ) // 18) error on 7
306  //
307  % ( 100 * HistoStats::underflowEntriesFrac( histo ) ) // 19) fraction of underflow entries
308  % ( 100 * HistoStats::underflowEntriesFracErr( histo ) ) // 20) error on 19
309  % ( 100 * HistoStats::overflowEntriesFrac( histo ) ) // 21) fraction of overflow entries
310  % ( 100 * HistoStats::overflowEntriesFracErr( histo ) ) // 22) error on 21
311  //
312  % HistoStats::underflowIntegralFrac( histo ) // 23) fraction of underflow integral
313  % HistoStats::underflowIntegralFracErr( histo ) // 24) error on 23
314  % HistoStats::overflowIntegralFrac( histo ) // 25) fraction of overflow intergal
315  % HistoStats::overflowIntegralFracErr( histo ) // 26) error on 25
316  ;
317 
318  return _fmt.str();
319 }

◆ format() [4/5]

std::string Gaudi::Utils::Histos::format ( const AIDA::IProfile1D *  histo,
const std::string &  ID,
const std::string &  fmt1,
const std::string &  fmt2 
)

format a full row in table, including ID, label, path or any other "extra" identifier in string form

using namespace Gaudi::Utils::Histos
const AIDA::IProfile1D* histo = ... ;
// define short format
const std::string fmt1 = " |%1$-30.30s %|33t| %2" ;
// define format for the histogram
const std::string fmt2 = ... ;
info () <<
format ( "My Histo" , histo , fmt1 , fmt2 )
<< endmsg ;
Parameters
histopointer to the histogram
IDhistorgam ID, title, label or other extra information
fmt1"short" format used for the table
fmt2format used for the histogram printout
Returns
formatted row
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-08

Definition at line 342 of file HistoTableFormat.cpp.

343  {
344  using namespace boost::io;
345  boost::format _fmt( fmt1 );
346  // allow various number of arguments
347  _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
348  //
349  _fmt % ID // format ID
350  % format( histo, fmt2 ); // format the histogram
351  //
352  return _fmt.str();
353 }

◆ format() [5/5]

std::string Gaudi::Utils::Histos::format ( const std::string &  val1,
const std::string &  val2,
const std::string &  fmt 
)

helper method to merge the headers for short format table

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-07

Definition at line 357 of file HistoTableFormat.cpp.

357  {
358  using namespace boost::io;
359  boost::format _fmt( fmt );
360  // allow various number of arguments
361  _fmt.exceptions( all_error_bits ^ ( too_many_args_bit | too_few_args_bit ) );
362  //
363  _fmt % val1 // format ID
364  % val2; // format the histogram
365  //
366  return _fmt.str();
367 }

◆ fromXml() [1/18]

StatusCode Gaudi::Utils::Histos::fromXml ( AIDA::IHistogram1D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 431 of file HistoXML.cpp.

431  {
432  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &result );
433  return root ? fromXml( *root, input ) : StatusCode::FAILURE; // RETURN
434 }

◆ fromXml() [2/18]

StatusCode Gaudi::Utils::Histos::fromXml ( AIDA::IHistogram2D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 442 of file HistoXML.cpp.

442  {
443  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &result );
444  return root ? fromXml( *root, input ) : StatusCode::FAILURE; // RETURN
445 }

◆ fromXml() [3/18]

StatusCode Gaudi::Utils::Histos::fromXml ( AIDA::IHistogram3D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 453 of file HistoXML.cpp.

453  {
454  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &result );
455  return root ? fromXml( *root, input ) : StatusCode::FAILURE; // RETURN
456 }

◆ fromXml() [4/18]

StatusCode Gaudi::Utils::Histos::fromXml ( AIDA::IProfile1D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 464 of file HistoXML.cpp.

464  {
465  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &result );
466  return root ? fromXml( *root, input ) : StatusCode::FAILURE; // RETURN
467 }

◆ fromXml() [5/18]

StatusCode Gaudi::Utils::Histos::fromXml ( AIDA::IProfile2D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 475 of file HistoXML.cpp.

475  {
476  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &result );
477  return root ? fromXml( *root, input ) : StatusCode::FAILURE; // RETURN
478 }

◆ fromXml() [6/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH1D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 199 of file HistoXML.cpp.

199  {
200  //
201  result.Reset(); // RESET old histogram
202  //
203 
204  auto histo = _Xml<TH1D>( input );
205  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
206  //
207  histo->Copy( result );
208  //
209  return StatusCode::SUCCESS;
210 }

◆ fromXml() [7/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH1D *&  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 345 of file HistoXML.cpp.

345  {
346  if ( result ) { return fromXml( *result, input ); }
347  //
348  auto histo = _Xml<TH1D>( input );
349  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
350  //
351  result = histo.release(); // ASSIGN
352  //
353  return StatusCode::SUCCESS;
354 }

◆ fromXml() [8/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH1F &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 254 of file HistoXML.cpp.

254  {
255  //
256  result.Reset(); // RESET old histogram
257  //
258  auto histo = _Xml<TH1F>( input );
259  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
260  //
261  histo->Copy( result );
262  //
263  return StatusCode::SUCCESS;
264 }

◆ fromXml() [9/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH2D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 218 of file HistoXML.cpp.

218  {
219  //
220  result.Reset(); // RESET old histogram
221  //
222  auto histo = _Xml<TH2D>( input );
223  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
224  //
225  histo->Copy( result );
226  //
227  return StatusCode::SUCCESS;
228 }

◆ fromXml() [10/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH2D *&  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 362 of file HistoXML.cpp.

362  {
363  if ( result ) { return fromXml( *result, input ); }
364  //
365  auto histo = _Xml<TH2D>( input );
366  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
367  //
368  result = histo.release(); // ASSIGN
369  //
370  return StatusCode::SUCCESS;
371 }

◆ fromXml() [11/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH2F &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 272 of file HistoXML.cpp.

272  {
273  //
274  result.Reset(); // RESET old histogram
275  //
276  auto histo = _Xml<TH2F>( input );
277  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
278  //
279  histo->Copy( result );
280  //
281  return StatusCode::SUCCESS;
282 }

◆ fromXml() [12/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH3D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 236 of file HistoXML.cpp.

236  {
237  //
238  result.Reset(); // RESET old histogram
239  //
240  auto histo = _Xml<TH3D>( input );
241  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
242  //
243  histo->Copy( result );
244  //
245  return StatusCode::SUCCESS;
246 }

◆ fromXml() [13/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH3D *&  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 379 of file HistoXML.cpp.

379  {
380  if ( result ) { return fromXml( *result, input ); }
381  //
382  auto histo = _Xml<TH3D>( input );
383  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
384  //
385  result = histo.release(); // ASSIGN
386  //
387  return StatusCode::SUCCESS;
388 }

◆ fromXml() [14/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TH3F &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 290 of file HistoXML.cpp.

290  {
291  //
292  result.Reset(); // RESET old histogram
293  //
294  auto histo = _Xml<TH3F>( input );
295  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
296  //
297  histo->Copy( result );
298  //
299  return StatusCode::SUCCESS;
300 }

◆ fromXml() [15/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TProfile &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 308 of file HistoXML.cpp.

308  {
309  //
310  result.Reset(); // RESET old histogram
311  //
312  auto histo = _Xml<TProfile>( input );
313  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
314  //
315  histo->Copy( result );
316  //
317  return StatusCode::SUCCESS;
318 }

◆ fromXml() [16/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TProfile *&  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 397 of file HistoXML.cpp.

397  {
398  if ( result ) { return fromXml( *result, input ); }
399  //
400  auto histo = _Xml<TProfile>( input );
401  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
402  //
403  result = histo.release(); // ASSIGN
404  //
405  return StatusCode::SUCCESS;
406 }

◆ fromXml() [17/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TProfile2D &  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 326 of file HistoXML.cpp.

326  {
327  //
328  result.Reset(); // RESET old histogram
329  //
330  auto histo = _Xml<TProfile2D>( input );
331  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
332  //
333  histo->Copy( result );
334  //
335  return StatusCode::SUCCESS;
336 }

◆ fromXml() [18/18]

StatusCode Gaudi::Utils::Histos::fromXml ( TProfile2D *&  result,
std::string_view  input 
)

parse the histogram from standard ROOT XML

See also
TBufferXML
TBufferXML::ConvertFromXML
Parameters
result(OUTPUT) the parsed histogram
input(INPUT) the input XML string
Returns
status code

Definition at line 414 of file HistoXML.cpp.

414  {
415  if ( result ) { return fromXml( *result, input ); }
416  //
417  auto histo = _Xml<TProfile2D>( input );
418  if ( !histo ) { return StatusCode::FAILURE; } // RETURN
419  //
420  result = histo.release(); // ASSIGN
421  //
422  return StatusCode::SUCCESS;
423 }

◆ histoDump() [1/4]

std::string Gaudi::Utils::Histos::histoDump ( const AIDA::IHistogram1D *  histo,
const std::size_t  width = 80,
const std::size_t  height = 50,
const bool  errors = false 
)

dump the text representation of the histogram

Parameters
histo(INPUT) the histogram
width(INPUT) the maximal column width
height(INPUT) the proposed column height
erorrs(INPUT) print/plot errors
Returns
string representation of the histogram
Author
Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2009-09-19

Definition at line 559 of file HistoDump.cpp.

560  {
561  std::ostringstream stream;
562  stream << std::endl;
563  if ( !histo ) { return stream.str(); } // RETURN
564  Histo hist;
565  StatusCode sc = _getHisto( histo, hist );
566  if ( sc.isFailure() ) { return stream.str(); } // RETURN
567 
568  stream << fmt::format( R"( Histo TES : "{}"
569  Histo Title : "{}"
570 
571  Mean : {:11.5g} +- {:<10.4g}
572  Rms : {:11.5g} +- {:<10.4g}
573  Skewness : {:11.5g} +- {:<10.4g}
574  Kurtosis : {:11.5g} +- {:<10.4g}
575 
576  Entries :
577  | All | In Range | Underflow | Overflow | #Equivalent | Integral | Total |
578  | {:^9} | {:^9} | {:^9} | {:^9} | {:^11.5g} | {:^11.5g} | {:^11.5g} |
579 
580 )",
581  path( histo ), histo->title(), //
586  histo->allEntries(), histo->entries(), histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN ),
587  histo->binEntries( AIDA::IAxis::OVERFLOW_BIN ), histo->equivalentBinEntries(),
588  histo->sumBinHeights(), histo->sumAllBinHeights() );
589 
590  const AIDA::IAnnotation& a = histo->annotation();
591  if ( a.size() ) {
592  stream << " Annotation\n";
593  for ( int i = 0; i < a.size(); ++i ) {
594  stream << fmt::format( " | {:<25.25s} : {:<45.45s} |\n", a.key( i ), a.value( i ) );
595  }
596  stream << '\n';
597  }
598 
599  return dumpText( hist, width, height, errors, stream ).str();
600 }

◆ histoDump() [2/4]

std::string Gaudi::Utils::Histos::histoDump ( const AIDA::IProfile1D *  histo,
const std::size_t  width = 80,
const std::size_t  height = 50,
const bool  spread = true 
)

dump the text representation of the 1D-profile

Parameters
histo(INPUT) the histogram
width(INPUT) the maximal column width
height(INPUT) the proposed column height
spread(INPUT) print/plto spread vs rms
Returns
string representation of the histogram
Author
Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2009-09-19

Definition at line 610 of file HistoDump.cpp.

611  {
612  std::ostringstream stream;
613  stream << std::endl;
614  if ( !histo ) { return stream.str(); } // RETURN
615  Histo hist;
616  StatusCode sc = _getHisto( histo, hist, spread );
617  if ( sc.isFailure() ) { return stream.str(); } // RETURN
618 
619  stream << fmt::format( R"( Histo TES : "{}"
620  Histo Title : "{}"
621 
622  Mean : {:11.5g}
623  Rms : {:11.5g}
624 
625  Entries :
626  | All | In Range | Underflow | Overflow | Integral | Total |
627  | {:^9} | {:^9} | {:^9} | {:^9} | {:^11.5g} | {:^11.5g} |
628 
629 )",
630  path( histo ), histo->title(), //
631  histo->mean(), histo->rms(), histo->allEntries(), histo->entries(),
632  histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN ),
633  histo->binEntries( AIDA::IAxis::OVERFLOW_BIN ), histo->sumBinHeights(),
634  histo->sumAllBinHeights() );
635 
636  const AIDA::IAnnotation& a = histo->annotation();
637  if ( a.size() ) {
638  stream << " Annotation\n";
639  for ( int i = 0; i < a.size(); ++i ) {
640  stream << fmt::format( " | {:<25.25s} : {:<45.45s} |\n", a.key( i ), a.value( i ) );
641  }
642  stream << std::endl;
643  }
644 
645  return dumpText( hist, width, height, true, stream ).str();
646 }

◆ histoDump() [3/4]

std::string Gaudi::Utils::Histos::histoDump ( const TH1 *  histo,
const std::size_t  width = 80,
const std::size_t  height = 50,
const bool  errors = false 
)

dump the text representation of the histogram

Parameters
histo(INPUT) the histogram
width(INPUT) the maximal column width
height(INPUT) the propsoed coulmn height
erorrs(INPUT) print/plot errors
Returns
string representation of the histogram
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2009-09-19

Definition at line 656 of file HistoDump.cpp.

657  {
658  const TProfile* profile = dynamic_cast<const TProfile*>( histo );
659  if ( profile ) { return histoDump( profile, width, height ); }
660  //
661  std::ostringstream stream;
662  stream << std::endl;
663  if ( !histo ) { return stream.str(); } // RETURN
664  Histo hist;
665  StatusCode sc = _getHisto( histo, hist );
666  if ( sc.isFailure() ) { return stream.str(); } // RETURN
667 
668  stream << fmt::format( R"( Histo Name : "{}"
669  Histo Title : "{}"
670 
671  Mean : {:11.5g} +- {:<10.4g}
672  Rms : {:11.5g} +- {:<10.4g}
673  Skewness : {:11.5g}
674  Kurtosis : {:11.5g}
675 
676  Entries :
677  | All | Underflow | Overflow | #Equivalent | Integral |
678  | {:^11.5g} | {:^11.5g} | {:^11.5g} | {:^11.5g} | {:^11.5g} |
679 
680 )",
681  histo->GetName(), histo->GetTitle(), //
682  histo->GetMean(), histo->GetMeanError(), histo->GetRMS(), histo->GetRMSError(),
683  histo->GetSkewness(), histo->GetKurtosis(), histo->GetEntries(), histo->GetBinContent( 0 ),
684  histo->GetBinContent( histo->GetNbinsX() + 1 ), histo->GetEffectiveEntries(),
685  histo->Integral() );
686 
687  return dumpText( hist, width, height, errors, stream ).str();
688 }

◆ histoDump() [4/4]

std::string Gaudi::Utils::Histos::histoDump ( const TProfile *  histo,
const std::size_t  width = 80,
const std::size_t  height = 50 
)

dump the text representation of the histogram

Parameters
histo(INPUT) the histogram
width(INPUT) the maximal column width
height(INPUT) the propsoed coulmn height
erorrs(INPUT) print/plot errors
Returns
string representation of the histogram
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2009-09-19

Definition at line 698 of file HistoDump.cpp.

699  {
700  std::ostringstream stream;
701  stream << std::endl;
702  if ( !histo ) { return stream.str(); } // RETURN
703  Histo hist;
704  StatusCode sc = _getHisto( histo, hist, true );
705  if ( sc.isFailure() ) { return stream.str(); } // RETURN
706 
707  stream << fmt::format( R"( Profile Name : "{}"
708  Profile Title : "{}"
709 
710  Mean : {:11.5g}
711  Rms : {:11.5g}
712 
713  Entries :
714  | All | Underflow | Overflow | Integral |
715  | {:^11.5g} | {:^11.5g} | {:^11.5g} | {:^11.5g} |
716 
717 )",
718  histo->GetName(), histo->GetTitle(), //
719  histo->GetMean(), histo->GetRMS(), histo->GetSkewness(), histo->GetKurtosis(),
720  histo->GetEntries(), histo->GetBinContent( 0 ), histo->GetBinContent( histo->GetNbinsX() + 1 ),
721  histo->Integral() );
722 
723  return dumpText( hist, width, height, true, stream ).str();
724 }

◆ path()

std::string Gaudi::Utils::Histos::path ( const AIDA::IBaseHistogram *  aida)

get the path in THS for AIDA histogram

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-08

Definition at line 218 of file HistoTableFormat.cpp.

218  {
219  if ( !aida ) { return ""; } // RETURN
220  const auto object = dynamic_cast<const DataObject*>( aida );
221  if ( !object ) { return ""; } // RETURN
222  const auto registry = object->registry();
223  if ( !registry ) { return ""; } // RETURN
224  const auto _path = registry->identifier();
225  const auto n = _path.find( "/stat/" );
226  return ( 0 == n ? std::string( _path, 6 ) : _path ); // RETURN
227 }

◆ printList() [1/2]

template<class LIST , class STREAM , class TERMINATOR >
STREAM& Gaudi::Utils::Histos::printList ( const LIST &  histos,
const std::string &  fmt,
STREAM &  stream,
TERMINATOR  term 
)
inline

print the simple container of histograms as table

using namespace Gaudi::Utils::Histos ;
SEQUENCE histos = ... ;
// print a table with three columns: path, title and #entries
( histos ,
" | %1$|-40.40s | %2$-30.30s | %3$=7d | " ,
std::cout ,
'\n' ) ;
Parameters
histosthe sequence of histograms
streamthe stream to be used for printout
termthe terminmator for the stream
fmtthe format to be used

Definition at line 315 of file HistoTableFormat.h.

315  {
316  return printList( histos.begin(), histos.end(), fmt, stream, term );
317  }

◆ printList() [2/2]

template<class HISTO , class STREAM , class TERMINATOR >
STREAM& Gaudi::Utils::Histos::printList ( HISTO  first,
HISTO  last,
const std::string &  fmt,
STREAM &  stream,
TERMINATOR  term 
)
inline

print the simple sequence (list-like) of histograms as table

SEQUENCE histos = ... ;
// print a table with three colums path, title and #entries
( histos.begin () ,
histos.end () ,
" | %1$|-40.40s | %2$-30.30s | %3$=7d | " ,
std::cout ,
'\n' ) ;
Parameters
firstbegin-iterator for the sequence
lastend-iterator for the sequence
streamthe stream to be used for printout
termthe terminmator for the stream
fmtthe format to be used

Definition at line 286 of file HistoTableFormat.h.

286  {
287  for ( ; first != last; ++first ) { stream << format( *first, fmt ) << term; } // print table rows
288  return stream; // RETURN
289  }

◆ printMap() [1/2]

template<class MAP , class STREAM , class TERMINATOR >
STREAM& Gaudi::Utils::Histos::printMap ( const MAP &  histos,
const std::string &  fmt1,
const std::string &  fmt2,
STREAM &  stream,
TERMINATOR  term 
)
inline

Print the "associative sequence" (e.g.

part of std:map) of histograms as table:

using namespace Gaudi::Utils::Histos ;
const std::map<std::string,AIDA::IHistogram1D*>& m = ... ;
( m ,
"| %1$-10.10s | %2% " , // short format
Gaudi::Utils::Histos::Formats::histoFormatOnly ,
always() ,
endmsg ) ;

Print only mean and rms:

using namespace Gaudi::Utils::Histos ;
const std::map<std::string,AIDA::IHistogram1D*>& m = ... ;
( m ,
"| %1$-10.10s | %2% " , // short format
" %8$10.5g+-%10$-10.5g|", // mean+-rms
always() ,
endmsg ) ;
Parameters
begin'begin'-iterator for the mapping sequence
end'end'-iterator for the mapping sequence
fmt1'short' format for the table printout
fmt3format for the printout of the histogram
streamthe stream for printout
termstream terminator

Definition at line 418 of file HistoTableFormat.h.

419  {
420  return printMap( histos.begin(), histos.end(), fmt1, fmt2, stream, term );
421  }

◆ printMap() [2/2]

template<class HISTO , class STREAM , class TERMINATOR >
STREAM& Gaudi::Utils::Histos::printMap ( HISTO  begin,
HISTO  end,
const std::string &  fmt1,
const std::string &  fmt2,
STREAM &  stream,
TERMINATOR  term 
)
inline

Print the "associative sequence" (e.g.

part of std:map) of histograms as table:

using namespace Gaudi::Utils::Histos ;
const std::map<std::string,AIDA::IHistogram1D*>& m = ... ;
( m.begin () ,
m.end () ,
"| %1$-10.10s | %2% " , // short format
Gaudi::Utils::Histos::Formats::histoFormatOnly ,
always() ,
endmsg ) ;

Print only mean and rms:

using namespace Gaudi::Utils::Histos ;
const std::map<std::string,AIDA::IHistogram1D*>& m = ... ;
( m.begin () ,
m.end () ,
"| %1$-10.10s | %2% " , // short format
" %8$10.5g+-%10$-10.5g|", // mean+-rms
always() ,
endmsg ) ;
Parameters
begin'begin'-iterator for the mapping sequence
end'end'-iterator for the mapping sequence
fmt1'short' format for the table printout
fmt3format for the printout of the histogram
streamthe stream for printout
termstream terminator

Definition at line 364 of file HistoTableFormat.h.

365  {
366  for ( ; begin != end; ++begin ) {
367  stream << format( begin->second, // the histogram
368  begin->first, // the key
369  fmt1, fmt2 )
370  << term;
371  }
372  return stream;
373  }

◆ setAxisLabels() [1/4]

bool Gaudi::Utils::Histos::setAxisLabels ( AIDA::IHistogram1D *  hist,
const std::string &  xAxis,
const std::string &  yAxis 
)

Set the axis labels for the given 1D histogram.

Parameters
histPointer to the histogram
xAxisLabel for the x axis
yAxisLabel for the y axis
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 133 of file HistoLabels.cpp.

133  {
134  return setAxisLabels_<TH1D>( hist, xAxis, yAxis );
135  }

◆ setAxisLabels() [2/4]

bool Gaudi::Utils::Histos::setAxisLabels ( AIDA::IHistogram2D *  hist,
const std::string &  xAxis,
const std::string &  yAxis 
)

Set the axis labels for the given 2D histogram.

Parameters
histPointer to the histogram
xAxisLabel for the x axis
yAxisLabel for the y axis
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 141 of file HistoLabels.cpp.

141  {
142  return setAxisLabels_<TH2D>( hist, xAxis, yAxis );
143  }

◆ setAxisLabels() [3/4]

bool Gaudi::Utils::Histos::setAxisLabels ( AIDA::IProfile1D *  hist,
const std::string &  xAxis,
const std::string &  yAxis 
)

Set the axis labels for the given 1D profile histogram.

Parameters
histPointer to the histogram
xAxisLabel for the x axis
yAxisLabel for the y axis
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 137 of file HistoLabels.cpp.

137  {
138  return setAxisLabels_<TProfile>( hist, xAxis, yAxis );
139  }

◆ setAxisLabels() [4/4]

bool Gaudi::Utils::Histos::setAxisLabels ( AIDA::IProfile2D *  hist,
const std::string &  xAxis,
const std::string &  yAxis 
)

Set the axis labels for the given 2D profile histogram.

Parameters
histPointer to the histogram
xAxisLabel for the x axis
yAxisLabel for the y axis
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 145 of file HistoLabels.cpp.

145  {
146  return setAxisLabels_<TProfile2D>( hist, xAxis, yAxis );
147  }

◆ setBinLabels() [1/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IHistogram1D *  hist,
const BinLabels labels 
)

Set the Bin labels for a given 1D histogram.

Each entry in 'labels' gives the bin number and its associated label

Parameters
histPointer to the histogram
labelsThe list of labels
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 83 of file HistoLabels.cpp.

83  {
84  return setBinLabels_<TH1D>( hist, labels );
85  }

◆ setBinLabels() [2/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IHistogram1D *  hist,
const Labels labels 
)

Set the Bin labels for a given 1D histogram.

The labels will be applied in the order they appear in the list, starting at the first bin. If the list of labels is too short, the later bins will be missing a label. If the list is too long, only the first N will be used, where N is the number of bins in the histogram

Parameters
histPointer to the histogram
labelsThe list of labels
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 91 of file HistoLabels.cpp.

91 { return setBinLabels_( hist, labels ); }

◆ setBinLabels() [3/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IHistogram2D *  hist,
const BinLabels xlabels,
const BinLabels ylabels 
)

Set the Bin labels for a given 2D histogram.

Each entry in 'labels' lists gives the bin number and its associated label

Parameters
histPointer to the histogram
xlabelsThe list of x bin numbers and the associated label
ylabelsThe list of y bin numbers and the associated label
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 108 of file HistoLabels.cpp.

108  {
109  TH2D* h2d = Gaudi::Utils::Aida2ROOT::aida2root( hist );
110  return ( h2d && setBinLabels_( h2d->GetXaxis(), xlabels ) && setBinLabels_( h2d->GetYaxis(), ylabels ) );
111  }

◆ setBinLabels() [4/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IHistogram2D *  hist,
const Labels xlabels,
const Labels ylabels 
)

Set the Bin labels for a given 2D histogram.

The labels will be applied in the order they appear in the lists, starting at the first bin. If the list of labels is too short, the later bins will be missing a label. If the list is too long, only the first N will be used, where N is the number of bins in the histogram

Parameters
histPointer to the histogram
xlabelsThe list of x labels
ylabelsThe list of y labels
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 95 of file HistoLabels.cpp.

95  {
96  if ( !hist ) return false;
97  TH2D* h2d = Gaudi::Utils::Aida2ROOT::aida2root( hist );
98  if ( !h2d ) return false;
99  BinLabels lx;
100  lx.reserve( xlabels.size() );
101  for ( unsigned int i = 0; i < xlabels.size(); ++i ) { lx.emplace_back( i, xlabels[i] ); }
102  BinLabels ly;
103  ly.reserve( ylabels.size() );
104  for ( unsigned int i = 0; i < ylabels.size(); ++i ) { ly.emplace_back( i, ylabels[i] ); }
105  return ( setBinLabels_( h2d->GetXaxis(), lx ) && setBinLabels_( h2d->GetYaxis(), ly ) );
106  }

◆ setBinLabels() [5/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IProfile1D *  hist,
const BinLabels labels 
)

Set the Bin labels for a given 1D profile histogram.

Each entry in 'labels' gives the bin number and its associated label

Parameters
histPointer to the histogram
labelsThe list of bin numbers and the associated label
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 87 of file HistoLabels.cpp.

87  {
88  return setBinLabels_<TProfile>( hist, labels );
89  }

◆ setBinLabels() [6/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IProfile1D *  hist,
const Labels labels 
)

Set the Bin labels for a given 1D profile histogram.

The labels will be applied in the order they appear in the list, starting at the first bin. If the list of labels is too short, the later bins will be missing a label. If the list is too long, only the first N will be used, where N is the number of bins in the histogram

Parameters
histPointer to the histogram
labelsThe list of labels
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 93 of file HistoLabels.cpp.

93 { return setBinLabels_( hist, labels ); }

◆ setBinLabels() [7/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IProfile2D *  hist,
const BinLabels xlabels,
const BinLabels ylabels 
)

Set the Bin labels for a given 2D profile histogram.

Each entry in 'labels' lists gives the bin number and its associated label

Parameters
histPointer to the histogram
xlabelsThe list of x bin numbers and the associated label
ylabelsThe list of y bin numbers and the associated label
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 126 of file HistoLabels.cpp.

126  {
127  TProfile2D* h2d = Gaudi::Utils::Aida2ROOT::aida2root( hist );
128  return ( h2d && setBinLabels_( h2d->GetXaxis(), xlabels ) && setBinLabels_( h2d->GetYaxis(), ylabels ) );
129  }

◆ setBinLabels() [8/8]

bool Gaudi::Utils::Histos::setBinLabels ( AIDA::IProfile2D *  hist,
const Labels xlabels,
const Labels ylabels 
)

Set the Bin labels for a given 2D profile histogram.

The labels will be applied in the order they appear in the lists, starting at the first bin. If the list of labels is too short, the later bins will be missing a label. If the list is too long, only the first N will be used, where N is the number of bins in the histogram

Parameters
histPointer to the histogram
xlabelsThe list of x labels
ylabelsThe list of y labels
Returns
Boolean indicating if the labels were successfully applied or not
Return values
TRUELabels were applied OK
FALSELabels were NOT applied

Definition at line 113 of file HistoLabels.cpp.

113  {
114  if ( !hist ) return false;
115  TProfile2D* h2d = Gaudi::Utils::Aida2ROOT::aida2root( hist );
116  if ( !h2d ) return false;
117  BinLabels lx;
118  lx.reserve( xlabels.size() );
119  for ( unsigned int i = 0; i < xlabels.size(); ++i ) { lx.emplace_back( i, xlabels[i] ); }
120  BinLabels ly;
121  ly.reserve( ylabels.size() );
122  for ( unsigned int i = 0; i < ylabels.size(); ++i ) { ly.emplace_back( i, ylabels[i] ); }
123  return ( setBinLabels_( h2d->GetXaxis(), lx ) && setBinLabels_( h2d->GetYaxis(), ly ) );
124  }

◆ toXml() [1/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const AIDA::IHistogram1D &  histo,
std::ostream &  stream 
)

stream the AIDA histogram into the output stream as XML

Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 148 of file HistoXML.cpp.

148  {
149  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &histo );
150  return root ? toXml( *root, stream ) : stream;
151 }

◆ toXml() [2/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const AIDA::IHistogram2D &  histo,
std::ostream &  stream 
)

stream the AIDA histogram into the output stream as XML

Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 158 of file HistoXML.cpp.

158  {
159  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &histo );
160  return root ? toXml( *root, stream ) : stream;
161 }

◆ toXml() [3/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const AIDA::IHistogram3D &  histo,
std::ostream &  stream 
)

stream the AIDA histogram into the output stream as XML

Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 168 of file HistoXML.cpp.

168  {
169  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &histo );
170  return root ? toXml( *root, stream ) : stream;
171 }

◆ toXml() [4/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const AIDA::IProfile1D &  histo,
std::ostream &  stream 
)

stream the AIDA histogram into the output stream as XML

Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 178 of file HistoXML.cpp.

178  {
179  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &histo );
180  return root ? toXml( *root, stream ) : stream;
181 }

◆ toXml() [5/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const AIDA::IProfile2D &  histo,
std::ostream &  stream 
)

stream the AIDA histogram into the output stream as XML

Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 188 of file HistoXML.cpp.

188  {
189  auto root = Gaudi::Utils::Aida2ROOT::aida2root( &histo );
190  return root ? toXml( *root, stream ) : stream;
191 }

◆ toXml() [6/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TH1D &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 76 of file HistoXML.cpp.

76  {
77  return stream << TBufferXML::ConvertToXML( &histo );
78 }

◆ toXml() [7/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TH1F &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 103 of file HistoXML.cpp.

103  {
104  return stream << TBufferXML::ConvertToXML( &histo );
105 }

◆ toXml() [8/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TH2D &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 85 of file HistoXML.cpp.

85  {
86  return stream << TBufferXML::ConvertToXML( &histo );
87 }

◆ toXml() [9/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TH2F &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 112 of file HistoXML.cpp.

112  {
113  return stream << TBufferXML::ConvertToXML( &histo );
114 }

◆ toXml() [10/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TH3D &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 94 of file HistoXML.cpp.

94  {
95  return stream << TBufferXML::ConvertToXML( &histo );
96 }

◆ toXml() [11/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TH3F &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 121 of file HistoXML.cpp.

121  {
122  return stream << TBufferXML::ConvertToXML( &histo );
123 }

◆ toXml() [12/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TProfile &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 130 of file HistoXML.cpp.

130  {
131  return stream << TBufferXML::ConvertToXML( &histo );
132 }

◆ toXml() [13/13]

std::ostream & Gaudi::Utils::Histos::toXml ( const TProfile2D &  histo,
std::ostream &  stream 
)

stream the ROOT histogram into output stream as XML

See also
TBufferXML
TBufferXML::ConvertToXML
Parameters
histo(INPUT) the histogram to be streamed
stream(OUTPUT) the stream

Definition at line 139 of file HistoXML.cpp.

139  {
140  return stream << TBufferXML::ConvertToXML( &histo );
141 }
GaudiPython.Bindings.FAILURE
FAILURE
Definition: Bindings.py:84
Gaudi::Utils::Histos::printList
STREAM & printList(const LIST &histos, const std::string &fmt, STREAM &stream, TERMINATOR term)
print the simple container of histograms as table
Definition: HistoTableFormat.h:315
Write.stream
stream
Definition: Write.py:32
cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:83
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:620
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
Gaudi::Utils::HistoStats::rmsErr
static double rmsErr(const AIDA::IHistogram1D *histo)
get an error in the rms value
Definition: HistoStats.cpp:652
gaudiComponentHelp.root
root
Definition: gaudiComponentHelp.py:42
Gaudi::Utils::Histos::histoDump
GAUDI_API std::string histoDump(const AIDA::IHistogram1D *histo, const std::size_t width=80, const std::size_t height=50, const bool errors=false)
dump the text representation of the histogram
Definition: HistoDump.cpp:559
Gaudi::Utils::Histos::printMap
STREAM & printMap(HISTO begin, HISTO end, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
Print the "associative sequence" (e.g.
Definition: HistoTableFormat.h:364
Gaudi::Utils
Definition: Property.h:641
Gaudi::Utils::Aida2ROOT::aida2root
static TH1D * aida2root(AIDA::IHistogram1D *aida)
get the underlying pointer for 1D-histogram
Definition: Aida2ROOT.cpp:60
Gaudi::Utils::HistoStats::kurtosisErr
static double kurtosisErr(const AIDA::IHistogram1D *histo)
get the error in kurtosis for the histogram
Definition: HistoStats.cpp:612
Gaudi::Utils::HistoStats::underflowEntriesFracErr
static double underflowEntriesFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow entries (useful for shape comparison)
Definition: HistoStats.cpp:742
Gaudi::Utils::HistoStats::meanErr
static double meanErr(const AIDA::IHistogram1D *histo)
get an error in the mean value
Definition: HistoStats.cpp:636
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:135
StatusCode
Definition: StatusCode.h:64
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:107
Gaudi::Utils::Histos::BinLabels
std::vector< BinLabel > BinLabels
Typedef for a list of bin numbers and their associated label.
Definition: HistoLabels.h:36
Gaudi::Utils::Histos::format
GAUDI_API std::string format(const std::string &val1, const std::string &val2, const std::string &fmt)
helper method to merge the headers for short format table
Definition: HistoTableFormat.cpp:357
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:93
Gaudi::Utils::HistoStats::overflowEntriesFrac
static double overflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow entries (useful for shape comparison)
Definition: HistoStats.cpp:682
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
cpluginsvc.n
n
Definition: cpluginsvc.py:234
Gaudi::Utils::HistoStats::overflowIntegralFracErr
static double overflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of overflow intergal
Definition: HistoStats.cpp:754
Gaudi::Utils::HistoStats::underflowIntegralFrac
static double underflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow integral (useful for shape comparison)
Definition: HistoStats.cpp:718
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
Gaudi::Utils::HistoStats::overflowEntriesFracErr
static double overflowEntriesFracErr(const AIDA::IHistogram1D *histo)
error on fraction of overflow entries (useful for shape comparison)
Definition: HistoStats.cpp:730
Gaudi::Utils::Histos::printMap
STREAM & printMap(const MAP &histos, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
Print the "associative sequence" (e.g.
Definition: HistoTableFormat.h:418
Gaudi::Utils::Histos::printList
STREAM & printList(HISTO first, HISTO last, const std::string &fmt, STREAM &stream, TERMINATOR term)
print the simple sequence (list-like) of histograms as table
Definition: HistoTableFormat.h:286
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
compareRootHistos.histos
histos
Definition: compareRootHistos.py:26
Gaudi::Utils::HistoStats::mean
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:628
fmt
Gaudi::Utils::Histos::fromXml
GAUDI_API StatusCode fromXml(TH1D &result, std::string_view input)
parse the histogram from standard ROOT XML
Definition: HistoXML.cpp:199
DataObject
Definition: DataObject.h:37
Gaudi::Utils::HistoStats::rms
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:644
Gaudi::Utils::HistoStats::kurtosis
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
Definition: HistoStats.cpp:604
Gaudi::Utils::HistoStats::sumBinHeightErr
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
Definition: HistoStats.cpp:660
Gaudi::Utils::HistoStats::sumAllBinHeightErr
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
Definition: HistoStats.cpp:670
IOTest.end
end
Definition: IOTest.py:125
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
Gaudi::Utils::HistoStats::skewnessErr
static double skewnessErr(const AIDA::IHistogram1D *histo)
get the error in skewness for the histogram
Definition: HistoStats.cpp:596
Gaudi::Utils::Histos
Definition: HistoDump.h:27
Gaudi::Utils::HistoStats::overflowIntegralFrac
static double overflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow intergal (useful for shape comparison)
Definition: HistoStats.cpp:706
Gaudi::Utils::HistoStats::skewness
static double skewness(const AIDA::IHistogram1D *histo)
get the skewness for the histogram
Definition: HistoStats.cpp:588
Gaudi::Utils::Histos::format
GAUDI_API std::string format(const AIDA::IHistogram1D *histo, const std::string &fmt)
Make the string representation of the histogram according to the specified format.
Definition: HistoTableFormat.cpp:233
Gaudi::Utils::HistoStats::underflowIntegralFracErr
static double underflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow integral
Definition: HistoStats.cpp:766
Gaudi::Utils::Histos::toXml
GAUDI_API std::ostream & toXml(const TH1D &histo, std::ostream &stream)
stream the ROOT histogram into output stream as XML
Definition: HistoXML.cpp:76
Gaudi::Utils::HistoStats::underflowEntriesFrac
static double underflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow entries (useful for shape comparison)
Definition: HistoStats.cpp:694