Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:20:19

0001 /*!
0002  * \file PHFieldConfig.h
0003  * \brief
0004  * \author Jin Huang <jhuang@bnl.gov>
0005  * \version $Revision:   $
0006  * \date $Date: $
0007  */
0008 
0009 #ifndef PHFIELD_PHFIELDCONFIG_H
0010 #define PHFIELD_PHFIELDCONFIG_H
0011 
0012 #include <phool/PHObject.h>
0013 
0014 #include <iostream>
0015 #include <limits>
0016 #include <string>
0017 
0018 /*!
0019  * \brief PHFieldConfig store field configuration information */
0020 class PHFieldConfig : public PHObject
0021 {
0022  public:
0023   ~PHFieldConfig() override {}
0024 
0025   /** identify Function from PHObject
0026    @param os Output Stream
0027    */
0028   void identify(std::ostream& os = std::cout) const override;
0029 
0030   enum FieldConfigTypes
0031   {
0032     //! Constant field
0033     kFieldUniform = 0,
0034     //! 2D field map expressed in cylindrical coordinates
0035     kField2D = 2,
0036     //! 3D field map expressed in cylindrical coordinates
0037     kField3DCylindrical = 3,
0038     //! Beast field map from https://github.com/eic/BeastMagneticField
0039     kFieldBeast = 4,
0040     //! Cleo field map from https://gitlab.com/eic/escalate/g4e/-/blob/master/SolenoidMag3D.TABLE
0041     kFieldCleo = 5,
0042     //! 3D field map expressed in Cartesian coordinates
0043     Field3DCartesian = 1,
0044     //! Interpolation of the 3D field map (Cartesian coordinates)
0045     FieldInterpolated = 6,
0046 
0047     //! invalid value
0048     kFieldInvalid = 9999
0049   };
0050 
0051   virtual FieldConfigTypes get_field_config() const { return kFieldInvalid; }
0052 
0053   std::string get_field_config_description() const;
0054 
0055   virtual void set_field_config(FieldConfigTypes /*fieldConfig*/) { return; }
0056 
0057   virtual const std::string& get_filename() const { return kInvalid_FileName; }
0058 
0059   virtual void set_filename(const std::string& /*filename*/) { return; }
0060 
0061   virtual double get_magfield_rescale() const { return std::numeric_limits<double>::quiet_NaN(); }
0062 
0063   virtual void set_magfield_rescale(double /*magfieldRescale*/) { return; }
0064 
0065   //! field value in Tesla for uniform field model ONLY for PHFieldConfig_v2
0066   virtual double get_field_mag_x() const { return std::numeric_limits<double>::quiet_NaN(); }
0067 
0068   //! field value in Tesla for uniform field model ONLY for PHFieldConfig_v2
0069   virtual void set_field_mag_x(double /*fieldMagX*/) { return; }
0070 
0071   //! field value in Tesla for uniform field model ONLY for PHFieldConfig_v2
0072   virtual double get_field_mag_y() const { return std::numeric_limits<double>::quiet_NaN(); }
0073 
0074   //! field value in Tesla for uniform field model ONLY for PHFieldConfig_v2
0075   virtual void set_field_mag_y(double /*fieldMagY*/) { return; }
0076 
0077   //! field value in Tesla for uniform field model ONLY for PHFieldConfig_v2
0078   virtual double get_field_mag_z() const { return std::numeric_limits<double>::quiet_NaN(); }
0079 
0080   //! field value in Tesla for uniform field model ONLY for PHFieldConfig_v2
0081   virtual void set_field_mag_z(double /*fieldMagZ*/) { return; }
0082 
0083   //! equal to operator, to base class
0084   virtual bool operator == (const PHFieldConfig& ) const
0085   { return false; }
0086 
0087  protected:
0088   //! pure virtual interface class. not for direct use
0089   PHFieldConfig() {}
0090 
0091   static const std::string kInvalid_FileName;
0092 
0093   ClassDefOverride(PHFieldConfig, 1)
0094 };
0095 
0096 #endif