Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:19:20

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4MAIN_PHG4DETECTOR_H
0004 #define G4MAIN_PHG4DETECTOR_H
0005 
0006 #include <Geant4/G4RotationMatrix.hh>
0007 
0008 #include <iostream>
0009 #include <string>
0010 
0011 class G4LogicalVolume;
0012 class G4Material;
0013 class G4Element;
0014 class G4UserSteppingAction;
0015 class G4VSolid;
0016 class PHCompositeNode;
0017 class PHG4Subsystem;
0018 
0019 //! base class for phenix detector creation
0020 /*! derived classes must implement construct method, which takes the "world" logical volume as argument */
0021 class PHG4Detector
0022 {
0023  public:
0024   //! constructor
0025   // delete default ctor, nobody should use it
0026   PHG4Detector() = delete;
0027   // this is the ctor we use
0028   explicit PHG4Detector(PHG4Subsystem *subsys, PHCompositeNode *Node, const std::string &nam);
0029 
0030   //! destructor
0031   virtual ~PHG4Detector(void)
0032   {
0033   }
0034 
0035   //! construct method
0036   /*!
0037   construct all logical and physical volumes relevant for given detector and place them
0038   inside the world logical volume
0039   */
0040   virtual void Construct(G4LogicalVolume *world) final;
0041 
0042   virtual void ConstructMe(G4LogicalVolume *mothervolume) = 0;
0043 
0044   //! Optional PostConstruction call after all geometry is constructed
0045   virtual void PostConstruction(){};
0046 
0047   virtual void Verbosity(const int v) { m_Verbosity = v; }
0048 
0049   virtual int Verbosity() const { return m_Verbosity; }
0050   virtual G4UserSteppingAction *GetSteppingAction() { return nullptr; }
0051   virtual std::string GetName() const { return m_Name; }
0052   virtual void OverlapCheck(const bool chk) { m_OverlapCheck = chk; }
0053   virtual bool OverlapCheck() const { return m_OverlapCheck; }
0054   virtual void Print(const std::string & /*what*/ = "ALL") const
0055   {
0056     std::cout << GetName() << ": Print method not implemented" << std::endl;
0057   }
0058   virtual int DisplayVolume(G4VSolid *volume, G4LogicalVolume *logvol, G4RotationMatrix *rotm = nullptr);
0059   virtual int DisplayVolume(G4LogicalVolume *checksolid, G4LogicalVolume *logvol, G4RotationMatrix *rotm = nullptr);
0060   virtual PHCompositeNode *topNode() { return m_topNode; }
0061   virtual PHG4Subsystem *GetMySubsystem() { return m_MySubsystem; }
0062   static G4Material *GetDetectorMaterial(const std::string &name, const bool quit = true);
0063   static G4Element *GetDetectorElement(const std::string &name, const bool quit = true);
0064 
0065  private:
0066   PHCompositeNode *m_topNode = nullptr;
0067   PHG4Subsystem *m_MySubsystem = nullptr;
0068   int m_Verbosity = 0;
0069   bool m_OverlapCheck = false;
0070   int m_ColorIndex = 0;
0071   std::string m_Name;
0072 };
0073 
0074 #endif  // G4MAIN_PHG4DETECTOR_H