File indexing completed on 2025-08-05 08:18:13
0001
0002
0003 #ifndef G4MVTX_PHG4MVTXDETECTOR_H
0004 #define G4MVTX_PHG4MVTXDETECTOR_H
0005
0006 #include <trackbase/TrkrDefs.h>
0007
0008 #include <g4main/PHG4Detector.h>
0009
0010 #include <array>
0011 #include <cmath>
0012 #include <map>
0013 #include <set>
0014 #include <string>
0015 #include <tuple>
0016 #include <vector>
0017
0018 class G4AssemblyVolume;
0019 class G4LogicalVolume;
0020 class G4VPhysicalVolume;
0021 class PHCompositeNode;
0022 class PHG4MvtxDisplayAction;
0023 class PHG4Subsystem;
0024 class PHParametersContainer;
0025 class PHG4MvtxMisalignment;
0026
0027 class PHG4MvtxDetector : public PHG4Detector
0028 {
0029 public:
0030
0031 PHG4MvtxDetector(PHG4Subsystem* subsys, PHCompositeNode* Node, const PHParametersContainer* _paramsContainer, const std::string& dnam,
0032 const bool applyMisalignment, const std::string& misalignmentfile);
0033
0034
0035 ~PHG4MvtxDetector() override {}
0036
0037
0038 void ConstructMe(G4LogicalVolume* world) override;
0039
0040
0041
0042 int IsInMvtx(G4VPhysicalVolume*, int& layer, int& stave) const;
0043 int IsSensor(G4VPhysicalVolume*) const;
0044
0045
0046 int IsActive(int lyr) const { return m_IsLayerActive[lyr]; }
0047 int IsSupportActive(int lyr) const { return m_IsLayerSupportActive[lyr]; }
0048 int IsBlackHole(int lyr) const { return m_IsBlackHole[lyr]; }
0049 void SuperDetector(const std::string& name) { m_SuperDetector = name; }
0050 const std::string &SuperDetector() const { return m_SuperDetector; }
0051 void Detector(const std::string& name) { m_Detector = name; }
0052 const std::string &Detector() const { return m_Detector; }
0053
0054 int get_layer(int stv_index) const;
0055 int get_stave(int stv_index) const;
0056
0057 void FillSupportLVArray(G4LogicalVolume* lv) { m_SupportLV.insert(lv); }
0058
0059 void ApplyMisalignment(bool b) { apply_misalignment = b; };
0060
0061 private:
0062 void AddGeometryNode();
0063 int ConstructMvtx(G4LogicalVolume* sandwich);
0064 int ConstructMvtx_Layer(int layer, G4AssemblyVolume* stave, G4LogicalVolume*& trackerenvelope);
0065 int ConstructMvtxPassiveVol(G4LogicalVolume*& lv);
0066
0067 void SetDisplayProperty(G4AssemblyVolume* av);
0068 void SetDisplayProperty(G4LogicalVolume* lv);
0069 void FillPVArray(G4AssemblyVolume* av);
0070 void FindSensor(G4LogicalVolume* lv);
0071
0072 double get_phistep(int lay) const { return 2.0 * M_PI / m_N_staves[lay]; }
0073
0074 PHG4MvtxDisplayAction* m_DisplayAction{nullptr};
0075 const PHParametersContainer* m_ParamsContainer{nullptr};
0076
0077 static constexpr int n_Layers{3};
0078 int m_SupportActiveFlag{0};
0079
0080 std::string m_Detector;
0081 std::string m_SuperDetector;
0082 std::string m_StaveGeometryFile;
0083
0084
0085 std::set<G4VPhysicalVolume*> m_SensorPV;
0086 std::map<G4VPhysicalVolume*, std::tuple<int, int>> m_StavePV;
0087
0088 std::set<G4LogicalVolume*> m_SupportLV;
0089
0090
0091 std::array<int, n_Layers> m_IsLayerActive{};
0092 std::array<int, n_Layers> m_IsLayerSupportActive{};
0093 std::array<int, n_Layers> m_IsBlackHole{};
0094 std::array<int, n_Layers> m_N_staves{};
0095 std::array<double, n_Layers> m_nominal_radius{};
0096 std::array<double, n_Layers> m_nominal_phitilt{};
0097 std::array<double, n_Layers> m_nominal_phi0{};
0098
0099
0100 bool apply_misalignment {false};
0101 std::string m_misalignmentFile="";
0102 double m_GlobalDisplacementX = 0.0;
0103 double m_GlobalDisplacementY = 0.0;
0104 double m_GlobalDisplacementZ = 0.0;
0105 };
0106
0107 #endif