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