File indexing completed on 2025-10-31 09:02:03
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 #ifndef GAUDISVC_HISTOGRAMSVC_H
0013 #define GAUDISVC_HISTOGRAMSVC_H 1
0014 
0015 
0016 
0017 
0018 
0019 #include <GaudiKernel/DataSvc.h>
0020 #include <GaudiKernel/GaudiException.h>
0021 #include <GaudiKernel/HistoProperty.h>
0022 #include <GaudiKernel/IHistogramSvc.h>
0023 #include <GaudiKernel/IRegistry.h>
0024 #include <GaudiKernel/System.h>
0025 
0026 
0027 
0028 
0029 #include <AIDA/IAnnotation.h>
0030 #include <AIDA/IHistogramFactory.h>
0031 
0032 
0033 
0034 #include "Axis.h"
0035 #include "HistogramUtility.h"
0036 #include <TH1.h>
0037 #include <TH2.h>
0038 #include <TH3.h>
0039 
0040 namespace AIDA {
0041   class ICloud1D;
0042   class ICloud2D;
0043   class ICloud3D;
0044 } 
0045 
0046 namespace detail {
0047   template <class T>
0048   static DataObject* cast( T* p ) {
0049     DataObject* q = dynamic_cast<DataObject*>( p );
0050     if ( !q && p ) { throw std::runtime_error( "HistogramSvc: Unexpected object type." ); }
0051     return q;
0052   }
0053 } 
0054 
0055 
0056 
0057 
0058 
0059 
0060 
0061 class HistogramSvc : public extends<DataSvc, IHistogramSvc>, virtual public AIDA::IHistogramFactory {
0062 
0063 private:
0064   void not_implemented() const { error() << "Sorry, not yet implemented..." << endmsg; }
0065 
0066 protected:
0067   typedef AIDA::IHistogram3D   H3D;
0068   typedef AIDA::IProfile2D     P2D;
0069   typedef AIDA::IBaseHistogram Base;
0070 
0071   struct Helper {
0072     HistogramSvc* m_svc;
0073     Helper( HistogramSvc* p ) : m_svc( p ) {}
0074     template <class A1, class A3>
0075     StatusCode retrieve( A1 a1, A3*& a3 ) {
0076       DataObject* pObject = nullptr;
0077       StatusCode  sc      = m_svc->retrieveObject( a1, pObject );
0078       a3                  = dynamic_cast<A3*>( pObject );
0079       return sc;
0080     }
0081     template <class A1, class A2, class A3>
0082     StatusCode retrieve( A1 a1, A2 a2, A3*& a3 ) {
0083       DataObject* pObject = nullptr;
0084       StatusCode  sc      = m_svc->retrieveObject( a1, a2, pObject );
0085       a3                  = dynamic_cast<A3*>( pObject );
0086       return sc;
0087     }
0088     template <class A1, class A3>
0089     StatusCode find( A1 a1, A3*& a3 ) {
0090       DataObject* pObject = nullptr;
0091       StatusCode  sc      = m_svc->findObject( a1, pObject );
0092       a3                  = dynamic_cast<A3*>( pObject );
0093       return sc;
0094     }
0095     template <class A1, class A2, class A3>
0096     StatusCode find( A1 a1, A2 a2, A3*& a3 ) {
0097       DataObject* pObject = nullptr;
0098       StatusCode  sc      = m_svc->findObject( a1, a2, pObject );
0099       a3                  = dynamic_cast<A3*>( pObject );
0100       return sc;
0101     }
0102     template <class R, class S, class T1, class T2>
0103     static R* act( R* res, const S& b, void ( T1::*pmf )( const T2*, Double_t ), Double_t scale ) {
0104       auto       h1 = Gaudi::getRepresentation<R, T1>( *res );
0105       const auto h2 = Gaudi::getRepresentation<R, T2>( b );
0106       if ( h1 && h2 ) {
0107         ( h1->*pmf )( h2, scale );
0108         return res;
0109       }
0110       return nullptr;
0111     }
0112     template <class R, class S, class T1, class T2>
0113     static R* act( R* res, const S& b, Bool_t ( T1::*pmf )( const T2*, Double_t ), Double_t scale ) {
0114       auto       h1 = Gaudi::getRepresentation<R, T1>( *res );
0115       const auto h2 = Gaudi::getRepresentation<R, T2>( b );
0116       if ( h1 && h2 ) {
0117         ( h1->*pmf )( h2, scale );
0118         return res;
0119       }
0120       return nullptr;
0121     }
0122     template <class R, class S, class T1, class T2>
0123     static R* act( R* res, const S& b, void ( T1::*pmf )( const T2* ) ) {
0124       auto       h1 = Gaudi::getRepresentation<R, T1>( *res );
0125       const auto h2 = Gaudi::getRepresentation<R, T2>( b );
0126       if ( h1 && h2 ) {
0127         ( h1->*pmf )( h2 );
0128         return res;
0129       }
0130       return nullptr;
0131     }
0132     template <class R, class S, class T1, class T2>
0133     static R* act( R* res, const S& b, Bool_t ( T1::*pmf )( const T2* ) ) {
0134       auto       h1 = Gaudi::getRepresentation<R, T1>( *res );
0135       const auto h2 = Gaudi::getRepresentation<R, T2>( b );
0136       if ( h1 && h2 ) {
0137         ( h1->*pmf )( h2 );
0138         return res;
0139       }
0140       return nullptr;
0141     }
0142   };
0143 
0144 public:
0145   using Edges        = std::vector<double>;
0146   using DBaseEntries = std::vector<std::string>;
0147 
0148   
0149 
0150 
0151 
0152   HistogramSvc( const std::string& name, ISvcLocator* svc );
0153 
0154   
0155   ~HistogramSvc() override;
0156 
0157   
0158 
0159 
0160 
0161 
0162   std::pair<std::string, std::string> i_splitPath( const std::string& full );
0163 
0164   
0165 
0166 
0167   StatusCode connectInput( const std::string& ident );
0168 
0169   template <class T>
0170   inline T* i_book( DataObject* pPar, const std::string& rel, const std::string& title,
0171                     const std::pair<DataObject*, T*>& o ) {
0172     if ( o.first && registerObject( pPar, rel, (Base*)o.second ).isSuccess() ) return o.second;
0173     delete o.first;
0174     throw GaudiException( "Cannot book " + System::typeinfoName( typeid( T ) ) + " " + title, "HistogramSvc",
0175                           StatusCode::FAILURE );
0176   }
0177 
0178   
0179   AIDA::IHistogram2D* i_project( const std::string& nameAndTitle, const AIDA::IHistogram3D& h, const std::string& dir );
0180 
0181 public:
0182   
0183   StatusCode initialize() override;
0184   
0185   StatusCode reinitialize() override;
0186   
0187   StatusCode finalize() override;
0188 
0189   
0190   AIDA::IHistogramFactory* histogramFactory() override { return this; }
0191 
0192   
0193   
0194   
0195   
0196 
0197 
0198 
0199 
0200 
0201 
0202 
0203 
0204 
0205 
0206 
0207 
0208 
0209 
0210 
0211   AIDA::IHistogram1D* book( const std::string& par, const std::string& rel, const std::string& title, int nx,
0212                             double lowx, double upx ) override;
0213 
0214   AIDA::IHistogram1D* book( const std::string& par, int hID, const std::string& title, int nx, double lowx,
0215                             double upx ) override;
0216 
0217   AIDA::IHistogram1D* book( DataObject* pPar, int hID, const std::string& title, int nx, double lowx,
0218                             double upx ) override;
0219 
0220   AIDA::IHistogram1D* book( DataObject* pPar, const std::string& rel, const std::string& title, int nx, double lowx,
0221                             double upx ) override;
0222 
0223   virtual AIDA::IHistogram1D* book( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0224                                     double lowx, double upx );
0225 
0226   AIDA::IHistogram1D* book( const std::string& full, const std::string& title, int nx, double lowx,
0227                             double upx ) override;
0228 
0229   
0230   
0231   
0232   
0233 
0234 
0235 
0236 
0237 
0238 
0239 
0240 
0241 
0242 
0243 
0244 
0245 
0246 
0247 
0248   AIDA::IProfile1D* bookProf( const std::string& par, const std::string& rel, const std::string& title, int nx,
0249                               double lowx, double upx, const std::string& opt ) override;
0250 
0251   AIDA::IProfile1D* bookProf( const std::string& par, int hID, const std::string& title, int nx, double lowx,
0252                               double upx, const std::string& opt ) override;
0253 
0254   AIDA::IProfile1D* bookProf( DataObject* pPar, int hID, const std::string& title, int nx, double lowx, double upx,
0255                               const std::string& opt ) override;
0256 
0257   virtual AIDA::IProfile1D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0258                                       double lowx, double upx, const std::string& opt );
0259 
0260   AIDA::IProfile1D* bookProf( const std::string& full, const std::string& title, int nx, double lowx, double upx,
0261                               const std::string& opt ) override;
0262 
0263   AIDA::IProfile1D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, int nx, double lowx,
0264                               double upx, const std::string& opt ) override;
0265 
0266   AIDA::IProfile1D* bookProf( const std::string& par, const std::string& rel, const std::string& title, int nx,
0267                               double lowx, double upx, double upper, double lower, const std::string& opt ) override;
0268 
0269   AIDA::IProfile1D* bookProf( const std::string& par, int hID, const std::string& title, int nx, double lowx,
0270                               double upx, double upper, double lower, const std::string& opt ) override;
0271 
0272   AIDA::IProfile1D* bookProf( DataObject* pPar, int hID, const std::string& title, int nx, double lowx, double upx,
0273                               double upper, double lower, const std::string& opt ) override;
0274 
0275   virtual AIDA::IProfile1D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0276                                       double lowx, double upx, double upper, double lower, const std::string& opt );
0277 
0278   AIDA::IProfile1D* bookProf( const std::string& full, const std::string& title, int nx, double lowx, double upx,
0279                               double upper, double lower, const std::string& opt ) override;
0280 
0281   AIDA::IProfile1D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, int nx, double lowx,
0282                               double upx, double upper, double lower, const std::string& opt ) override;
0283 
0284   
0285   
0286   
0287   
0288 
0289 
0290 
0291 
0292 
0293 
0294 
0295 
0296 
0297 
0298 
0299 
0300 
0301   AIDA::IHistogram1D* book( const std::string& par, int hID, const std::string& title, Edges e ) override;
0302 
0303   AIDA::IHistogram1D* book( DataObject* pPar, int hID, const std::string& title, Edges e ) override;
0304 
0305   AIDA::IHistogram1D* book( const std::string& par, const std::string& rel, const std::string& title,
0306                             Edges e ) override;
0307 
0308   virtual AIDA::IHistogram1D* book( const std::pair<std::string, std::string>& loc, const std::string& title, Edges e );
0309 
0310   AIDA::IHistogram1D* book( const std::string& full, const std::string& title, Edges e ) override;
0311 
0312   AIDA::IHistogram1D* book( DataObject* pPar, const std::string& rel, const std::string& title, Edges e ) override;
0313 
0314   
0315   
0316   
0317   
0318 
0319 
0320 
0321 
0322 
0323 
0324 
0325 
0326 
0327 
0328 
0329 
0330 
0331   AIDA::IProfile1D* bookProf( const std::string& full, const std::string& title, Edges e ) override;
0332 
0333   AIDA::IProfile1D* bookProf( const std::string& par, const std::string& rel, const std::string& title,
0334                               Edges e ) override;
0335 
0336   AIDA::IProfile1D* bookProf( const std::string& par, int hID, const std::string& title, Edges e ) override;
0337 
0338   AIDA::IProfile1D* bookProf( DataObject* pPar, int hID, const std::string& title, Edges e ) override;
0339 
0340   virtual AIDA::IProfile1D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title,
0341                                       Edges e );
0342 
0343   AIDA::IProfile1D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, Edges e ) override;
0344 
0345   virtual AIDA::IProfile1D* bookProf( const std::string& full, const std::string& title, Edges e, double upper,
0346                                       double lower );
0347 
0348   virtual AIDA::IProfile1D* bookProf( const std::string& par, const std::string& rel, const std::string& title, Edges e,
0349                                       double upper, double lower );
0350 
0351   virtual AIDA::IProfile1D* bookProf( const std::string& par, int hID, const std::string& title, Edges e, double upper,
0352                                       double lower );
0353 
0354   virtual AIDA::IProfile1D* bookProf( DataObject* pPar, int hID, const std::string& title, Edges e, double upper,
0355                                       double lower );
0356 
0357   virtual AIDA::IProfile1D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, Edges e,
0358                                       double upper, double lower );
0359 
0360   virtual AIDA::IProfile1D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, Edges e,
0361                                       double upper, double lower );
0362 
0363   
0364   
0365   
0366   
0367 
0368 
0369 
0370 
0371 
0372 
0373 
0374 
0375 
0376 
0377 
0378 
0379 
0380 
0381 
0382 
0383 
0384 
0385   AIDA::IHistogram2D* book( const std::string& full, const std::string& title, int nx, double lowx, double upx, int ny,
0386                             double lowy, double upy ) override;
0387 
0388   AIDA::IHistogram2D* book( const std::string& par, const std::string& rel, const std::string& title, int nx,
0389                             double lowx, double upx, int ny, double lowy, double upy ) override;
0390 
0391   AIDA::IHistogram2D* book( const std::string& par, int hID, const std::string& title, int nx, double lowx, double upx,
0392                             int ny, double lowy, double upy ) override;
0393 
0394   virtual AIDA::IHistogram2D* book( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0395                                     double lowx, double upx, int ny, double lowy, double upy );
0396 
0397   AIDA::IHistogram2D* book( DataObject* pPar, int hID, const std::string& title, int nx, double lowx, double upx,
0398                             int ny, double lowy, double upy ) override;
0399 
0400   AIDA::IHistogram2D* book( DataObject* pPar, const std::string& rel, const std::string& title, int nx, double lowx,
0401                             double upx, int ny, double lowy, double upy ) override;
0402 
0403   
0404   
0405   
0406   
0407 
0408 
0409 
0410 
0411 
0412 
0413 
0414 
0415 
0416 
0417 
0418 
0419 
0420 
0421 
0422 
0423 
0424 
0425   virtual AIDA::IProfile2D* bookProf( const std::string& full, const std::string& title, int nx, double lowx,
0426                                       double upx, int ny, double lowy, double upy, double upper, double lower );
0427 
0428   virtual AIDA::IProfile2D* bookProf( const std::string& par, const std::string& rel, const std::string& title, int nx,
0429                                       double lowx, double upx, int ny, double lowy, double upy, double upper,
0430                                       double lower );
0431 
0432   virtual AIDA::IProfile2D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0433                                       double lowx, double upx, int ny, double lowy, double upy, double upper,
0434                                       double lower );
0435 
0436   virtual AIDA::IProfile2D* bookProf( const std::string& par, int hID, const std::string& title, int nx, double lowx,
0437                                       double upx, int ny, double lowy, double upy, double upper, double lower );
0438 
0439   virtual AIDA::IProfile2D* bookProf( DataObject* pPar, int hID, const std::string& title, int nx, double lowx,
0440                                       double upx, int ny, double lowy, double upy, double upper, double lower );
0441 
0442   virtual AIDA::IProfile2D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, int nx,
0443                                       double lowx, double upx, int ny, double lowy, double upy, double upper,
0444                                       double lower );
0445 
0446   AIDA::IProfile2D* bookProf( const std::string& full, const std::string& title, int nx, double lowx, double upx,
0447                               int ny, double lowy, double upy ) override;
0448 
0449   AIDA::IProfile2D* bookProf( const std::string& par, const std::string& rel, const std::string& title, int nx,
0450                               double lowx, double upx, int ny, double lowy, double upy ) override;
0451 
0452   virtual AIDA::IProfile2D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0453                                       double lowx, double upx, int ny, double lowy, double upy );
0454 
0455   AIDA::IProfile2D* bookProf( const std::string& par, int hID, const std::string& title, int nx, double lowx,
0456                               double upx, int ny, double lowy, double upy ) override;
0457 
0458   AIDA::IProfile2D* bookProf( DataObject* pPar, int hID, const std::string& title, int nx, double lowx, double upx,
0459                               int ny, double lowy, double upy ) override;
0460 
0461   AIDA::IProfile2D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, int nx, double lowx,
0462                               double upx, int ny, double lowy, double upy ) override;
0463 
0464   
0465   
0466   
0467   
0468 
0469 
0470 
0471 
0472 
0473 
0474 
0475 
0476 
0477 
0478 
0479 
0480 
0481   AIDA::IHistogram2D* book( const std::string& full, const std::string& title, Edges x, Edges y ) override;
0482 
0483   AIDA::IHistogram2D* book( const std::string& par, const std::string& rel, const std::string& title, Edges x,
0484                             Edges y ) override;
0485 
0486   AIDA::IHistogram2D* book( const std::string& par, int hID, const std::string& title, Edges x, Edges y ) override;
0487 
0488   virtual AIDA::IHistogram2D* book( const std::pair<std::string, std::string>& loc, const std::string& title, Edges x,
0489                                     Edges y );
0490 
0491   AIDA::IHistogram2D* book( DataObject* pPar, int hID, const std::string& title, Edges x, Edges y ) override;
0492 
0493   AIDA::IHistogram2D* book( DataObject* pPar, const std::string& rel, const std::string& title, Edges x,
0494                             Edges y ) override;
0495 
0496   
0497   
0498   
0499   
0500 
0501 
0502 
0503 
0504 
0505 
0506 
0507 
0508 
0509 
0510 
0511 
0512 
0513   AIDA::IProfile2D* bookProf( const std::string& full, const std::string& title, Edges x, Edges y ) override;
0514 
0515   AIDA::IProfile2D* bookProf( const std::string& par, const std::string& rel, const std::string& title, Edges x,
0516                               Edges y ) override;
0517 
0518   AIDA::IProfile2D* bookProf( const std::string& par, int hID, const std::string& title, Edges x, Edges y ) override;
0519 
0520   AIDA::IProfile2D* bookProf( DataObject* pPar, int hID, const std::string& title, Edges x, Edges y ) override;
0521 
0522   virtual AIDA::IProfile2D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, Edges x,
0523                                       Edges y );
0524 
0525   AIDA::IProfile2D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, Edges x,
0526                               Edges y ) override;
0527 
0528   virtual AIDA::IProfile2D* bookProf( const std::string& full, const std::string& title, Edges x, Edges y, double upper,
0529                                       double lower );
0530 
0531   virtual AIDA::IProfile2D* bookProf( const std::string& par, const std::string& rel, const std::string& title, Edges x,
0532                                       Edges y, double upper, double lower );
0533 
0534   virtual AIDA::IProfile2D* bookProf( const std::string& par, int hID, const std::string& title, Edges x, Edges y,
0535                                       double upper, double lower );
0536 
0537   virtual AIDA::IProfile2D* bookProf( DataObject* pPar, int hID, const std::string& title, Edges x, Edges y,
0538                                       double upper, double lower );
0539 
0540   virtual AIDA::IProfile2D* bookProf( const std::pair<std::string, std::string>& loc, const std::string& title, Edges x,
0541                                       Edges y, double upper, double lower );
0542 
0543   virtual AIDA::IProfile2D* bookProf( DataObject* pPar, const std::string& rel, const std::string& title, Edges x,
0544                                       Edges y, double upper, double lower );
0545 
0546   
0547   
0548   
0549   
0550 
0551 
0552 
0553 
0554 
0555 
0556 
0557 
0558 
0559 
0560 
0561 
0562 
0563 
0564 
0565   AIDA::IHistogram3D* book( const std::string& full, const std::string& title, int nx, double lowx, double upx, int ny,
0566                             double lowy, double upy, int nz, double lowz, double upz ) override;
0567 
0568   AIDA::IHistogram3D* book( const std::string& par, const std::string& rel, const std::string& title, int nx,
0569                             double lowx, double upx, int ny, double lowy, double upy, int nz, double lowz,
0570                             double upz ) override;
0571 
0572   AIDA::IHistogram3D* book( const std::string& par, int hID, const std::string& title, int nx, double lowx, double upx,
0573                             int ny, double lowy, double upy, int nz, double lowz, double upz ) override;
0574 
0575   AIDA::IHistogram3D* book( DataObject* pPar, int hID, const std::string& title, int nx, double lowx, double upx,
0576                             int ny, double lowy, double upy, int nz, double lowz, double upz ) override;
0577 
0578   virtual AIDA::IHistogram3D* book( const std::pair<std::string, std::string>& loc, const std::string& title, int nx,
0579                                     double lowx, double upx, int ny, double lowy, double upy, int nz, double lowz,
0580                                     double upz );
0581 
0582   AIDA::IHistogram3D* book( DataObject* pPar, const std::string& rel, const std::string& title, int nx, double lowx,
0583                             double upx, int ny, double lowy, double upy, int nz, double lowz, double upz ) override;
0584 
0585   
0586   
0587   
0588   
0589 
0590 
0591 
0592 
0593 
0594 
0595 
0596 
0597 
0598 
0599 
0600 
0601 
0602 
0603 
0604   AIDA::IHistogram3D* book( const std::string& full, const std::string& title, Edges x, Edges y, Edges z ) override;
0605 
0606   AIDA::IHistogram3D* book( const std::string& par, const std::string& rel, const std::string& title, Edges x, Edges y,
0607                             Edges z ) override;
0608 
0609   AIDA::IHistogram3D* book( const std::string& par, int hID, const std::string& title, Edges x, Edges y,
0610                             Edges z ) override;
0611 
0612   AIDA::IHistogram3D* book( DataObject* pPar, int hID, const std::string& title, Edges x, Edges y, Edges z ) override;
0613 
0614   virtual AIDA::IHistogram3D* book( const std::pair<std::string, std::string>& loc, const std::string& title, Edges x,
0615                                     Edges y, Edges z );
0616 
0617   AIDA::IHistogram3D* book( DataObject* pPar, const std::string& rel, const std::string& title, Edges x, Edges y,
0618                             Edges z ) override;
0619 
0620   
0621   
0622   
0623   using DataSvc::registerObject;
0624   StatusCode registerObject( const std::string& parent, const std::string& rel, Base* obj ) override;
0625 
0626   StatusCode registerObject( Base* pPar, const std::string& rel, Base* obj ) override;
0627 
0628   StatusCode registerObject( const std::string& full, Base* obj ) override;
0629 
0630   StatusCode registerObject( DataObject* pPar, const std::string& rel, Base* obj ) override;
0631 
0632   
0633   
0634   
0635   StatusCode unregisterObject( Base* obj ) override;
0636 
0637   StatusCode unregisterObject( Base* obj, const std::string& objectPath ) override;
0638 
0639   StatusCode unregisterObject( Base* obj, int item ) override;
0640 
0641   
0642   
0643   
0644   StatusCode retrieveObject( IRegistry* pReg, const std::string& path, AIDA::IHistogram1D*& obj ) override;
0645 
0646   StatusCode retrieveObject( IRegistry* pReg, const std::string& path, AIDA::IProfile1D*& obj ) override;
0647 
0648   StatusCode retrieveObject( IRegistry* pReg, const std::string& path, AIDA::IHistogram2D*& obj ) override;
0649 
0650   StatusCode retrieveObject( IRegistry* pReg, const std::string& path, AIDA::IProfile2D*& obj ) override;
0651 
0652   StatusCode retrieveObject( IRegistry* pReg, const std::string& path, AIDA::IHistogram3D*& obj ) override;
0653 
0654   StatusCode retrieveObject( const std::string& full, AIDA::IProfile1D*& obj ) override;
0655 
0656   StatusCode retrieveObject( const std::string& full, AIDA::IProfile2D*& obj ) override;
0657 
0658   StatusCode retrieveObject( const std::string& full, AIDA::IHistogram1D*& obj ) override;
0659 
0660   StatusCode retrieveObject( const std::string& full, AIDA::IHistogram2D*& obj ) override;
0661 
0662   StatusCode retrieveObject( const std::string& full, AIDA::IHistogram3D*& obj ) override;
0663 
0664   StatusCode retrieveObject( const std::string& parent, const std::string& rel, AIDA::IProfile1D*& obj ) override;
0665 
0666   StatusCode retrieveObject( const std::string& parent, const std::string& rel, AIDA::IProfile2D*& obj ) override;
0667 
0668   StatusCode retrieveObject( const std::string& parent, const std::string& rel, AIDA::IHistogram1D*& obj ) override;
0669 
0670   StatusCode retrieveObject( const std::string& parent, const std::string& rel, AIDA::IHistogram2D*& obj ) override;
0671 
0672   StatusCode retrieveObject( const std::string& parent, const std::string& rel, AIDA::IHistogram3D*& obj ) override;
0673 
0674   StatusCode retrieveObject( const std::string& parent, int item, AIDA::IProfile1D*& obj ) override;
0675 
0676   StatusCode retrieveObject( const std::string& parent, int item, AIDA::IProfile2D*& obj ) override;
0677 
0678   StatusCode retrieveObject( const std::string& parent, int item, AIDA::IHistogram1D*& obj ) override;
0679 
0680   StatusCode retrieveObject( const std::string& parent, int item, AIDA::IHistogram2D*& obj ) override;
0681 
0682   StatusCode retrieveObject( const std::string& parent, int item, AIDA::IHistogram3D*& obj ) override;
0683 
0684   StatusCode retrieveObject( DataObject* par, const std::string& item, AIDA::IProfile1D*& obj ) override;
0685 
0686   StatusCode retrieveObject( DataObject* par, const std::string& item, AIDA::IProfile2D*& obj ) override;
0687 
0688   StatusCode retrieveObject( DataObject* par, const std::string& item, AIDA::IHistogram1D*& obj ) override;
0689 
0690   StatusCode retrieveObject( DataObject* par, const std::string& item, AIDA::IHistogram2D*& obj ) override;
0691 
0692   StatusCode retrieveObject( DataObject* par, const std::string& item, AIDA::IHistogram3D*& obj ) override;
0693 
0694   StatusCode retrieveObject( DataObject* par, int item, AIDA::IProfile1D*& obj ) override;
0695 
0696   StatusCode retrieveObject( DataObject* par, int item, AIDA::IProfile2D*& obj ) override;
0697 
0698   StatusCode retrieveObject( DataObject* par, int item, AIDA::IHistogram1D*& obj ) override;
0699 
0700   StatusCode retrieveObject( DataObject* par, int item, AIDA::IHistogram2D*& obj ) override;
0701 
0702   StatusCode retrieveObject( DataObject* par, int item, AIDA::IHistogram3D*& obj ) override;
0703 
0704   StatusCode retrieveObject( Base* par, int item, AIDA::IProfile1D*& obj ) override;
0705 
0706   StatusCode retrieveObject( Base* par, int item, AIDA::IProfile2D*& obj ) override;
0707 
0708   StatusCode retrieveObject( Base* par, int item, AIDA::IHistogram1D*& obj ) override;
0709 
0710   StatusCode retrieveObject( Base* par, int item, AIDA::IHistogram2D*& obj ) override;
0711 
0712   StatusCode retrieveObject( Base* par, int item, AIDA::IHistogram3D*& obj ) override;
0713 
0714   StatusCode retrieveObject( Base* par, const std::string& item, AIDA::IProfile1D*& obj ) override;
0715 
0716   StatusCode retrieveObject( Base* par, const std::string& item, AIDA::IProfile2D*& obj ) override;
0717 
0718   StatusCode retrieveObject( Base* par, const std::string& item, AIDA::IHistogram1D*& obj ) override;
0719 
0720   StatusCode retrieveObject( Base* par, const std::string& item, AIDA::IHistogram2D*& obj ) override;
0721 
0722   StatusCode retrieveObject( Base* par, const std::string& item, AIDA::IHistogram3D*& obj ) override;
0723 
0724   
0725   
0726   
0727   StatusCode findObject( IRegistry* pReg, const std::string& path, AIDA::IProfile1D*& obj ) override;
0728 
0729   StatusCode findObject( IRegistry* pReg, const std::string& path, AIDA::IProfile2D*& obj ) override;
0730 
0731   StatusCode findObject( IRegistry* pReg, const std::string& path, AIDA::IHistogram1D*& obj ) override;
0732 
0733   StatusCode findObject( IRegistry* pReg, const std::string& path, AIDA::IHistogram2D*& obj ) override;
0734 
0735   StatusCode findObject( IRegistry* pReg, const std::string& path, AIDA::IHistogram3D*& obj ) override;
0736 
0737   StatusCode findObject( const std::string& full, AIDA::IProfile1D*& obj ) override;
0738 
0739   StatusCode findObject( const std::string& full, AIDA::IProfile2D*& obj ) override;
0740 
0741   StatusCode findObject( const std::string& full, AIDA::IHistogram1D*& obj ) override;
0742 
0743   StatusCode findObject( const std::string& full, AIDA::IHistogram2D*& obj ) override;
0744 
0745   StatusCode findObject( const std::string& full, AIDA::IHistogram3D*& obj ) override;
0746 
0747   StatusCode findObject( const std::string& par, const std::string& rel, AIDA::IProfile1D*& obj ) override;
0748 
0749   StatusCode findObject( const std::string& par, const std::string& rel, AIDA::IProfile2D*& obj ) override;
0750 
0751   StatusCode findObject( const std::string& par, const std::string& rel, AIDA::IHistogram1D*& obj ) override;
0752 
0753   StatusCode findObject( const std::string& par, const std::string& rel, AIDA::IHistogram2D*& obj ) override;
0754 
0755   StatusCode findObject( const std::string& par, const std::string& rel, AIDA::IHistogram3D*& obj ) override;
0756 
0757   StatusCode findObject( const std::string& par, int item, AIDA::IProfile1D*& obj ) override;
0758 
0759   StatusCode findObject( const std::string& par, int item, AIDA::IProfile2D*& obj ) override;
0760 
0761   StatusCode findObject( const std::string& par, int item, AIDA::IHistogram1D*& obj ) override;
0762 
0763   StatusCode findObject( const std::string& par, int item, AIDA::IHistogram2D*& obj ) override;
0764 
0765   StatusCode findObject( const std::string& par, int item, AIDA::IHistogram3D*& obj ) override;
0766 
0767   StatusCode findObject( DataObject* par, int item, AIDA::IProfile1D*& obj ) override;
0768 
0769   StatusCode findObject( DataObject* par, int item, AIDA::IProfile2D*& obj ) override;
0770 
0771   StatusCode findObject( DataObject* par, int item, AIDA::IHistogram1D*& obj ) override;
0772 
0773   StatusCode findObject( DataObject* par, int item, AIDA::IHistogram2D*& obj ) override;
0774 
0775   StatusCode findObject( DataObject* par, int item, AIDA::IHistogram3D*& obj ) override;
0776 
0777   StatusCode findObject( DataObject* par, const std::string& item, AIDA::IProfile1D*& obj ) override;
0778 
0779   StatusCode findObject( DataObject* par, const std::string& item, AIDA::IProfile2D*& obj ) override;
0780 
0781   StatusCode findObject( DataObject* par, const std::string& item, AIDA::IHistogram1D*& obj ) override;
0782 
0783   StatusCode findObject( DataObject* par, const std::string& item, AIDA::IHistogram2D*& obj ) override;
0784 
0785   StatusCode findObject( DataObject* par, const std::string& item, AIDA::IHistogram3D*& obj ) override;
0786 
0787   StatusCode findObject( Base* par, int item, AIDA::IProfile1D*& obj ) override;
0788 
0789   StatusCode findObject( Base* par, int item, AIDA::IProfile2D*& obj ) override;
0790 
0791   StatusCode findObject( Base* par, int item, AIDA::IHistogram1D*& obj ) override;
0792 
0793   StatusCode findObject( Base* par, int item, AIDA::IHistogram2D*& obj ) override;
0794 
0795   StatusCode findObject( Base* par, int item, AIDA::IHistogram3D*& obj ) override;
0796 
0797   StatusCode findObject( Base* par, const std::string& item, AIDA::IProfile1D*& obj ) override;
0798 
0799   StatusCode findObject( Base* par, const std::string& item, AIDA::IProfile2D*& obj ) override;
0800 
0801   StatusCode findObject( Base* par, const std::string& item, AIDA::IHistogram1D*& obj ) override;
0802 
0803   StatusCode findObject( Base* par, const std::string& item, AIDA::IHistogram2D*& obj ) override;
0804 
0805   StatusCode findObject( Base* par, const std::string& item, AIDA::IHistogram3D*& obj ) override;
0806 
0807   
0808   
0809   
0810   AIDA::IHistogram1D* projectionX( const std::string& name, const AIDA::IHistogram2D& h ) override;
0811 
0812   AIDA::IHistogram1D* projectionY( const std::string& name, const AIDA::IHistogram2D& h ) override;
0813 
0814   AIDA::IHistogram1D* sliceX( const std::string& name, const AIDA::IHistogram2D& h, int indexY ) override;
0815 
0816   AIDA::IHistogram1D* sliceY( const std::string& name, const AIDA::IHistogram2D& h, int indexX ) override;
0817 
0818   AIDA::IHistogram1D* sliceX( const std::string& name, const AIDA::IHistogram2D& h, int indexY1, int indexY2 ) override;
0819 
0820   AIDA::IHistogram1D* sliceY( const std::string& name, const AIDA::IHistogram2D& h, int indexX1, int indexX2 ) override;
0821 
0822   bool destroy( IBaseHistogram* hist ) override;
0823 
0824   AIDA::IHistogram1D* add( const std::string& nameAndTitle, const AIDA::IHistogram1D& a,
0825                            const AIDA::IHistogram1D& b ) override;
0826 
0827   AIDA::IHistogram1D* subtract( const std::string& nameAndTitle, const AIDA::IHistogram1D& a,
0828                                 const AIDA::IHistogram1D& b ) override;
0829 
0830   AIDA::IHistogram1D* multiply( const std::string& nameAndTitle, const AIDA::IHistogram1D& a,
0831                                 const AIDA::IHistogram1D& b ) override;
0832 
0833   AIDA::IHistogram1D* divide( const std::string& nameAndTitle, const AIDA::IHistogram1D& a,
0834                               const AIDA::IHistogram1D& b ) override;
0835 
0836   AIDA::IHistogram2D* add( const std::string& nameAndTitle, const AIDA::IHistogram2D& a,
0837                            const AIDA::IHistogram2D& b ) override;
0838 
0839   AIDA::IHistogram2D* subtract( const std::string& nameAndTitle, const AIDA::IHistogram2D& a,
0840                                 const AIDA::IHistogram2D& b ) override;
0841 
0842   AIDA::IHistogram2D* multiply( const std::string& nameAndTitle, const AIDA::IHistogram2D& a,
0843                                 const AIDA::IHistogram2D& b ) override;
0844 
0845   AIDA::IHistogram2D* divide( const std::string& nameAndTitle, const AIDA::IHistogram2D& a,
0846                               const AIDA::IHistogram2D& b ) override;
0847 
0848   AIDA::IHistogram3D* add( const std::string& nameAndTitle, const AIDA::IHistogram3D& a,
0849                            const AIDA::IHistogram3D& b ) override;
0850 
0851   AIDA::IHistogram3D* subtract( const std::string& nameAndTitle, const AIDA::IHistogram3D& a,
0852                                 const AIDA::IHistogram3D& b ) override;
0853 
0854   AIDA::IHistogram3D* multiply( const std::string& nameAndTitle, const AIDA::IHistogram3D& a,
0855                                 const AIDA::IHistogram3D& b ) override;
0856 
0857   AIDA::IHistogram3D* divide( const std::string& nameAndTitle, const AIDA::IHistogram3D& a,
0858                               const AIDA::IHistogram3D& b ) override;
0859 
0860   AIDA::IHistogram2D* projectionXY( const std::string& nameAndTitle, const AIDA::IHistogram3D& h ) override;
0861 
0862   AIDA::IHistogram2D* projectionXZ( const std::string& nameAndTitle, const AIDA::IHistogram3D& h ) override;
0863 
0864   AIDA::IHistogram2D* projectionYZ( const std::string& nameAndTitle, const AIDA::IHistogram3D& h ) override;
0865 
0866   AIDA::IHistogram2D* sliceXY( const std::string& , const AIDA::IHistogram3D& , int ,
0867                                int  ) override {
0868     not_implemented();
0869     return nullptr;
0870   }
0871 
0872   AIDA::IHistogram2D* sliceXZ( const std::string& , const AIDA::IHistogram3D& , int ,
0873                                int  ) override {
0874     not_implemented();
0875     return nullptr;
0876   }
0877 
0878   AIDA::IHistogram2D* sliceYZ( const std::string& , const AIDA::IHistogram3D& , int ,
0879                                int  ) override {
0880     not_implemented();
0881     return nullptr;
0882   }
0883 
0884   AIDA::IHistogram1D* createHistogram1D( const std::string& name, const std::string& title, int nx, double lowx,
0885                                          double upx );
0886 
0887   AIDA::IHistogram1D* createHistogram1D( const std::string& name, const std::string& title, int nx, double lowx,
0888                                          double upx, const std::string&  ) override;
0889 
0890   AIDA::IHistogram1D* createHistogram1D( const std::string& name, const std::string& title, const Edges& x,
0891                                          const std::string&  ) override;
0892 
0893   AIDA::IHistogram1D* createHistogram1D( const std::string& nameAndTitle, int nx, double lowx, double upx ) override;
0894 
0895   AIDA::IHistogram1D* createCopy( const std::string& full, const AIDA::IHistogram1D& h ) override;
0896 
0897   AIDA::IHistogram1D* createCopy( const std::string& par, const std::string& rel, const AIDA::IHistogram1D& h );
0898 
0899   AIDA::IHistogram1D* createCopy( const std::pair<std::string, std::string>& loc, const AIDA::IHistogram1D& h );
0900 
0901   AIDA::IHistogram1D* createCopy( DataObject* pPar, const std::string& rel, const AIDA::IHistogram1D& h );
0902 
0903   AIDA::IHistogram2D* createHistogram2D( const std::string& name, const std::string& title, int nx, double lowx,
0904                                          double upx, int ny, double lowy, double upy );
0905 
0906   AIDA::IHistogram2D* createHistogram2D( const std::string& name, const std::string& title, int nx, double lowx,
0907                                          double upx, int ny, double lowy, double upy,
0908                                          const std::string&  ) override;
0909 
0910   AIDA::IHistogram2D* createHistogram2D( const std::string& name, const std::string& title, const Edges& x,
0911                                          const Edges& y, const std::string&  ) override;
0912 
0913   AIDA::IHistogram2D* createHistogram2D( const std::string& nameAndTitle, int nx, double lowx, double upx, int ny,
0914                                          double lowy, double upy ) override;
0915 
0916   AIDA::IHistogram2D* createCopy( const std::string& full, const AIDA::IHistogram2D& h ) override;
0917 
0918   AIDA::IHistogram2D* createCopy( const std::string& par, const std::string& rel, const AIDA::IHistogram2D& h );
0919 
0920   AIDA::IHistogram2D* createCopy( const std::pair<std::string, std::string>& loc, const AIDA::IHistogram2D& h );
0921 
0922   AIDA::IHistogram2D* createCopy( DataObject* pPar, const std::string& rel, const AIDA::IHistogram2D& h );
0923 
0924   AIDA::IHistogram3D* createHistogram3D( const std::string& name, const std::string& title, int nx, double lowx,
0925                                          double upx, int ny, double lowy, double upy, int nz, double lowz, double upz );
0926 
0927   AIDA::IHistogram3D* createHistogram3D( const std::string& name, const std::string& title, int nx, double lowx,
0928                                          double upx, int ny, double lowy, double upy, int nz, double lowz, double upz,
0929                                          const std::string&  ) override;
0930 
0931   AIDA::IHistogram3D* createHistogram3D( const std::string& name, const std::string& title, const Edges& x,
0932                                          const Edges& y, const Edges& z, const std::string&  ) override;
0933 
0934   AIDA::IHistogram3D* createHistogram3D( const std::string& nameAndTitle, int nx, double lowx, double upx, int ny,
0935                                          double lowy, double upy, int nz, double lowz, double upz ) override;
0936 
0937   AIDA::IHistogram3D* createCopy( const std::string& full, const AIDA::IHistogram3D& h ) override;
0938 
0939   AIDA::IHistogram3D* createCopy( const std::string& par, const std::string& rel, const AIDA::IHistogram3D& h );
0940 
0941   AIDA::IHistogram3D* createCopy( const std::pair<std::string, std::string>& loc, const AIDA::IHistogram3D& h );
0942 
0943   AIDA::IHistogram3D* createCopy( DataObject* pPar, const std::string& rel, const AIDA::IHistogram3D& h );
0944 
0945   AIDA::IProfile1D* createProfile1D( const std::string& name, const std::string& title, int nx, double lowx, double upx,
0946                                      const std::string& opt ) override;
0947 
0948   AIDA::IProfile1D* createProfile1D( const std::string& name, const std::string& title, int nx, double lowx, double upx,
0949                                      double upper, double lower, const std::string& opt ) override;
0950 
0951   AIDA::IProfile1D* createProfile1D( const std::string& name, const std::string& title, const Edges& x,
0952                                      const std::string&  ) override;
0953 
0954   AIDA::IProfile1D* createProfile1D( const std::string& name, const std::string& title, const Edges& x, double upper,
0955                                      double lower, const std::string&  ) override;
0956 
0957   AIDA::IProfile1D* createProfile1D( const std::string& nametit, int nx, double lowx, double upx ) override;
0958 
0959   AIDA::IProfile1D* createProfile1D( const std::string& nametit, int nx, double lowx, double upx, double upper,
0960                                      double lower ) override;
0961 
0962   AIDA::IProfile1D* createCopy( const std::string& full, const AIDA::IProfile1D& h ) override;
0963 
0964   AIDA::IProfile1D* createCopy( const std::string& par, const std::string& rel, const AIDA::IProfile1D& h );
0965 
0966   AIDA::IProfile1D* createCopy( const std::pair<std::string, std::string>& loc, const AIDA::IProfile1D& h );
0967 
0968   AIDA::IProfile1D* createCopy( DataObject* pPar, const std::string& rel, const AIDA::IProfile1D& h );
0969 
0970   AIDA::IProfile2D* createProfile2D( const std::string& name, const std::string& title, int nx, double lowx, double upx,
0971                                      int ny, double lowy, double upy );
0972 
0973   AIDA::IProfile2D* createProfile2D( const std::string& name, const std::string& title, int nx, double lowx, double upx,
0974                                      int ny, double lowy, double upy, const std::string&  ) override;
0975 
0976   AIDA::IProfile2D* createProfile2D( const std::string& name, const std::string& title, const Edges& x, const Edges& y,
0977                                      const std::string&  ) override;
0978 
0979   AIDA::IProfile2D* createProfile2D( const std::string& nameAndTitle, int nx, double lowx, double upx, int ny,
0980                                      double lowy, double upy ) override;
0981 
0982   AIDA::IProfile2D* createProfile2D( const std::string& name, const std::string& title, int nx, double lowx, double upx,
0983                                      int ny, double lowy, double upy, double upper, double lower );
0984 
0985   AIDA::IProfile2D* createProfile2D( const std::string& name, const std::string& title, int nx, double lowx, double upx,
0986                                      int ny, double lowy, double upy, double upper, double lower,
0987                                      const std::string&  ) override;
0988 
0989   AIDA::IProfile2D* createProfile2D( const std::string& name, const std::string& title, const Edges& x, const Edges& y,
0990                                      double upper, double lower, const std::string&  ) override;
0991 
0992   AIDA::IProfile2D* createProfile2D( const std::string& nameAndTitle, int nx, double lowx, double upx, int ny,
0993                                      double lowy, double upy, double upper, double lower ) override;
0994 
0995   AIDA::IProfile2D* createCopy( const std::string& full, const AIDA::IProfile2D& h ) override;
0996 
0997   AIDA::IProfile2D* createCopy( const std::string& par, const std::string& rel, const AIDA::IProfile2D& h );
0998 
0999   AIDA::IProfile2D* createCopy( const std::pair<std::string, std::string>& loc, const AIDA::IProfile2D& h );
1000 
1001   AIDA::IProfile2D* createCopy( DataObject* pPar, const std::string& rel, const AIDA::IProfile2D& h );
1002 
1003   AIDA::ICloud1D* createCloud1D( const std::string&, const std::string&, int, const std::string& ) override {
1004     not_implemented();
1005     return nullptr;
1006   }
1007 
1008   AIDA::ICloud1D* createCloud1D( const std::string& ) override {
1009     not_implemented();
1010     return nullptr;
1011   }
1012 
1013   AIDA::ICloud1D* createCopy( const std::string&, const AIDA::ICloud1D& ) override {
1014     not_implemented();
1015     return nullptr;
1016   }
1017 
1018   AIDA::ICloud2D* createCloud2D( const std::string&, const std::string&, int, const std::string& ) override {
1019     not_implemented();
1020     return nullptr;
1021   }
1022 
1023   AIDA::ICloud2D* createCloud2D( const std::string& ) override {
1024     not_implemented();
1025     return nullptr;
1026   }
1027 
1028   AIDA::ICloud2D* createCopy( const std::string&, const AIDA::ICloud2D& ) override {
1029     not_implemented();
1030     return nullptr;
1031   }
1032 
1033   AIDA::ICloud3D* createCloud3D( const std::string&, const std::string&, int, const std::string& ) override {
1034     not_implemented();
1035     return nullptr;
1036   }
1037 
1038   AIDA::ICloud3D* createCloud3D( const std::string& ) override {
1039     not_implemented();
1040     return nullptr;
1041   }
1042 
1043   AIDA::ICloud3D* createCopy( const std::string&, const AIDA::ICloud3D& ) override {
1044     not_implemented();
1045     return nullptr;
1046   }
1047 
1048   
1049   using IDataProviderSvc::findObject;
1050   using IDataProviderSvc::registerObject;
1051   using IDataProviderSvc::retrieveObject;
1052   using IDataProviderSvc::unregisterObject;
1053 
1054   
1055   std::ostream& print( Base* h, std::ostream& s = std::cout ) const override;
1056 
1057   
1058   std::ostream& write( Base* h, std::ostream& s = std::cout ) const override;
1059 
1060   
1061   int write( Base* h, const char* file_name ) const override;
1062 
1063   
1064   DataObject* createPath( const std::string& newPath ) override;
1065 
1066   
1067 
1068 
1069 
1070   DataObject* createDirectory( const std::string& parentDir, const std::string& subDir ) override;
1071 
1072   typedef std::map<std::string, Gaudi::Histo1DDef> Histo1DMap;
1073 
1074 private:
1075   
1076   void update1Ddefs();
1077 
1078   
1079   std::string buildHistoPath( DataObject const* pPar, std::string const& rel );
1080 
1081   Gaudi::Property<DBaseEntries> m_input{ this, "Input", {}, "input streams" };
1082   Gaudi::Property<Histo1DMap>   m_defs1D{
1083       this, "Predefined1DHistos", {}, &HistogramSvc::update1Ddefs, "histograms with predefined parameters" };
1084 
1085   
1086   std::set<std::string> m_mods1D;
1087 };
1088 #endif