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/GaudiAlgorithm.h>
0014 #include <string>
0015 
0016 class IInterface;
0017 class IProperty;
0018 class IAlgTool;
0019 class IAlgorithm;
0020 class GaudiAlgorithm;
0021 class GaudiTool;
0022 class DataObject;
0023 
0024 // ============================================================================
0025 /** @file
0026  *
0027  *  Collection of "decorators" for python algorithms
0028  *
0029  *  @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
0030  *  @date   2005-08-03
0031  */
0032 // ============================================================================
0033 namespace GaudiPython {
0034   // ==========================================================================
0035   /** simple class that allows to "decorate" the python
0036    *  algorithm with 'basic' functionality from class GaudiAlgorithm
0037    *  @author Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
0038    *  @date 2007-08-03
0039    */
0040   class GAUDI_API AlgDecorator {
0041   public:
0042     // ========================================================================
0043     /// the actual type of vector of counters
0044     typedef std::vector<Gaudi::Accumulators::PrintableCounter*> Counters;
0045     typedef std::vector<IAlgTool*>                              Tools;
0046     typedef std::vector<IService*>                              Services;
0047     // ========================================================================
0048     // the general functional methods
0049     // ========================================================================
0050   public:
0051     /** get the tool from GaudiAlgorithm
0052      *  @param alg GaudiAlgorithm
0053      *  @param type tool type
0054      *  @param name tool name
0055      *  @param parent tool parent
0056      *  @param create flag to create
0057      *  @return the tool
0058      */
0059     static IAlgTool* tool_( const GaudiAlgorithm* alg, const std::string& type, const std::string& name,
0060                             const IInterface* parent = 0, const bool create = true );
0061     /** get the tool from GaudiAlgorithm
0062      *  @param alg GaudiAlgorithm
0063      *  @param typeAndName tool type/name
0064      *  @param parent tool parent
0065      *  @param create flag to create
0066      *  @return the tool
0067      */
0068     static IAlgTool* tool_( const GaudiAlgorithm* alg, const std::string& typeAndName, const IInterface* parent = 0,
0069                             const bool create = true );
0070     /** get the service from GaudiAlgorithm
0071      *  @param alg GaudiAlgorithm
0072      *  @param name service name
0073      *  @param create flag to create
0074      *  @return the tool
0075      */
0076     static IInterface* svc_( const GaudiAlgorithm* alg, const std::string& name, const bool create = false );
0077     // ========================================================================
0078     // get the data from TES
0079     // ========================================================================
0080   public:
0081     /** get the data from TES
0082      *  @param alg          GaudiAlgorithm
0083      *  @param location     data location in TES
0084      *  @param useRoonInTes flag to respect RootInTes
0085      *  @return the data
0086      */
0087     static DataObject* get_( const GaudiAlgorithm* alg, const std::string& location, const bool useRootInTes );
0088     // ========================================================================
0089   public:
0090     // ========================================================================
0091     /** get the data from TES
0092      *  @param alg          GaudiAlgorithm
0093      *  @param location     data location in TES
0094      *  @param useRoonInTes flag to respect RootInTes
0095      *  @return the data
0096      */
0097     static bool exist( const GaudiAlgorithm* alg, const std::string& location, const bool useRootInTes );
0098     // ========================================================================
0099   public: // inspection: get all counters:
0100     // ========================================================================
0101     static size_t _counters_a_( const GaudiAlgorithm* alg, std::vector<std::string>& names, Counters& out );
0102     static size_t _counters_t_( const GaudiTool* alg, std::vector<std::string>& names, Counters& out );
0103     static size_t _counters_a_( const IAlgorithm* alg, std::vector<std::string>& names, Counters& out );
0104     static size_t _counters_t_( const IAlgTool* alg, std::vector<std::string>& names, Counters& out );
0105     // ========================================================================
0106   public: // inspection: get the counter
0107     // ========================================================================
0108     static StatEntity* _counter_a_( const GaudiAlgorithm* alg, const std::string& name );
0109     static StatEntity* _counter_t_( const GaudiTool* alg, const std::string& name );
0110     static StatEntity* _counter_a_( const IAlgorithm* alg, const std::string& name );
0111     static StatEntity* _counter_t_( const IAlgTool* alg, const std::string& name );
0112     // ========================================================================
0113   public: // inspection: get all tools
0114     // ========================================================================
0115     static size_t _tools_a_( const GaudiAlgorithm*, Tools& tools );
0116     static size_t _tools_t_( const GaudiTool*, Tools& tools );
0117     static size_t _tools_a_( const IAlgorithm*, Tools& tools );
0118     static size_t _tools_t_( const IAlgTool*, Tools& tools );
0119     // ========================================================================
0120   };
0121   // ==========================================================================
0122 } // namespace GaudiPython