Gaudi Framework, version v25r2

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

Generated at Wed Jun 4 2014 14:48:55 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004