Gaudi Framework, version v25r0

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

Generated at Mon Feb 17 2014 14:37:38 for Gaudi Framework, version v25r0 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004