GaudiHistos_2DVariableBinning.icpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 template <class PBASE>
00007 AIDA::IHistogram2D* GaudiHistos<PBASE>::book2D
00008 ( const std::string& title ,
00009 const HistoBinEdges& edgesX ,
00010 const HistoBinEdges& edgesY ) const
00011 {
00012
00013 AIDA::IHistogram2D * hist = histo2D ( title ) ;
00014
00015 if ( NULL != hist ) { return hist ; }
00016
00017
00018 HistoID ID;
00019 newHistoID( title, ID );
00020
00021
00022 return this -> book2D ( ID, title, edgesX, edgesY );
00023 }
00024
00025
00026
00027 template <class PBASE>
00028 AIDA::IHistogram2D* GaudiHistos<PBASE>::book2D
00029 ( const HistoID& ID ,
00030 const std::string& title ,
00031 const HistoBinEdges& edgesX ,
00032 const HistoBinEdges& edgesY ) const
00033 {
00034
00035 if (ID.undefined())
00036 {
00037 this->Error("Undefined Histogram ID : Title='"+title+"'");
00038 return NULL;
00039 }
00040
00041
00042 AIDA::IHistogram2D * hist = histo2D ( ID ) ;
00043
00044 if ( NULL != hist ) { return hist ; }
00045
00046
00047 const std::string & htitle =
00048 ( title.empty() ? "Unnamed 2D Histogram ID="+ID.idAsString() : title ) ;
00049
00050
00051 if ( ID.numeric() )
00052 {
00053 hist = this->histoSvc() -> book ( histoPath() ,
00054 ID.numericID() ,
00055 htitle ,
00056 edgesX ,
00057 edgesY ) ;
00058 }
00059 else if ( ID.literal() )
00060 {
00061 hist = this->histoSvc() -> book ( histoPath()+"/"+
00062 ID.literalID() ,
00063 htitle ,
00064 edgesX ,
00065 edgesY ) ;
00066 }
00067
00068
00069 if( NULL == hist )
00070 { this->Error( "IHistogram2D* points to NULL! ID='" + ID.idAsString() +
00071 "' title='"+htitle+"'" ) ; return NULL; }
00072
00073
00074 m_histo2DMapID [ ID ] = hist ;
00075 m_histo2DMapTitle [ title ] = hist ;
00076
00077
00078 monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
00079
00080
00081 if ( this->msgLevel(MSG::DEBUG) )
00082 { this->debug() << "Booked 2D Histogram : ID='" << ID
00083 << "' Path=" << histoPath()
00084 << " Title='"
00085 << Gaudi::Utils::Histos::htitle ( hist )
00086 << "'" << endmsg; }
00087 return hist ;
00088 }
00089
00090
00091
00092 template <class PBASE>
00093 AIDA::IHistogram2D*
00094 GaudiHistos<PBASE>::plot2D
00095 ( const double valueX ,
00096 const double valueY ,
00097 const std::string& title ,
00098 const HistoBinEdges& edgesX ,
00099 const HistoBinEdges& edgesY ,
00100 const double weight ) const
00101 {
00102 AIDA::IHistogram2D * h(NULL);
00103 if ( produceHistos() )
00104 {
00105
00106 h = histo2D ( title ) ;
00107 if ( NULL == h ) { h = book2D ( title , edgesX , edgesY ) ; }
00108
00109 h = fill ( h , valueX , valueY , weight , title );
00110 }
00111 return h;
00112 }
00113
00114
00115
00116 template <class PBASE>
00117 AIDA::IHistogram2D*
00118 GaudiHistos<PBASE>::plot2D
00119 ( const double valueX ,
00120 const double valueY ,
00121 const HistoID& ID ,
00122 const std::string& title ,
00123 const HistoBinEdges& edgesX ,
00124 const HistoBinEdges& edgesY ,
00125 const double weight ) const
00126 {
00127 AIDA::IHistogram2D * h(NULL);
00128 if ( produceHistos() )
00129 {
00130
00131 h = histo2D ( ID ) ;
00132 if ( NULL == h ) { h = book2D ( ID , title , edgesX , edgesY ) ; }
00133
00134 h = fill ( h , valueX , valueY , weight , title ) ;
00135 }
00136 return h;
00137 }