00001
00002
00003
00004
00005
00006 template <class PBASE>
00007 AIDA::IHistogram2D* GaudiHistos<PBASE>::book2D
00008 ( const std::string& title ,
00009 const double lowX ,
00010 const double highX ,
00011 const unsigned long binsX ,
00012 const double lowY ,
00013 const double highY ,
00014 const unsigned long binsY ) const
00015 {
00016
00017 AIDA::IHistogram2D* hist = histo2D ( title ) ;
00018
00019 if( NULL != hist ) { return hist ; }
00020
00021
00022 HistoID ID;
00023 newHistoID( title, ID );
00024
00025
00026 return this -> book2D ( ID, title, lowX, highX, binsX, lowY, highY, binsY );
00027 }
00028
00029
00030
00031 template <class PBASE>
00032 AIDA::IHistogram2D* GaudiHistos<PBASE>::book2D
00033 ( const HistoID& ID ,
00034 const std::string& title ,
00035 const double lowX ,
00036 const double highX ,
00037 const unsigned long binsX ,
00038 const double lowY ,
00039 const double highY ,
00040 const unsigned long binsY ) const
00041 {
00042
00043 if (ID.undefined())
00044 {
00045 this->Error("Undefined Histogram ID : Title='"+title+"'");
00046 return NULL;
00047 }
00048
00049
00050 AIDA::IHistogram2D* hist = histo2D( ID ) ;
00051
00052 if( NULL != hist ) { return hist ; }
00053
00054
00055 const std::string & htitle =
00056 ( title.empty() ? "Unnamed 2D Histogram ID="+ID.idAsString() : title ) ;
00057
00058
00059 if ( ID.numeric() )
00060 {
00061 hist = this->histoSvc() -> book ( histoPath() ,
00062 ID.numericID() ,
00063 htitle ,
00064 binsX ,
00065 lowX ,
00066 highX ,
00067 binsY ,
00068 lowY ,
00069 highY ) ;
00070 }
00071 else if ( ID.literal() )
00072 {
00073 hist = this->histoSvc() -> book ( histoPath()+"/"+
00074 ID.literalID() ,
00075 htitle ,
00076 binsX ,
00077 lowX ,
00078 highX ,
00079 binsY ,
00080 lowY ,
00081 highY ) ;
00082 }
00083
00084
00085 if( NULL == hist )
00086 { this->Error( "IHistogram2D* points to NULL! ID='" + ID.idAsString() +
00087 "' title='"+htitle+"'" ) ; return NULL; }
00088
00089
00090 if ( ID.numeric() )
00091 { m_histo2DMapNumID [ ID.numericID() ] = hist ; }
00092 else if ( ID.literal() )
00093 { m_histo2DMapLitID [ ID.literalID() ] = hist ; }
00094 m_histo2DMapTitle [ title ] = hist ;
00095
00096
00097 monitorHisto( Gaudi::Utils::Histos::toBase ( hist) , ID );
00098
00099
00100 if ( this->msgLevel(MSG::DEBUG) )
00101 { this->debug() << "Booked 2D Histogram : ID='"
00102 << ID << "' Path=" << histoPath()
00103 << " Title='"
00104 << Gaudi::Utils::Histos::htitle ( hist )
00105 << "'" << endmsg; }
00106
00107 return hist ;
00108 }
00109
00110
00111
00112 template <class PBASE>
00113 AIDA::IHistogram2D* GaudiHistos<PBASE>::fill
00114 ( AIDA::IHistogram2D* histo ,
00115 const double valueX ,
00116 const double valueY ,
00117 const double weight ,
00118 const std::string& title ) const
00119 {
00120 if ( NULL != histo && produceHistos() )
00121 {
00122 if ( !checkForNaN() )
00123 { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , weight ) ; }
00124 else if ( lfin ( valueX ) && lfin ( valueY ) && lfin ( weight ) )
00125 { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , weight ) ; }
00126 else if ( lnan ( valueX ) || lnan ( valueY ) || lnan ( weight ) )
00127 {
00128 this -> Warning
00129 ("fill():: 'NaN' value is skipped from the histogram '"
00130 + Gaudi::Utils::Histos::htitle ( histo , title ) + "'" ) ;
00131 }
00132 else
00133 {
00134 this -> Warning
00135 ("fill():: 'Infinite' value is skipped from the histogram '"
00136 + Gaudi::Utils::Histos::htitle ( histo , title ) + "'" ) ;
00137 }
00138 }
00139
00140 return histo ;
00141 }
00142
00143
00144
00145 template <class PBASE>
00146 AIDA::IHistogram2D* GaudiHistos<PBASE>::plot2D
00147 ( const double valueX ,
00148 const double valueY ,
00149 const std::string& title ,
00150 const double lowX ,
00151 const double highX ,
00152 const double lowY ,
00153 const double highY ,
00154 const unsigned long binsX ,
00155 const unsigned long binsY ,
00156 const double weight ) const
00157 {
00158 AIDA::IHistogram2D * h(NULL);
00159 if ( produceHistos() )
00160 {
00161
00162 h = histo2D ( title ) ;
00163 if ( NULL == h )
00164 { h = book2D ( title , lowX , highX , binsX , lowY , highY , binsY ) ; }
00165
00166 h = fill ( h , valueX , valueY , weight , title ) ;
00167 }
00168 return h;
00169 }
00170
00171
00172
00173 template <class PBASE>
00174 AIDA::IHistogram2D* GaudiHistos<PBASE>::plot2D
00175 ( const double valueX ,
00176 const double valueY ,
00177 const HistoID& ID ,
00178 const std::string& title ,
00179 const double lowX ,
00180 const double highX ,
00181 const double lowY ,
00182 const double highY ,
00183 const unsigned long binsX ,
00184 const unsigned long binsY ,
00185 const double weight ) const
00186 {
00187 AIDA::IHistogram2D * h(NULL);
00188
00189 if ( produceHistos() )
00190 {
00191
00192 h = histo2D ( ID ) ;
00193 if ( NULL == h ) { h = book2D ( ID , title ,
00194 lowX , highX , binsX ,
00195 lowY , highY , binsY ) ; }
00196
00197 h = fill ( h , valueX , valueY , weight , title ) ;
00198 }
00199 return h;
00200 }