Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:14:22

0001 #ifndef PHGARFIELD__H
0002 #define PHGARFIELD__H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <array>
0007 #include <numbers>
0008 #include <string>
0009 
0010 class CDBTTree;
0011 class PHField3DCartesian;
0012 class TPolyLine3D;
0013 
0014 namespace Garfield
0015 {
0016   class ComponentUser;
0017   class MediumMagboltz;
0018 }  // namespace Garfield
0019 
0020 class PHGarfield : public SubsysReco
0021 {
0022  public:
0023   PHGarfield(const std::string &name = "PHGarfield");
0024   ~PHGarfield() override;
0025 
0026   int InitRun(PHCompositeNode *) override;
0027   int process_event(PHCompositeNode * topNode) override;
0028 
0029   bool StopHere(const double x, const double y, const double z, const double zPrevious);
0030 
0031   void PrintMaps() const;
0032   void PrintGarfield(double x, double y, double z) const;
0033   void PrintGasSummary() const;
0034 
0035   //  These are left in public namespace for easy plotting macros...
0036   //  The user is encouraged to add more routine to fit their analysis goals...
0037   TPolyLine3D *ReverseDrift(double x_cm, double y_cm, double z_cm, double step_ns = 50.0);  // Drifts electrons from some initial point until they hit a detector boundary...
0038 
0039   double GetRadius(size_t index) const {return radii.at(index);}
0040 
0041  private:
0042   void GetMagneticFieldTesla(double x_cm, double y_cm, double z_cm, double &bx_t, double &by_t, double &bz_t) const;      // Feeds magnetic field to Garfield
0043   void GetElectricFieldVcm(double x_cm, double y_cm, double z_cm, double &ex_vcm, double &ey_vcm, double &ez_vcm) const;  // Feeds electric field to Garfield
0044   void InitializeGas(const std::string &name);  // Acepts a file or a directory
0045   void FillRadii();
0046   static double bounder(double phi, double phi_min);
0047 
0048   CDBTTree *m_cdbTPCMAPttree{nullptr};            // Locations of the pads from CDB...
0049   PHField3DCartesian *m_field{nullptr};           // The standard sPHENIX field holding container.
0050   Garfield::ComponentUser *m_component{nullptr};  // This handles the interface of the electric and magnetic fields as handed to Garfield
0051   Garfield::MediumMagboltz *m_gas{nullptr};       // This is the pre-tabulated gas properties required by Garfield...
0052   std::string m_defaultGasfile;
0053   bool m_GasFilesLoaded{false};
0054 
0055   //  These are utilities for a spot check of the overall routine:
0056   // std::string calibdir;
0057   // std::string m_DiodeContainerName;
0058   double PHI_MIN{-std::numbers::pi};
0059   std::array<double, 48> radii{};  // Radius on each layer just for test purposes...need to be cm!
0060 };
0061 
0062 #endif