Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:20:27

0001 /**
0002  *  @file   PandoraSDK/include/Plugins/EnergyCorrectionsPlugin.h
0003  * 
0004  *  @brief  Header file for the calo hit plugin class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_ENERGY_CORRECTIONS_PLUGIN_H
0009 #define PANDORA_ENERGY_CORRECTIONS_PLUGIN_H 1
0010 
0011 #include "Pandora/PandoraEnumeratedTypes.h"
0012 #include "Pandora/PandoraInternal.h"
0013 #include "Pandora/Process.h"
0014 
0015 namespace pandora
0016 {
0017 
0018 class TiXmlHandle;
0019 
0020 //------------------------------------------------------------------------------------------------------------------------------------------
0021 
0022 /**
0023  *  @brief  EnergyCorrectionPlugin class
0024  */
0025 class EnergyCorrectionPlugin : public Process
0026 {
0027 public:
0028     /**
0029      *  @brief  Make energy corrections to a cluster
0030      * 
0031      *  @param  pCluster address of the cluster
0032      *  @param  correctedEnergy to receive the corrected energy
0033      */
0034     virtual StatusCode MakeEnergyCorrections(const Cluster *const pCluster, float &correctedEnergy) const = 0;
0035 
0036 protected:
0037     friend class EnergyCorrections;
0038 };
0039 
0040 //------------------------------------------------------------------------------------------------------------------------------------------
0041 
0042 /**
0043  *  @brief  EnergyCorrections class
0044  */
0045 class EnergyCorrections
0046 {
0047 public:
0048     /**
0049      *  @brief  Make an ordered list of energy corrections to a cluster
0050      * 
0051      *  @param  pCluster address of the cluster
0052      *  @param  correctedElectromagneticEnergy to receive the corrected electromagnetic energy
0053      *  @param  correctedHadronicEnergy to receive the corrected hadronic energy
0054      */
0055     StatusCode MakeEnergyCorrections(const Cluster *const pCluster, float &correctedElectromagneticEnergy, float &correctedHadronicEnergy) const;
0056 
0057 private:
0058     /**
0059      *  @brief  Default constructor
0060      * 
0061      *  @param  pPandora address of the associated pandora instance
0062      */
0063     EnergyCorrections(const Pandora *const pPandora);
0064 
0065     /**
0066      *  @brief  Destructor
0067      */
0068     ~EnergyCorrections();
0069 
0070     /**
0071      *  @brief  Register an energy correction plugin
0072      * 
0073      *  @param  pluginName the name/label associated with the energy correction plugin
0074      *  @param  energyCorrectionType the energy correction type
0075      *  @param  energyCorrectionPlugin pointer to an energy correction plugin
0076      */
0077     StatusCode RegisterPlugin(const std::string &pluginName, const EnergyCorrectionType energyCorrectionType,
0078         EnergyCorrectionPlugin *const pEnergyCorrectionPlugin);
0079 
0080     /**
0081      *  @brief  Initialize plugins
0082      * 
0083      *  @param  pXmlHandle address of the relevant xml handle
0084      */
0085     StatusCode InitializePlugins(const TiXmlHandle *const pXmlHandle);
0086 
0087     typedef std::vector<EnergyCorrectionPlugin *> EnergyCorrectionPluginVector;
0088 
0089     /**
0090      *  @brief  Read requested plugin names/labels from a specified xml tag and attempt to assign the plugin pointers as requested
0091      * 
0092      *  @param  pXmlHandle address of the relevant xml handle
0093      *  @param  xmlTagName the xml tag name for a given energy correction type
0094      *  @param  energyCorrectionType the energy correction type
0095      *  @param  energyCorrectionPluginVector to receive the addresses of the energy correction plugins
0096      */
0097     StatusCode InitializePlugin(const TiXmlHandle *const pXmlHandle, const std::string &xmlTagName,
0098         const EnergyCorrectionType energyCorrectionType, EnergyCorrectionPluginVector &energyCorrectionPluginVector);
0099 
0100     typedef std::map<std::string, EnergyCorrectionPlugin *> EnergyCorrectionPluginMap;
0101 
0102     /**
0103      *  @brief  Get the energy correction plugin map corresponding to the specified energy correction type
0104      * 
0105      *  @param  energyCorrectionType the energy correction type
0106      * 
0107      *  @return reference to the relevant energy correction plugin map
0108      */
0109     EnergyCorrectionPluginMap &GetEnergyCorrectionPluginMap(const EnergyCorrectionType energyCorrectionType);
0110 
0111     /**
0112      *  @brief  Call the reset callback in all managed plugins
0113      */
0114     StatusCode ResetForNextEvent();
0115 
0116     const Pandora *const            m_pPandora;                         ///< Address of the associated pandora instance
0117     EnergyCorrectionPluginMap       m_hadEnergyCorrectionPluginMap;     ///< The hadronic energy correction plugin map
0118     EnergyCorrectionPluginMap       m_emEnergyCorrectionPluginMap;      ///< The electromagnetic energy correction plugin map
0119     EnergyCorrectionPluginVector    m_hadEnergyCorrectionPlugins;       ///< The final hadronic energy correction plugin vector
0120     EnergyCorrectionPluginVector    m_emEnergyCorrectionPlugins;        ///< The final electromagnetic energy correction plugin vector
0121 
0122     friend class PandoraApiImpl;
0123     friend class PluginManager;
0124 };
0125 
0126 } // namespace pandora
0127 
0128 #endif // #ifndef PANDORA_ENERGY_CORRECTIONS_PLUGIN_H