Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:18:17

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4DETECTORS_PHG4CYLINDERSUBSYSTEM_H
0004 #define G4DETECTORS_PHG4CYLINDERSUBSYSTEM_H
0005 
0006 #include "PHG4DetectorSubsystem.h"
0007 
0008 #include <array>   // for array
0009 #include <string>  // for string
0010 
0011 class PHCompositeNode;
0012 class PHG4CylinderDetector;
0013 class PHG4Detector;
0014 class PHG4DisplayAction;
0015 class PHG4SteppingAction;
0016 
0017 class PHG4CylinderSubsystem : public PHG4DetectorSubsystem
0018 {
0019  public:
0020   //! constructor
0021   PHG4CylinderSubsystem(const std::string& name = "CYLINDER", const int layer = 0);
0022 
0023   //! destructor
0024   ~PHG4CylinderSubsystem(void) override;
0025 
0026   //! init runwise stuff
0027   /*!
0028   creates the m_Detector object
0029   creates the stepping action
0030   creates relevant hit nodes that will be populated by the stepping action and stored in the output DST
0031   */
0032   int InitRunSubsystem(PHCompositeNode*) override;
0033 
0034   //! event processing
0035   /*!
0036   get all relevant nodes from top nodes (namely hit list)
0037   and pass that to the stepping action
0038   */
0039   int process_event(PHCompositeNode*) override;
0040 
0041   //! Print info (from SubsysReco)
0042   void Print(const std::string& what = "ALL") const override;
0043 
0044   //! accessors (reimplemented)
0045   PHG4Detector* GetDetector(void) const override;
0046   PHG4SteppingAction* GetSteppingAction(void) const override { return m_SteppingAction; }
0047 
0048   PHG4DisplayAction* GetDisplayAction() const override { return m_DisplayAction; }
0049   void set_color(const double red, const double green, const double blue, const double alpha = 1.)
0050   {
0051     m_ColorArray[0] = red;
0052     m_ColorArray[1] = green;
0053     m_ColorArray[2] = blue;
0054     m_ColorArray[3] = alpha;
0055   }
0056   // this method is used to check if it can be used as mothervolume
0057   // Subsystems which can be mothervolume need to implement this
0058   // and return true
0059   bool CanBeMotherSubsystem() const override { return true; }
0060 
0061   // this is just needed for use as reference plane for projections
0062   // this is the only detector using this - there is no need to add
0063   // this to our parameters
0064   void SaveAllHits(bool i = true) { m_SaveAllHitsFlag = i; }
0065 
0066  private:
0067   void SetDefaultParameters() override;
0068 
0069   //! detector geometry
0070   /*! derives from PHG4Detector */
0071   PHG4CylinderDetector* m_Detector{nullptr};
0072 
0073   //! particle tracking "stepping" action
0074   /*! derives from PHG4SteppingActions */
0075   PHG4SteppingAction* m_SteppingAction{nullptr};
0076 
0077   //! display attribute setting
0078   /*! derives from PHG4DisplayAction */
0079   PHG4DisplayAction* m_DisplayAction{nullptr};
0080 
0081   bool m_SaveAllHitsFlag = false;
0082   //! Color setting if we want to override the default
0083   std::array<double, 4> m_ColorArray{};
0084 };
0085 
0086 #endif  // G4DETECTORS_PHG4CYLINDERSUBSYSTEM_H