Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

GaudiHistos_2DProfFixedBinning.icpp

Go to the documentation of this file.
00001 // ============================================================================
00002 // book the 2D profile histogram (book on demand)
00003 // ============================================================================
00004 template <class PBASE>
00005 AIDA::IProfile2D*  GaudiHistos<PBASE>::bookProfile2D
00006 ( const std::string&  title        ,
00007   const double        lowX         ,
00008   const double        highX        ,
00009   const unsigned long binsX        ,
00010   const double        lowY         ,
00011   const double        highY        ,
00012   const unsigned long binsY         ) const
00013 {
00014   // exist?
00015   AIDA::IProfile2D* hist = profile2D ( title ) ;
00016   // histogram is already booked
00017   if( 0 != hist      )                          { return hist ; } // RETURN !!
00018 
00019   // propose the histogram ID
00020   HistoID ID;
00021   newHistoID( title, ID );
00022 
00023   // book histogram and return
00024   return this -> bookProfile2D ( ID, title, lowX, highX, binsX, lowY, highY, binsY );
00025 }
00026 // ============================================================================
00027 // book the 2D profile histogram with forced ID (book on demand)
00028 // ============================================================================
00029 template <class PBASE>
00030 AIDA::IProfile2D*  GaudiHistos<PBASE>::bookProfile2D
00031 ( const HistoID&      ID           ,
00032   const std::string&  title        ,
00033   const double        lowX         ,
00034   const double        highX        ,
00035   const unsigned long binsX        ,
00036   const double        lowY         ,
00037   const double        highY        ,
00038   const unsigned long binsY         ) 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::IProfile2D* hist = profile2D ( ID ) ;
00049   // histogram is already booked
00050   if( 0 != hist )                               { return hist ; } // RETURN !!
00051 
00052   // Histogram title
00053   const std::string & htitle =
00054     ( title.empty() ?
00055       "Unnamed 2D 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                                           binsX       ,
00064                                           lowX        ,
00065                                           highX       ,
00066                                           binsY       ,
00067                                           lowY        ,
00068                                           highY        ) ;
00069   }
00070   else if ( ID.literal() )
00071   {
00072     hist = this->histoSvc() -> bookProf ( histoPath()+"/"+
00073                                           ID.literalID() ,
00074                                           htitle      ,
00075                                           binsX       ,
00076                                           lowX        ,
00077                                           highX       ,
00078                                           binsY       ,
00079                                           lowY        ,
00080                                           highY        ) ;
00081   }
00082 
00083   // test OK
00084   if( 0 == hist )
00085   { this->Error( "IProfile2D* points to NULL! ID='" + ID.idAsString() +
00086                  "' title='"+htitle+"'" ) ; return 0; } // RETURN !!
00087 
00088   // add histogram into histogram storages
00089   if      ( ID.numeric() )
00090   { m_profile2DMapNumID [ ID.numericID() ] = hist ; }
00091   else if ( ID.literal() )
00092   { m_profile2DMapLitID [ ID.literalID() ] = hist ; }
00093   m_profile2DMapTitle [ 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 2D Profile Histogram : ID='" << ID
00101                    << "' Path=" << histoPath()
00102                    << " Title='"
00103                    << Gaudi::Utils::Histos::htitle ( hist )
00104                    << "'" << endmsg; }
00105   return hist ;
00106 }
00107 // ============================================================================
00108 // fill the 2D profile histogram with the value and weight
00109 // ============================================================================
00110 template <class PBASE>
00111 AIDA::IProfile2D* GaudiHistos<PBASE>::fill
00112 ( AIDA::IProfile2D*    histo  ,
00113   const double         valueX ,
00114   const double         valueY ,
00115   const double         valueZ ,
00116   const double         weight ,
00117   const std::string&   title  ) const
00118 {
00119   if ( 0 != histo && produceHistos() )
00120   {
00121     if ( !checkForNaN() )
00122     { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , valueZ , weight ); }
00123     else if  ( lfin ( valueX ) && lfin ( valueY ) &&
00124                lfin ( valueZ ) && lfin ( weight ) )
00125     { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , valueZ , weight ); }
00126     else if  ( lnan ( valueX ) || lnan ( valueY ) ||
00127                lnan ( valueZ ) || lnan ( weight ) )
00128     {
00129       this -> Warning
00130         ("fill():: 'NaN'      value is skipped from the histogram '"
00131          + Gaudi::Utils::Histos::htitle ( histo , title ) + "'" ) ;
00132     }
00133     else
00134     {
00135       this -> Warning
00136         ("fill():: 'Infinite' value is skipped from the histogram '"
00137          + Gaudi::Utils::Histos::htitle ( histo , title ) + "'" ) ;
00138     }
00139   }
00140   // return
00141   return histo ;
00142 }
00143 // ============================================================================
00144 // fill the 2D profile histogram (book on demand)
00145 // ============================================================================
00146 template <class PBASE>
00147 AIDA::IProfile2D* GaudiHistos<PBASE>::profile2D
00148 ( const double        valueX       ,
00149   const double        valueY       ,
00150   const double        valueZ       ,
00151   const std::string&  title        ,
00152   const double        lowX         ,
00153   const double        highX        ,
00154   const double        lowY         ,
00155   const double        highY        ,
00156   const unsigned long binsX        ,
00157   const unsigned long binsY        ,
00158   const double        weight       ) const
00159 {
00160   AIDA::IProfile2D * h(0);
00161   if ( produceHistos() )
00162   {
00163     // retrieve or book the histogram
00164     h = profile2D ( title ) ;
00165     if ( 0 == h ) { h = bookProfile2D ( title ,
00166                                         lowX , highX , binsX ,
00167                                         lowY , highY , binsY ) ; }
00168     // fill the histogram
00169     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
00170   }
00171   return h;
00172 }
00173 // ============================================================================
00174 // fill the 2D profile histogram with forced ID assignment (book on demand)
00175 // ============================================================================
00176 template <class PBASE>
00177 AIDA::IProfile2D* GaudiHistos<PBASE>::profile2D
00178 ( const double        valueX       ,
00179   const double        valueY       ,
00180   const double        valueZ       ,
00181   const HistoID&      ID           ,
00182   const std::string&  title        ,
00183   const double        lowX         ,
00184   const double        highX        ,
00185   const double        lowY         ,
00186   const double        highY        ,
00187   const unsigned long binsX        ,
00188   const unsigned long binsY        ,
00189   const double        weight       ) const
00190 {
00191   AIDA::IProfile2D * h(0);
00192   if ( produceHistos() )
00193   {
00194     // retrieve or book the histogram
00195     h = profile2D ( ID ) ;
00196     if ( 0 == h ) { h = bookProfile2D ( ID , title ,
00197                                         lowX , highX , binsX ,
00198                                         lowY , highY , binsY ) ; }
00199     // fill the histogram
00200     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
00201   }
00202   return h;
00203 }

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