Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

GaudiHistos_1DProfFixedBinning.icpp

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

Generated at Mon Sep 7 18:05:34 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004