Gaudi Framework, version v25r0

Home   Generated: Mon Feb 17 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HistogramSvc.h
Go to the documentation of this file.
1 // $Id: HistogramSvc.h,v 1.16 2008/10/09 09:59:14 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDISVC_HISTOGRAMSVC_H
4 #define GAUDISVC_HISTOGRAMSVC_H 1
5 // ============================================================================
6 // Include Files
7 // ============================================================================
8 // GaudiKernel
9 // ============================================================================
10 #include "GaudiKernel/System.h"
11 #include "GaudiKernel/DataSvc.h"
14 #include "GaudiKernel/IRegistry.h"
16 // ============================================================================
17 // AIDA
18 // ============================================================================
20 #include "AIDA_visibility_hack.h"
21 #include "AIDA/IHistogramFactory.h"
22 #include "AIDA/IAnnotation.h"
23 // ============================================================================
24 // local (+PI)
25 // ============================================================================
26 #include "Axis.h"
27 #include "GaudiPI.h"
28 #include "TH1.h"
29 #include "TH2.h"
30 #include "TH3.h"
31 // ============================================================================
32 namespace AIDA {
33  class ICloud1D;
34  class ICloud2D;
35  class ICloud3D;
36 }
37 // ============================================================================
38 // Forward declarations
39 #define DBINS(x) int n##x, double low##x, double up##x
40 #define BINS(x) n##x, low##x, up##x
41 #define NOT_IMPLEMENTED { not_implemented(); return 0; }
42 // ============================================================================
48 class HistogramSvc : virtual public extends1<DataSvc, IHistogramSvc>,
49  virtual public AIDA::IHistogramFactory
50 {
51 
52 private:
54  void not_implemented() const {
55  MsgStream log( msgSvc(), name() );
56  log << MSG::ERROR << "Sorry, not yet implemented..." << endmsg;
57  }
58 protected:
59  typedef const std::string& CSTR;
62  typedef AIDA::IHistogram1D H1D;
63  typedef AIDA::IHistogram2D H2D;
64  typedef AIDA::IHistogram3D H3D;
65  typedef AIDA::IProfile1D P1D;
66  typedef AIDA::IProfile2D P2D;
67  typedef AIDA::IBaseHistogram Base;
68  struct Helper {
71  template <class A1, class A3> StatusCode retrieve(A1 a1, A3*& a3) {
72  DataObject* pObject = 0;
73  StatusCode sc = m_svc->DataSvc::retrieveObject(a1,pObject);
74  a3 = dynamic_cast<A3*>(pObject);
75  return sc;
76  }
77  template <class A1, class A2, class A3> StatusCode retrieve(A1 a1, A2 a2, A3*& a3) {
78  DataObject* pObject = 0;
79  StatusCode sc = m_svc->DataSvc::retrieveObject(a1,a2,pObject);
80  a3 = dynamic_cast<A3*>(pObject);
81  return sc;
82  }
83  template <class A1, class A3> StatusCode find(A1 a1, A3*& a3) {
84  DataObject* pObject = 0;
85  StatusCode sc = m_svc->DataSvc::findObject(a1,pObject);
86  a3 = dynamic_cast<A3*>(pObject);
87  return sc;
88  }
89  template <class A1, class A2, class A3> StatusCode find(A1 a1, A2 a2, A3*& a3) {
90  DataObject* pObject = 0;
91  StatusCode sc = m_svc->DataSvc::findObject(a1,a2,pObject);
92  a3 = dynamic_cast<A3*>(pObject);
93  return sc;
94  }
95  template <class R, class S, class T1, class T2>
96  static R* act(R* res,const S& b, void (T1::*pmf)(const T2*,Double_t), Double_t scale) {
97  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
98  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
99  if ( h1 && h2 ) {
100  (h1->*pmf)(h2,scale);
101  return res;
102  }
103  return 0;
104  }
105  template <class R, class S, class T1, class T2>
106  static R* act(R* res,const S& b, Bool_t (T1::*pmf)(const T2*,Double_t), Double_t scale) {
107  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
108  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
109  if ( h1 && h2 ) {
110  (h1->*pmf)(h2,scale);
111  return res;
112  }
113  return 0;
114  }
115  template <class R, class S, class T1, class T2>
116  static R* act(R* res,const S& b, void (T1::*pmf)(const T2*)) {
117  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
118  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
119  if ( h1 && h2 ) {
120  (h1->*pmf)(h2);
121  return res;
122  }
123  return 0;
124  }
125  template <class R, class S, class T1, class T2>
126  static R* act(R* res,const S& b, Bool_t (T1::*pmf)(const T2*)) {
127  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
128  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
129  if ( h1 && h2 ) {
130  (h1->*pmf)(h2);
131  return res;
132  }
133  return 0;
134  }
135  };
136 
137 
140 
141 public:
147 
149  virtual ~HistogramSvc();
150 
157 
162  std::string _STR(int i);
163 
164  template <class T> inline
165  T* i_book(DataObject* pPar,CSTR rel,CSTR title,const std::pair<DataObject*,T*>& o) {
166  if (o.first && registerObject(pPar, rel, (Base*)o.second).isSuccess())
167  return o.second;
168  delete o.first;
169  throw GaudiException("Cannot book "+System::typeinfoName(typeid(T))+" "+title,
170  "HistogramSvc",StatusCode::FAILURE);
171  }
172  template <class T> static DataObject* __cast(T* p) {
173  DataObject* q = dynamic_cast<DataObject*>(p);
174  if ( 0 == q && 0 != p ) {
175  throw std::runtime_error("HistogramSvc: Unexpected object type.");
176  }
177  return q;
178  }
180  H2D* i_project(CSTR nameAndTitle,const H3D& h, CSTR dir);
181 
182 public:
184  virtual StatusCode initialize ();
186  virtual StatusCode reinitialize ();
188  virtual StatusCode finalize ();
189 
191  virtual AIDA::IHistogramFactory* histogramFactory() { return this; }
192 
193  // ==========================================================================
194  // Book 1D histogram with fix binning
195  // ==========================================================================
213  virtual H1D* book(CSTR par, CSTR rel, CSTR title, DBINS(x))
214  { return book(createPath(par), rel, title, BINS(x)); }
215  virtual H1D* book(CSTR par, int hID, CSTR title, DBINS(x))
216  { return book(par, _STR(hID), title, BINS(x)); }
217  virtual H1D* book(DataObject* pPar, int hID, CSTR title, DBINS(x))
218  { return book(pPar, _STR(hID), title, BINS(x)); }
219  virtual H1D* book(DataObject* pPar, CSTR rel, CSTR title, DBINS(x)) ;
220  virtual H1D* book(STRPAIR loc,CSTR title, DBINS(x))
221  { return book(loc.first, loc.second, title, BINS(x)); }
222  virtual H1D* book(CSTR full, CSTR title, DBINS(x))
223  { return book(i_splitPath(full), title, BINS(x)); }
224  // ==========================================================================
225  // Book 1D Profile histogram with fix binning
226  // ==========================================================================
244  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x),CSTR opt)
245  { return bookProf(createPath(par), rel, title, BINS(x),opt); }
246  virtual P1D* bookProf(CSTR par, int hID, CSTR title, DBINS(x),CSTR opt )
247  { return bookProf(par, _STR(hID), title, BINS(x),opt); }
248  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x),CSTR opt )
249  { return bookProf(pPar, _STR(hID), title, BINS(x),opt); }
250  virtual P1D* bookProf(STRPAIR loc,CSTR title, DBINS(x),CSTR opt)
251  { return bookProf(loc.first, loc.second, title, BINS(x),opt); }
252  virtual P1D* bookProf(CSTR full, CSTR title, DBINS(x),CSTR opt)
253  { return bookProf(i_splitPath(full), title, BINS(x),opt); }
254  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x),CSTR opt)
255  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, BINS(x),0,0,opt)); }
256 
257  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x), double upper, double lower,CSTR opt)
258  { return bookProf(createPath(par), rel, title, BINS(x), upper, lower , opt); }
259  virtual P1D* bookProf(CSTR par, int hID, CSTR title, DBINS(x), double upper, double lower, CSTR opt)
260  { return bookProf(par, _STR(hID), title, BINS(x), upper, lower, opt ); }
261  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x), double upper, double lower, CSTR opt)
262  { return bookProf(pPar, _STR(hID), title, BINS(x), upper, lower, opt); }
263  virtual P1D* bookProf(STRPAIR loc,CSTR title, DBINS(x), double upper, double lower, CSTR opt)
264  { return bookProf(loc.first, loc.second, title, BINS(x), upper, lower,opt); }
265  virtual P1D* bookProf(CSTR full, CSTR title, DBINS(x), double upper, double lower, CSTR opt )
266  { return bookProf(i_splitPath(full), title, BINS(x), upper, lower , opt ); }
267  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), double upper, double lower, CSTR opt)
268  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, BINS(x), upper, lower, opt)); }
269  // ==========================================================================
270  // Book 1D histogram with variable binning
271  // ==========================================================================
286  virtual H1D* book(CSTR par, int hID, CSTR title, Edges e)
287  { return book(par, _STR(hID), title, e); }
288  virtual H1D* book(DataObject* pPar, int hID, CSTR title, Edges e)
289  { return book(pPar, _STR(hID), title, e); }
290  virtual H1D* book(CSTR par, CSTR rel, CSTR title, Edges e )
291  { return book(createPath(par), rel, title, e); }
292  virtual H1D* book(STRPAIR loc,CSTR title, Edges e )
293  { return book(loc.first, loc.second, title, e); }
294  virtual H1D* book(CSTR full, CSTR title, Edges e )
295  { return book(i_splitPath(full), title, e); }
296  virtual H1D* book(DataObject* pPar, CSTR rel, CSTR title, Edges e )
297  { return i_book(pPar, rel, title, Gaudi::createH1D(title, e)); }
298 
299  // ==========================================================================
300  // Book 1D profile histogram with variable binning
301  // ==========================================================================
316  virtual P1D* bookProf(CSTR full, CSTR title, Edges e )
317  { return bookProf(i_splitPath(full), title, e); }
318  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, Edges e )
319  { return bookProf(createPath(par), rel, title, e); }
320  virtual P1D* bookProf(CSTR par, int hID, CSTR title, Edges e )
321  { return bookProf(par, _STR(hID), title, e); }
322  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, Edges e )
323  { return bookProf(pPar, _STR(hID), title, e); }
324  virtual P1D* bookProf(STRPAIR loc,CSTR title, Edges e)
325  { return bookProf(loc.first, loc.second, title, e); }
326  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges e )
327  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, e, 0, 0)); }
328 
329  virtual P1D* bookProf(CSTR full, CSTR title, Edges e, double upper, double lower)
330  { return bookProf(i_splitPath(full), title, e, upper, lower); }
331  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, Edges e, double upper, double lower)
332  { return bookProf(createPath(par), rel, title, e, upper, lower); }
333  virtual P1D* bookProf(CSTR par, int hID, CSTR title, Edges e, double upper, double lower)
334  { return bookProf(par, _STR(hID), title, e, upper, lower); }
335  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, Edges e, double upper, double lower)
336  { return bookProf(pPar, _STR(hID), title, e, upper, lower); }
337  virtual P1D* bookProf(STRPAIR loc,CSTR title, Edges e, double upper, double lower)
338  { return bookProf(loc.first, loc.second, title, e, upper, lower); }
339  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges e, double upper, double lower)
340  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, e, upper, lower));}
341  // ==========================================================================
342  // Book 2D histogram with fixed binning
343  // ==========================================================================
361  virtual H2D* book(CSTR full, CSTR title, DBINS(x), DBINS(y))
362  { return book(i_splitPath(full), title, BINS(x),BINS(y)); }
363  virtual H2D* book(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y))
364  { return book(createPath(par), rel, title, BINS(x),BINS(y)); }
365  virtual H2D* book(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y))
366  { return book(par,_STR(hID), title, BINS(x),BINS(y)); }
367  virtual H2D* book(STRPAIR loc,CSTR title, DBINS(x), DBINS(y))
368  { return book(loc.first, loc.second, title, BINS(x), BINS(y)); }
369  virtual H2D* book(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y))
370  { return book(pPar,_STR(hID), title, BINS(x),BINS(y)); }
371  virtual H2D* book(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y))
372  { return i_book(pPar,rel,title,Gaudi::createH2D(title, BINS(x),BINS(y)));}
373  // ==========================================================================
374  // Book 2D profile histogram with fixed binning
375  // ==========================================================================
393  virtual P2D* bookProf(CSTR full, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
394  { return bookProf(i_splitPath(full), title, BINS(x),BINS(y), upper, lower); }
395  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
396  { return bookProf(createPath(par), rel, title, BINS(x),BINS(y), upper, lower); }
397  virtual P2D* bookProf(STRPAIR loc,CSTR title, DBINS(x), DBINS(y), double upper, double lower)
398  { return bookProf(loc.first, loc.second, title, BINS(x), BINS(y), upper, lower); }
399  virtual P2D* bookProf(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
400  { return bookProf(par, _STR(hID), title, BINS(x),BINS(y), upper, lower); }
401  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
402  { return bookProf(pPar,_STR(hID), title, BINS(x),BINS(y), upper, lower); }
403  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
404  { return i_book(pPar,rel,title,Gaudi::createProf2D(title, BINS(x),BINS(y), upper, lower)); }
405 
406  virtual P2D* bookProf(CSTR full, CSTR title, DBINS(x), DBINS(y))
407  { return bookProf(i_splitPath(full), title, BINS(x),BINS(y)); }
408  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y))
409  { return bookProf(createPath(par), rel, title, BINS(x),BINS(y)); }
410  virtual P2D* bookProf(STRPAIR loc,CSTR title, DBINS(x), DBINS(y))
411  { return bookProf(loc.first, loc.second, title, BINS(x), BINS(y)); }
412  virtual P2D* bookProf(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y))
413  { return bookProf(par, _STR(hID), title, BINS(x),BINS(y)); }
414  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y))
415  { return bookProf(pPar,_STR(hID), title, BINS(x),BINS(y)); }
416  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y))
417  { return i_book(pPar,rel,title,Gaudi::createProf2D(title, BINS(x),BINS(y),0,0));}
418  // ==========================================================================
419  // Book 2D histogram with variable binning
420  // ==========================================================================
435  virtual H2D* book(CSTR full, CSTR title, Edges x, Edges y )
436  { return book(i_splitPath(full), title, x, y); }
437  virtual H2D* book(CSTR par, CSTR rel, CSTR title, Edges x, Edges y )
438  { return book(createPath(par), rel, title, x, y); }
439  virtual H2D* book(CSTR par, int hID, CSTR title, Edges x, Edges y )
440  { return book(par, _STR(hID), title, x, y); }
441  virtual H2D* book(STRPAIR loc,CSTR title, Edges x, Edges y )
442  { return book(loc.first, loc.second, title, x, y); }
443  virtual H2D* book(DataObject* pPar, int hID, CSTR title, Edges x, Edges y )
444  { return book(pPar, _STR(hID), title, x, y); }
445  virtual H2D* book(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y )
446  { return i_book(pPar, rel, title, Gaudi::createH2D(title, x,y)); }
447  // ==========================================================================
448  // Book 2D profile histogram with variable binning
449  // ==========================================================================
464  virtual P2D* bookProf(CSTR full, CSTR title, Edges x, Edges y )
465  { return bookProf(i_splitPath(full), title, x, y); }
466  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, Edges x, Edges y )
467  { return bookProf(createPath(par), rel, title, x, y); }
468  virtual P2D* bookProf(CSTR par, int hID, CSTR title, Edges x, Edges y )
469  { return bookProf(par, _STR(hID), title, x, y); }
470  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, Edges x, Edges y )
471  { return bookProf(pPar, _STR(hID), title, x, y); }
472  virtual P2D* bookProf(STRPAIR loc,CSTR title, Edges x, Edges y )
473  { return bookProf(loc.first, loc.second, title, x, y); }
474  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y )
475  { return i_book(pPar, rel, title, Gaudi::createProf2D(title,x,y,0,0)); }
476 
477  virtual P2D* bookProf(CSTR full, CSTR title, Edges x, Edges y, double upper, double lower )
478  { return bookProf(i_splitPath(full), title, x, y, upper, lower); }
479  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, Edges x, Edges y, double upper, double lower )
480  { return bookProf(createPath(par), rel, title, x, y, upper, lower); }
481  virtual P2D* bookProf(CSTR par, int hID, CSTR title, Edges x, Edges y, double upper, double lower )
482  { return bookProf(par, _STR(hID), title, x, y, upper, lower); }
483  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, Edges x, Edges y, double upper, double lower )
484  { return bookProf(pPar, _STR(hID), title, x, y, upper, lower); }
485  virtual P2D* bookProf(STRPAIR loc,CSTR title, Edges x, Edges y, double upper, double lower )
486  { return bookProf(loc.first, loc.second, title, x, y, upper, lower); }
487  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y, double upper, double lower )
488  { return i_book(pPar, rel, title, Gaudi::createProf2D(title,x,y, upper, lower)); }
489  // ==========================================================================
490  // Book 3D histogram with fixed binning
491  // ==========================================================================
509  virtual H3D* book(CSTR full, CSTR title, DBINS(x), DBINS(y), DBINS(z))
510  { return book(i_splitPath(full),title,BINS(x),BINS(y),BINS(z)); }
511  virtual H3D* book(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y), DBINS(z))
512  { return book(createPath(par),rel,title,BINS(x),BINS(y),BINS(z)); }
513  virtual H3D* book(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y), DBINS(z))
514  { return book(par,_STR(hID),title,BINS(x),BINS(y),BINS(z)); }
515  virtual H3D* book(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y), DBINS(z))
516  { return book(pPar,_STR(hID), title, BINS(x),BINS(y),BINS(z)); }
517  virtual H3D* book(STRPAIR loc,CSTR title, DBINS(x), DBINS(y), DBINS(z))
518  { return book(loc.first, loc.second, title, BINS(x),BINS(y),BINS(z)); }
519  virtual H3D* book(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y), DBINS(z))
520  { return i_book(pPar, rel, title, Gaudi::createH3D(title,BINS(x),BINS(y),BINS(z)));}
521  // ==========================================================================
522  // Book 3D histogram with variable binning
523  // ==========================================================================
540  virtual H3D* book(CSTR full, CSTR title, Edges x, Edges y, Edges z)
541  { return book(i_splitPath(full), title, x, y, z); }
542  virtual H3D* book(CSTR par, CSTR rel, CSTR title, Edges x, Edges y, Edges z)
543  { return book(createPath(par), rel, title, x, y, z); }
544  virtual H3D* book(CSTR par, int hID, CSTR title, Edges x, Edges y, Edges z)
545  { return book(par,_STR(hID), title, x, y, z); }
546  virtual H3D* book(DataObject* pPar, int hID, CSTR title, Edges x, Edges y, Edges z)
547  { return book(pPar,_STR(hID), title, x, y, z); }
548  virtual H3D* book(STRPAIR loc,CSTR title, Edges x, Edges y, Edges z)
549  { return book(loc.first, loc.second, title, x,y,z); }
550  virtual H3D* book(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y, Edges z)
551  { return i_book(pPar, rel, title, Gaudi::createH3D(title,x,y,z)); }
552 
553  // ==========================================================================
554  // Register histogram with the data store
555  // ==========================================================================
556 //------------------------------------------------------------------------------
557 // Register object with the data store
558 //------------------------------------------------------------------------------
559  virtual StatusCode registerObject(CSTR parent, CSTR rel, Base* obj )
560  { return registerObject(createPath(parent), rel, obj); }
561  virtual StatusCode registerObject(CSTR parent, int item, Base* obj )
562  { return registerObject(parent, _STR(item), obj); }
563  virtual StatusCode registerObject(Base* pPar, CSTR rel, Base* obj )
564  { return registerObject(__cast(pPar), rel, obj); }
565  virtual StatusCode registerObject(DataObject* pPar, int item, Base* obj )
566  { return registerObject(pPar, _STR(item), obj); }
567  virtual StatusCode registerObject(Base* pPar, int item, Base* obj )
568  { return registerObject(__cast(pPar), item, obj); }
569  virtual StatusCode registerObject(CSTR full, Base* obj );
570  virtual StatusCode registerObject(DataObject* pPar, CSTR rel, Base* obj );
571  // ==========================================================================
572  // Unregister histogram from the data store
573  // ==========================================================================
575  { return DataSvc::unregisterObject(__cast(obj)); }
576  virtual StatusCode unregisterObject(Base* obj, CSTR objectPath)
577  { return DataSvc::unregisterObject(__cast(obj),objectPath); }
578  virtual StatusCode unregisterObject(Base* obj, int item )
579  { return DataSvc::unregisterObject(__cast(obj),item); }
580  // ==========================================================================
581  // Retrieve histogram from data store
582  // ==========================================================================
584  { return Helper(this).retrieve(pReg,path,obj); }
586  { return Helper(this).retrieve(pReg,path,obj); }
588  { return Helper(this).retrieve(pReg,path,obj); }
590  { return Helper(this).retrieve(pReg,path,obj); }
592  { return Helper(this).retrieve(pReg,path,obj); }
593  //------------------------------------------------------------------------------
594  virtual StatusCode retrieveObject(CSTR full,P1D*& obj)
595  { return Helper(this).retrieve(full,obj); }
596  virtual StatusCode retrieveObject(CSTR full,P2D*& obj)
597  { return Helper(this).retrieve(full,obj); }
598  virtual StatusCode retrieveObject(CSTR full,H1D*& obj)
599  { return Helper(this).retrieve(full,obj); }
600  virtual StatusCode retrieveObject(CSTR full,H2D*& obj)
601  { return Helper(this).retrieve(full,obj); }
602  virtual StatusCode retrieveObject(CSTR full,H3D*& obj)
603  { return Helper(this).retrieve(full,obj); }
604  //------------------------------------------------------------------------------
605  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,P1D*& obj)
606  { return Helper(this).retrieve(parent,rel,obj); }
607  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,P2D*& obj)
608  { return Helper(this).retrieve(parent,rel,obj); }
609  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,H1D*& obj)
610  { return Helper(this).retrieve(parent,rel,obj); }
611  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,H2D*& obj)
612  { return Helper(this).retrieve(parent,rel,obj); }
613  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,H3D*& obj)
614  { return Helper(this).retrieve(parent,rel,obj); }
615  //------------------------------------------------------------------------------
616  virtual StatusCode retrieveObject(CSTR parent,int item,P1D*& obj)
617  { return Helper(this).retrieve(parent,item,obj); }
618  virtual StatusCode retrieveObject(CSTR parent,int item,P2D*& obj)
619  { return Helper(this).retrieve(parent,item,obj); }
620  virtual StatusCode retrieveObject(CSTR parent,int item,H1D*& obj)
621  { return Helper(this).retrieve(parent,item,obj); }
622  virtual StatusCode retrieveObject(CSTR parent,int item,H2D*& obj)
623  { return Helper(this).retrieve(parent,item,obj); }
624  virtual StatusCode retrieveObject(CSTR parent,int item,H3D*& obj)
625  { return Helper(this).retrieve(parent,item,obj); }
626  //------------------------------------------------------------------------------
628  { return Helper(this).retrieve(par,item,obj); }
630  { return Helper(this).retrieve(par,item,obj); }
632  { return Helper(this).retrieve(par,item,obj); }
634  { return Helper(this).retrieve(par,item,obj); }
636  { return Helper(this).retrieve(par,item,obj); }
637  //------------------------------------------------------------------------------
638  virtual StatusCode retrieveObject(DataObject* par,int item,P1D*& obj)
639  { return Helper(this).retrieve(par,item,obj); }
640  virtual StatusCode retrieveObject(DataObject* par,int item,P2D*& obj)
641  { return Helper(this).retrieve(par,item,obj); }
642  virtual StatusCode retrieveObject(DataObject* par,int item,H1D*& obj)
643  { return Helper(this).retrieve(par,item,obj); }
644  virtual StatusCode retrieveObject(DataObject* par,int item,H2D*& obj)
645  { return Helper(this).retrieve(par,item,obj); }
646  virtual StatusCode retrieveObject(DataObject* par,int item,H3D*& obj)
647  { return Helper(this).retrieve(par,item,obj); }
648  //------------------------------------------------------------------------------
649  virtual StatusCode retrieveObject(Base* par,int item,P1D*& obj)
650  { return Helper(this).retrieve(__cast(par),item,obj); }
651  virtual StatusCode retrieveObject(Base* par,int item,P2D*& obj)
652  { return Helper(this).retrieve(__cast(par),item,obj); }
653  virtual StatusCode retrieveObject(Base* par,int item,H1D*& obj)
654  { return Helper(this).retrieve(__cast(par),item,obj); }
655  virtual StatusCode retrieveObject(Base* par,int item,H2D*& obj)
656  { return Helper(this).retrieve(__cast(par),item,obj); }
657  virtual StatusCode retrieveObject(Base* par,int item,H3D*& obj)
658  { return Helper(this).retrieve(__cast(par),item,obj); }
659  //------------------------------------------------------------------------------
661  { return Helper(this).retrieve(__cast(par),item,obj); }
663  { return Helper(this).retrieve(__cast(par),item,obj); }
665  { return Helper(this).retrieve(__cast(par),item,obj); }
667  { return Helper(this).retrieve(__cast(par),item,obj); }
669  { return Helper(this).retrieve(__cast(par),item,obj); }
670 
671  // ==========================================================================
672  // Find histogram identified by its full path in the data store
673  // ==========================================================================
674 
675  //------------------------------------------------------------------------------
676  // Find object identified by its full path in the data store
677  //------------------------------------------------------------------------------
679  { return Helper(this).find(pReg,path,obj); }
681  { return Helper(this).find(pReg,path,obj); }
683  { return Helper(this).find(pReg,path,obj); }
685  { return Helper(this).find(pReg,path,obj); }
687  { return Helper(this).find(pReg,path,obj); }
688  //------------------------------------------------------------------------------
689  virtual StatusCode findObject(CSTR full,P1D*& obj)
690  { return Helper(this).find(full,obj); }
691  virtual StatusCode findObject(CSTR full,P2D*& obj)
692  { return Helper(this).find(full,obj); }
693  virtual StatusCode findObject(CSTR full,H1D*& obj)
694  { return Helper(this).find(full,obj); }
695  virtual StatusCode findObject(CSTR full,H2D*& obj)
696  { return Helper(this).find(full,obj); }
697  virtual StatusCode findObject(CSTR full,H3D*& obj)
698  { return Helper(this).find(full,obj); }
699  //------------------------------------------------------------------------------
700  virtual StatusCode findObject(CSTR par,CSTR rel,P1D*& obj)
701  { return Helper(this).find(par,rel,obj); }
702  virtual StatusCode findObject(CSTR par,CSTR rel,P2D*& obj)
703  { return Helper(this).find(par,rel,obj); }
704  virtual StatusCode findObject(CSTR par,CSTR rel,H1D*& obj)
705  { return Helper(this).find(par,rel,obj); }
706  virtual StatusCode findObject(CSTR par,CSTR rel,H2D*& obj)
707  { return Helper(this).find(par,rel,obj); }
708  virtual StatusCode findObject(CSTR par,CSTR rel,H3D*& obj)
709  { return Helper(this).find(par,rel,obj); }
710  //------------------------------------------------------------------------------
711  virtual StatusCode findObject(CSTR par,int item,P1D*& obj)
712  { return Helper(this).find(par,item,obj); }
713  virtual StatusCode findObject(CSTR par,int item,P2D*& obj)
714  { return Helper(this).find(par,item,obj); }
715  virtual StatusCode findObject(CSTR par,int item,H1D*& obj)
716  { return Helper(this).find(par,item,obj); }
717  virtual StatusCode findObject(CSTR par,int item,H2D*& obj)
718  { return Helper(this).find(par,item,obj); }
719  virtual StatusCode findObject(CSTR par,int item,H3D*& obj)
720  { return Helper(this).find(par,item,obj); }
721  //------------------------------------------------------------------------------
722  virtual StatusCode findObject(DataObject* par,int item,P1D*& obj)
723  { return Helper(this).find(par,item,obj); }
724  virtual StatusCode findObject(DataObject* par,int item,P2D*& obj)
725  { return Helper(this).find(par,item,obj); }
726  virtual StatusCode findObject(DataObject* par,int item,H1D*& obj)
727  { return Helper(this).find(par,item,obj); }
728  virtual StatusCode findObject(DataObject* par,int item,H2D*& obj)
729  { return Helper(this).find(par,item,obj); }
730  virtual StatusCode findObject(DataObject* par,int item,H3D*& obj)
731  { return Helper(this).find(par,item,obj); }
732  //------------------------------------------------------------------------------
734  { return Helper(this).find(par,item,obj); }
736  { return Helper(this).find(par,item,obj); }
738  { return Helper(this).find(par,item,obj); }
740  { return Helper(this).find(par,item,obj); }
742  { return Helper(this).find(par,item,obj); }
743  //------------------------------------------------------------------------------
744  virtual StatusCode findObject(Base* par,int item,P1D*& obj)
745  { return Helper(this).find(__cast(par),item,obj); }
746  virtual StatusCode findObject(Base* par,int item,P2D*& obj)
747  { return Helper(this).find(__cast(par),item,obj); }
748  virtual StatusCode findObject(Base* par,int item,H1D*& obj)
749  { return Helper(this).find(__cast(par),item,obj); }
750  virtual StatusCode findObject(Base* par,int item,H2D*& obj)
751  { return Helper(this).find(__cast(par),item,obj); }
752  virtual StatusCode findObject(Base* par,int item,H3D*& obj)
753  { return Helper(this).find(__cast(par),item,obj); }
754  //------------------------------------------------------------------------------
755  virtual StatusCode findObject(Base* par,CSTR item,P1D*& obj)
756  { return Helper(this).find(__cast(par),item,obj); }
757  virtual StatusCode findObject(Base* par,CSTR item,P2D*& obj)
758  { return Helper(this).find(__cast(par),item,obj); }
759  virtual StatusCode findObject(Base* par,CSTR item,H1D*& obj)
760  { return Helper(this).find(__cast(par),item,obj); }
761  virtual StatusCode findObject(Base* par,CSTR item,H2D*& obj)
762  { return Helper(this).find(__cast(par),item,obj); }
763  virtual StatusCode findObject(Base* par,CSTR item,H3D*& obj)
764  { return Helper(this).find(__cast(par),item,obj); }
765 
766  // ==========================================================================
767  // Projections and slices.
768  // ==========================================================================
769  virtual H1D* projectionX(CSTR name,const H2D& h)
770  { return sliceX( name, h, IAxis::UNDERFLOW_BIN, IAxis::OVERFLOW_BIN); }
771  virtual H1D* projectionY(CSTR name,const H2D& h)
772  { return sliceY( name, h, IAxis::UNDERFLOW_BIN, IAxis::OVERFLOW_BIN); }
773  virtual H1D* sliceX(CSTR name,const H2D& h,int indexY)
774  { return sliceX( name, h, indexY, indexY ); }
775  virtual H1D* sliceY(CSTR name,const H2D& h,int indexX)
776  { return sliceY( name, h, indexX, indexX ); }
777  virtual H1D* sliceX(CSTR name,const H2D& h,int indexY1,int indexY2);
778  virtual H1D* sliceY(CSTR name,const H2D& h,int indexX1,int indexX2);
779  //------------------------------------------------------------------------------
780  bool destroy( IBaseHistogram* hist);
781 
782  H1D* add(CSTR nameAndTitle, const H1D& a, const H1D& b)
783  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Add, 1.); }
784  H1D* subtract(CSTR nameAndTitle, const H1D& a, const H1D& b)
785  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Add,-1.); }
786  H1D* multiply(CSTR nameAndTitle, const H1D& a, const H1D& b)
787  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Multiply); }
788  H1D* divide(CSTR nameAndTitle, const H1D& a, const H1D& b)
789  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Divide); }
790 
791  H2D* add(CSTR nameAndTitle, const H2D& a, const H2D& b)
792  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Add, 1.); }
793  H2D* subtract(CSTR nameAndTitle, const H2D& a, const H2D& b)
794  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Add,-1.); }
795  H2D* multiply(CSTR nameAndTitle, const H2D& a, const H2D& b)
796  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Multiply); }
797  H2D* divide(CSTR nameAndTitle, const H2D& a, const H2D& b)
798  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Divide); }
799 
800  H3D* add(CSTR nameAndTitle, const H3D& a, const H3D& b)
801  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Add, 1.); }
802  H3D* subtract(CSTR nameAndTitle, const H3D& a, const H3D& b)
803  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Add,-1.); }
804  H3D* multiply(CSTR nameAndTitle, const H3D& a, const H3D& b)
805  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Multiply); }
806  H3D* divide(CSTR nameAndTitle, const H3D& a, const H3D& b)
807  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Divide); }
808 
809  H2D* projectionXY(CSTR nameAndTitle,const H3D& h)
810  { return i_project(nameAndTitle,h,"xy"); }
811  H2D* projectionXZ(CSTR nameAndTitle,const H3D& h)
812  { return i_project(nameAndTitle,h,"xz"); }
813  H2D* projectionYZ(CSTR nameAndTitle,const H3D& h)
814  { return i_project(nameAndTitle,h,"yz"); }
815  H2D* sliceXY(CSTR /* nameAndTitle */,const H3D& /* h */,int /* low */,int /* high */ ) NOT_IMPLEMENTED
816  H2D* sliceXZ(CSTR /* nameAndTitle */,const H3D& /* h */,int /* low */,int /* high */ ) NOT_IMPLEMENTED
817  H2D* sliceYZ(CSTR /* nameAndTitle */,const H3D& /* h */,int /* low */,int /* high */ ) NOT_IMPLEMENTED
818 
819  //------------------------------------------------------------------------------
821  { return book( name, tit, BINS(x)); }
823  { return book( name, tit, BINS(x)); }
824  H1D* createHistogram1D(CSTR name,CSTR title,const Edges& x,CSTR /*opt*/)
825  { return book(name, title, x); }
826  H1D* createHistogram1D(CSTR nameAndTitle, DBINS(x))
827  { return book(nameAndTitle, nameAndTitle, BINS(x)); }
828  H1D* createCopy(CSTR full, const H1D& h)
829  { return createCopy(i_splitPath(full), h); }
830  H1D* createCopy(CSTR par, CSTR rel, const H1D& h)
831  { return createCopy(createPath(par), rel, h); }
832  H1D* createCopy(STRPAIR loc, const H1D& h)
833  { return createCopy(loc.first, loc.second, h); }
834  H1D* createCopy(DataObject* pPar, CSTR rel, const H1D& h)
835  { return i_book(pPar, rel, h.title(), Gaudi::createH1D(h)); }
836  //------------------------------------------------------------------------------
838  { return book( name, tit, BINS(x), BINS(y)); }
839  H2D* createHistogram2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),CSTR /*opt*/)
840  { return book( name, tit, BINS(x), BINS(y)); }
841  H2D* createHistogram2D(CSTR name,CSTR title,const Edges& x,const Edges& y, CSTR /*opt*/)
842  { return book(name, title, x, y); }
843  H2D* createHistogram2D(CSTR nameAndTitle, DBINS(x), DBINS(y))
844  { return book(nameAndTitle, nameAndTitle, BINS(x), BINS(y)); }
845  H2D* createCopy(CSTR full, const H2D& h)
846  { return createCopy(i_splitPath(full), h); }
847  H2D* createCopy(CSTR par, CSTR rel, const H2D& h)
848  { return createCopy(createPath(par), rel, h); }
849  H2D* createCopy(STRPAIR loc, const H2D& h)
850  { return createCopy(loc.first, loc.second, h); }
851  H2D* createCopy(DataObject* pPar, CSTR rel, const H2D& h)
852  { return i_book(pPar, rel, h.title(), Gaudi::createH2D(h)); }
853  //------------------------------------------------------------------------------
854  H3D* createHistogram3D(CSTR name, CSTR tit, DBINS(x), DBINS(y), DBINS(z))
855  { return book( name, tit, BINS(x), BINS(y), BINS(z)); }
856  H3D* createHistogram3D(CSTR name, CSTR tit, DBINS(x), DBINS(y), DBINS(z), CSTR /*opt*/)
857  { return book( name, tit, BINS(x), BINS(y), BINS(z)); }
858  H3D* createHistogram3D(CSTR name, CSTR title,const Edges& x,const Edges& y,const Edges& z,CSTR /*opt*/)
859  { return book(name, title, x, y, z); }
860  H3D* createHistogram3D(CSTR nameAndTitle, DBINS(x), DBINS(y), DBINS(z))
861  { return book(nameAndTitle, nameAndTitle, BINS(x), BINS(y), BINS(z)); }
862  H3D* createCopy(CSTR full, const H3D& h)
863  { return createCopy(i_splitPath(full), h); }
864  H3D* createCopy(CSTR par, CSTR rel, const H3D& h)
865  { return createCopy(createPath(par), rel, h); }
866  H3D* createCopy(STRPAIR loc, const H3D& h)
867  { return createCopy(loc.first, loc.second, h); }
868  H3D* createCopy(DataObject* pPar, CSTR rel, const H3D& h)
869  { return i_book(pPar, rel, h.title(), Gaudi::createH3D(h)); }
870  //------------------------------------------------------------------------------
871 
872 
874  { return bookProf( name, tit, BINS(x) , opt ); }
875  P1D* createProfile1D(CSTR name,CSTR tit,DBINS(x),double upper, double lower , CSTR opt )
876  { return bookProf( name, tit, BINS(x), upper, lower , opt ); }
877  P1D* createProfile1D(CSTR name,CSTR title,const Edges& x,CSTR /* opt */ )
878  { return bookProf(name, title, x ); }
879  P1D* createProfile1D(CSTR name,CSTR title,const Edges& x,double upper, double lower, CSTR /* opt */ )
880  { return bookProf(name, title, x, upper, lower ); }
881 
883  { return bookProf( nametit, nametit, BINS(x) , "s"); }
884  P1D* createProfile1D(CSTR nametit,DBINS(x),double upper, double lower )
885  { return bookProf( nametit, nametit, BINS(x), upper, lower , "s"); }
886 
887 
888  P1D* createCopy(CSTR full, const P1D& h)
889  { return createCopy(i_splitPath(full), h); }
890  P1D* createCopy(CSTR par, CSTR rel, const P1D& h)
891  { return createCopy(createPath(par), rel, h); }
892  P1D* createCopy(STRPAIR loc, const P1D& h)
893  { return createCopy(loc.first, loc.second, h); }
894  P1D* createCopy(DataObject* pPar, CSTR rel, const P1D& h)
895  { return i_book(pPar, rel, h.title(), Gaudi::createProf1D(h)); }
896  //------------------------------------------------------------------------------
898  { return bookProf( name, tit, BINS(x), BINS(y)); }
899  P2D* createProfile2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),CSTR /*opt*/)
900  { return bookProf( name, tit, BINS(x), BINS(y)); }
901  P2D* createProfile2D(CSTR name,CSTR title,const Edges& x,const Edges& y, CSTR /*opt*/)
902  { return bookProf(name, title, x, y); }
903  P2D* createProfile2D(CSTR nameAndTitle, DBINS(x), DBINS(y))
904  { return bookProf(nameAndTitle, nameAndTitle, BINS(x), BINS(y)); }
905 
906  P2D* createProfile2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),double upper, double lower)
907  { return bookProf( name, tit, BINS(x), BINS(y), upper, lower); }
908  P2D* createProfile2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),double upper, double lower,CSTR /*opt*/)
909  { return bookProf( name, tit, BINS(x), BINS(y), upper, lower); }
910  P2D* createProfile2D(CSTR name,CSTR title,const Edges& x,const Edges& y,double upper, double lower, CSTR /*opt*/)
911  { return bookProf(name, title, x, y, upper, lower); }
912  P2D* createProfile2D(CSTR nameAndTitle, DBINS(x), DBINS(y),double upper, double lower)
913  { return bookProf(nameAndTitle, nameAndTitle, BINS(x), BINS(y), upper, lower);}
914 
915  P2D* createCopy(CSTR full, const P2D& h)
916  { return createCopy(i_splitPath(full), h); }
917  P2D* createCopy(CSTR par, CSTR rel, const P2D& h)
918  { return createCopy(createPath(par), rel, h); }
919  P2D* createCopy(STRPAIR loc, const P2D& h)
920  { return createCopy(loc.first, loc.second, h); }
921  P2D* createCopy(DataObject* pPar, CSTR rel, const P2D& h)
922  { return i_book(pPar, rel, h.title(), Gaudi::createProf2D(h)); }
923  //------------------------------------------------------------------------------
924  AIDA::ICloud1D* createCloud1D(CSTR, CSTR, int, CSTR) NOT_IMPLEMENTED
925  AIDA::ICloud1D* createCloud1D(CSTR) NOT_IMPLEMENTED
926  AIDA::ICloud1D* createCopy(CSTR, const AIDA::ICloud1D&) NOT_IMPLEMENTED
927  AIDA::ICloud2D* createCloud2D(CSTR, CSTR, int, CSTR) NOT_IMPLEMENTED
928  AIDA::ICloud2D* createCloud2D(CSTR) NOT_IMPLEMENTED
929  AIDA::ICloud2D* createCopy(CSTR, const AIDA::ICloud2D&) NOT_IMPLEMENTED
930  AIDA::ICloud3D* createCloud3D(CSTR, CSTR, int, CSTR) NOT_IMPLEMENTED
931  AIDA::ICloud3D* createCloud3D(CSTR) NOT_IMPLEMENTED
932  AIDA::ICloud3D* createCopy(CSTR, const AIDA::ICloud3D&) NOT_IMPLEMENTED
933 
939 
941  virtual std::ostream& print(Base* h, std::ostream& s = std::cout) const;
942 
944  virtual std::ostream& write(Base* h, std::ostream& s = std::cout) const;
945 
947  virtual int write(Base* h, const char* file_name ) const;
948 
950  virtual DataObject* createPath(CSTR newPath );
951 
956  virtual DataObject* createDirectory (CSTR parentDir, CSTR subDir );
957 
958 public:
959  // ==========================================================================
961  void update1Ddefs ( Property& ) ;
962  // ==========================================================================
963  typedef std::map<std::string,Gaudi::Histo1DDef> Histo1DMap ;
964  // ==========================================================================
965 private:
966  // ==========================================================================
967  // container with the definition of "the special" histograms
968  Histo1DMap m_defs1D ;
969  // ==========================================================================
970  // modified histograms:
971  std::set<std::string> m_mods1D ;
972  // ==========================================================================
973 };
974 // ===========================================================================
975 // The END
976 // ===========================================================================
977 #endif // GAUDISVC_HISTOGRAMSVC_H
978 // ===========================================================================

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