| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# GaudiHistos_2DProfVariableBinning.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 HistoBinEdges& edgesX,
    00008   const HistoBinEdges& edgesY ) const
    00009 {
    00010   //
    00011   if  ( !produceHistos() )                   { return 0    ; } // RETURN
    00012   //
    00013   // exist?
    00014   AIDA::IProfile2D* hist = profile2D ( title ) ;
    00015   // histogram is already booked
    00016   if( NULL != hist      )                     { return hist ; } // RETURN !!
    00017
    00018   // propose the histogram ID
    00019   HistoID ID;
    00020   newHistoID( title, ID );
    00021
    00022   // book histogram and return
    00023   return this -> bookProfile2D ( ID, title, edgesX, edgesY );
    00024 }
    00025 // ============================================================================
    00026 // book the 2D profile histogram with forced ID (book on demand)
    00027 // ============================================================================
    00028 template <class PBASE>
    00029 AIDA::IProfile2D*  GaudiHistos<PBASE>::bookProfile2D
    00030 ( const HistoID&       ID           ,
    00031   const std::string&   title        ,
    00032   const HistoBinEdges& edgesX       ,
    00033   const HistoBinEdges& edgesY       ) const
    00034 {
    00035   //
    00036   if  ( !produceHistos() )                   { return 0    ; } // RETURN
    00037   //
    00038   // Check ID
    00039   if (ID.undefined())
    00040   {
    00041     this->Error("Undefined Histogram ID : Title='"+title+"'");
    00042     return NULL;
    00043   }
    00044   // exist?
    00045   AIDA::IProfile2D* hist = profile2D ( ID ) ;
    00046   // histogram is already booked
    00047   if( NULL != hist )                         { return hist ; } // RETURN !!
    00048
    00049   // Histogram title
    00050   const std::string & htitle =
    00051     ( title.empty() ?
    00052       "Unnamed 2D Profile Histogram ID="+ID.idAsString() : title ) ;
    00053
    00054   // book the histogram
    00055   if ( ID.numeric() )
    00056   {
    00057     hist = this->histoSvc() -> bookProf ( histoPath() ,
    00058                                           ID.numericID() ,
    00059                                           htitle      ,
    00060                                           edgesX      ,
    00061                                           edgesY      ) ;
    00062   }
    00063   else if ( ID.literal() )
    00064   {
    00065     hist = this->histoSvc() -> bookProf ( histoPath()+"/"+
    00066                                           ID.literalID() ,
    00067                                           htitle      ,
    00068                                           edgesX      ,
    00069                                           edgesY      ) ;
    00070   }
    00071
    00072   // test OK
    00073   if( NULL == hist )
    00074   { this->Error( "IProfile2D* points to NULL! ID='" + ID.idAsString() +
    00075                  "' title='"+htitle+"'" ) ; return NULL; } // RETURN !!
    00076
    00077   // add histogram into histogram storages
    00078   m_profile2DMapID    [ ID    ] = hist ;
    00079   m_profile2DMapTitle [ title ] = hist ;
    00080
    00081   // Declare to monitoring service
    00082   monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
    00083
    00084   // printout and return
    00085   if ( this->msgLevel(MSG::DEBUG) )
    00086   {  this->debug() << "Booked 2D Profile Histogram : ID='" << ID
    00087                    << "' Path=" << histoPath()
    00088                    << " Title='"
    00089                    << Gaudi::Utils::Histos::htitle ( hist )
    00090                    << "'" << endmsg; }
    00091   return hist ;
    00092 }
    00093 // ============================================================================
    00094 // fill the 2D profile histogram (book on demand)
    00095 // ============================================================================
    00096 template <class PBASE>
    00097 AIDA::IProfile2D* GaudiHistos<PBASE>::profile2D
    00098 ( const double        valueX       ,
    00099   const double        valueY       ,
    00100   const double        valueZ       ,
    00101   const std::string&  title        ,
    00102   const HistoBinEdges& edgesX       ,
    00103   const HistoBinEdges& edgesY       ,
    00104   const double        weight       ) const
    00105 {
    00106   AIDA::IProfile2D * h(NULL);
    00107   if ( produceHistos() )
    00108   {
    00109     // retrieve or book the histogram
    00110     h = profile2D ( title ) ;
    00111     if ( NULL == h ) { h = bookProfile2D ( title, edgesX, edgesY ) ; }
    00112     // fill the histogram
    00113     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
    00114   }
    00115   return h;
    00116 }
    00117 // ============================================================================
    00118 // fill the 2D profile histogram with forced ID assignment (book on demand)
    00119 // ============================================================================
    00120 template <class PBASE>
    00121 AIDA::IProfile2D* GaudiHistos<PBASE>::profile2D
    00122 ( const double        valueX       ,
    00123   const double        valueY       ,
    00124   const double        valueZ       ,
    00125   const HistoID&      ID           ,
    00126   const std::string&  title        ,
    00127   const HistoBinEdges& edgesX       ,
    00128   const HistoBinEdges& edgesY       ,
    00129   const double        weight       ) const
    00130 {
    00131   AIDA::IProfile2D * h(NULL);
    00132   if ( produceHistos() )
    00133   {
    00134     // retrieve or book the histogram
    00135     h = profile2D ( ID ) ;
    00136     if ( NULL == h ) { h = bookProfile2D ( ID , title , edgesX , edgesY ) ; }
    00137
    00138     // fill the histogram
    00139     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
    00140   }
    00141   return h;
    00142 }
    00143 // ============================================================================
    00144 // The END
    00145 // ============================================================================

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines