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 m_histo1DMapID [ ID ] = hist ;
00071 m_histo1DMapTitle [ title ] = hist ;
00072
00073
00074 monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
00075
00076
00077 if ( this->msgLevel(MSG::DEBUG) )
00078 { this->debug() << "Booked 1D Histogram : ID='" << ID
00079 << "' Path=" << histoPath()
00080 << " Title='"
00081 << Gaudi::Utils::Histos::htitle ( hist )
00082 << "'" << endmsg; }
00083 return hist ;
00084 }
00085
00086
00087
00088 template <class PBASE>
00089 AIDA::IHistogram1D*
00090 GaudiHistos<PBASE>::plot1D
00091 ( const double value ,
00092 const std::string& title ,
00093 const HistoBinEdges& edges ,
00094 const double weight ) const
00095 {
00096 AIDA::IHistogram1D * h(NULL);
00097 if ( produceHistos() )
00098 {
00099
00100 h = histo1D ( title ) ;
00101 if ( NULL == h ) { h = book1D ( title , edges ) ; }
00102
00103 h = fill ( h , value , weight , title );
00104 }
00105 return h;
00106 }
00107
00108
00109
00110 template <class PBASE>
00111 AIDA::IHistogram1D*
00112 GaudiHistos<PBASE>::plot1D
00113 ( const double value ,
00114 const HistoID& ID ,
00115 const std::string& title ,
00116 const HistoBinEdges& edges ,
00117 const double weight ) const
00118 {
00119 AIDA::IHistogram1D* h(NULL);
00120 if ( produceHistos() )
00121 {
00122
00123 h = histo1D ( ID ) ;
00124 if ( NULL == h ) { h = book1D ( ID , title , edges ) ; }
00125
00126 h = fill ( h , value , weight , title ) ;
00127 }
00128 return h;
00129 }