| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

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