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_PHG4DISPLAYACTION_H
0004 #define G4MAIN_PHG4DISPLAYACTION_H
0005 
0006 #include <string>
0007 
0008 class G4VPhysicalVolume;
0009 
0010 class PHG4DisplayAction
0011 {
0012  public:
0013   //! constructor
0014   // delete default ctor, nobody should use it
0015   PHG4DisplayAction() = delete;
0016   // this is the ctor we use
0017   PHG4DisplayAction(const std::string &name)
0018     : m_Detector(name)
0019   {
0020   }
0021 
0022   //! destructor
0023   virtual ~PHG4DisplayAction() {}
0024 
0025   //! ApplyDisplayAction method
0026   /**
0027    pure virtual - has to be implemented by derived class
0028    creates and set VisAttributes for volumes
0029    @param[in] physvol starting volume in hierarchy (typically world volume)
0030   */
0031 
0032   virtual void ApplyDisplayAction(G4VPhysicalVolume *physvol) = 0;
0033 
0034   virtual void SetName(const std::string &name) { m_Detector = name; }
0035 
0036   virtual std::string GetName() const { return m_Detector; }
0037 
0038   virtual void Print(const std::string & /*what*/ = "ALL") {}
0039 
0040   enum CheckReturnCodes
0041   {
0042     ABORT = -1,
0043     FAILED = 0,
0044     ACCEPT = 1
0045   };
0046 
0047  protected:
0048   //! find FindVolume method
0049   /*
0050    * @param[in] starting volume
0051    */
0052   int FindVolumes(G4VPhysicalVolume *physvol);
0053 
0054   //! find CheckVolume method
0055   /*
0056    * @param[in] physical volume to be checked
0057    */
0058   virtual int CheckVolume(G4VPhysicalVolume * /*physvol*/) { return 0; }
0059 
0060   //! ApplyVisAttributes method
0061   /**
0062    *@param[in] physvol selected physical volume
0063    */
0064   virtual void ApplyVisAttributes(G4VPhysicalVolume * /*physvol*/) { return; }
0065 
0066  private:
0067   std::string m_Detector;
0068 };
0069 
0070 #endif  // G4MAIN_PHG4DISPLAYACTION_H