Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

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   if      ( ID.numeric() )
00070   { m_profile1DMapNumID [ ID.numericID() ] = hist ; }
00071   else if ( ID.literal() )
00072   { m_profile1DMapLitID [ ID.literalID() ] = hist ; }
00073   m_profile1DMapTitle [ title ] = hist ;
00074 
00075   // Declare to monitoring service
00076   monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
00077 
00078   // printout and return
00079   if ( this->msgLevel(MSG::DEBUG) )
00080   { this->debug() << "Booked 1D Profile Histogram : ID='"
00081                   << ID << "' Path=" << histoPath()
00082                   << " Title='"
00083                   << Gaudi::Utils::Histos::htitle ( hist )
00084                   << "'" << endmsg; }
00085   return hist ;
00086 }
00087 // ============================================================================
00088 // fill the 1D profile histogram (book on demand)
00089 // ============================================================================
00090 template <class PBASE>
00091 AIDA::IProfile1D* GaudiHistos<PBASE>::profile1D
00092 ( const double         valueX       ,
00093   const double         valueY       ,
00094   const std::string&   title        ,
00095   const HistoBinEdges& edges        ,
00096   const double         weight       ) const
00097 {
00098   AIDA::IProfile1D * h(NULL);
00099   if ( produceHistos() )
00100   {
00101     // retrieve or book the histogram
00102     h = profile1D ( title ) ;
00103     if ( NULL == h )
00104     { h = bookProfile1D ( title , edges ) ; }
00105     // fill the histogram
00106     h = fill ( h , valueX , valueY , weight , title ) ;
00107   }
00108   return h;
00109 }
00110 // ============================================================================
00111 // fill the 1D profile histogram with forced ID assignment (book on demand)
00112 // ============================================================================
00113 template <class PBASE>
00114 AIDA::IProfile1D* GaudiHistos<PBASE>::profile1D
00115 ( const double         valueX       ,
00116   const double         valueY       ,
00117   const HistoID&       ID           ,
00118   const std::string&   title        ,
00119   const HistoBinEdges& edges        ,
00120   const double         weight       ) const
00121 {
00122   AIDA::IProfile1D * h(NULL);
00123   if ( produceHistos() )
00124   {
00125     // retrieve or book the histogram
00126     h = profile1D ( ID ) ;
00127     if ( NULL == h )
00128     { h = bookProfile1D ( ID , title , edges ) ; }
00129     // fill the histogram
00130     h = fill ( h , valueX , valueY , weight , title ) ;
00131   }
00132   return h;
00133 }

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