| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

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