Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:18:17

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 // $$Id: PHG4CylinderGeom_Spacalv1.h,v 1.2 2014/08/12 03:49:12 jinhuang Exp $$
0004 
0005 /*!
0006  * \file ${file_name}
0007  * \brief
0008  * \author Jin Huang <jhuang@bnl.gov>
0009  * \version $$Revision: 1.2 $$
0010  * \date $$Date: 2014/08/12 03:49:12 $$
0011  */
0012 #ifndef G4DETECTORS_PHG4CYLINDERGEOMSPACALV1_H
0013 #define G4DETECTORS_PHG4CYLINDERGEOMSPACALV1_H
0014 
0015 #include "PHG4CylinderGeomv2.h"
0016 
0017 #include <iostream>  // for cout, ostream
0018 #include <map>
0019 #include <string>
0020 
0021 class PHParameters;
0022 
0023 class PHG4CylinderGeom_Spacalv1 : public PHG4CylinderGeomv2
0024 {
0025  public:
0026   /** @name Ctor DTor and IDs
0027    */
0028   ///@{
0029   PHG4CylinderGeom_Spacalv1();
0030 
0031   ~PHG4CylinderGeom_Spacalv1() override
0032   {
0033     sector_map.clear();
0034   }
0035 
0036   // from PHObject
0037   void identify(std::ostream &os = std::cout) const override;
0038 
0039   // from TObject
0040   void Print(Option_t *option = "") const override;
0041 
0042   // cppcheck-suppress virtualCallInConstructor
0043   virtual void SetDefault();
0044 
0045   //! load parameters from PHParameters, which interface to Database/XML/ROOT files
0046   void ImportParameters(const PHParameters &param) override;
0047 
0048   ///@}
0049 
0050   /** @name Set Cylinder Geometry
0051    */
0052   ///@{
0053   double
0054   get_max_radius() const
0055   {
0056     return get_radius() + get_thickness();
0057   }
0058 
0059   double
0060   get_half_radius() const
0061   {
0062     return get_radius() + get_thickness() / 2.;
0063   }
0064 
0065   double
0066   get_length() const
0067   {
0068     return get_zmax() - get_zmin();
0069   }
0070 
0071   double
0072   get_xpos() const
0073   {
0074     return xpos;
0075   }
0076 
0077   void
0078   set_xpos(double x)
0079   {
0080     this->xpos = x;
0081   }
0082 
0083   double
0084   get_ypos() const
0085   {
0086     return ypos;
0087   }
0088 
0089   void
0090   set_ypos(double y)
0091   {
0092     this->ypos = y;
0093   }
0094 
0095   double
0096   get_zpos() const
0097   {
0098     return zpos;
0099   }
0100 
0101   void
0102   set_zpos(double z)
0103   {
0104     this->zpos = z;
0105   }
0106 
0107   ///@}
0108 
0109   /** @name Azimuthal segments
0110    */
0111   ///@{
0112   virtual int
0113   get_azimuthal_n_sec() const;
0114 
0115   virtual double
0116   get_azimuthal_distance() const;
0117 
0118   virtual double
0119   get_z_distance() const;
0120 
0121   //! sector map sector_ID -> azimuthal rotation.
0122   typedef std::map<int, double> sector_map_t;
0123 
0124   //! sector map sector_ID -> azimuthal rotation.
0125   const sector_map_t &
0126   get_sector_map() const
0127   {
0128     return sector_map;
0129   }
0130 
0131   //! sector map sector_ID -> azimuthal rotation.
0132   sector_map_t &
0133   get_sector_map()
0134   {
0135     return sector_map;
0136   }
0137 
0138   //! load a default map that populate all the sectors
0139   void
0140   init_default_sector_map();
0141 
0142   ///@}
0143 
0144   /** @name Fiber geometry
0145    */
0146   ///@{
0147   double
0148   get_fiber_outer_r() const
0149   {
0150     return get_fiber_clading_thickness() + get_fiber_core_diameter() / 2;
0151   }
0152 
0153   double
0154   get_fiber_clading_thickness() const
0155   {
0156     return fiber_clading_thickness;
0157   }
0158 
0159   void
0160   set_fiber_clading_thickness(double fiberCladingThickness)
0161   {
0162     fiber_clading_thickness = fiberCladingThickness;
0163   }
0164 
0165   double
0166   get_fiber_core_diameter() const
0167   {
0168     return fiber_core_diameter;
0169   }
0170 
0171   void
0172   set_fiber_core_diameter(double fiberCoreDiameter)
0173   {
0174     fiber_core_diameter = fiberCoreDiameter;
0175   }
0176 
0177   double
0178   get_fiber_distance() const
0179   {
0180     return fiber_distance;
0181   }
0182 
0183   void
0184   set_fiber_distance(double fiberDistance)
0185   {
0186     fiber_distance = fiberDistance;
0187   }
0188 
0189   ///@}
0190 
0191   /** @name Materials
0192    */
0193   ///@{
0194   const std::string
0195   &get_absorber_mat() const
0196   {
0197     return absorber_mat;
0198   }
0199 
0200   void
0201   set_absorber_mat(const std::string &absorberMat)
0202   {
0203     absorber_mat = absorberMat;
0204   }
0205 
0206   const std::string
0207   &get_fiber_clading_mat() const
0208   {
0209     return fiber_clading_mat;
0210   }
0211 
0212   void
0213   set_fiber_clading_mat(const std::string &fiberCladingMat)
0214   {
0215     fiber_clading_mat = fiberCladingMat;
0216   }
0217 
0218   const std::string
0219   &get_fiber_core_mat() const
0220   {
0221     return fiber_core_mat;
0222   }
0223 
0224   void
0225   set_fiber_core_mat(const std::string &fiberCoreMat)
0226   {
0227     fiber_core_mat = fiberCoreMat;
0228   }
0229 
0230   ///@}
0231 
0232   /** @name General options
0233    */
0234   ///@{
0235 
0236   double
0237   get_fiber_core_step_size() const
0238   {
0239     return get_fiber_core_diameter() / 10.;
0240   }
0241 
0242   enum config_t
0243   {
0244 
0245     //! fiber always placed radially
0246     kNonProjective = 0,
0247     //! alias of above, more explicit
0248     k1DProjectiveSpacal = kNonProjective,
0249 
0250     //! Fully projective spacal with 2D tapered modules
0251     kFullProjective_2DTaper = 2,
0252 
0253     //! Fully projective spacal with 2D tapered modules. To speed up construction, same-length fiber is used cross one tower
0254     kFullProjective_2DTaper_SameLengthFiberPerTower = 3,
0255 
0256     //! Fully projective spacal with 2D tapered modules and allow azimuthal tilts
0257     kFullProjective_2DTaper_Tilted = 4,
0258 
0259     //! Fully projective spacal with 2D tapered modules and allow azimuthal tilts. To speed up construction, same-length fiber is used cross one tower
0260     kFullProjective_2DTaper_Tilted_SameLengthFiberPerTower = 5,
0261 
0262     //! alias of above, the default 2D-projective SPACAL
0263     k2DProjectiveSpacal = kFullProjective_2DTaper_Tilted_SameLengthFiberPerTower,
0264 
0265     //! max allowed value, for boundary cross check
0266     kInvalidSpacalConfig
0267   };
0268 
0269   config_t
0270   get_config() const
0271   {
0272     return config;
0273   }
0274 
0275   void
0276   set_config(config_t c)
0277   {
0278     this->config = c;
0279   }
0280 
0281   bool
0282   is_virualize_fiber() const
0283   {
0284     return virualize_fiber;
0285   }
0286 
0287   virtual bool is_azimuthal_seg_visible() const
0288   {
0289     return false;
0290   }
0291 
0292   void
0293   set_virualize_fiber(bool virualizeFiber = true)
0294   {
0295     virualize_fiber = virualizeFiber;
0296   }
0297 
0298   int get_construction_verbose() const
0299   {
0300     return construction_verbose;
0301   }
0302 
0303   void
0304   set_construction_verbose(int constructionVerbose)
0305   {
0306     construction_verbose = constructionVerbose;
0307   }
0308 
0309   ///@}
0310 
0311  protected:
0312   std::string absorber_mat;
0313   std::string fiber_core_mat;
0314   std::string fiber_clading_mat;
0315   double xpos{std::numeric_limits<double>::quiet_NaN()};
0316   double ypos{std::numeric_limits<double>::quiet_NaN()};
0317   double zpos{std::numeric_limits<double>::quiet_NaN()};
0318   double fiber_core_diameter{std::numeric_limits<double>::quiet_NaN()};
0319   double fiber_clading_thickness{std::numeric_limits<double>::quiet_NaN()};
0320   double fiber_distance{std::numeric_limits<double>::quiet_NaN()};
0321   config_t config{kInvalidSpacalConfig};
0322   bool virualize_fiber{false};
0323   int construction_verbose{0};
0324 
0325   //! sector map sector_ID -> azimuthal rotation.
0326   sector_map_t sector_map;
0327 
0328   ClassDefOverride(PHG4CylinderGeom_Spacalv1, 2)
0329 };
0330 
0331 #endif