The Gaudi Framework  master (37c0b60a)
Gaudi::Utils::Histos Namespace Reference

Namespaces

 Formats
 

Classes

class  HistoStrings
 
class  Table
 

Typedefs

typedef std::vector< std::stringLabels
 Typedef for a list of labels. More...
 
typedef std::pair< unsigned, std::stringBinLabel
 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::ostreamtoXml (const TH1D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TH2D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TH3D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TProfile &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TProfile2D &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const AIDA::IHistogram1D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const AIDA::IHistogram2D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const AIDA::IHistogram3D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const AIDA::IProfile1D &histo, std::ostream &stream)
 stream the AIDA histogram into the output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TH1F &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TH2F &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (const TH3F &histo, std::ostream &stream)
 stream the ROOT histogram into output stream as XML More...
 
GAUDI_API std::ostreamtoXml (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 for a bin number and its associated label.

Definition at line 35 of file HistoLabels.h.

◆ BinLabels

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

Definition at line 37 of file HistoLabels.h.

◆ Labels

Typedef for a list of labels.

Definition at line 33 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:
format ( histo , " #nEntries/Overflow/Underflow=%3%/%4%/%5%" )
<< std::endl ;
// print the formatted Mean+-ErrorMean:
format ( histo , " Mean+-Error=(%8%+-%9%)" )
<< std::endl ;
// print the skewness and kurtosis:
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 565 of file HistoDump.cpp.

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

◆ 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 616 of file HistoDump.cpp.

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

◆ 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 662 of file HistoDump.cpp.

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

◆ 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 704 of file HistoDump.cpp.

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

◆ 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 | " ,
'\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 316 of file HistoTableFormat.h.

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

◆ 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 | " ,
'\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 287 of file HistoTableFormat.h.

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

◆ 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 ;
( m ,
"| %1$-10.10s | %2% " , // short format
Gaudi::Utils::Histos::Formats::histoFormatOnly ,
always() ,
endmsg ) ;

Print only mean and rms:

using namespace Gaudi::Utils::Histos ;
( 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 419 of file HistoTableFormat.h.

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

◆ 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 ;
( 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 ;
( 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 365 of file HistoTableFormat.h.

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

◆ 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 139 of file HistoLabels.cpp.

139  {
140  return setAxisLabels_<TH1D>( hist, xAxis, yAxis );
141  }

◆ 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 147 of file HistoLabels.cpp.

147  {
148  return setAxisLabels_<TH2D>( hist, xAxis, yAxis );
149  }

◆ 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 143 of file HistoLabels.cpp.

143  {
144  return setAxisLabels_<TProfile>( hist, xAxis, yAxis );
145  }

◆ 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 151 of file HistoLabels.cpp.

151  {
152  return setAxisLabels_<TProfile2D>( hist, xAxis, yAxis );
153  }

◆ 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 89 of file HistoLabels.cpp.

89  {
90  return setBinLabels_<TH1D>( hist, labels );
91  }

◆ 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 97 of file HistoLabels.cpp.

97 { 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 114 of file HistoLabels.cpp.

114  {
115  TH2D* h2d = Gaudi::Utils::Aida2ROOT::aida2root( hist );
116  return ( h2d && setBinLabels_( h2d->GetXaxis(), xlabels ) && setBinLabels_( h2d->GetYaxis(), ylabels ) );
117  }

◆ 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 101 of file HistoLabels.cpp.

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

◆ 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 93 of file HistoLabels.cpp.

93  {
94  return setBinLabels_<TProfile>( hist, labels );
95  }

◆ 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 99 of file HistoLabels.cpp.

99 { 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 132 of file HistoLabels.cpp.

132  {
133  TProfile2D* h2d = Gaudi::Utils::Aida2ROOT::aida2root( hist );
134  return ( h2d && setBinLabels_( h2d->GetXaxis(), xlabels ) && setBinLabels_( h2d->GetYaxis(), ylabels ) );
135  }

◆ 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 119 of file HistoLabels.cpp.

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

◆ 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:316
Write.stream
stream
Definition: Write.py:32
std::string
STL class.
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:565
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:365
Gaudi::Utils
Definition: Property.h:650
Gaudi::Utils::Aida2ROOT::aida2root
static TH1D * aida2root(AIDA::IHistogram1D *aida)
get the underlying pointer for 1D-histogram
Definition: Aida2ROOT.cpp:66
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:136
StatusCode
Definition: StatusCode.h:65
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:108
std::cout
Gaudi::Utils::Histos::BinLabels
std::vector< BinLabel > BinLabels
Typedef for a list of bin numbers and their associated label.
Definition: HistoLabels.h:37
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:119
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:202
std::map
STL class.
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
std::ostringstream
STL class.
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:419
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:287
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
std::endl
T endl(T... args)
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:36
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:101
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