Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:58:00

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DD4HEP_CONDITIONSPRINTER_H
0014 #define DD4HEP_CONDITIONSPRINTER_H
0015 
0016 // Framework includes
0017 #include <DD4hep/Printout.h>
0018 #include <DD4hep/DetElement.h>
0019 #include <DD4hep/Conditions.h>
0020 
0021 /// Namespace for the AIDA detector description toolkit
0022 namespace dd4hep {
0023 
0024   /// Namespace for the AIDA detector description toolkit supporting XML utilities
0025   namespace cond {
0026 
0027     /// Generic Conditions data dumper.
0028     /**
0029      *   Please note that the principle of locality applies:
0030      *   The object is designed for stack allocation and configuration.
0031      *   It may NOT be shared across threads!
0032      *
0033      *   \author  M.Frank
0034      *   \version 1.0
0035      *   \date    31/03/2016
0036      *   \ingroup DD4HEP_DDDB
0037      */
0038     class ConditionsPrinter  {
0039     protected:
0040       /// Internal param printer class
0041       class ParamPrinter;
0042       friend class ParamPrinter;
0043 
0044       /// Sub-printer
0045       ParamPrinter*  m_print = 0;
0046       /// Conditionsmap to resolve things
0047       ConditionsMap* mapping = 0;
0048 
0049     protected:
0050       /// Printout processing and customization flag
0051       int            m_flag = 0;
0052 
0053     public:
0054       /** Setup parameters to configure printout */
0055       /// Printer name. Want to know who is printing what
0056       std::string    name;
0057       /// Printout prefix
0058       std::string    prefix;
0059       /// Printout level
0060       PrintLevel     printLevel = INFO;
0061       /// Line length
0062       size_t         lineLength = 80;
0063       /// Counter: number of parameters
0064       size_t         numParam = 0;
0065       /// Counter: number of conditions
0066       mutable size_t numCondition = 0;
0067       /// Counter: number of empty conditions
0068       mutable size_t numEmptyCondition = 0;
0069       /// Flag to print summary
0070       bool           summary = true;
0071     public:
0072       /// Initializing constructor
0073       ConditionsPrinter(ConditionsMap* m,
0074                         const std::string& prefix="", 
0075                         int flag=Condition::NO_NAME|Condition::WITH_IOV|Condition::WITH_ADDRESS);
0076       /// Default destructor
0077       virtual ~ConditionsPrinter();
0078       /// Set name for printouts
0079       void setName(const std::string& value)            {  name = value;       }
0080       /// Set prefix for printouts
0081       void setPrefix(const std::string& value)          {  prefix = value;     }
0082       /// Callback to output conditions information of an entire DetElement
0083       virtual int operator()(DetElement de, int level) const;
0084       /// Callback to output conditions information
0085       virtual int operator()(Condition condition)  const;
0086     };
0087     
0088   }    /* End namespace cond           */
0089 }      /* End namespace dd4hep               */
0090 #endif // DD4HEP_CONDITIONSPRINTER_H