The Gaudi Framework  master (37c0b60a)
Gaudi::Profile1D Class Reference

#include </builds/gaudi/Gaudi/GaudiCommonSvc/include/GaudiCommonSvc/P1D.h>

Inheritance diagram for Gaudi::Profile1D:
Collaboration diagram for Gaudi::Profile1D:

Public Member Functions

 Profile1D ()
 Default Constructor. More...
 
 Profile1D (TProfile *rep)
 Standard constructor with initialization. The histogram representation will be adopted. More...
 
bool fill (double x, double y, double weight=1.) override
 Fill the Profile1D with a value and the corresponding weight. More...
 
virtual bool setBinContents (int i, int entries, double height, double error, double spread, double centre)
 
const CLIDclID () const override
 Retrieve reference to class defininition identifier. More...
 
- Public Member Functions inherited from DataObject
 DataObject ()
 Standard Constructor. More...
 
 DataObject (const DataObject &rhs)
 Copy Constructor. More...
 
DataObjectoperator= (const DataObject &rhs)
 Assignment Operator. More...
 
 DataObject (DataObject &&rhs)
 Move Constructor. More...
 
DataObjectoperator= (DataObject &&rhs)
 Move Assignment Operator. More...
 
virtual ~DataObject ()
 Standard Destructor. More...
 
virtual unsigned long addRef ()
 Add reference to object. More...
 
virtual unsigned long release ()
 release reference to object More...
 
const std::stringname () const
 Retreive DataObject name. It is the name when registered in the store. More...
 
virtual StatusCode update ()
 Provide empty placeholder for internal object reconfiguration callback. More...
 
void setRegistry (IRegistry *pRegistry)
 Set pointer to Registry. More...
 
IRegistryregistry () const
 Get pointer to Registry. More...
 
LinkManagerlinkMgr ()
 Retrieve Link manager. More...
 
const LinkManagerlinkMgr () const
 
unsigned char version () const
 Retrieve version number of this object representation. More...
 
void setVersion (unsigned char vsn)
 Set version number of this object representation. More...
 
unsigned long refCount () const
 Return the refcount. More...
 
virtual std::ostreamfillStream (std::ostream &s) const
 Fill the output stream (ASCII) More...
 
- Public Member Functions inherited from Gaudi::Generic1D< AIDA::IProfile1D, TProfile >
 Generic1D ()=default
 Default constructor. More...
 
virtual const std::stringuserLevelClassType () const
 The AIDA user-level unterface leaf class type. More...
 
void * cast (const std::string &cl) const override
 Manual cast by class name. More...
 
void * cast (const std::string &className) const
 
void * cast (const std::string &className) const
 
TObject * representation () const override
 ROOT object implementation. More...
 
void adoptRepresentation (TObject *rep) override
 Adopt ROOT histogram representation. More...
 
void adoptRepresentation (TObject *rep)
 Adopt ROOT histogram representation. More...
 
void adoptRepresentation (TObject *rep)
 Adopt ROOT histogram representation. More...
 
std::string title () const override
 Get the title of the object. More...
 
bool setTitle (const std::string &title) override
 Set the title of the object. More...
 
std::string name () const
 object name More...
 
bool setName (const std::string &newName)
 Set the name of the object. More...
 
AIDA::IAnnotation & annotation () override
 Access annotation object. More...
 
const AIDA::IAnnotation & annotation () const override
 Access annotation object (cons) More...
 
Axisaxis ()
 Access to axis object. More...
 
const Axisaxis () const override
 Get the x axis of the IHistogram1D. More...
 
int entries () const override
 Get the number or all the entries. More...
 
int allEntries () const override
 Get the number or all the entries, both in range and underflow/overflow bins of the IProfile. More...
 
int extraEntries () const override
 Get the number of entries in the underflow and overflow bins. More...
 
int binEntries (int index) const override
 Number of entries in the corresponding bin (ie the number of times fill was called for this bin). More...
 
int binEntries (int index) const
 
int binEntries (int index) const
 
virtual double binRms (int index) const
 
double sumBinHeights () const override
 Get the sum of in range bin heights in the IProfile. More...
 
double sumAllBinHeights () const override
 Get the sum of all the bins heights (including underflow and overflow bin). More...
 
