| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# 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   m_profile2DMapID    [ ID    ] = hist ;
    00090   m_profile2DMapTitle [ title ] = hist ;
    00091
    00092   // Declare to monitoring service
    00093   monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
    00094
    00095   // printout and return
    00096   if ( this->msgLevel(MSG::DEBUG) )
    00097   {  this->debug() << "Booked 2D Profile Histogram : ID='" << ID
    00098                    << "' Path=" << histoPath()
    00099                    << " Title='"
    00100                    << Gaudi::Utils::Histos::htitle ( hist )
    00101                    << "'" << endmsg; }
    00102   return hist ;
    00103 }
    00104 // ============================================================================
    00105 // fill the 2D profile histogram with the value and weight
    00106 // ============================================================================
    00107 template <class PBASE>
    00108 AIDA::IProfile2D* GaudiHistos<PBASE>::fill
    00109 ( AIDA::IProfile2D*    histo  ,
    00110   const double         valueX ,
    00111   const double         valueY ,
    00112   const double         valueZ ,
    00113   const double         weight ,
    00114   const std::string&   title  ) const
    00115 {
    00116   if ( 0 != histo && produceHistos() )
    00117   {
    00118     if ( !checkForNaN() )
    00119     { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , valueZ , weight ); }
    00120     else if  ( lfin ( valueX ) && lfin ( valueY ) &&
    00121                lfin ( valueZ ) && lfin ( weight ) )
    00122     { Gaudi::Utils::Histos::fill ( histo , valueX , valueY , valueZ , weight ); }
    00123     else if  ( lnan ( valueX ) || lnan ( valueY ) ||
    00124                lnan ( valueZ ) || 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 2D profile histogram (book on demand)
    00142 // ============================================================================
    00143 template <class PBASE>
    00144 AIDA::IProfile2D* GaudiHistos<PBASE>::profile2D
    00145 ( const double        valueX       ,
    00146   const double        valueY       ,
    00147   const double        valueZ       ,
    00148   const std::string&  title        ,
    00149   const double        lowX         ,
    00150   const double        highX        ,
    00151   const double        lowY         ,
    00152   const double        highY        ,
    00153   const unsigned long binsX        ,
    00154   const unsigned long binsY        ,
    00155   const double        weight       ) const
    00156 {
    00157   AIDA::IProfile2D * h(0);
    00158   if ( produceHistos() )
    00159   {
    00160     // retrieve or book the histogram
    00161     h = profile2D ( title ) ;
    00162     if ( 0 == h ) { h = bookProfile2D ( title ,
    00163                                         lowX , highX , binsX ,
    00164                                         lowY , highY , binsY ) ; }
    00165     // fill the histogram
    00166     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
    00167   }
    00168   return h;
    00169 }
    00170 // ============================================================================
    00171 // fill the 2D profile histogram with forced ID assignment (book on demand)
    00172 // ============================================================================
    00173 template <class PBASE>
    00174 AIDA::IProfile2D* GaudiHistos<PBASE>::profile2D
    00175 ( const double        valueX       ,
    00176   const double        valueY       ,
    00177   const double        valueZ       ,
    00178   const HistoID&      ID           ,
    00179   const std::string&  title        ,
    00180   const double        lowX         ,
    00181   const double        highX        ,
    00182   const double        lowY         ,
    00183   const double        highY        ,
    00184   const unsigned long binsX        ,
    00185   const unsigned long binsY        ,
    00186   const double        weight       ) const
    00187 {
    00188   AIDA::IProfile2D * h(0);
    00189   if ( produceHistos() )
    00190   {
    00191     // retrieve or book the histogram
    00192     h = profile2D ( ID ) ;
    00193     if ( 0 == h ) { h = bookProfile2D ( ID , title ,
    00194                                         lowX , highX , binsX ,
    00195                                         lowY , highY , binsY ) ; }
    00196     // fill the histogram
    00197     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
    00198   }
    00199   return h;
    00200 }