Go to the documentation of this file.
12 #ifndef GAUDISVC_HISTOGRAMSVC_H
13 #define GAUDISVC_HISTOGRAMSVC_H 1
29 #include <AIDA/IAnnotation.h>
30 #include <AIDA/IHistogramFactory.h>
50 if ( !q && p ) {
throw std::runtime_error(
"HistogramSvc: Unexpected object type." ); }
67 typedef AIDA::IHistogram3D
H3D;
68 typedef AIDA::IProfile2D
P2D;
69 typedef AIDA::IBaseHistogram
Base;
74 template <
class A1,
class A3>
78 a3 =
dynamic_cast<A3*
>( pObject );
81 template <
class A1,
class A2,
class A3>
85 a3 =
dynamic_cast<A3*
>( pObject );
88 template <
class A1,
class A3>
92 a3 =
dynamic_cast<A3*
>( pObject );
95 template <
class A1,
class A2,
class A3>
99 a3 =
dynamic_cast<A3*
>( pObject );
102 template <
class R,
class S,
class T1,
class T2>
103 static R*
act( R* res,
const S& b,
void ( T1::*pmf )(
const T2*, Double_t ), Double_t scale ) {
104 auto h1 = Gaudi::getRepresentation<R, T1>( *res );
105 const auto h2 = Gaudi::getRepresentation<R, T2>( b );
107 ( h1->*pmf )( h2, scale );
112 template <
class R,
class S,
class T1,
class T2>
113 static R*
act( R* res,
const S& b, Bool_t ( T1::*pmf )(
const T2*, Double_t ), Double_t scale ) {
114 auto h1 = Gaudi::getRepresentation<R, T1>( *res );
115 const auto h2 = Gaudi::getRepresentation<R, T2>( b );
117 ( h1->*pmf )( h2, scale );
122 template <
class R,
class S,
class T1,
class T2>
123 static R*
act( R* res,
const S& b,
void ( T1::*pmf )(
const T2* ) ) {
124 auto h1 = Gaudi::getRepresentation<R, T1>( *res );
125 const auto h2 = Gaudi::getRepresentation<R, T2>( b );
132 template <
class R,
class S,
class T1,
class T2>
133 static R*
act( R* res,
const S& b, Bool_t ( T1::*pmf )(
const T2* ) ) {
134 auto h1 = Gaudi::getRepresentation<R, T1>( *res );
135 const auto h2 = Gaudi::getRepresentation<R, T2>( b );
212 double lowx,
double upx )
override;
215 double upx )
override;
218 double upx )
override;
221 double upx )
override;
224 double lowx,
double upx );
227 double upx )
override;
249 double lowx,
double upx,
const std::string& opt )
override;
267 double lowx,
double upx,
double upper,
double lower,
const std::string& opt )
override;
270 double upx,
double upper,
double lower,
const std::string& opt )
override;
273 double upper,
double lower,
const std::string& opt )
override;
276 double lowx,
double upx,
double upper,
double lower,
const std::string& opt );
279 double upper,
double lower,
const std::string& opt )
override;
282 double upx,
double upper,
double lower,
const std::string& opt )
override;
349 double upper,
double lower );
358 double upper,
double lower );
361 double upper,
double lower );
386 double lowy,
double upy )
override;
389 double lowx,
double upx,
int ny,
double lowy,
double upy )
override;
392 int ny,
double lowy,
double upy )
override;
395 double lowx,
double upx,
int ny,
double lowy,
double upy );
398 int ny,
double lowy,
double upy )
override;
401 double upx,
int ny,
double lowy,
double upy )
override;
426 double upx,
int ny,
double lowy,
double upy,
double upper,
double lower );
429 double lowx,
double upx,
int ny,
double lowy,
double upy,
double upper,
433 double lowx,
double upx,
int ny,
double lowy,
double upy,
double upper,
437 double upx,
int ny,
double lowy,
double upy,
double upper,
double lower );
440 double upx,
int ny,
double lowy,
double upy,
double upper,
double lower );
443 double lowx,
double upx,
int ny,
double lowy,
double upy,
double upper,
447 int ny,
double lowy,
double upy )
override;
450 double lowx,
double upx,
int ny,
double lowy,
double upy )
override;
453 double lowx,
double upx,
int ny,
double lowy,
double upy );
456 double upx,
int ny,
double lowy,
double upy )
override;
459 int ny,
double lowy,
double upy )
override;
462 double upx,
int ny,
double lowy,
double upy )
override;
532 Edges y,
double upper,
double lower );
535 double upper,
double lower );
538 double upper,
double lower );
541 Edges y,
double upper,
double lower );
544 Edges y,
double upper,
double lower );
566 double lowy,
double upy,
int nz,
double lowz,
double upz )
override;
569 double lowx,
double upx,
int ny,
double lowy,
double upy,
int nz,
double lowz,
570 double upz )
override;
573 int ny,
double lowy,
double upy,
int nz,
double lowz,
double upz )
override;
576 int ny,
double lowy,
double upy,
int nz,
double lowz,
double upz )
override;
579 double lowx,
double upx,
int ny,
double lowy,
double upy,
int nz,
double lowz,
583 double upx,
int ny,
double lowy,
double upy,
int nz,
double lowz,
double upz )
override;
822 bool destroy( IBaseHistogram* hist )
override;
824 AIDA::IHistogram1D*
add(
const std::string& nameAndTitle,
const AIDA::IHistogram1D& a,
825 const AIDA::IHistogram1D& b )
override;
827 AIDA::IHistogram1D*
subtract(
const std::string& nameAndTitle,
const AIDA::IHistogram1D& a,
828 const AIDA::IHistogram1D& b )
override;
830 AIDA::IHistogram1D*
multiply(
const std::string& nameAndTitle,
const AIDA::IHistogram1D& a,
831 const AIDA::IHistogram1D& b )
override;
833 AIDA::IHistogram1D*
divide(
const std::string& nameAndTitle,
const AIDA::IHistogram1D& a,
834 const AIDA::IHistogram1D& b )
override;
836 AIDA::IHistogram2D*
add(
const std::string& nameAndTitle,
const AIDA::IHistogram2D& a,
837 const AIDA::IHistogram2D& b )
override;
839 AIDA::IHistogram2D*
subtract(
const std::string& nameAndTitle,
const AIDA::IHistogram2D& a,
840 const AIDA::IHistogram2D& b )
override;
842 AIDA::IHistogram2D*
multiply(
const std::string& nameAndTitle,
const AIDA::IHistogram2D& a,
843 const AIDA::IHistogram2D& b )
override;
845 AIDA::IHistogram2D*
divide(
const std::string& nameAndTitle,
const AIDA::IHistogram2D& a,
846 const AIDA::IHistogram2D& b )
override;
848 AIDA::IHistogram3D*
add(
const std::string& nameAndTitle,
const AIDA::IHistogram3D& a,
849 const AIDA::IHistogram3D& b )
override;
851 AIDA::IHistogram3D*
subtract(
const std::string& nameAndTitle,
const AIDA::IHistogram3D& a,
852 const AIDA::IHistogram3D& b )
override;
854 AIDA::IHistogram3D*
multiply(
const std::string& nameAndTitle,
const AIDA::IHistogram3D& a,
855 const AIDA::IHistogram3D& b )
override;
857 AIDA::IHistogram3D*
divide(
const std::string& nameAndTitle,
const AIDA::IHistogram3D& a,
858 const AIDA::IHistogram3D& b )
override;
904 double upx,
int ny,
double lowy,
double upy );
907 double upx,
int ny,
double lowy,
double upy,
914 double lowy,
double upy )
override;
925 double upx,
int ny,
double lowy,
double upy,
int nz,
double lowz,
double upz );
928 double upx,
int ny,
double lowy,
double upy,
int nz,
double lowz,
double upz,
935 double lowy,
double upy,
int nz,
double lowz,
double upz )
override;
949 double upper,
double lower,
const std::string& opt )
override;
960 double lower )
override;
971 int ny,
double lowy,
double upy );
974 int ny,
double lowy,
double upy,
const std::string& )
override;
980 double lowy,
double upy )
override;
983 int ny,
double lowy,
double upy,
double upper,
double lower );
986 int ny,
double lowy,
double upy,
double upper,
double lower,
990 double upper,
double lower,
const std::string& )
override;
993 double lowy,
double upy,
double upper,
double lower )
override;
1088 #endif // GAUDISVC_HISTOGRAMSVC_H
AIDA::IProfile1D * bookProf(const std::string &par, int hID, const std::string &title, int nx, double lowx, double upx, double upper, double lower, const std::string &opt) override
virtual StatusCode unregisterObject(std::string_view fullPath)=0
Unregister object from the data store.
std::ostream & write(Base *h, std::ostream &s=std::cout) const override
Write (ASCII) the 1D histogram table into the output stream.
AIDA::IHistogram1D * sliceX(const std::string &name, const AIDA::IHistogram2D &h, int indexY1, int indexY2) override
AIDA::IProfile2D * createProfile2D(const std::string &name, const std::string &title, int nx, double lowx, double upx, int ny, double lowy, double upy)
~HistogramSvc() override
Destructor.
AIDA::IProfile1D * bookProf(DataObject *pPar, int hID, const std::string &title, int nx, double lowx, double upx, double upper, double lower, const std::string &opt) override
AIDA::IHistogram1D * book(const std::string &par, const std::string &rel, const std::string &title, int nx, double lowx, double upx) override
Book histogram and register it with the histogram data store.
static R * act(R *res, const S &b, void(T1::*pmf)(const T2 *))
StatusCode find(A1 a1, A2 a2, A3 *&a3)
static R * act(R *res, const S &b, Bool_t(T1::*pmf)(const T2 *))
std::set< std::string > m_mods1D
StatusCode registerObject(DataObject *pPar, const std::string &rel, Base *obj) override
AIDA::IProfile1D * bookProf(const std::string &par, int hID, const std::string &title, int nx, double lowx, double upx, const std::string &opt) override
std::map< std::string, Gaudi::Histo1DDef > Histo1DMap
StatusCode retrieveObject(IRegistry *pReg, const std::string &path, AIDA::IHistogram1D *&obj) override
AIDA::IProfile1D * bookProf(const std::string &full, const std::string &title, int nx, double lowx, double upx, const std::string &opt) override
AIDA::IHistogram2D * projectionXY(const std::string &nameAndTitle, const AIDA::IHistogram3D &h) override
Gaudi::Property< Histo1DMap > m_defs1D
virtual AIDA::IHistogram1D * book(const std::pair< std::string, std::string > &loc, const std::string &title, int nx, double lowx, double upx)
static R * act(R *res, const S &b, void(T1::*pmf)(const T2 *, Double_t), Double_t scale)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
StatusCode finalize() override
finalize the service
AIDA::IHistogram1D * sliceX(const std::string &name, const AIDA::IHistogram2D &h, int indexY) override
AIDA::IBaseHistogram Base
AIDA::IHistogram3D * createHistogram3D(const std::string &name, const std::string &title, int nx, double lowx, double upx, int ny, double lowy, double upy, int nz, double lowz, double upz)
AIDA::IHistogram1D * sliceY(const std::string &name, const AIDA::IHistogram2D &h, int indexX) override
AIDA::ICloud1D * createCloud1D(const std::string &, const std::string &, int, const std::string &) override
StatusCode retrieve(A1 a1, A2 a2, A3 *&a3)
AIDA::ICloud1D * createCloud1D(const std::string &) override
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
AIDA::IHistogram1D * book(DataObject *pPar, const std::string &rel, const std::string &title, int nx, double lowx, double upx) override
AIDA::IHistogram1D * createHistogram1D(const std::string &name, const std::string &title, int nx, double lowx, double upx)
AIDA::IProfile1D * bookProf(const std::string &full, const std::string &title, int nx, double lowx, double upx, double upper, double lower, const std::string &opt) override
StatusCode retrieve(A1 a1, A3 *&a3)
T * i_book(DataObject *pPar, const std::string &rel, const std::string &title, const std::pair< DataObject *, T * > &o)
AIDA::ICloud1D * createCopy(const std::string &, const AIDA::ICloud1D &) override
static R * act(R *res, const S &b, Bool_t(T1::*pmf)(const T2 *, Double_t), Double_t scale)
StatusCode initialize() override
Initialise the service.
const std::string & name() const override
Retrieve name of the service
AIDA::IProfile1D * createProfile1D(const std::string &name, const std::string &title, int nx, double lowx, double upx, const std::string &opt) override
AIDA::IHistogram1D * subtract(const std::string &nameAndTitle, const AIDA::IHistogram1D &a, const AIDA::IHistogram1D &b) override
AIDA::IHistogram1D * projectionY(const std::string &name, const AIDA::IHistogram2D &h) override
AIDA::IHistogram1D * multiply(const std::string &nameAndTitle, const AIDA::IHistogram1D &a, const AIDA::IHistogram1D &b) override
StatusCode connectInput(const std::string &ident)
Connect input histogram file to the service.
std::vector< double > Edges
AIDA::IProfile1D * bookProf(const std::string &par, const std::string &rel, const std::string &title, int nx, double lowx, double upx, const std::string &opt) override
Book histogram and register it with the histogram data store.
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
AIDA::IProfile1D * bookProf(const std::string &par, const std::string &rel, const std::string &title, int nx, double lowx, double upx, double upper, double lower, const std::string &opt) override
StatusCode unregisterObject(Base *obj) override
AIDA::IHistogram1D * book(const std::string &par, int hID, const std::string &title, int nx, double lowx, double upx) override
AIDA::ICloud2D * createCloud2D(const std::string &) override
AIDA::IHistogram2D * sliceYZ(const std::string &, const AIDA::IHistogram3D &, int, int) override
virtual AIDA::IProfile1D * bookProf(const std::pair< std::string, std::string > &loc, const std::string &title, int nx, double lowx, double upx, const std::string &opt)
bool destroy(IBaseHistogram *hist) override
int write(Base *h, const char *file_name) const override
Write (ASCII) the 1D histogram table into a file.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Base class used to extend a class implementing other interfaces.
AIDA::IHistogramFactory * histogramFactory() override
Retrieve the AIDA HistogramFactory interface.
AIDA::IHistogram2D * projectionXZ(const std::string &nameAndTitle, const AIDA::IHistogram3D &h) override
AIDA::ICloud3D * createCloud3D(const std::string &) override
std::string buildHistoPath(DataObject const *pPar, std::string const &rel)
extracts the path of an histogram from the related DataObject
AIDA::IHistogram2D * sliceXY(const std::string &, const AIDA::IHistogram3D &, int, int) override
AIDA::IHistogram2D * sliceXZ(const std::string &, const AIDA::IHistogram3D &, int, int) override
StatusCode findObject(IRegistry *pReg, const std::string &path, AIDA::IProfile1D *&obj) override
AIDA::IHistogram2D * createHistogram2D(const std::string &name, const std::string &title, int nx, double lowx, double upx, int ny, double lowy, double upy)
DataObject * createPath(const std::string &newPath) override
Create all directories in a given full path.
AIDA::IProfile1D * bookProf(DataObject *pPar, const std::string &rel, const std::string &title, int nx, double lowx, double upx, const std::string &opt) override
AIDA::IHistogram1D * book(const std::string &full, const std::string &title, int nx, double lowx, double upx) override
AIDA::IHistogram1D * projectionX(const std::string &name, const AIDA::IHistogram2D &h) override
std::pair< std::string, std::string > i_splitPath(const std::string &full)
Split full path into its components.
AIDA::ICloud3D * createCopy(const std::string &, const AIDA::ICloud3D &) override
AIDA::IHistogram1D * book(DataObject *pPar, int hID, const std::string &title, int nx, double lowx, double upx) override
AIDA::IHistogram2D * i_project(const std::string &nameAndTitle, const AIDA::IHistogram3D &h, const std::string &dir)
Helper for 2D projections.
virtual AIDA::IProfile1D * bookProf(const std::pair< std::string, std::string > &loc, const std::string &title, int nx, double lowx, double upx, double upper, double lower, const std::string &opt)
AIDA::IProfile1D * bookProf(DataObject *pPar, const std::string &rel, const std::string &title, int nx, double lowx, double upx, double upper, double lower, const std::string &opt) override
std::ostream & print(Base *h, std::ostream &s=std::cout) const override
Print (ASCII) the 1D histogram into the output stream.
StatusCode reinitialize() override
Initialise the service.
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Gaudi::Property< DBaseEntries > m_input
AIDA::IHistogram1D * sliceY(const std::string &name, const AIDA::IHistogram2D &h, int indexX1, int indexX2) override
HistogramSvc(const std::string &name, ISvcLocator *svc)
Statndard Constructor.
void not_implemented() const
void update1Ddefs()
handler to be invoked for updating property m_defs1D
constexpr static const auto FAILURE
AIDA::IHistogram2D * projectionYZ(const std::string &nameAndTitle, const AIDA::IHistogram3D &h) override
AIDA::IHistogram1D * divide(const std::string &nameAndTitle, const AIDA::IHistogram1D &a, const AIDA::IHistogram1D &b) override
StatusCode registerObject(const std::string &parent, const std::string &rel, Base *obj) override
AIDA::ICloud2D * createCloud2D(const std::string &, const std::string &, int, const std::string &) override
AIDA::ICloud3D * createCloud3D(const std::string &, const std::string &, int, const std::string &) override
Implementation of property with value of concrete type.
DataObject * createDirectory(const std::string &parentDir, const std::string &subDir) override
Create a sub-directory in a directory.
AIDA::IProfile1D * bookProf(DataObject *pPar, int hID, const std::string &title, int nx, double lowx, double upx, const std::string &opt) override
virtual StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Find object identified by its directory entry.
AIDA::IHistogram1D * createCopy(const std::string &full, const AIDA::IHistogram1D &h) override
AIDA::IHistogram1D * add(const std::string &nameAndTitle, const AIDA::IHistogram1D &a, const AIDA::IHistogram1D &b) override
StatusCode registerObject(const std::string &full, Base *obj) override
StatusCode find(A1 a1, A3 *&a3)
AIDA::ICloud2D * createCopy(const std::string &, const AIDA::ICloud2D &) override