Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:45

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 
0004 #ifndef G4CALOPROTOTYPE_PHG4SPACALPROTOTYPEDETECTOR_H
0005 #define G4CALOPROTOTYPE_PHG4SPACALPROTOTYPEDETECTOR_H
0006 
0007 #include <g4detectors/PHG4CylinderGeom_Spacalv3.h>
0008 
0009 #include <g4main/PHG4Detector.h>
0010 
0011 #include <Geant4/G4Transform3D.hh>
0012 #include <Geant4/G4Types.hh>
0013 
0014 #include <map>
0015 #include <string>  // for string
0016 #include <utility>
0017 
0018 class G4LogicalVolume;
0019 class G4UserLimits;
0020 class G4VPhysicalVolume;
0021 class G4VSolid;
0022 class PHCompositeNode;
0023 class PHG4Subsystem;
0024 class PHParameters;
0025 
0026 class PHG4SpacalPrototypeDetector : public PHG4Detector
0027 {
0028  public:
0029   typedef PHG4CylinderGeom_Spacalv3 SpacalGeom_t;
0030 
0031   PHG4SpacalPrototypeDetector(PHG4Subsystem* subsys, PHCompositeNode* Node, PHParameters* parameters, const std::string& dnam);
0032 
0033   virtual ~PHG4SpacalPrototypeDetector(void);
0034 
0035   virtual void
0036   ConstructMe(G4LogicalVolume* world);
0037 
0038   virtual std::pair<G4LogicalVolume*, G4Transform3D>
0039   Construct_AzimuthalSeg();
0040 
0041   //! a block along z axis built with G4Trd that is slightly tapered in x dimension
0042   virtual G4LogicalVolume*
0043   Construct_Tower(const SpacalGeom_t::geom_tower& tower);
0044   //! a block for the light guide along z axis that fit to the tower
0045   virtual G4LogicalVolume*
0046   Construct_LightGuide(const SpacalGeom_t::geom_tower& tower, const int index_x, const int index_y);
0047 
0048   //! Fully projective spacal with 2D tapered modules. To speed up construction, same-length fiber is used cross one tower
0049   virtual int
0050   Construct_Fibers_SameLengthFiberPerTower(
0051       const SpacalGeom_t::geom_tower& tower, G4LogicalVolume* LV_tower);
0052 
0053   virtual G4LogicalVolume*
0054   Construct_Fiber(const G4double length, const std::string& id);
0055 
0056   void
0057   SetActive(const int i = 1)
0058   {
0059     active = i;
0060   }
0061 
0062   void
0063   SetAbsorberActive(const int i = 1)
0064   {
0065     absorberactive = i;
0066   }
0067 
0068   void
0069   SetDetectorType(const std::string& typ)
0070   {
0071     detector_type = typ;
0072   }
0073 
0074   int IsInCylinderActive(const G4VPhysicalVolume*);
0075 
0076   void
0077   SuperDetector(const std::string& name)
0078   {
0079     superdetector = name;
0080   }
0081 
0082   const std::string
0083   SuperDetector() const
0084   {
0085     return superdetector;
0086   }
0087 
0088   virtual void
0089   Print(const std::string& what = "ALL") const;
0090 
0091   const SpacalGeom_t*
0092   get_geom() const
0093   {
0094     return _geom;
0095   }
0096 
0097   enum
0098   {
0099     FIBER_CORE = 1,
0100     FIBER_CLADING = 0,
0101     ABSORBER = -1,
0102     SUPPORT = -2,
0103     INACTIVE = -100
0104   };
0105 
0106  protected:
0107   PHParameters* construction_params;
0108 
0109   G4VSolid* cylinder_solid;
0110   G4LogicalVolume* cylinder_logic;
0111   G4VPhysicalVolume* cylinder_physi;
0112   std::map<const G4VPhysicalVolume*, int> fiber_core_vol;
0113 
0114   //! map for G4VPhysicalVolume -> fiber ID
0115   std::map<const G4VPhysicalVolume*, int> fiber_vol;
0116 
0117   //! map for G4VPhysicalVolume -> Sector ID
0118   std::map<const G4VPhysicalVolume*, int> calo_vol;
0119 
0120   //! map for G4VPhysicalVolume -> towers ID
0121   std::map<const G4VPhysicalVolume*, int> block_vol;
0122 
0123   int active;
0124   int absorberactive;
0125   std::string detector_type;
0126   std::string superdetector;
0127 
0128   G4UserLimits* step_limits;
0129   G4UserLimits* clading_step_limits;
0130   G4UserLimits* fiber_core_step_limits;
0131 
0132  private:
0133   SpacalGeom_t* _geom;
0134 };
0135 
0136 #endif