Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:45

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #pragma once
0012 
0013 #include <GaudiAlg/GaudiHistoAlg.h>
0014 #include <GaudiPython/Vector.h>
0015 
0016 struct GaudiHistoTool;
0017 
0018 namespace GaudiPython {
0019   /** @class HistoDecorator                        GaudiPython/HistoDecorator.h
0020    *  Simple decorator class to allow to reuse the functionality of
0021    *  GaudiHistos<TYPE> class in pythin
0022    *  @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
0023    *  @date   2005-08-04
0024    */
0025   class GAUDI_API HistoDecorator {
0026   public:
0027     // ========================================================================
0028     typedef std::vector<GaudiAlg::ID>        IDs;
0029     typedef std::vector<AIDA::IHistogram1D*> Histos1D;
0030     typedef std::vector<AIDA::IHistogram2D*> Histos2D;
0031     typedef std::vector<AIDA::IHistogram3D*> Histos3D;
0032     typedef std::vector<AIDA::IProfile1D*>   Profiles1D;
0033     typedef std::vector<AIDA::IProfile2D*>   Profiles2D;
0034     // ========================================================================
0035   public:
0036     // ========================================================================
0037     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0038      *  (Expected to be more efficient)
0039      *  @param algo the algorihtm
0040      *  @param data  data
0041      *  @param title histogram title
0042      *  @param low   low edge
0043      *  @param high  high edge
0044      *  @param bins  number of bins
0045      */
0046     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const std::string& title,
0047                                        const double low, const double high, const unsigned long bins = 100 );
0048     // ========================================================================
0049     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0050      *  (Expected to be more efficient)
0051      *  @param algo the algorihtm
0052      *  @param data data
0053      *  @param ID   histogram ID
0054      *  @param title histogram title
0055      *  @param low   low edge
0056      *  @param high  high edge
0057      *  @param bins  number of bins
0058      */
0059     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const GaudiAlg::HistoID& ID,
0060                                        const std::string& title, const double low, const double high,
0061                                        const unsigned long bins = 100 );
0062     // ========================================================================
0063     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0064      *  (Expected to be more efficient)
0065      *  @param algo the algorihtm
0066      *  @param data data
0067      *  @param ID   histogram ID
0068      *  @param title histogram title
0069      *  @param low   low edge
0070      *  @param high  high edge
0071      *  @param bins  number of bins
0072      */
0073     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const long ID,
0074                                        const std::string& title, const double low, const double high,
0075                                        const unsigned long bins = 100 );
0076     // ========================================================================
0077     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0078      *  (Expected to be more efficient)
0079      *  @param algo the algorihtm
0080      *  @param data data
0081      *  @param ID   histogram ID
0082      *  @param title histogram title
0083      *  @param low   low edge
0084      *  @param high  high edge
0085      *  @param bins  number of bins
0086      */
0087     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const double data, const std::string& ID,
0088                                        const std::string& title, const double low, const double high,
0089                                        const unsigned long bins = 100 );
0090     // ========================================================================
0091     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0092      *  (Expected to be more efficient)
0093      *  @param algo the algorihtm
0094      *  @param data vector of data
0095      *  @param title histogram title
0096      *  @param low   low edge
0097      *  @param high  high edge
0098      *  @param bins  number of bins
0099      */
0100     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data,
0101                                        const std::string& title, const double low, const double high,
0102                                        const unsigned long bins = 100 );
0103     // ========================================================================
0104     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0105      *  (Expected to be more efficient)
0106      *  @param algo the algorihtm
0107      *  @param data vector of data
0108      *  @param ID   histogram ID
0109      *  @param title histogram title
0110      *  @param low   low edge
0111      *  @param high  high edge
0112      *  @param bins  number of bins
0113      */
0114     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data,
0115                                        const GaudiAlg::HistoID& ID, const std::string& title, const double low,
0116                                        const double high, const unsigned long bins = 100 );
0117     // ========================================================================
0118     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0119      *  (Expected to be more efficient)
0120      *  @param algo the algorihtm
0121      *  @param data vector of data
0122      *  @param ID   histogram ID
0123      *  @param title histogram title
0124      *  @param low   low edge
0125      *  @param high  high edge
0126      *  @param bins  number of bins
0127      */
0128     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data, const long ID,
0129                                        const std::string& title, const double low, const double high,
0130                                        const unsigned long bins = 100 );
0131     // ========================================================================
0132     /** "plot"(book&fill) a sequence of data from the vector (implicit loop)
0133      *  (Expected to be more efficient)
0134      *  @param algo the algorihtm
0135      *  @param data vector of data
0136      *  @param ID   histogram ID
0137      *  @param title histogram title
0138      *  @param low   low edge
0139      *  @param high  high edge
0140      *  @param bins  number of bins
0141      */
0142     static AIDA::IHistogram1D* plot1D( const GaudiHistoAlg& algo, const GaudiPython::Vector& data,
0143                                        const std::string& ID, const std::string& title, const double low,
0144                                        const double high, const unsigned long bins = 100 );
0145     // ========================================================================
0146     /** fill the 2D histogram (book on demand)
0147      *  @param valueX x value to be filled
0148      *  @param valueY y value to be filled
0149      *  @param title histogram title (must be unique within the algorithm)
0150      *  @param lowX  low x limit for histogram
0151      *  @param highX high x limit for histogram
0152      *  @param lowY  low y limit for histogram
0153      *  @param highY high y limit for histogram
0154      *  @param binsX  number of bins in x
0155      *  @param binsY  number of bins in y
0156      *  @param weight weight
0157      *  @return pointer to AIDA 2D histogram
0158      */
0159     static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0160                                        const std::string& title, const double lowX, const double highX,
0161                                        const double lowY, const double highY, const unsigned long binsX = 50,
0162                                        const unsigned long binsY = 50, const double weight = 1.0 );
0163     // ========================================================================
0164     /** fill the 2D histogram with forced ID assignment (book on demand)
0165      *  @param valueX x value to be filled
0166      *  @param valueY y value to be filled
0167      *  @param ID     Histogram ID to use
0168      *  @param title histogram title (must be unique within the algorithm)
0169      *  @param lowX  low x limit for histogram
0170      *  @param highX high x limit for histogram
0171      *  @param lowY  low y limit for histogram
0172      *  @param highY high y limit for histogram
0173      *  @param binsX  number of bins in x
0174      *  @param binsY  number of bins in y
0175      *  @param weight weight
0176      *  @return pointer to AIDA 2D histogram
0177      */
0178     static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0179                                        const GaudiAlg::HistoID& ID, const std::string& title, const double lowX,
0180                                        const double highX, const double lowY, const double highY,
0181                                        const unsigned long binsX = 50, const unsigned long binsY = 50,
0182                                        const double weight = 1.0 );
0183     // ========================================================================
0184     /** fill the 2D histogram with forced ID assignment (book on demand)
0185      *  @param valueX x value to be filled
0186      *  @param valueY y value to be filled
0187      *  @param ID     Histogram ID to use
0188      *  @param title histogram title (must be unique within the algorithm)
0189      *  @param lowX  low x limit for histogram
0190      *  @param highX high x limit for histogram
0191      *  @param lowY  low y limit for histogram
0192      *  @param highY high y limit for histogram
0193      *  @param binsX  number of bins in x
0194      *  @param binsY  number of bins in y
0195      *  @param weight weight
0196      *  @return pointer to AIDA 2D histogram
0197      */
0198     static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0199                                        const long ID, const std::string& title, const double lowX, const double highX,
0200                                        const double lowY, const double highY, const unsigned long binsX = 50,
0201                                        const unsigned long binsY = 50, const double weight = 1.0 );
0202     // ========================================================================
0203     /** fill the 2D histogram with forced ID assignment (book on demand)
0204      *  @param valueX x value to be filled
0205      *  @param valueY y value to be filled
0206      *  @param ID     Histogram ID to use
0207      *  @param title histogram title (must be unique within the algorithm)
0208      *  @param lowX  low x limit for histogram
0209      *  @param highX high x limit for histogram
0210      *  @param lowY  low y limit for histogram
0211      *  @param highY high y limit for histogram
0212      *  @param binsX  number of bins in x
0213      *  @param binsY  number of bins in y
0214      *  @param weight weight
0215      *  @return pointer to AIDA 2D histogram
0216      */
0217     static AIDA::IHistogram2D* plot2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0218                                        const std::string& ID, const std::string& title, const double lowX,
0219                                        const double highX, const double lowY, const double highY,
0220                                        const unsigned long binsX = 50, const unsigned long binsY = 50,
0221                                        const double weight = 1.0 );
0222     // ========================================================================
0223     /** fill the 3D histogram (book on demand)
0224      *  @param valueX x value to be filled
0225      *  @param valueY y value to be filled
0226      *  @param valueZ z value to be filled
0227      *  @param title histogram title (must be unique within the algorithm)
0228      *  @param lowX  low x limit for histogram
0229      *  @param highX high x limit for histogram
0230      *  @param lowY  low y limit for histogram
0231      *  @param highY high y limit for histogram
0232      *  @param lowZ  low z limit for histogram
0233      *  @param highZ high z limit for histogram
0234      *  @param binsX number of bins in x
0235      *  @param binsY number of bins in y
0236      *  @param binsZ number of bins in z
0237      *  @param weight weight
0238      *  @return pointer to AIDA 3D histogram
0239      */
0240     static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0241                                        const double valueZ, const std::string& title, const double lowX,
0242                                        const double highX, const double lowY, const double highY, const double lowZ,
0243                                        const double highZ, const unsigned long binsX = 10,
0244                                        const unsigned long binsY = 10, const unsigned long binsZ = 10,
0245                                        const double weight = 1.0 );
0246     // ========================================================================
0247     /** fill the 3D histogram (book on demand)
0248      *  @param valueX x value to be filled
0249      *  @param valueY y value to be filled
0250      *  @param valueZ z value to be filled
0251      *  @param ID     Histogram ID to use
0252      *  @param title histogram title (must be unique within the algorithm)
0253      *  @param lowX  low x limit for histogram
0254      *  @param highX high x limit for histogram
0255      *  @param lowY  low y limit for histogram
0256      *  @param highY high y limit for histogram
0257      *  @param lowZ  low z limit for histogram
0258      *  @param highZ high z limit for histogram
0259      *  @param binsX number of bins in x
0260      *  @param binsY number of bins in y
0261      *  @param binsZ number of bins in z
0262      *  @param weight weight
0263      *  @return pointer to AIDA 3D histogram
0264      */
0265     static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0266                                        const double valueZ, const GaudiAlg::HistoID& ID, const std::string& title,
0267                                        const double lowX, const double highX, const double lowY, const double highY,
0268                                        const double lowZ, const double highZ, const unsigned long binsX = 10,
0269                                        const unsigned long binsY = 10, const unsigned long binsZ = 10,
0270                                        const double weight = 1.0 );
0271     // ========================================================================
0272     /** fill the 3D histogram (book on demand)
0273      *  @param valueX x value to be filled
0274      *  @param valueY y value to be filled
0275      *  @param valueZ z value to be filled
0276      *  @param ID     Histogram ID to use
0277      *  @param title histogram title (must be unique within the algorithm)
0278      *  @param lowX  low x limit for histogram
0279      *  @param highX high x limit for histogram
0280      *  @param lowY  low y limit for histogram
0281      *  @param highY high y limit for histogram
0282      *  @param lowZ  low z limit for histogram
0283      *  @param highZ high z limit for histogram
0284      *  @param binsX number of bins in x
0285      *  @param binsY number of bins in y
0286      *  @param binsZ number of bins in z
0287      *  @param weight weight
0288      *  @return pointer to AIDA 3D histogram
0289      */
0290     static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0291                                        const double valueZ, const long ID, const std::string& title, const double lowX,
0292                                        const double highX, const double lowY, const double highY, const double lowZ,
0293                                        const double highZ, const unsigned long binsX = 10,
0294                                        const unsigned long binsY = 10, const unsigned long binsZ = 10,
0295                                        const double weight = 1.0 );
0296     // ========================================================================
0297     /** fill the 3D histogram (book on demand)
0298      *  @param valueX x value to be filled
0299      *  @param valueY y value to be filled
0300      *  @param valueZ z value to be filled
0301      *  @param ID     Histogram ID to use
0302      *  @param title histogram title (must be unique within the algorithm)
0303      *  @param lowX  low x limit for histogram
0304      *  @param highX high x limit for histogram
0305      *  @param lowY  low y limit for histogram
0306      *  @param highY high y limit for histogram
0307      *  @param lowZ  low z limit for histogram
0308      *  @param highZ high z limit for histogram
0309      *  @param binsX number of bins in x
0310      *  @param binsY number of bins in y
0311      *  @param binsZ number of bins in z
0312      *  @param weight weight
0313      *  @return pointer to AIDA 3D histogram
0314      */
0315     static AIDA::IHistogram3D* plot3D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0316                                        const double valueZ, const std::string& ID, const std::string& title,
0317                                        const double lowX, const double highX, const double lowY, const double highY,
0318                                        const double lowZ, const double highZ, const unsigned long binsX = 10,
0319                                        const unsigned long binsY = 10, const unsigned long binsZ = 10,
0320                                        const double weight = 1.0 );
0321     // ========================================================================
0322     // 1D-profiles: by title
0323     // ========================================================================
0324     static AIDA::IProfile1D* profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0325                                         const std::string& title, const double lowX, const double highX,
0326                                         const unsigned long binsX = 100, const std::string& opt = "",
0327                                         const double lowY   = -std::numeric_limits<double>::max(),
0328                                         const double highY  = std::numeric_limits<double>::max(),
0329                                         const double weight = 1.0 );
0330     // ========================================================================
0331     // 1D-profiles: by generic ID
0332     // ========================================================================
0333     static AIDA::IProfile1D*
0334     profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY, const GaudiAlg::HistoID& ID,
0335                const std::string& title, const double lowX, const double highX, const unsigned long binsX = 100,
0336                const std::string& opt = "", const double lowY = -std::numeric_limits<double>::max(),
0337                const double highY = std::numeric_limits<double>::max(), const double weight = 1.0 );
0338     // ========================================================================
0339     // 1D-profiles: by numeric ID
0340     // ========================================================================
0341     static AIDA::IProfile1D* profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0342                                         const long ID, const std::string& title, const double lowX, const double highX,
0343                                         const unsigned long binsX = 100, const std::string& opt = "",
0344                                         const double lowY   = -std::numeric_limits<double>::max(),
0345                                         const double highY  = std::numeric_limits<double>::max(),
0346                                         const double weight = 1.0 );
0347     // ========================================================================
0348     // 1D-profiles: by string ID
0349     // ========================================================================
0350     static AIDA::IProfile1D*
0351     profile1D( const GaudiHistoAlg& algo, const double valueX, const double valueY, const std::string& ID,
0352                const std::string& title, const double lowX, const double highX, const unsigned long binsX = 100,
0353                const std::string& opt = "", const double lowY = -std::numeric_limits<double>::max(),
0354                const double highY = std::numeric_limits<double>::max(), const double weight = 1.0 );
0355     // ========================================================================
0356     // 2D-profiles: by title
0357     // ========================================================================
0358     static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0359                                         const double valueZ, const std::string& title, const double lowX,
0360                                         const double highX, const double lowY, const double highY,
0361                                         const unsigned long binsX = 50, const unsigned long binsY = 50,
0362                                         const double weight = 1.0 );
0363     // ========================================================================
0364     // 2D-profiles: by generic ID
0365     // ========================================================================
0366     static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0367                                         const double valueZ, const GaudiAlg::HistoID& ID, const std::string& title,
0368                                         const double lowX, const double highX, const double lowY, const double highY,
0369                                         const unsigned long binsX = 50, const unsigned long binsY = 50,
0370                                         const double weight = 1.0 );
0371     // ========================================================================
0372     // 2D-profiles: by numeric ID
0373     // ========================================================================
0374     static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0375                                         const double valueZ, const long ID, const std::string& title, const double lowX,
0376                                         const double highX, const double lowY, const double highY,
0377                                         const unsigned long binsX = 50, const unsigned long binsY = 50,
0378                                         const double weight = 1.0 );
0379     // ========================================================================
0380     // 2D-profiles: by string ID
0381     // ========================================================================
0382     static AIDA::IProfile2D* profile2D( const GaudiHistoAlg& algo, const double valueX, const double valueY,
0383                                         const double valueZ, const std::string& ID, const std::string& title,
0384                                         const double lowX, const double highX, const double lowY, const double highY,
0385                                         const unsigned long binsX = 50, const unsigned long binsY = 50,
0386                                         const double weight = 1.0 );
0387     // ========================================================================
0388   public:
0389     // ========================================================================
0390     static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Histos1D& histos );
0391     static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Histos1D& histos );
0392     static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Histos1D& histos );
0393     static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Histos1D& histos );
0394     // ========================================================================
0395     static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Histos2D& histos );
0396     static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Histos2D& histos );
0397     static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Histos2D& histos );
0398     static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Histos2D& histos );
0399     // ========================================================================
0400     static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Histos3D& histos );
0401     static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Histos3D& histos );
0402     static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Histos3D& histos );
0403     static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Histos3D& histos );
0404     // ========================================================================
0405     static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Profiles1D& histos );
0406     static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Profiles1D& histos );
0407     static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Profiles1D& histos );
0408     static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Profiles1D& histos );
0409     // ========================================================================
0410     static size_t _histos_a_( const GaudiHistoAlg* cmp, IDs& ids, Profiles2D& histos );
0411     static size_t _histos_t_( const GaudiHistoTool* cmp, IDs& ids, Profiles2D& histos );
0412     static size_t _histos_a_( const IAlgorithm* cmp, IDs& ids, Profiles2D& histos );
0413     static size_t _histos_t_( const IAlgTool* cmp, IDs& ids, Profiles2D& histos );
0414     // ========================================================================
0415   };
0416   // ==========================================================================
0417 } // namespace GaudiPython