Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

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

Generated at Wed Feb 9 16:24:47 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004