| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiHistos_1DProfVariableBinning.icpp
Go to the documentation of this file.
1 // ============================================================================
2 // book the 1D profile histogram (book on demand)
3 // ============================================================================
4 template <class PBASE>
5 AIDA::IProfile1D* GaudiHistos<PBASE>::bookProfile1D
6 ( const std::string& title ,
7 const HistoBinEdges& edges ) const
8 {
9 //
10 if ( !produceHistos() ) { return 0 ; } // RETURN
11 //
12 // exist?
13 AIDA::IProfile1D* hist = profile1D ( title ) ;
14 // histogram is already booked
15 if ( NULL != hist ) { return hist ; } // RETURN !!
16
17 // propose the histogram ID
18 HistoID ID;
19 newHistoID( title, ID );
20
21 // Book the histo and return
22 return this -> bookProfile1D ( ID, title, edges );
23 }
24 // ============================================================================
25 // book the 1D profile histogram with forced ID (book on demand)
26 // ============================================================================
27 template <class PBASE>
28 AIDA::IProfile1D* GaudiHistos<PBASE>::bookProfile1D
29 ( const HistoID& ID ,
30 const std::string& title ,
31 const HistoBinEdges& edges ) const
32 {
33 //
34 if ( !produceHistos() ) { return 0 ; } // RETURN
35 //
36 // Check ID
37 if (ID.undefined())
38 {
39 this->Error("Undefined Histogram ID : Title='"+title+"'");
40 return NULL;
41 }
42
43 // exist?
44 AIDA::IProfile1D* hist = profile1D ( ID ) ;
45 // histogram is already booked
46 if ( NULL != hist ) { return hist ; } // RETURN !!
47
48 // Histogram title
49 const std::string & htitle =
50 ( title.empty() ?
51 "Unnamed 1D Profile Histogram ID="+ID.idAsString() : title ) ;
52
53 // book the histogram
54 if ( ID.numeric() )
55 {
56 hist = this->histoSvc() -> bookProf ( histoPath() ,
57 ID.numericID() ,
58 htitle ,
59 edges ) ;
60 }
61 else if ( ID.literal() )
62 {
63 hist = this->histoSvc() -> bookProf ( histoPath()+"/"+
64 ID.literalID() ,
65 htitle ,
66 edges ) ;
67 }
68
69 // test ok
70 if( NULL == hist )
71 { this->Error( "IProfile1D* points to NULL! ID='" + ID.idAsString() +
72 "' title='"+htitle+"'" ) ; return NULL; } // RETURN !!
73
74 // add histogram into histogram storages
75 m_profile1DMapID [ ID ] = hist ;
76 m_profile1DMapTitle [ title ] = hist ;
77
78 // Declare to monitoring service
79 monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
80
81 // printout and return
82 if ( this->msgLevel(MSG::DEBUG) )
83 { this->debug() << "Booked 1D Profile Histogram : ID='"
84 << ID << "' Path=" << histoPath()
85 << " Title='"
86 << Gaudi::Utils::Histos::htitle ( hist )
87 << "'" << endmsg; }
88 return hist ;
89 }
90 // ============================================================================
91 // fill the 1D profile histogram (book on demand)
92 // ============================================================================
93 template <class PBASE>
94 AIDA::IProfile1D* GaudiHistos<PBASE>::profile1D
95 ( const double valueX ,
96 const double valueY ,
97 const std::string& title ,
98 const HistoBinEdges& edges ,
99 const double weight ) const
100 {
101 AIDA::IProfile1D * h(NULL);
102 if ( produceHistos() )
103 {
104 // retrieve or book the histogram
105 h = profile1D ( title ) ;
106 if ( NULL == h ) { h = bookProfile1D ( title , edges ) ; }
107 // fill the histogram
108 h = fill ( h , valueX , valueY , weight , title ) ;
109 }
110 return h;
111 }
112 // ============================================================================
113 // fill the 1D profile histogram with forced ID assignment (book on demand)
114 // ============================================================================
115 template <class PBASE>
116 AIDA::IProfile1D* GaudiHistos<PBASE>::profile1D
117 ( const double valueX ,
118 const double valueY ,
119 const HistoID& ID ,
120 const std::string& title ,
121 const HistoBinEdges& edges ,
122 const double weight ) const
123 {
124 AIDA::IProfile1D * h(NULL);
125 if ( produceHistos() )
126 {
127 // retrieve or book the histogram
128 h = profile1D ( ID ) ;
129 if ( NULL == h ) { h = bookProfile1D ( ID , title , edges ) ; }
130 // fill the histogram
131 h = fill ( h , valueX , valueY , weight , title ) ;
132 }
133 return h;
134 }
135 // ============================================================================
136 // The END
137 // ============================================================================