16 template <
class PBASE>
18 const unsigned long binsX,
const double lowY,
const double highY,
19 const unsigned long binsY )
const {
21 if ( !produceHistos() ) {
return nullptr; }
24 auto hist = histo2D( title );
26 if ( hist ) {
return hist; }
30 newHistoID( title, ID );
33 return this->book2D( ID, title, lowX, highX, binsX, lowY, highY, binsY );
38 template <
class PBASE>
40 const double highX,
const unsigned long binsX,
const double lowY,
41 const double highY,
const unsigned long binsY )
const {
43 if ( !produceHistos() ) {
return nullptr; }
47 this->Error(
"Undefined Histogram ID : Title='" + title +
"'" ).ignore();
52 auto hist = histo2D( ID );
54 if ( hist ) {
return hist; }
61 hist = this->histoSvc()->book( histoPath(), ID.
numericID(),
htitle, binsX, lowX, highX, binsY, lowY, highY );
63 hist = this->histoSvc()->book( histoPath() +
"/" + ID.
literalID(),
htitle, binsX, lowX, highX, binsY, lowY, highY );
68 this->Error(
"IHistogram2D* points to NULL! ID='" + ID.
idAsString() +
"' title='" +
htitle +
"'" ).ignore();
73 m_histo2DMapID[ID] = hist;
74 m_histo2DMapTitle[title] = hist;
81 this->debug() <<
"Booked 2D Histogram : ID='" << ID <<
"' Path=" << histoPath() <<
" Title='" 90 template <
class PBASE>
92 const double weight,
const std::string& title )
const {
94 if ( !histo ) {
return nullptr; }
96 if ( !checkForNaN() ) {
101 this->Warning(
"fill():: 'NaN' value is skipped from the histogram '" +
105 this->Warning(
"fill():: 'Infinite' value is skipped from the histogram '" +
115 template <
class PBASE>
117 const double lowX,
const double highX,
const double lowY,
118 const double highY,
const unsigned long binsX,
119 const unsigned long binsY,
const double weight )
const {
120 AIDA::IHistogram2D* h(
nullptr );
121 if ( produceHistos() ) {
123 h = histo2D( title );
124 if ( !h ) { h = book2D( title, lowX, highX, binsX, lowY, highY, binsY ); }
126 h =
fill( h, valueX, valueY, weight, title );
133 template <
class PBASE>
135 const std::string& title,
const double lowX,
const double highX,
136 const double lowY,
const double highY,
const unsigned long binsX,
137 const unsigned long binsY,
const double weight )
const {
138 AIDA::IHistogram2D* h(
nullptr );
140 if ( produceHistos() ) {
143 if ( !h ) { h = book2D( ID, title, lowX, highX, binsX, lowY, highY, binsY ); }
145 h =
fill( h, valueX, valueY, weight, title );
const LiteralID & literalID() const noexcept
Returns the ID as a LiteralID.
GAUDI_API std::string htitle(const AIDA::IBaseHistogram *histo, const std::string &title="")
get the title
GAUDI_API void fill(AIDA::IHistogram1D *histo, const double value, const double weight=1.0)
simple function to fill AIDA::IHistogram1D objects
NumericID numericID() const noexcept
Returns the numerical ID.
GAUDI_API LiteralID idAsString() const
Return ID as string, for both numeric and literal IDs.
bool undefined() const noexcept
Is this ID undefined.
bool literal() const noexcept
Is this ID numeric.
AIDA::IHistogram2D * book2D(const std::string &title, const double lowX=0, const double highX=100, const unsigned long binsX=50, const double lowY=0, const double highY=100, const unsigned long binsY=50) const
book the 2D histogram
AIDA::IHistogram1D * fill(AIDA::IHistogram1D *histo, const double value, const double weight, const std::string &title="") const
fill the 1D histogram with the value and weight
bool numeric() const noexcept
Is this ID numeric.
GAUDI_API AIDA::IBaseHistogram * toBase(AIDA::IHistogram1D *histo)
ID class for Histogram and Ntuples.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
AIDA::IHistogram2D * plot2D(const double valueX, const double valueY, const std::string &title, const double lowX, const double highX, const double lowY, const double highY, const unsigned long binsX=50, const unsigned long binsY=50, const double weight=1.0) const
fill the 2D histogram (book on demand)