GaudiHistos_2DVariableBinning.icpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 template <class PBASE>
00007 AIDA::IHistogram2D* GaudiHistos<PBASE>::book2D
00008 ( const std::string& title ,
00009 const HistoBinEdges& edgesX ,
00010 const HistoBinEdges& edgesY ) const
00011 {
00012
00013 AIDA::IHistogram2D * hist = histo2D ( title ) ;
00014
00015 if ( NULL != hist ) { return hist ; }
00016
00017
00018 HistoID ID;
00019 newHistoID( title, ID );
00020
00021
00022 return this -> book2D ( ID, title, edgesX, edgesY );
00023 }
00024
00025
00026
00027 template <class PBASE>
00028 AIDA::IHistogram2D* GaudiHistos<PBASE>::book2D
00029 ( const HistoID& ID ,
00030 const std::string& title ,
00031 const HistoBinEdges& edgesX ,
00032 const HistoBinEdges& edgesY ) const
00033 {
00034
00035 if (ID.undefined())
00036 {
00037 this->Error("Undefined Histogram ID : Title='"+title+"'");
00038 return NULL;
00039 }
00040
00041
00042 AIDA::IHistogram2D * hist = histo2D ( ID ) ;
00043
00044 if ( NULL != hist ) { return hist ; }
00045
00046
00047 const std::string & htitle =
00048 ( title.empty() ? "Unnamed 2D Histogram ID="+ID.idAsString() : title ) ;
00049
00050
00051 if ( ID.numeric() )
00052 {
00053 hist = this->histoSvc() -> book ( histoPath() ,
00054 ID.numericID() ,
00055 htitle ,
00056 edgesX ,
00057 edgesY ) ;
00058 }
00059 else if ( ID.literal() )
00060 {
00061 hist = this->histoSvc() -> book ( histoPath()+"/"+
00062 ID.literalID() ,
00063 htitle ,
00064 edgesX ,
00065 edgesY ) ;
00066 }
00067
00068
00069 if( NULL == hist )
00070 { this->Error( "IHistogram2D* points to NULL! ID='" + ID.idAsString() +
00071 "' title='"+htitle+"'" ) ; return NULL; }
00072
00073
00074 if ( ID.numeric() )
00075 { m_histo2DMapNumID [ ID.numericID() ] = hist ; }
00076 else if ( ID.literal() )
00077 { m_histo2DMapLitID [ ID.literalID() ] = hist ; }
00078 m_histo2DMapTitle [ title ] = hist ;
00079
00080
00081 monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
00082
00083
00084 if ( this->msgLevel(MSG::DEBUG) )
00085 { this->debug() << "Booked 2D Histogram : ID='" << ID
00086 << "' Path=" << histoPath()
00087 << " Title='"
00088 << Gaudi::Utils::Histos::htitle ( hist )
00089 << "'" << endmsg; }
00090 return hist ;
00091 }
00092
00093
00094
00095 template <class PBASE>
00096 AIDA::IHistogram2D*
00097 GaudiHistos<PBASE>::plot2D
00098 ( const double valueX ,
00099 const double valueY ,
00100 const std::string& title ,
00101 const HistoBinEdges& edgesX ,
00102 const HistoBinEdges& edgesY ,
00103 const double weight ) const
00104 {
00105 AIDA::IHistogram2D * h(NULL);
00106 if ( produceHistos() )
00107 {
00108
00109 h = histo2D ( title ) ;
00110 if ( NULL == h ) { h = book2D ( title , edgesX , edgesY ) ; }
00111
00112 h = fill ( h , valueX , valueY , weight , title );
00113 }
00114 return h;
00115 }
00116
00117
00118
00119 template <class PBASE>
00120 AIDA::IHistogram2D*
00121 GaudiHistos<PBASE>::plot2D
00122 ( const double valueX ,
00123 const double valueY ,
00124 const HistoID& ID ,
00125 const std::string& title ,
00126 const HistoBinEdges& edgesX ,
00127 const HistoBinEdges& edgesY ,
00128 const double weight ) const
00129 {
00130 AIDA::IHistogram2D * h(NULL);
00131 if ( produceHistos() )
00132 {
00133
00134 h = histo2D ( ID ) ;
00135 if ( NULL == h ) { h = book2D ( ID , title , edgesX , edgesY ) ; }
00136
00137 h = fill ( h , valueX , valueY , weight , title ) ;
00138 }
00139 return h;
00140 }