#ifndef OAEMFIELD_IFIELDMAPDESCRIPTION_HXX #define OAEMFIELD_IFIELDMAPDESCRIPTION_HXX #include #include #include #include #include #include namespace COMET { class IFieldMapDescription; class IFieldMap; } /// Implement the FieldDescription for field-map files. /// Persists the original filename and the MD5 check-sum so that the same field /// can be loaded back in even the file might not be stored in the same /// directory. class COMET::IFieldMapDescription:public COMET::IElementFieldDescription{ public: IFieldMapDescription(); // Constructor used for reading in configuration in IFieldMapList.hxx in // oaEMField IFieldMapDescription(const std::string& fieldMapFile, Double_t scale, const TVector3* translation, const TRotation* rotation); IFieldMapDescription(const std::string& fieldMapFile, Double_t scale, Double_t gradient, Double_t timeOffset, const TVector3* translation, const TRotation* rotation); /// Copy constructor to handle owned pointers IFieldMapDescription(const IFieldMapDescription& rhs); /// Assignment constructor to handle owned pointers IFieldMapDescription& operator=(IFieldMapDescription rhs); /// Swap function for copy-and-swap idiom friend void swap(IFieldMapDescription& aDescr, IFieldMapDescription& bDescr){ // Swap the base classes swap(static_cast(aDescr), static_cast(bDescr)); // Use std::swap now using std::swap; // Swap the members swap(aDescr.fFilename, bDescr.fFilename); swap(aDescr.fCheckSum, bDescr.fCheckSum); swap(aDescr.fScaling, bDescr.fScaling); swap(aDescr.fGradient, bDescr.fGradient); swap(aDescr.fTimeOffset, bDescr.fTimeOffset); } virtual ~IFieldMapDescription(); virtual void ls(Option_t* opt = "") const; //virtual COMET::IElementField* Recreate()const; /// Add a directory to be searched for fieldmaps files. /// Entries can contain environment variables (escaped as ${..}), which /// will be expanded when searching for files. static void AddFieldmapPath(const std::string& path){ SetupFilePath(); fFieldmapPaths.insert(fFieldmapPaths.begin(),path); } /// Print the list of paths that are used to find fieldmaps static void PrintFieldmapSearchPaths(bool use_error_stream=false); // Setters for the configuration setting void SetScaling(double scale) {fScaling = scale;}; std::string Filename()const{return fFilename;} TMD5* CheckSum() const {return fCheckSum;} Double_t Scaling()const{return fScaling;} Double_t Gradient()const{return fGradient;} Double_t TimeOffset()const{return fTimeOffset;} private: std::string FindFullFilename()const; static void SetupFilePath(); friend class COMET::IFieldMap; private: std::string fFilename; TMD5* fCheckSum; Double_t fScaling; Double_t fGradient; Double_t fTimeOffset; /// List of paths that should be searched for fieldmaps. /// Entries can contain environment variables typedef std::vector PathList; //! static std::vector fFieldmapPaths; //! ClassDef(IFieldMapDescription,4); }; #endif // OAEMFIELD_IFIELDMAPDESCRIPTION_HXX