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