Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:42

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4DETECTORS_PHG4BLOCKSUBSYSTEM_H
0004 #define G4DETECTORS_PHG4BLOCKSUBSYSTEM_H
0005 
0006 #include "PHG4DetectorSubsystem.h"
0007 
0008 #include <array>   // for array
0009 #include <string>  // for string
0010 
0011 class PHCompositeNode;
0012 class PHG4Detector;
0013 class PHG4BlockDetector;
0014 class PHG4DisplayAction;
0015 class PHG4SteppingAction;
0016 
0017 class PHG4BlockSubsystem : public PHG4DetectorSubsystem
0018 {
0019  public:
0020   //! constructor
0021   PHG4BlockSubsystem(const std::string& name = "BLOCK", const int layer = 0);
0022 
0023   //! destructor
0024   ~PHG4BlockSubsystem() override;
0025 
0026   //! InitRunSubsystem
0027   /*!
0028   creates the detector_ object and place it on the node tree, under "DETECTORS" node (or whatever)
0029   reates the stepping action and place it on the node tree, under "ACTIONS" node
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   //! accessors (reimplemented)
0042   PHG4Detector* GetDetector() const override;
0043 
0044   PHG4SteppingAction* GetSteppingAction() const override { return m_SteppingAction; }
0045 
0046   PHG4DisplayAction* GetDisplayAction() const override { return m_DisplayAction; }
0047 
0048   void set_color(const double red, const double green, const double blue, const double alpha = 1.)
0049   {
0050     m_ColorArray[0] = red;
0051     m_ColorArray[1] = green;
0052     m_ColorArray[2] = blue;
0053     m_ColorArray[3] = alpha;
0054   }
0055   // this method is used to check if it can be used as mothervolume
0056   // Subsystems which can be mothervolume need to implement this
0057   // and return true
0058   bool CanBeMotherSubsystem() const override { return true; }
0059 
0060  private:
0061   void SetDefaultParameters() override;
0062 
0063   //! detector geometry
0064   /*! defines from PHG4Detector */
0065   PHG4BlockDetector* m_Detector{nullptr};
0066 
0067   //! particle tracking "stepping" action
0068   /*! derives from PHG4SteppingActions */
0069   PHG4SteppingAction* m_SteppingAction{nullptr};
0070 
0071   //! display attribute setting
0072   /*! derives from PHG4DisplayAction */
0073   PHG4DisplayAction* m_DisplayAction{nullptr};
0074   //! Color setting if we want to override the default
0075   std::array<double, 4> m_ColorArray{};
0076 };
0077 
0078 #endif