Gaudi Framework, version v21r4

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

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