Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:21:43

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4DETECTORS_PHG4TPCCYLINDERGEOM_H
0004 #define G4DETECTORS_PHG4TPCCYLINDERGEOM_H
0005 
0006 #include "PHG4CylinderGeom.h"
0007 
0008 #include <array>
0009 #include <cmath>
0010 #include <iostream>  // for cout, ostream
0011 #include <string>
0012 #include <utility>  // for pair
0013 
0014 class PHG4TpcCylinderGeom : public PHG4CylinderGeom
0015 {
0016  public:
0017   PHG4TpcCylinderGeom() = default;
0018 
0019   ~PHG4TpcCylinderGeom() override = default;
0020 
0021   // from PHObject
0022   void identify(std::ostream& os = std::cout) const override;
0023 
0024   int get_layer() const override { return layer; }
0025   double get_radius() const override { return radius; }
0026   double get_thickness() const override { return thickness; }
0027   int get_binning() const { return binning; }
0028   int get_zbins() const;
0029   int get_phibins() const;
0030   double get_zmin() const override;
0031   double get_phistep() const;
0032   double get_phimin() const;
0033   double get_zstep() const;
0034   int get_etabins() const;
0035   double get_etastep() const;
0036   double get_etamin() const;
0037 
0038   double get_max_driftlength() const { return 102.325; }
0039   double get_CM_halfwidth() const  { return 0.28; }
0040   double get_adc_clock() const  { return  53.326184; } // default sim value
0041   double get_extended_readout_time() const  { return 0.; }
0042   double get_drift_velocity_sim() const  { return 0.007550; }
0043   
0044   virtual std::pair<double, double> get_zbounds(const int ibin) const;
0045   virtual std::pair<double, double> get_phibounds(const int ibin) const;
0046   virtual std::pair<double, double> get_etabounds(const int ibin) const;
0047   virtual double get_etacenter(const int ibin) const;
0048   virtual double get_zcenter(const int ibin) const;
0049   virtual double get_phicenter(const int ibin, const int side = 0) const;
0050   virtual double get_phicenter_new(const int ibin) const;
0051   virtual double get_phi(const float ibin, const int side = 0) const;
0052 
0053   virtual int get_etabin(const double eta) const;
0054   virtual int get_zbin(const double z) const;
0055   virtual int get_phibin(const double phi, int side = 0) const;
0056   virtual int get_phibin_new(const double phi) const;
0057 
0058   virtual float get_pad_float(const double phi, int side = 0) const;
0059   virtual float get_tbin_float(const double z) const;
0060   virtual int find_phibin(const double phi, int side = 0) const;
0061 
0062   void set_layer(const int i) override { layer = i; }
0063   void set_binning(const int i) { binning = i; }
0064   void set_radius(const double r) override { radius = r; }
0065   void set_thickness(const double t) override { thickness = t; }
0066   void set_zbins(const int i);
0067   void set_zmin(const double z) override;
0068   void set_zstep(const double z);
0069   void set_phibins(const int i);
0070   void set_phistep(const double phi);
0071   void set_phimin(const double phi);
0072   void set_etabins(const int i);
0073   void set_etamin(const double z);
0074   void set_etastep(const double z);
0075   // capture the z geometry related setup parameters
0076   void set_max_driftlength(const double /*val*/) { return; }
0077   void set_CM_halfwidth(const double /*val*/) { return; }
0078   void set_adc_clock(const double /*val*/) { return; }
0079   void set_extended_readout_time(const double /*val*/) { return; }
0080   void set_drift_velocity_sim(const double /*val*/) { return; }
0081   
0082   static const int NSides = 2;
0083 
0084   void set_r_bias(const std::array<std::vector<double>, NSides> &dr) { sector_R_bias = dr; }
0085   void set_phi_bias(const std::array<std::vector<double>, NSides> &dphi) { sector_Phi_bias = dphi; }
0086 
0087   // void set_sector_phi(const double s_phi){sector_phi = s_phi;}
0088   void set_sector_min_phi(const std::array<std::vector<double>, NSides> &s_min_phi) { sector_min_Phi = s_min_phi; }
0089   void set_sector_max_phi(const std::array<std::vector<double>, NSides> &s_max_phi) { sector_max_Phi = s_max_phi; }
0090 
0091   const std::array<std::vector<double>, NSides> &get_sector_min_phi() { return sector_min_Phi; }
0092   const std::array<std::vector<double>, NSides> &get_sector_max_phi() { return sector_max_Phi; }
0093 
0094  protected:
0095   void check_binning_method(const int i) const;
0096   void check_binning_method_eta(const std::string& src = "") const;
0097   void check_binning_method_phi(const std::string& src = "") const;
0098   std::string methodname(const int i) const;
0099   int layer{-999};
0100   int binning{0};
0101   double radius{std::numeric_limits<double>::quiet_NaN()};
0102   int nzbins{-1};
0103   double zmin{std::numeric_limits<double>::quiet_NaN()};
0104   double zstep{std::numeric_limits<double>::quiet_NaN()};
0105   int nphibins{-1};
0106   double phimin{-M_PI};
0107   double phistep{std::numeric_limits<double>::quiet_NaN()};
0108   double thickness{std::numeric_limits<double>::quiet_NaN()};
0109 
0110   // double max_driftlength{std::numeric_limits<double>::quiet_NaN()};
0111   // double CM_halfwidth{std::numeric_limits<double>::quiet_NaN()};
0112   // double adc_clock{std::numeric_limits<double>::quiet_NaN()};
0113   // double extended_readout_time{std::numeric_limits<double>::quiet_NaN()};
0114   // double drift_velocity_sim{std::numeric_limits<double>::quiet_NaN()};
0115   
0116   std::array<std::vector<double>, NSides> sector_R_bias;
0117   std::array<std::vector<double>, NSides> sector_Phi_bias;
0118   std::array<std::vector<double>, NSides> sector_min_Phi;
0119   std::array<std::vector<double>, NSides> sector_max_Phi;
0120 
0121   // streamer
0122   friend std::ostream& operator<<(std::ostream&, const PHG4TpcCylinderGeom&);
0123 
0124   ClassDefOverride(PHG4TpcCylinderGeom, 1)
0125 };
0126 
0127 #endif