Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 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 template <class T> class SvcFactory;
40 #define DBINS(x) int n##x, double low##x, double up##x
41 #define BINS(x) n##x, low##x, up##x
42 #define NOT_IMPLEMENTED { not_implemented(); return 0; }
43 // ============================================================================
49 class HistogramSvc : virtual public extends1<DataSvc, IHistogramSvc>,
50  virtual public AIDA::IHistogramFactory
51 {
52 
53 private:
54  // Allow SvcFactory to instantiate the service.
55  friend class SvcFactory<HistogramSvc>;
57  void not_implemented() const {
58  MsgStream log( msgSvc(), name() );
59  log << MSG::ERROR << "Sorry, not yet implemented..." << endmsg;
60  }
61 protected:
62  typedef const std::string& CSTR;
65  typedef AIDA::IHistogram1D H1D;
66  typedef AIDA::IHistogram2D H2D;
67  typedef AIDA::IHistogram3D H3D;
68  typedef AIDA::IProfile1D P1D;
69  typedef AIDA::IProfile2D P2D;
70  typedef AIDA::IBaseHistogram Base;
71  struct Helper {
74  template <class A1, class A3> StatusCode retrieve(A1 a1, A3*& a3) {
75  DataObject* pObject = 0;
76  StatusCode sc = m_svc->DataSvc::retrieveObject(a1,pObject);
77  a3 = dynamic_cast<A3*>(pObject);
78  return sc;
79  }
80  template <class A1, class A2, class A3> StatusCode retrieve(A1 a1, A2 a2, A3*& a3) {
81  DataObject* pObject = 0;
82  StatusCode sc = m_svc->DataSvc::retrieveObject(a1,a2,pObject);
83  a3 = dynamic_cast<A3*>(pObject);
84  return sc;
85  }
86  template <class A1, class A3> StatusCode find(A1 a1, A3*& a3) {
87  DataObject* pObject = 0;
88  StatusCode sc = m_svc->DataSvc::findObject(a1,pObject);
89  a3 = dynamic_cast<A3*>(pObject);
90  return sc;
91  }
92  template <class A1, class A2, class A3> StatusCode find(A1 a1, A2 a2, A3*& a3) {
93  DataObject* pObject = 0;
94  StatusCode sc = m_svc->DataSvc::findObject(a1,a2,pObject);
95  a3 = dynamic_cast<A3*>(pObject);
96  return sc;
97  }
98  template <class R, class S, class T1, class T2>
99  static R* act(R* res,const S& b, void (T1::*pmf)(const T2*,Double_t), Double_t scale) {
100  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
101  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
102  if ( h1 && h2 ) {
103  (h1->*pmf)(h2,scale);
104  return res;
105  }
106  return 0;
107  }
108  template <class R, class S, class T1, class T2>
109  static R* act(R* res,const S& b, Bool_t (T1::*pmf)(const T2*,Double_t), Double_t scale) {
110  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
111  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
112  if ( h1 && h2 ) {
113  (h1->*pmf)(h2,scale);
114  return res;
115  }
116  return 0;
117  }
118  template <class R, class S, class T1, class T2>
119  static R* act(R* res,const S& b, void (T1::*pmf)(const T2*)) {
120  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
121  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
122  if ( h1 && h2 ) {
123  (h1->*pmf)(h2);
124  return res;
125  }
126  return 0;
127  }
128  template <class R, class S, class T1, class T2>
129  static R* act(R* res,const S& b, Bool_t (T1::*pmf)(const T2*)) {
130  T1 *h1 = Gaudi::getRepresentation<R,T1>(*res);
131  T1 *h2 = Gaudi::getRepresentation<R,T1>(b);
132  if ( h1 && h2 ) {
133  (h1->*pmf)(h2);
134  return res;
135  }
136  return 0;
137  }
138  };
139 
140 
143 
144 public:
150 
152  virtual ~HistogramSvc();
153 
160 
165  std::string _STR(int i);
166 
167  template <class T> inline
168  T* i_book(DataObject* pPar,CSTR rel,CSTR title,const std::pair<DataObject*,T*>& o) {
169  if (o.first && registerObject(pPar, rel, (Base*)o.second).isSuccess())
170  return o.second;
171  delete o.first;
172  throw GaudiException("Cannot book "+System::typeinfoName(typeid(T))+" "+title,
173  "HistogramSvc",StatusCode::FAILURE);
174  }
175  template <class T> static DataObject* __cast(T* p) {
176  DataObject* q = dynamic_cast<DataObject*>(p);
177  if ( 0 == q && 0 != p ) {
178  throw std::runtime_error("HistogramSvc: Unexpected object type.");
179  }
180  return q;
181  }
183  H2D* i_project(CSTR nameAndTitle,const H3D& h, CSTR dir);
184 
185 public:
187  virtual StatusCode initialize ();
189  virtual StatusCode reinitialize ();
191  virtual StatusCode finalize ();
192 
194  virtual AIDA::IHistogramFactory* histogramFactory() { return this; }
195 
196  // ==========================================================================
197  // Book 1D histogram with fix binning
198  // ==========================================================================
216  virtual H1D* book(CSTR par, CSTR rel, CSTR title, DBINS(x))
217  { return book(createPath(par), rel, title, BINS(x)); }
218  virtual H1D* book(CSTR par, int hID, CSTR title, DBINS(x))
219  { return book(par, _STR(hID), title, BINS(x)); }
220  virtual H1D* book(DataObject* pPar, int hID, CSTR title, DBINS(x))
221  { return book(pPar, _STR(hID), title, BINS(x)); }
222  virtual H1D* book(DataObject* pPar, CSTR rel, CSTR title, DBINS(x)) ;
223  virtual H1D* book(STRPAIR loc,CSTR title, DBINS(x))
224  { return book(loc.first, loc.second, title, BINS(x)); }
225  virtual H1D* book(CSTR full, CSTR title, DBINS(x))
226  { return book(i_splitPath(full), title, BINS(x)); }
227  // ==========================================================================
228  // Book 1D Profile histogram with fix binning
229  // ==========================================================================
247  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x),CSTR opt)
248  { return bookProf(createPath(par), rel, title, BINS(x),opt); }
249  virtual P1D* bookProf(CSTR par, int hID, CSTR title, DBINS(x),CSTR opt )
250  { return bookProf(par, _STR(hID), title, BINS(x),opt); }
251  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x),CSTR opt )
252  { return bookProf(pPar, _STR(hID), title, BINS(x),opt); }
253  virtual P1D* bookProf(STRPAIR loc,CSTR title, DBINS(x),CSTR opt)
254  { return bookProf(loc.first, loc.second, title, BINS(x),opt); }
255  virtual P1D* bookProf(CSTR full, CSTR title, DBINS(x),CSTR opt)
256  { return bookProf(i_splitPath(full), title, BINS(x),opt); }
257  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x),CSTR opt)
258  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, BINS(x),0,0,opt)); }
259 
260  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x), double upper, double lower,CSTR opt)
261  { return bookProf(createPath(par), rel, title, BINS(x), upper, lower , opt); }
262  virtual P1D* bookProf(CSTR par, int hID, CSTR title, DBINS(x), double upper, double lower, CSTR opt)
263  { return bookProf(par, _STR(hID), title, BINS(x), upper, lower, opt ); }
264  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x), double upper, double lower, CSTR opt)
265  { return bookProf(pPar, _STR(hID), title, BINS(x), upper, lower, opt); }
266  virtual P1D* bookProf(STRPAIR loc,CSTR title, DBINS(x), double upper, double lower, CSTR opt)
267  { return bookProf(loc.first, loc.second, title, BINS(x), upper, lower,opt); }
268  virtual P1D* bookProf(CSTR full, CSTR title, DBINS(x), double upper, double lower, CSTR opt )
269  { return bookProf(i_splitPath(full), title, BINS(x), upper, lower , opt ); }
270  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), double upper, double lower, CSTR opt)
271  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, BINS(x), upper, lower, opt)); }
272  // ==========================================================================
273  // Book 1D histogram with variable binning
274  // ==========================================================================
289  virtual H1D* book(CSTR par, int hID, CSTR title, Edges e)
290  { return book(par, _STR(hID), title, e); }
291  virtual H1D* book(DataObject* pPar, int hID, CSTR title, Edges e)
292  { return book(pPar, _STR(hID), title, e); }
293  virtual H1D* book(CSTR par, CSTR rel, CSTR title, Edges e )
294  { return book(createPath(par), rel, title, e); }
295  virtual H1D* book(STRPAIR loc,CSTR title, Edges e )
296  { return book(loc.first, loc.second, title, e); }
297  virtual H1D* book(CSTR full, CSTR title, Edges e )
298  { return book(i_splitPath(full), title, e); }
299  virtual H1D* book(DataObject* pPar, CSTR rel, CSTR title, Edges e )
300  { return i_book(pPar, rel, title, Gaudi::createH1D(title, e)); }
301 
302  // ==========================================================================
303  // Book 1D profile histogram with variable binning
304  // ==========================================================================
319  virtual P1D* bookProf(CSTR full, CSTR title, Edges e )
320  { return bookProf(i_splitPath(full), title, e); }
321  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, Edges e )
322  { return bookProf(createPath(par), rel, title, e); }
323  virtual P1D* bookProf(CSTR par, int hID, CSTR title, Edges e )
324  { return bookProf(par, _STR(hID), title, e); }
325  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, Edges e )
326  { return bookProf(pPar, _STR(hID), title, e); }
327  virtual P1D* bookProf(STRPAIR loc,CSTR title, Edges e)
328  { return bookProf(loc.first, loc.second, title, e); }
329  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges e )
330  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, e, 0, 0)); }
331 
332  virtual P1D* bookProf(CSTR full, CSTR title, Edges e, double upper, double lower)
333  { return bookProf(i_splitPath(full), title, e, upper, lower); }
334  virtual P1D* bookProf(CSTR par, CSTR rel, CSTR title, Edges e, double upper, double lower)
335  { return bookProf(createPath(par), rel, title, e, upper, lower); }
336  virtual P1D* bookProf(CSTR par, int hID, CSTR title, Edges e, double upper, double lower)
337  { return bookProf(par, _STR(hID), title, e, upper, lower); }
338  virtual P1D* bookProf(DataObject* pPar, int hID, CSTR title, Edges e, double upper, double lower)
339  { return bookProf(pPar, _STR(hID), title, e, upper, lower); }
340  virtual P1D* bookProf(STRPAIR loc,CSTR title, Edges e, double upper, double lower)
341  { return bookProf(loc.first, loc.second, title, e, upper, lower); }
342  virtual P1D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges e, double upper, double lower)
343  { return i_book(pPar,rel,title,Gaudi::createProf1D(title, e, upper, lower));}
344  // ==========================================================================
345  // Book 2D histogram with fixed binning
346  // ==========================================================================
364  virtual H2D* book(CSTR full, CSTR title, DBINS(x), DBINS(y))
365  { return book(i_splitPath(full), title, BINS(x),BINS(y)); }
366  virtual H2D* book(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y))
367  { return book(createPath(par), rel, title, BINS(x),BINS(y)); }
368  virtual H2D* book(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y))
369  { return book(par,_STR(hID), title, BINS(x),BINS(y)); }
370  virtual H2D* book(STRPAIR loc,CSTR title, DBINS(x), DBINS(y))
371  { return book(loc.first, loc.second, title, BINS(x), BINS(y)); }
372  virtual H2D* book(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y))
373  { return book(pPar,_STR(hID), title, BINS(x),BINS(y)); }
374  virtual H2D* book(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y))
375  { return i_book(pPar,rel,title,Gaudi::createH2D(title, BINS(x),BINS(y)));}
376  // ==========================================================================
377  // Book 2D profile histogram with fixed binning
378  // ==========================================================================
396  virtual P2D* bookProf(CSTR full, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
397  { return bookProf(i_splitPath(full), title, BINS(x),BINS(y), upper, lower); }
398  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
399  { return bookProf(createPath(par), rel, title, BINS(x),BINS(y), upper, lower); }
400  virtual P2D* bookProf(STRPAIR loc,CSTR title, DBINS(x), DBINS(y), double upper, double lower)
401  { return bookProf(loc.first, loc.second, title, BINS(x), BINS(y), upper, lower); }
402  virtual P2D* bookProf(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
403  { return bookProf(par, _STR(hID), title, BINS(x),BINS(y), upper, lower); }
404  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
405  { return bookProf(pPar,_STR(hID), title, BINS(x),BINS(y), upper, lower); }
406  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y), double upper, double lower)
407  { return i_book(pPar,rel,title,Gaudi::createProf2D(title, BINS(x),BINS(y), upper, lower)); }
408 
409  virtual P2D* bookProf(CSTR full, CSTR title, DBINS(x), DBINS(y))
410  { return bookProf(i_splitPath(full), title, BINS(x),BINS(y)); }
411  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y))
412  { return bookProf(createPath(par), rel, title, BINS(x),BINS(y)); }
413  virtual P2D* bookProf(STRPAIR loc,CSTR title, DBINS(x), DBINS(y))
414  { return bookProf(loc.first, loc.second, title, BINS(x), BINS(y)); }
415  virtual P2D* bookProf(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y))
416  { return bookProf(par, _STR(hID), title, BINS(x),BINS(y)); }
417  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y))
418  { return bookProf(pPar,_STR(hID), title, BINS(x),BINS(y)); }
419  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y))
420  { return i_book(pPar,rel,title,Gaudi::createProf2D(title, BINS(x),BINS(y),0,0));}
421  // ==========================================================================
422  // Book 2D histogram with variable binning
423  // ==========================================================================
438  virtual H2D* book(CSTR full, CSTR title, Edges x, Edges y )
439  { return book(i_splitPath(full), title, x, y); }
440  virtual H2D* book(CSTR par, CSTR rel, CSTR title, Edges x, Edges y )
441  { return book(createPath(par), rel, title, x, y); }
442  virtual H2D* book(CSTR par, int hID, CSTR title, Edges x, Edges y )
443  { return book(par, _STR(hID), title, x, y); }
444  virtual H2D* book(STRPAIR loc,CSTR title, Edges x, Edges y )
445  { return book(loc.first, loc.second, title, x, y); }
446  virtual H2D* book(DataObject* pPar, int hID, CSTR title, Edges x, Edges y )
447  { return book(pPar, _STR(hID), title, x, y); }
448  virtual H2D* book(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y )
449  { return i_book(pPar, rel, title, Gaudi::createH2D(title, x,y)); }
450  // ==========================================================================
451  // Book 2D profile histogram with variable binning
452  // ==========================================================================
467  virtual P2D* bookProf(CSTR full, CSTR title, Edges x, Edges y )
468  { return bookProf(i_splitPath(full), title, x, y); }
469  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, Edges x, Edges y )
470  { return bookProf(createPath(par), rel, title, x, y); }
471  virtual P2D* bookProf(CSTR par, int hID, CSTR title, Edges x, Edges y )
472  { return bookProf(par, _STR(hID), title, x, y); }
473  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, Edges x, Edges y )
474  { return bookProf(pPar, _STR(hID), title, x, y); }
475  virtual P2D* bookProf(STRPAIR loc,CSTR title, Edges x, Edges y )
476  { return bookProf(loc.first, loc.second, title, x, y); }
477  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y )
478  { return i_book(pPar, rel, title, Gaudi::createProf2D(title,x,y,0,0)); }
479 
480  virtual P2D* bookProf(CSTR full, CSTR title, Edges x, Edges y, double upper, double lower )
481  { return bookProf(i_splitPath(full), title, x, y, upper, lower); }
482  virtual P2D* bookProf(CSTR par, CSTR rel, CSTR title, Edges x, Edges y, double upper, double lower )
483  { return bookProf(createPath(par), rel, title, x, y, upper, lower); }
484  virtual P2D* bookProf(CSTR par, int hID, CSTR title, Edges x, Edges y, double upper, double lower )
485  { return bookProf(par, _STR(hID), title, x, y, upper, lower); }
486  virtual P2D* bookProf(DataObject* pPar, int hID, CSTR title, Edges x, Edges y, double upper, double lower )
487  { return bookProf(pPar, _STR(hID), title, x, y, upper, lower); }
488  virtual P2D* bookProf(STRPAIR loc,CSTR title, Edges x, Edges y, double upper, double lower )
489  { return bookProf(loc.first, loc.second, title, x, y, upper, lower); }
490  virtual P2D* bookProf(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y, double upper, double lower )
491  { return i_book(pPar, rel, title, Gaudi::createProf2D(title,x,y, upper, lower)); }
492  // ==========================================================================
493  // Book 3D histogram with fixed binning
494  // ==========================================================================
512  virtual H3D* book(CSTR full, CSTR title, DBINS(x), DBINS(y), DBINS(z))
513  { return book(i_splitPath(full),title,BINS(x),BINS(y),BINS(z)); }
514  virtual H3D* book(CSTR par, CSTR rel, CSTR title, DBINS(x), DBINS(y), DBINS(z))
515  { return book(createPath(par),rel,title,BINS(x),BINS(y),BINS(z)); }
516  virtual H3D* book(CSTR par, int hID, CSTR title, DBINS(x), DBINS(y), DBINS(z))
517  { return book(par,_STR(hID),title,BINS(x),BINS(y),BINS(z)); }
518  virtual H3D* book(DataObject* pPar, int hID, CSTR title, DBINS(x), DBINS(y), DBINS(z))
519  { return book(pPar,_STR(hID), title, BINS(x),BINS(y),BINS(z)); }
520  virtual H3D* book(STRPAIR loc,CSTR title, DBINS(x), DBINS(y), DBINS(z))
521  { return book(loc.first, loc.second, title, BINS(x),BINS(y),BINS(z)); }
522  virtual H3D* book(DataObject* pPar, CSTR rel, CSTR title, DBINS(x), DBINS(y), DBINS(z))
523  { return i_book(pPar, rel, title, Gaudi::createH3D(title,BINS(x),BINS(y),BINS(z)));}
524  // ==========================================================================
525  // Book 3D histogram with variable binning
526  // ==========================================================================
543  virtual H3D* book(CSTR full, CSTR title, Edges x, Edges y, Edges z)
544  { return book(i_splitPath(full), title, x, y, z); }
545  virtual H3D* book(CSTR par, CSTR rel, CSTR title, Edges x, Edges y, Edges z)
546  { return book(createPath(par), rel, title, x, y, z); }
547  virtual H3D* book(CSTR par, int hID, CSTR title, Edges x, Edges y, Edges z)
548  { return book(par,_STR(hID), title, x, y, z); }
549  virtual H3D* book(DataObject* pPar, int hID, CSTR title, Edges x, Edges y, Edges z)
550  { return book(pPar,_STR(hID), title, x, y, z); }
551  virtual H3D* book(STRPAIR loc,CSTR title, Edges x, Edges y, Edges z)
552  { return book(loc.first, loc.second, title, x,y,z); }
553  virtual H3D* book(DataObject* pPar, CSTR rel, CSTR title, Edges x, Edges y, Edges z)
554  { return i_book(pPar, rel, title, Gaudi::createH3D(title,x,y,z)); }
555 
556  // ==========================================================================
557  // Register histogram with the data store
558  // ==========================================================================
559 //------------------------------------------------------------------------------
560 // Register object with the data store
561 //------------------------------------------------------------------------------
562  virtual StatusCode registerObject(CSTR parent, CSTR rel, Base* obj )
563  { return registerObject(createPath(parent), rel, obj); }
564  virtual StatusCode registerObject(CSTR parent, int item, Base* obj )
565  { return registerObject(parent, _STR(item), obj); }
566  virtual StatusCode registerObject(Base* pPar, CSTR rel, Base* obj )
567  { return registerObject(__cast(pPar), rel, obj); }
568  virtual StatusCode registerObject(DataObject* pPar, int item, Base* obj )
569  { return registerObject(pPar, _STR(item), obj); }
570  virtual StatusCode registerObject(Base* pPar, int item, Base* obj )
571  { return registerObject(__cast(pPar), item, obj); }
572  virtual StatusCode registerObject(CSTR full, Base* obj );
573  virtual StatusCode registerObject(DataObject* pPar, CSTR rel, Base* obj );
574  // ==========================================================================
575  // Unregister histogram from the data store
576  // ==========================================================================
578  { return DataSvc::unregisterObject(__cast(obj)); }
579  virtual StatusCode unregisterObject(Base* obj, CSTR objectPath)
580  { return DataSvc::unregisterObject(__cast(obj),objectPath); }
581  virtual StatusCode unregisterObject(Base* obj, int item )
582  { return DataSvc::unregisterObject(__cast(obj),item); }
583  // ==========================================================================
584  // Retrieve histogram from data store
585  // ==========================================================================
587  { return Helper(this).retrieve(pReg,path,obj); }
589  { return Helper(this).retrieve(pReg,path,obj); }
591  { return Helper(this).retrieve(pReg,path,obj); }
593  { return Helper(this).retrieve(pReg,path,obj); }
595  { return Helper(this).retrieve(pReg,path,obj); }
596  //------------------------------------------------------------------------------
597  virtual StatusCode retrieveObject(CSTR full,P1D*& obj)
598  { return Helper(this).retrieve(full,obj); }
599  virtual StatusCode retrieveObject(CSTR full,P2D*& obj)
600  { return Helper(this).retrieve(full,obj); }
601  virtual StatusCode retrieveObject(CSTR full,H1D*& obj)
602  { return Helper(this).retrieve(full,obj); }
603  virtual StatusCode retrieveObject(CSTR full,H2D*& obj)
604  { return Helper(this).retrieve(full,obj); }
605  virtual StatusCode retrieveObject(CSTR full,H3D*& obj)
606  { return Helper(this).retrieve(full,obj); }
607  //------------------------------------------------------------------------------
608  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,P1D*& obj)
609  { return Helper(this).retrieve(parent,rel,obj); }
610  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,P2D*& obj)
611  { return Helper(this).retrieve(parent,rel,obj); }
612  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,H1D*& obj)
613  { return Helper(this).retrieve(parent,rel,obj); }
614  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,H2D*& obj)
615  { return Helper(this).retrieve(parent,rel,obj); }
616  virtual StatusCode retrieveObject(CSTR parent,CSTR rel,H3D*& obj)
617  { return Helper(this).retrieve(parent,rel,obj); }
618  //------------------------------------------------------------------------------
619  virtual StatusCode retrieveObject(CSTR parent,int item,P1D*& obj)
620  { return Helper(this).retrieve(parent,item,obj); }
621  virtual StatusCode retrieveObject(CSTR parent,int item,P2D*& obj)
622  { return Helper(this).retrieve(parent,item,obj); }
623  virtual StatusCode retrieveObject(CSTR parent,int item,H1D*& obj)
624  { return Helper(this).retrieve(parent,item,obj); }
625  virtual StatusCode retrieveObject(CSTR parent,int item,H2D*& obj)
626  { return Helper(this).retrieve(parent,item,obj); }
627  virtual StatusCode retrieveObject(CSTR parent,int item,H3D*& obj)
628  { return Helper(this).retrieve(parent,item,obj); }
629  //------------------------------------------------------------------------------
631  { return Helper(this).retrieve(par,item,obj); }
633  { return Helper(this).retrieve(par,item,obj); }
635  { return Helper(this).retrieve(par,item,obj); }
637  { return Helper(this).retrieve(par,item,obj); }
639  { return Helper(this).retrieve(par,item,obj); }
640  //------------------------------------------------------------------------------
641  virtual StatusCode retrieveObject(DataObject* par,int item,P1D*& obj)
642  { return Helper(this).retrieve(par,item,obj); }
643  virtual StatusCode retrieveObject(DataObject* par,int item,P2D*& obj)
644  { return Helper(this).retrieve(par,item,obj); }
645  virtual StatusCode retrieveObject(DataObject* par,int item,H1D*& obj)
646  { return Helper(this).retrieve(par,item,obj); }
647  virtual StatusCode retrieveObject(DataObject* par,int item,H2D*& obj)
648  { return Helper(this).retrieve(par,item,obj); }
649  virtual StatusCode retrieveObject(DataObject* par,int item,H3D*& obj)
650  { return Helper(this).retrieve(par,item,obj); }
651  //------------------------------------------------------------------------------
652  virtual StatusCode retrieveObject(Base* par,int item,P1D*& obj)
653  { return Helper(this).retrieve(__cast(par),item,obj); }
654  virtual StatusCode retrieveObject(Base* par,int item,P2D*& obj)
655  { return Helper(this).retrieve(__cast(par),item,obj); }
656  virtual StatusCode retrieveObject(Base* par,int item,H1D*& obj)
657  { return Helper(this).retrieve(__cast(par),item,obj); }
658  virtual StatusCode retrieveObject(Base* par,int item,H2D*& obj)
659  { return Helper(this).retrieve(__cast(par),item,obj); }
660  virtual StatusCode retrieveObject(Base* par,int item,H3D*& obj)
661  { return Helper(this).retrieve(__cast(par),item,obj); }
662  //------------------------------------------------------------------------------
664  { return Helper(this).retrieve(__cast(par),item,obj); }
666  { return Helper(this).retrieve(__cast(par),item,obj); }
668  { return Helper(this).retrieve(__cast(par),item,obj); }
670  { return Helper(this).retrieve(__cast(par),item,obj); }
672  { return Helper(this).retrieve(__cast(par),item,obj); }
673 
674  // ==========================================================================
675  // Find histogram identified by its full path in the data store
676  // ==========================================================================
677 
678  //------------------------------------------------------------------------------
679  // Find object identified by its full path in the data store
680  //------------------------------------------------------------------------------
682  { return Helper(this).find(pReg,path,obj); }
684  { return Helper(this).find(pReg,path,obj); }
686  { return Helper(this).find(pReg,path,obj); }
688  { return Helper(this).find(pReg,path,obj); }
690  { return Helper(this).find(pReg,path,obj); }
691  //------------------------------------------------------------------------------
692  virtual StatusCode findObject(CSTR full,P1D*& obj)
693  { return Helper(this).find(full,obj); }
694  virtual StatusCode findObject(CSTR full,P2D*& obj)
695  { return Helper(this).find(full,obj); }
696  virtual StatusCode findObject(CSTR full,H1D*& obj)
697  { return Helper(this).find(full,obj); }
698  virtual StatusCode findObject(CSTR full,H2D*& obj)
699  { return Helper(this).find(full,obj); }
700  virtual StatusCode findObject(CSTR full,H3D*& obj)
701  { return Helper(this).find(full,obj); }
702  //------------------------------------------------------------------------------
703  virtual StatusCode findObject(CSTR par,CSTR rel,P1D*& obj)
704  { return Helper(this).find(par,rel,obj); }
705  virtual StatusCode findObject(CSTR par,CSTR rel,P2D*& obj)
706  { return Helper(this).find(par,rel,obj); }
707  virtual StatusCode findObject(CSTR par,CSTR rel,H1D*& obj)
708  { return Helper(this).find(par,rel,obj); }
709  virtual StatusCode findObject(CSTR par,CSTR rel,H2D*& obj)
710  { return Helper(this).find(par,rel,obj); }
711  virtual StatusCode findObject(CSTR par,CSTR rel,H3D*& obj)
712  { return Helper(this).find(par,rel,obj); }
713  //------------------------------------------------------------------------------
714  virtual StatusCode findObject(CSTR par,int item,P1D*& obj)
715  { return Helper(this).find(par,item,obj); }
716  virtual StatusCode findObject(CSTR par,int item,P2D*& obj)
717  { return Helper(this).find(par,item,obj); }
718  virtual StatusCode findObject(CSTR par,int item,H1D*& obj)
719  { return Helper(this).find(par,item,obj); }
720  virtual StatusCode findObject(CSTR par,int item,H2D*& obj)
721  { return Helper(this).find(par,item,obj); }
722  virtual StatusCode findObject(CSTR par,int item,H3D*& obj)
723  { return Helper(this).find(par,item,obj); }
724  //------------------------------------------------------------------------------
725  virtual StatusCode findObject(DataObject* par,int item,P1D*& obj)
726  { return Helper(this).find(par,item,obj); }
727  virtual StatusCode findObject(DataObject* par,int item,P2D*& obj)
728  { return Helper(this).find(par,item,obj); }
729  virtual StatusCode findObject(DataObject* par,int item,H1D*& obj)
730  { return Helper(this).find(par,item,obj); }
731  virtual StatusCode findObject(DataObject* par,int item,H2D*& obj)
732  { return Helper(this).find(par,item,obj); }
733  virtual StatusCode findObject(DataObject* par,int item,H3D*& obj)
734  { return Helper(this).find(par,item,obj); }
735  //------------------------------------------------------------------------------
737  { return Helper(this).find(par,item,obj); }
739  { return Helper(this).find(par,item,obj); }
741  { return Helper(this).find(par,item,obj); }
743  { return Helper(this).find(par,item,obj); }
745  { return Helper(this).find(par,item,obj); }
746  //------------------------------------------------------------------------------
747  virtual StatusCode findObject(Base* par,int item,P1D*& obj)
748  { return Helper(this).find(__cast(par),item,obj); }
749  virtual StatusCode findObject(Base* par,int item,P2D*& obj)
750  { return Helper(this).find(__cast(par),item,obj); }
751  virtual StatusCode findObject(Base* par,int item,H1D*& obj)
752  { return Helper(this).find(__cast(par),item,obj); }
753  virtual StatusCode findObject(Base* par,int item,H2D*& obj)
754  { return Helper(this).find(__cast(par),item,obj); }
755  virtual StatusCode findObject(Base* par,int item,H3D*& obj)
756  { return Helper(this).find(__cast(par),item,obj); }
757  //------------------------------------------------------------------------------
758  virtual StatusCode findObject(Base* par,CSTR item,P1D*& obj)
759  { return Helper(this).find(__cast(par),item,obj); }
760  virtual StatusCode findObject(Base* par,CSTR item,P2D*& obj)
761  { return Helper(this).find(__cast(par),item,obj); }
762  virtual StatusCode findObject(Base* par,CSTR item,H1D*& obj)
763  { return Helper(this).find(__cast(par),item,obj); }
764  virtual StatusCode findObject(Base* par,CSTR item,H2D*& obj)
765  { return Helper(this).find(__cast(par),item,obj); }
766  virtual StatusCode findObject(Base* par,CSTR item,H3D*& obj)
767  { return Helper(this).find(__cast(par),item,obj); }
768 
769  // ==========================================================================
770  // Projections and slices.
771  // ==========================================================================
772  virtual H1D* projectionX(CSTR name,const H2D& h)
773  { return sliceX( name, h, IAxis::UNDERFLOW_BIN, IAxis::OVERFLOW_BIN); }
774  virtual H1D* projectionY(CSTR name,const H2D& h)
775  { return sliceY( name, h, IAxis::UNDERFLOW_BIN, IAxis::OVERFLOW_BIN); }
776  virtual H1D* sliceX(CSTR name,const H2D& h,int indexY)
777  { return sliceX( name, h, indexY, indexY ); }
778  virtual H1D* sliceY(CSTR name,const H2D& h,int indexX)
779  { return sliceY( name, h, indexX, indexX ); }
780  virtual H1D* sliceX(CSTR name,const H2D& h,int indexY1,int indexY2);
781  virtual H1D* sliceY(CSTR name,const H2D& h,int indexX1,int indexX2);
782  //------------------------------------------------------------------------------
783  bool destroy( IBaseHistogram* hist);
784 
785  H1D* add(CSTR nameAndTitle, const H1D& a, const H1D& b)
786  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Add, 1.); }
787  H1D* subtract(CSTR nameAndTitle, const H1D& a, const H1D& b)
788  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Add,-1.); }
789  H1D* multiply(CSTR nameAndTitle, const H1D& a, const H1D& b)
790  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Multiply); }
791  H1D* divide(CSTR nameAndTitle, const H1D& a, const H1D& b)
792  { return Helper::act(createCopy(nameAndTitle,a),b,&TH1::Divide); }
793 
794  H2D* add(CSTR nameAndTitle, const H2D& a, const H2D& b)
795  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Add, 1.); }
796  H2D* subtract(CSTR nameAndTitle, const H2D& a, const H2D& b)
797  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Add,-1.); }
798  H2D* multiply(CSTR nameAndTitle, const H2D& a, const H2D& b)
799  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Multiply); }
800  H2D* divide(CSTR nameAndTitle, const H2D& a, const H2D& b)
801  { return Helper::act(createCopy(nameAndTitle,a),b,&TH2D::Divide); }
802 
803  H3D* add(CSTR nameAndTitle, const H3D& a, const H3D& b)
804  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Add, 1.); }
805  H3D* subtract(CSTR nameAndTitle, const H3D& a, const H3D& b)
806  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Add,-1.); }
807  H3D* multiply(CSTR nameAndTitle, const H3D& a, const H3D& b)
808  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Multiply); }
809  H3D* divide(CSTR nameAndTitle, const H3D& a, const H3D& b)
810  { return Helper::act(createCopy(nameAndTitle,a),b,&TH3D::Divide); }
811 
812  H2D* projectionXY(CSTR nameAndTitle,const H3D& h)
813  { return i_project(nameAndTitle,h,"xy"); }
814  H2D* projectionXZ(CSTR nameAndTitle,const H3D& h)
815  { return i_project(nameAndTitle,h,"xz"); }
816  H2D* projectionYZ(CSTR nameAndTitle,const H3D& h)
817  { return i_project(nameAndTitle,h,"yz"); }
818  H2D* sliceXY(CSTR /* nameAndTitle */,const H3D& /* h */,int /* low */,int /* high */ ) NOT_IMPLEMENTED
819  H2D* sliceXZ(CSTR /* nameAndTitle */,const H3D& /* h */,int /* low */,int /* high */ ) NOT_IMPLEMENTED
820  H2D* sliceYZ(CSTR /* nameAndTitle */,const H3D& /* h */,int /* low */,int /* high */ ) NOT_IMPLEMENTED
821 
822  //------------------------------------------------------------------------------
824  { return book( name, tit, BINS(x)); }
826  { return book( name, tit, BINS(x)); }
827  H1D* createHistogram1D(CSTR name,CSTR title,const Edges& x,CSTR /*opt*/)
828  { return book(name, title, x); }
829  H1D* createHistogram1D(CSTR nameAndTitle, DBINS(x))
830  { return book(nameAndTitle, nameAndTitle, BINS(x)); }
831  H1D* createCopy(CSTR full, const H1D& h)
832  { return createCopy(i_splitPath(full), h); }
833  H1D* createCopy(CSTR par, CSTR rel, const H1D& h)
834  { return createCopy(createPath(par), rel, h); }
835  H1D* createCopy(STRPAIR loc, const H1D& h)
836  { return createCopy(loc.first, loc.second, h); }
837  H1D* createCopy(DataObject* pPar, CSTR rel, const H1D& h)
838  { return i_book(pPar, rel, h.title(), Gaudi::createH1D(h)); }
839  //------------------------------------------------------------------------------
841  { return book( name, tit, BINS(x), BINS(y)); }
842  H2D* createHistogram2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),CSTR /*opt*/)
843  { return book( name, tit, BINS(x), BINS(y)); }
844  H2D* createHistogram2D(CSTR name,CSTR title,const Edges& x,const Edges& y, CSTR /*opt*/)
845  { return book(name, title, x, y); }
846  H2D* createHistogram2D(CSTR nameAndTitle, DBINS(x), DBINS(y))
847  { return book(nameAndTitle, nameAndTitle, BINS(x), BINS(y)); }
848  H2D* createCopy(CSTR full, const H2D& h)
849  { return createCopy(i_splitPath(full), h); }
850  H2D* createCopy(CSTR par, CSTR rel, const H2D& h)
851  { return createCopy(createPath(par), rel, h); }
852  H2D* createCopy(STRPAIR loc, const H2D& h)
853  { return createCopy(loc.first, loc.second, h); }
854  H2D* createCopy(DataObject* pPar, CSTR rel, const H2D& h)
855  { return i_book(pPar, rel, h.title(), Gaudi::createH2D(h)); }
856  //------------------------------------------------------------------------------
857  H3D* createHistogram3D(CSTR name, CSTR tit, DBINS(x), DBINS(y), DBINS(z))
858  { return book( name, tit, BINS(x), BINS(y), BINS(z)); }
859  H3D* createHistogram3D(CSTR name, CSTR tit, DBINS(x), DBINS(y), DBINS(z), CSTR /*opt*/)
860  { return book( name, tit, BINS(x), BINS(y), BINS(z)); }
861  H3D* createHistogram3D(CSTR name, CSTR title,const Edges& x,const Edges& y,const Edges& z,CSTR /*opt*/)
862  { return book(name, title, x, y, z); }
863  H3D* createHistogram3D(CSTR nameAndTitle, DBINS(x), DBINS(y), DBINS(z))
864  { return book(nameAndTitle, nameAndTitle, BINS(x), BINS(y), BINS(z)); }
865  H3D* createCopy(CSTR full, const H3D& h)
866  { return createCopy(i_splitPath(full), h); }
867  H3D* createCopy(CSTR par, CSTR rel, const H3D& h)
868  { return createCopy(createPath(par), rel, h); }
869  H3D* createCopy(STRPAIR loc, const H3D& h)
870  { return createCopy(loc.first, loc.second, h); }
871  H3D* createCopy(DataObject* pPar, CSTR rel, const H3D& h)
872  { return i_book(pPar, rel, h.title(), Gaudi::createH3D(h)); }
873  //------------------------------------------------------------------------------
874 
875 
877  { return bookProf( name, tit, BINS(x) , opt ); }
878  P1D* createProfile1D(CSTR name,CSTR tit,DBINS(x),double upper, double lower , CSTR opt )
879  { return bookProf( name, tit, BINS(x), upper, lower , opt ); }
880  P1D* createProfile1D(CSTR name,CSTR title,const Edges& x,CSTR /* opt */ )
881  { return bookProf(name, title, x ); }
882  P1D* createProfile1D(CSTR name,CSTR title,const Edges& x,double upper, double lower, CSTR /* opt */ )
883  { return bookProf(name, title, x, upper, lower ); }
884 
886  { return bookProf( nametit, nametit, BINS(x) , "s"); }
887  P1D* createProfile1D(CSTR nametit,DBINS(x),double upper, double lower )
888  { return bookProf( nametit, nametit, BINS(x), upper, lower , "s"); }
889 
890 
891  P1D* createCopy(CSTR full, const P1D& h)
892  { return createCopy(i_splitPath(full), h); }
893  P1D* createCopy(CSTR par, CSTR rel, const P1D& h)
894  { return createCopy(createPath(par), rel, h); }
895  P1D* createCopy(STRPAIR loc, const P1D& h)
896  { return createCopy(loc.first, loc.second, h); }
897  P1D* createCopy(DataObject* pPar, CSTR rel, const P1D& h)
898  { return i_book(pPar, rel, h.title(), Gaudi::createProf1D(h)); }
899  //------------------------------------------------------------------------------
901  { return bookProf( name, tit, BINS(x), BINS(y)); }
902  P2D* createProfile2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),CSTR /*opt*/)
903  { return bookProf( name, tit, BINS(x), BINS(y)); }
904  P2D* createProfile2D(CSTR name,CSTR title,const Edges& x,const Edges& y, CSTR /*opt*/)
905  { return bookProf(name, title, x, y); }
906  P2D* createProfile2D(CSTR nameAndTitle, DBINS(x), DBINS(y))
907  { return bookProf(nameAndTitle, nameAndTitle, BINS(x), BINS(y)); }
908 
909  P2D* createProfile2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),double upper, double lower)
910  { return bookProf( name, tit, BINS(x), BINS(y), upper, lower); }
911  P2D* createProfile2D(CSTR name,CSTR tit,DBINS(x),DBINS(y),double upper, double lower,CSTR /*opt*/)
912  { return bookProf( name, tit, BINS(x), BINS(y), upper, lower); }
913  P2D* createProfile2D(CSTR name,CSTR title,const Edges& x,const Edges& y,double upper, double lower, CSTR /*opt*/)
914  { return bookProf(name, title, x, y, upper, lower); }
915  P2D* createProfile2D(CSTR nameAndTitle, DBINS(x), DBINS(y),double upper, double lower)
916  { return bookProf(nameAndTitle, nameAndTitle, BINS(x), BINS(y), upper, lower);}
917 
918  P2D* createCopy(CSTR full, const P2D& h)
919  { return createCopy(i_splitPath(full), h); }
920  P2D* createCopy(CSTR par, CSTR rel, const P2D& h)
921  { return createCopy(createPath(par), rel, h); }
922  P2D* createCopy(STRPAIR loc, const P2D& h)
923  { return createCopy(loc.first, loc.second, h); }
924  P2D* createCopy(DataObject* pPar, CSTR rel, const P2D& h)
925  { return i_book(pPar, rel, h.title(), Gaudi::createProf2D(h)); }
926  //------------------------------------------------------------------------------
927  AIDA::ICloud1D* createCloud1D(CSTR, CSTR, int, CSTR) NOT_IMPLEMENTED
928  AIDA::ICloud1D* createCloud1D(CSTR) NOT_IMPLEMENTED
929  AIDA::ICloud1D* createCopy(CSTR, const AIDA::ICloud1D&) NOT_IMPLEMENTED
930  AIDA::ICloud2D* createCloud2D(CSTR, CSTR, int, CSTR) NOT_IMPLEMENTED
931  AIDA::ICloud2D* createCloud2D(CSTR) NOT_IMPLEMENTED
932  AIDA::ICloud2D* createCopy(CSTR, const AIDA::ICloud2D&) NOT_IMPLEMENTED
933  AIDA::ICloud3D* createCloud3D(CSTR, CSTR, int, CSTR) NOT_IMPLEMENTED
934  AIDA::ICloud3D* createCloud3D(CSTR) NOT_IMPLEMENTED
935  AIDA::ICloud3D* createCopy(CSTR, const AIDA::ICloud3D&) NOT_IMPLEMENTED
936 
942 
944  virtual std::ostream& print(Base* h, std::ostream& s = std::cout) const;
945 
947  virtual std::ostream& write(Base* h, std::ostream& s = std::cout) const;
948 
950  virtual int write(Base* h, const char* file_name ) const;
951 
953  virtual DataObject* createPath(CSTR newPath );
954 
959  virtual DataObject* createDirectory (CSTR parentDir, CSTR subDir );
960 
961 public:
962  // ==========================================================================
964  void update1Ddefs ( Property& ) ;
965  // ==========================================================================
966  typedef std::map<std::string,Gaudi::Histo1DDef> Histo1DMap ;
967  // ==========================================================================
968 private:
969  // ==========================================================================
970  // container with the definition of "the special" histograms
971  Histo1DMap m_defs1D ;
972  // ==========================================================================
973  // modified histograms:
974  std::set<std::string> m_mods1D ;
975  // ==========================================================================
976 };
977 // ===========================================================================
978 // The END
979 // ===========================================================================
980 #endif // GAUDISVC_HISTOGRAMSVC_H
981 // ===========================================================================

Generated at Wed Dec 4 2013 14:33:07 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004