File indexing completed on 2025-08-05 08:17:50
0001
0002
0003 #ifndef G4DETECTORS_PHG4OUTERHCALDETECTOR_H
0004 #define G4DETECTORS_PHG4OUTERHCALDETECTOR_H
0005
0006 #include <g4main/PHG4Detector.h>
0007
0008 #include <Geant4/G4Types.hh> // for G4double
0009
0010 #pragma GCC diagnostic push
0011 #pragma GCC diagnostic ignored "-Wshadow"
0012 #pragma GCC diagnostic ignored "-Wpedantic"
0013 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0014 #include <CGAL/Exact_circular_kernel_2.h>
0015 #include <CGAL/point_generators_2.h>
0016 #pragma GCC diagnostic pop
0017
0018 #include <map>
0019 #include <set>
0020 #include <string> // for string
0021 #include <utility> // for pair
0022 #include <vector>
0023
0024 class G4AssemblyVolume;
0025 class G4LogicalVolume;
0026 class G4VPhysicalVolume;
0027 class G4VSolid;
0028 class PHCompositeNode;
0029 class PHG4OuterHcalDisplayAction;
0030 class PHG4OuterHcalFieldSetup;
0031 class PHParameters;
0032 class PHG4Subsystem;
0033 class RawTowerGeomContainer;
0034
0035 class PHG4OuterHcalDetector : public PHG4Detector
0036 {
0037 public:
0038 typedef CGAL::Exact_circular_kernel_2 Circular_k;
0039 typedef CGAL::Point_2<Circular_k> Point_2;
0040
0041 PHG4OuterHcalDetector(PHG4Subsystem *subsys, PHCompositeNode *Node, PHParameters *params, const std::string &dnam);
0042
0043
0044 ~PHG4OuterHcalDetector() override;
0045
0046
0047 void ConstructMe(G4LogicalVolume *world) override;
0048
0049 void Print(const std::string &what = "ALL") const override;
0050
0051
0052
0053 int IsInOuterHcal(G4VPhysicalVolume *) const;
0054
0055
0056 void SuperDetector(const std::string &name) { m_SuperDetector = name; }
0057 const std::string &SuperDetector() const { return m_SuperDetector; }
0058 int get_Layer() const { return m_Layer; }
0059 void ShiftSecantToTangent(Point_2 &lowleft, Point_2 &upleft, Point_2 &upright, Point_2 &lowright);
0060 int ConsistencyCheck() const;
0061 void SetTiltViaNcross();
0062 int CheckTiltAngle() const;
0063 void ConstructHcalSingleScintillators(G4LogicalVolume *hcalenvelope);
0064 G4VSolid *ConstructScintillatorBox(G4LogicalVolume *hcalenvelope);
0065 std::pair<int, int> GetLayerTowerId(G4VPhysicalVolume *volume) const;
0066
0067 protected:
0068 void AddGeometryNode();
0069 int ConstructOuterHcal(G4LogicalVolume *hcalenvelope);
0070 G4VSolid *ConstructSteelPlate(G4LogicalVolume *hcalenvelope);
0071 G4AssemblyVolume *ConstructHcalScintillatorAssembly(G4LogicalVolume *hcalenvelope);
0072 G4double x_at_y(Point_2 &p0, Point_2 &p1, G4double yin);
0073 PHG4OuterHcalDisplayAction *m_DisplayAction = nullptr;
0074 PHG4OuterHcalFieldSetup *m_FieldSetup = nullptr;
0075 PHParameters *m_Params = nullptr;
0076 G4AssemblyVolume *m_ScintiMotherAssembly = nullptr;
0077 G4VSolid *m_SteelCutoutForMagnetG4Solid = nullptr;
0078 double m_InnerRadius = NAN;
0079 double m_OuterRadius = NAN;
0080 double m_SizeZ = NAN;
0081 double m_ScintiTileX = NAN;
0082 double m_ScintiTileXLower = NAN;
0083 double m_ScintiTileXUpper = NAN;
0084 double m_ScintiTileZ = NAN;
0085 double m_ScintiTileThickness = NAN;
0086 double m_ScintiGap = NAN;
0087 double m_ScintiInnerRadius = NAN;
0088 double m_ScintiOuterRadius = NAN;
0089 double m_TiltAngle = NAN;
0090 double m_EnvelopeInnerRadius = NAN;
0091 double m_EnvelopeOuterRadius = NAN;
0092 double m_EnvelopeZ = NAN;
0093 double m_VolumeEnvelope = NAN;
0094 double m_VolumeSteel = NAN;
0095 double m_VolumeScintillator = NAN;
0096
0097 int m_NumScintiPlates = 0;
0098 int m_NumScintiTiles = 0;
0099
0100 int m_ActiveFlag = 0;
0101 int m_AbsorberActiveFlag = 0;
0102
0103 int m_Layer = 0;
0104 std::string m_SuperDetector;
0105 std::string m_ScintiLogicNamePrefix;
0106 std::vector<G4VSolid *> m_ScintiTilesVec;
0107 std::set<G4VPhysicalVolume *> m_SteelAbsorberVec;
0108 std::map<G4VPhysicalVolume *, std::pair<int, int>> m_ScintiTilePhysVolMap;
0109 RawTowerGeomContainer *m_RawTowerGeom = nullptr;
0110 std::string m_TowerGeomNodeName;
0111 };
0112
0113 #endif