Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:39

0001 #ifndef INTT_CYLINDERGEOMINTT_H
0002 #define INTT_CYLINDERGEOMINTT_H
0003 
0004 #include <g4detectors/PHG4CylinderGeom.h>
0005 
0006 #include <TVector2.h>
0007 #include <TVector3.h>
0008 
0009 #include <cmath>
0010 #include <iostream>
0011 
0012 class CylinderGeomInttHelper;
0013 
0014 class CylinderGeomIntt : public PHG4CylinderGeom
0015 {
0016  public:
0017   CylinderGeomIntt() = default;
0018   CylinderGeomIntt(
0019       const int layer,
0020       const double strip_x,
0021       const double strip_y,
0022       const double strip_z0,
0023       const double strip_z1,
0024       const int nstrips_z_sensor0,
0025       const int nstrips_z_sensor1,
0026       const int nstrips_phi_cell,
0027       const int nladders_layer,
0028       const double ladder_z0,
0029       const double ladder_z1,
0030       const double sensor_radius,
0031       const double strip_x_offset,
0032       const double offsetphi,
0033       const double offsetrot)
0034     : m_Layer(layer)
0035     , m_NStripsPhiCell(nstrips_phi_cell)
0036     , m_StripX(strip_x)
0037     , m_StripY(strip_y)
0038     , m_SensorRadius(sensor_radius)
0039     , m_StripXOffset(strip_x_offset)
0040     , m_OffsetPhi(offsetphi)
0041     , m_OffsetRot(offsetrot)
0042   {
0043     // Type-A
0044     m_StripZ[0] = strip_z0;
0045     m_LadderZ[0] = ladder_z0;
0046     m_NStripsZSensor[0] = nstrips_z_sensor0;
0047 
0048     // Type-B
0049     m_StripZ[1] = strip_z1;
0050     m_LadderZ[1] = ladder_z1;
0051     m_NStripsZSensor[1] = nstrips_z_sensor1;
0052 
0053     m_dPhi = 2. * M_PI / nladders_layer;
0054   }
0055 
0056   // from PHObject
0057   void identify(std::ostream& os = std::cout) const override;
0058 
0059   // overridden from base class
0060   double get_thickness() const override
0061   {
0062     return m_StripX;
0063   }
0064 
0065   double get_strip_y_spacing() const override
0066   {
0067     return m_StripY;
0068   }
0069 
0070   // double get_strip_z_spacing() const override // Only return type-A 1.6 cm strip z size
0071   // {
0072   //   return m_StripZ[0];
0073   // }
0074   // using PHG4CylinderGeom::get_strip_z_spacing; // brings both overloads from base class into scope
0075   double get_strip_z_spacing(const int itype = 0) const override
0076   {
0077     return (itype == 0 || itype == 1) ? m_StripZ[itype] : m_StripZ[0];
0078   }
0079 
0080   double get_strip_tilt() const override
0081   {
0082     return 0.;
0083   }
0084 
0085   void set_layer(const int i) override
0086   {
0087     m_Layer = i;
0088   }
0089 
0090   int get_layer() const override
0091   {
0092     return m_Layer;
0093   }
0094 
0095   double get_radius() const override
0096   {
0097     return m_SensorRadius;
0098   }
0099 
0100   // our own
0101   void find_strip_index_values(const int segment_z_bin, const double ypos, const double zpos, int& strip_y_index, int& strip_z_index) override;
0102 
0103   bool load_geometry() { return true; }
0104   void find_indices_from_segment_center(int& segment_z_bin, int& segment_phi_bin, double location[]);
0105   void find_indices_from_world_location(int& segment_z_bin, int& segment_phi_bin, double location[]);
0106   void find_strip_center_localcoords (const int segment_z_bin, const int strip_y_index, const int strip_z_index, double* location);
0107 
0108   void find_strip_center(int, int, int, int, double*) override
0109   {
0110     std::cout << "find_strip_center(int, int, int, int, double[]) is deprecated" << std::endl;
0111   }
0112   void find_segment_center(const int, const int, double*) override
0113   {
0114     std::cout << "find_segment_center(const int, const int, double*) is deprecated" << std::endl;
0115   }
0116 
0117   double get_strip_phi_tilt() const
0118   {
0119     return m_OffsetRot;
0120   }
0121 
0122  protected:
0123   friend CylinderGeomInttHelper;
0124 
0125   int m_Layer{-1};
0126   int m_NStripsPhiCell{-1};
0127   int m_NStripsZSensor[2]{-1, -1};
0128   double m_StripX{std::numeric_limits<double>::quiet_NaN()};
0129   double m_StripY{std::numeric_limits<double>::quiet_NaN()};
0130   double m_SensorRadius{std::numeric_limits<double>::quiet_NaN()};
0131   double m_StripXOffset{std::numeric_limits<double>::quiet_NaN()};
0132   double m_OffsetPhi{std::numeric_limits<double>::quiet_NaN()};
0133   double m_OffsetRot{std::numeric_limits<double>::quiet_NaN()};
0134   double m_dPhi{std::numeric_limits<double>::quiet_NaN()};
0135 
0136   double m_StripZ[2]{std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
0137   double m_LadderZ[2]{std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
0138 
0139   ClassDefOverride(CylinderGeomIntt, 1)
0140 };
0141 
0142 #endif