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