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