Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:51

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 
0004 /*!
0005  * \file ${file_name}
0006  * \brief
0007  * \author Jin Huang <jhuang@bnl.gov>
0008  * \version $$Revision: 1.2 $$
0009  * \date $$Date: 2014/08/12 03:49:12 $$
0010  */
0011 
0012 #ifndef G4DETECTORS_PHG4SPACALDETECTOR_H
0013 #define G4DETECTORS_PHG4SPACALDETECTOR_H
0014 
0015 #include "PHG4CellDefs.h"
0016 #include "PHG4CylinderGeom_Spacalv1.h"
0017 
0018 #include <g4main/PHG4Detector.h>
0019 
0020 #include <Geant4/G4Transform3D.hh>
0021 #include <Geant4/G4Types.hh>  // for G4double
0022 
0023 #include <map>
0024 #include <string>   // for string
0025 #include <utility>  // for pair
0026 
0027 class G4LogicalVolume;
0028 class G4UserLimits;
0029 class G4VPhysicalVolume;
0030 class PHCompositeNode;
0031 class PHG4CylinderGeom;
0032 class PHG4GDMLConfig;
0033 class PHG4SpacalDisplayAction;
0034 class PHParameters;
0035 class PHG4Subsystem;
0036 class RawTowerGeomContainer;
0037 
0038 class PHG4SpacalDetector : public PHG4Detector
0039 {
0040  public:
0041   typedef PHG4CylinderGeom_Spacalv1 SpacalGeom_t;
0042 
0043   PHG4SpacalDetector(PHG4Subsystem* subsys, PHCompositeNode* Node, const std::string& dnam,
0044                      PHParameters* parameters, const int layer = 0, bool init_geom = true);
0045 
0046   ~PHG4SpacalDetector(void) override;
0047 
0048   void
0049   ConstructMe(G4LogicalVolume* world) override;
0050 
0051   virtual std::pair<G4LogicalVolume*, G4Transform3D>
0052   Construct_AzimuthalSeg();
0053 
0054   virtual G4LogicalVolume*
0055   Construct_Fiber(const G4double length, const std::string& id);
0056 
0057   void
0058   SetActive(const int i = 1)
0059   {
0060     active = i;
0061   }
0062 
0063   void
0064   SetAbsorberActive(const int i = 1)
0065   {
0066     absorberactive = i;
0067   }
0068 
0069   void
0070   SetDetectorType(const std::string& typ)
0071   {
0072     detector_type = typ;
0073   }
0074 
0075   int IsInCylinderActive(const G4VPhysicalVolume*);
0076 
0077   void
0078   SuperDetector(const std::string& name)
0079   {
0080     superdetector = name;
0081   }
0082 
0083   const std::string
0084   &SuperDetector() const
0085   {
0086     return superdetector;
0087   }
0088 
0089   int get_Layer() const
0090   {
0091     return layer;
0092   }
0093 
0094   void
0095   Print(const std::string& what = "ALL") const override;
0096 
0097   const SpacalGeom_t*
0098   get_geom() const
0099   {
0100     return _geom;
0101   }
0102 
0103   virtual PHG4CylinderGeom* clone_geom() const
0104   {
0105     return new SpacalGeom_t(*_geom);
0106   }
0107 
0108   enum
0109   {
0110     FIBER_CORE = 1,
0111     FIBER_CLADING = 0,
0112     ABSORBER = -1,
0113     SUPPORT = -2,
0114     INACTIVE = -100
0115   };
0116 
0117   PHG4SpacalDisplayAction* GetDisplayAction() { return m_DisplayAction; }
0118 
0119   void CosmicSetup(const int i) { m_CosmicSetupFlag = i; }
0120   int CosmicSetup() { return m_CosmicSetupFlag; }
0121 
0122  private:
0123   PHG4SpacalDisplayAction* m_DisplayAction = nullptr;
0124 
0125  protected:
0126   void AddTowerGeometryNode();
0127   void AddCellGeometryNode();
0128   std::map<const G4VPhysicalVolume*, int> fiber_core_vol;
0129 
0130   //! map for G4VPhysicalVolume -> fiber ID
0131   std::map<const G4VPhysicalVolume*, int> fiber_vol;
0132 
0133   //! map for G4VPhysicalVolume -> Sector ID
0134   std::map<const G4VPhysicalVolume*, int> calo_vol;
0135 
0136   //! map for G4VPhysicalVolume -> towers ID
0137   std::map<const G4VPhysicalVolume*, int> block_vol;
0138 
0139   int active = 0;
0140   int absorberactive = 0;
0141   int layer = -9999;
0142   int m_CosmicSetupFlag = 0;
0143   int m_CellBinning = PHG4CellDefs::undefined;
0144   int m_NumLayers = -1;
0145   int m_NumPhiBins = -1;
0146   int m_NumEtaBins = -1;
0147   double m_Emin = 1e-6;
0148   double m_EtaMin = NAN;
0149   double m_PhiMin = NAN;
0150   double m_EtaStep = NAN;
0151   double m_PhiStep = NAN;
0152   std::string detector_type;
0153   std::string superdetector;
0154 
0155   //  G4UserLimits * step_limits;
0156   //  G4UserLimits * clading_step_limits;
0157   G4UserLimits* fiber_core_step_limits = nullptr;
0158 
0159   //! registry for volumes that should not be exported, i.e. fibers
0160   PHG4GDMLConfig* gdml_config = nullptr;
0161   // private:
0162 
0163   SpacalGeom_t* _geom = nullptr;
0164 
0165   RawTowerGeomContainer* m_RawTowerGeomContainer = nullptr;
0166   std::string m_TowerGeomNodeName;
0167 };
0168 
0169 #endif