Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002  *  @file   PandoraSDK/include/Persistency/Persistency.h
0003  * 
0004  *  @brief  Header file for persistency class
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_PERSISTENCY_H
0009 #define PANDORA_PERSISTENCY_H 1
0010 
0011 #include "Pandora/ObjectCreation.h"
0012 #include "Pandora/ObjectFactory.h"
0013 #include "Pandora/PandoraObjectFactories.h"
0014 
0015 #include "Persistency/PandoraIO.h"
0016 
0017 #include <string>
0018 
0019 namespace pandora
0020 {
0021 
0022 /**
0023  *  @brief  Persistency class
0024  */
0025 class Persistency
0026 {
0027 public:
0028     /**
0029      *  @brief  Constructor
0030      * 
0031      *  @param  pandora the pandora instance to be used alongside the file writer
0032      *  @param  fileName the name of the output file
0033      *  @param  fileMode the mode for file writing
0034      */
0035     Persistency(const pandora::Pandora &pandora, const std::string &fileName);
0036 
0037     /**
0038      *  @brief  Destructor
0039      */
0040     virtual ~Persistency();
0041 
0042     /**
0043      *  @brief  Get the file name
0044      * 
0045      *  @return the file name
0046      */
0047     const std::string &GetFileName() const;
0048 
0049     /**
0050      *  @brief  Get the file type
0051      * 
0052      *  @return the file type
0053      */
0054     FileType GetFileType() const;
0055 
0056     /**
0057      *  @brief  Set the factory to use for all instantiations and parameter persistence
0058      * 
0059      *  @param  pFactory address of the factory
0060      */
0061     template <typename PARAMETERS, typename OBJECT>
0062     StatusCode SetFactory(ObjectFactory<PARAMETERS, OBJECT> *const pFactory);
0063 
0064 protected:
0065     /**
0066      *  @brief  Replace the current factory with the provided instance
0067      * 
0068      *  @param  pFactory address of the factory
0069      */
0070     template <typename PARAMETERS, typename OBJECT>
0071     void ReplaceCurrentFactory(ObjectFactory<PARAMETERS, OBJECT> *const pFactory);
0072 
0073     const Pandora *const        m_pPandora;             ///< Address of pandora instance to be used alongside the file writer
0074     std::string                 m_fileName;             ///< The file name
0075     FileType                    m_fileType;             ///< The file type
0076     ContainerId                 m_containerId;          ///< The type of container currently being written to file
0077 
0078     ObjectFactory<object_creation::CaloHit::Parameters, object_creation::CaloHit::Object>                                  *m_pCaloHitFactory;       ///< Address of the calo hit factory
0079     ObjectFactory<object_creation::Track::Parameters, object_creation::Track::Object>                                      *m_pTrackFactory;         ///< Address of the track factory
0080     ObjectFactory<object_creation::MCParticle::Parameters, object_creation::MCParticle::Object>                            *m_pMCParticleFactory;    ///< Address of the mc particle factory
0081     ObjectFactory<object_creation::Geometry::SubDetector::Parameters, object_creation::Geometry::SubDetector::Object>      *m_pSubDetectorFactory;   ///< Address of the sub detector factory
0082     ObjectFactory<object_creation::Geometry::LArTPC::Parameters, object_creation::Geometry::LArTPC::Object>                *m_pLArTPCFactory;        ///< Address of the lar tpc factory
0083     ObjectFactory<object_creation::Geometry::LineGap::Parameters, object_creation::Geometry::LineGap::Object>              *m_pLineGapFactory;       ///< Address of the line gap factory
0084     ObjectFactory<object_creation::Geometry::BoxGap::Parameters, object_creation::Geometry::BoxGap::Object>                *m_pBoxGapFactory;        ///< Address of the box gap factory
0085     ObjectFactory<object_creation::Geometry::ConcentricGap::Parameters, object_creation::Geometry::ConcentricGap::Object>  *m_pConcentricGapFactory; ///< Address of the concentric gap factory
0086 };
0087 
0088 //------------------------------------------------------------------------------------------------------------------------------------------
0089 
0090 inline const std::string &Persistency::GetFileName() const
0091 {
0092     return m_fileName;
0093 }
0094 
0095 //------------------------------------------------------------------------------------------------------------------------------------------
0096 
0097 inline FileType Persistency::GetFileType() const
0098 {
0099     return m_fileType;
0100 }
0101 
0102 } // namespace pandora
0103 
0104 #endif // #ifndef PANDORA_PERSISTENCY_H