double sumExtraBinHeights () const override
 Get the sum of the underflow and overflow bin height. More...
 
double minBinHeight () const override
 Get the minimum height of the in-range bins. More...
 
double maxBinHeight () const override
 Get the maximum height of the in-range bins. More...
 
virtual double equivalentBinEntries () const
 Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ] More...
 
virtual bool scale (double scaleFactor)
 Scale the weights and the errors of all the IHistogram's bins (in-range and out-of-range ones) by a given scale factor. More...
 
bool reset () override
 Reset the Histogram; as if just created. More...
 
bool add (const AIDA::IProfile1D &profile) override
 Modifies this IProfile1D by adding the contents of profile to it. More...
 
virtual int rIndex (int index) const
 operator methods More...
 
double binMean (int index) const override
 The weighted mean of a bin. More...
 
double binHeight (int index) const override
 Total height of the corresponding bin (ie the sum of the weights in this bin). More...
 
double binError (int index) const override
 The error of a given bin. More...
 
double mean () const override
 The mean of the whole IHistogram1D. More...
 
double rms () const override
 The RMS of the whole IHistogram1D. More...
 
int coordToIndex (double coord) const override
 Get the bin number corresponding to a given coordinate along the x axis. More...
 
int dimension () const override
 Get the Histogram's dimension. More...
 
std::ostreamprint (std::ostream &s) const override
 Print (ASCII) the histogram into the output stream. More...
 
std::ostreamwrite (std::ostream &s) const override
 Write (ASCII) the histogram table into the output stream. More...
 
int write (const char *file_name) const override
 Write (ASCII) the histogram table into a file. More...
 
- Public Member Functions inherited from Gaudi::HistogramBase
virtual TObject * representation () const =0
 ROOT object implementation. More...
 
virtual ~HistogramBase ()=default
 

Static Public Member Functions

static const CLIDclassID ()
 
- Static Public Member Functions inherited from DataObject
static const CLIDclassID ()
 Retrieve reference to class definition structure (static access) More...
 

Private Types

typedef AIDA::IAnnotation IAnnotation
 

Private Member Functions

void init (const std::string &title, bool initialize_axis=true)
 

Private Attributes

std::mutex m_fillSerialization
 

Friends

void reset (Profile1D &h)
 
void to_json (nlohmann::json &j, Profile1D const &p)
 conversion to json via nlohmann library More...
 

Additional Inherited Members

- Public Types inherited from Gaudi::Generic1D< AIDA::IProfile1D, TProfile >
typedef Generic1D< AIDA::IProfile1D, TProfile > Base
 
- Protected Member Functions inherited from Gaudi::Generic1D< AIDA::IProfile1D, TProfile >
 Generic1D (TProfile *p)
 constructor More...
 
- Protected Attributes inherited from Gaudi::Generic1D< AIDA::IProfile1D, TProfile >
Axis m_axis
 Axis member. More...
 
AIDA::Annotation m_annotation
 Object annotations. More...
 
std::unique_ptr< TProfile > m_rep
 Reference to underlying implementation. More...
 
std::string m_classType
 
int m_sumEntries
 

Detailed Description

AIDA implementation for 1 D profiles using ROOT TProfile

Author
M.Frank

Definition at line 32 of file P1D.h.

Member Typedef Documentation

◆ IAnnotation

typedef AIDA::IAnnotation Gaudi::Profile1D::IAnnotation
private

Definition at line 33 of file P1D.h.

Constructor & Destructor Documentation

◆ Profile1D() [1/2]

Gaudi::Profile1D::Profile1D ( )

Default Constructor.

Definition at line 86 of file P1D.cpp.

86 : Base( new TProfile() ) { init( "", false ); }

◆ Profile1D() [2/2]

Gaudi::Profile1D::Profile1D ( TProfile *  rep)

Standard constructor with initialization. The histogram representation will be adopted.

Definition at line 88 of file P1D.cpp.

88 : Base( rep ) { init( m_rep->GetTitle() ); }

Member Function Documentation

◆ classID()

static const CLID& Gaudi::Profile1D::classID ( )
inlinestatic

Definition at line 52 of file P1D.h.

52 { return CLID_ProfileH; }

◆ clID()

const CLID& Gaudi::Profile1D::clID ( ) const
inlineoverridevirtual

Retrieve reference to class defininition identifier.

Reimplemented from DataObject.

Definition at line 51 of file P1D.h.

51 { return classID(); }

◆ fill()

bool Gaudi::Profile1D::fill ( double  x,
double  y,
double  weight = 1. 
)
override

Fill the Profile1D with a value and the corresponding weight.

Definition at line 114 of file P1D.cpp.

114  {
115  // avoid race conditions when filling the profile
116  auto guard = std::scoped_lock{ m_fillSerialization };
117  m_rep->Fill( x, y, weight );
118  return true;
119 }

◆ init()

void Gaudi::Profile1D::init ( const std::string title,
bool  initialize_axis = true 
)
private

Definition at line 90 of file P1D.cpp.

90  {
91  m_classType = "IProfile1D";
92  setTitle( title );
93  setName( title );
94  if ( initialize_axis ) { axis().initialize( m_rep->GetXaxis(), false ); }
95  // m_rep->SetErrorOption("s");
96  m_rep->SetDirectory( nullptr );
97  m_sumEntries = 0;
98 }

◆ setBinContents()

bool Gaudi::Profile1D::setBinContents ( int  i,
int  entries,
double  height,
double  error,
double  spread,
double  centre 
)
virtual

Definition at line 100 of file P1D.cpp.

101  {
102  m_rep->SetBinEntries( rIndex( i ), entries );
103  // set content takes in root height * entries
104  m_rep->SetBinContent( rIndex( i ), height * entries );
105  // set error takes sqrt of bin sum(w*y**2)
106  double sumwy2Bin = ( spread * spread + height * height ) * entries;
107  m_rep->SetBinError( rIndex( i ), sqrt( sumwy2Bin ) );
109  // not very efficient (but do evey bin since root cannot figure out by himself)
110  m_rep->SetEntries( m_sumEntries );
111  return true;
112 }

Friends And Related Function Documentation

◆ reset

void reset ( Profile1D h)
friend

Definition at line 47 of file P1D.h.

47 { h.reset(); }

◆ to_json

void to_json ( nlohmann::json &  j,
Profile1D const &  p 
)
friend

conversion to json via nlohmann library

Definition at line 49 of file P1D.h.

49 { j = *p.m_rep.get(); }

Member Data Documentation

◆ m_fillSerialization

std::mutex Gaudi::Profile1D::m_fillSerialization
private

Definition at line 55 of file P1D.h.


The documentation for this class was generated from the following files:
Gaudi::Accumulators::sqrt
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
Definition: Counters.h:34
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::m_classType
std::string m_classType
Definition: Generic1D.h:143
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::m_rep
std::unique_ptr< TProfile > m_rep
Reference to underlying implementation.
Definition: Generic1D.h:141
Gaudi::Profile1D::classID
static const CLID & classID()
Definition: P1D.h:52
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::setName
bool setName(const std::string &newName)
Set the name of the object.
Definition: Generic1D.h:157
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::Base
Generic1D< AIDA::IProfile1D, TProfile > Base
Definition: Generic1D.h:48
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::entries
int entries() const override
Get the number or all the entries.
Definition: Generic1D.h:83
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::axis
Axis & axis()
Access to axis object.
Definition: Generic1D.h:78
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::title
std::string title() const override
Get the title of the object.
Definition: Generic1D.h:66
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::rIndex
virtual int rIndex(int index) const
operator methods
Definition: Generic1D.h:113
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::m_sumEntries
int m_sumEntries
Definition: Generic1D.h:145
ProduceConsume.j
j
Definition: ProduceConsume.py:104
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:63
AlgSequencer.h
h
Definition: AlgSequencer.py:31
Gaudi::Profile1D::init
void init(const std::string &title, bool initialize_axis=true)
Definition: P1D.cpp:90
Gaudi::Generic1D< AIDA::IProfile1D, TProfile >::setTitle
bool setTitle(const std::string &title) override
Set the title of the object.
Definition: Generic1D.h:149
Gaudi::Profile1D::m_fillSerialization
std::mutex m_fillSerialization
Definition: P1D.h:55