Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:11

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4MAIN_PHG4SUBSYSTEM_H
0004 #define G4MAIN_PHG4SUBSYSTEM_H
0005 
0006 #include <fun4all/Fun4AllReturnCodes.h>
0007 #include <fun4all/SubsysReco.h>
0008 
0009 #include <iostream>
0010 #include <string>
0011 
0012 class G4LogicalVolume;
0013 class G4ParticleDefinition;
0014 class PHCompositeNode;
0015 class PHG4Detector;
0016 class PHG4DisplayAction;
0017 class PHG4EventAction;
0018 class PHG4StackingAction;
0019 class PHG4SteppingAction;
0020 class PHG4TrackingAction;
0021 
0022 class PHG4Subsystem : public SubsysReco
0023 {
0024  public:
0025   //! constructor
0026   PHG4Subsystem(const std::string &name = "Generic Subsystem")
0027     : SubsysReco(name)
0028   {
0029   }
0030 
0031   //! destructor
0032   ~PHG4Subsystem(void) override {}
0033 
0034   //! event processing
0035   virtual int process_after_geant(PHCompositeNode *)
0036   {
0037     return Fun4AllReturnCodes::EVENT_OK;
0038   }
0039 
0040   //! return pointer to created detector object
0041   virtual PHG4Detector *GetDetector(void) const
0042   {
0043     return nullptr;
0044   }
0045 
0046   //! return pointer to this subsystem event action
0047   virtual PHG4EventAction *GetEventAction(void) const
0048   {
0049     return nullptr;
0050   }
0051 
0052   //! return pointer to this subsystem stepping action
0053   virtual PHG4SteppingAction *GetSteppingAction(void) const
0054   {
0055     return nullptr;
0056   }
0057 
0058   //! return pointer to this subsystem stepping action
0059   virtual PHG4TrackingAction *GetTrackingAction(void) const
0060   {
0061     return nullptr;
0062   }
0063 
0064   //! return pointer to this subsystem display setting
0065   virtual PHG4DisplayAction *GetDisplayAction() const
0066   {
0067     return nullptr;
0068   }
0069 
0070   virtual PHG4StackingAction *GetStackingAction() const { return nullptr; }
0071 
0072   void OverlapCheck(const bool chk = true) { overlapcheck = chk; }
0073 
0074   bool CheckOverlap() const { return overlapcheck; }
0075 
0076   void SetMotherSubsystem(PHG4Subsystem *subsys);
0077   PHG4Subsystem *GetMotherSubsystem() const { return m_MyMotherSubsystem; }
0078 
0079   void SetLogicalVolume(G4LogicalVolume *vol) { m_MyLogicalVolume = vol; }
0080   G4LogicalVolume *GetLogicalVolume() const { return m_MyLogicalVolume; }
0081 
0082   // this method is used to check if it can be used as mothervolume
0083   // Subsystems which can be mothervolume need to implement this
0084   // and return true
0085   virtual bool CanBeMotherSubsystem() const { return false; }
0086 
0087   //
0088   virtual void AddProcesses(G4ParticleDefinition * /*particle*/) {}
0089 
0090   // define materials used in detector
0091   virtual void DefineMaterials() {}
0092 
0093  private:
0094   PHG4Subsystem *m_MyMotherSubsystem = nullptr;
0095   G4LogicalVolume *m_MyLogicalVolume = nullptr;
0096   bool overlapcheck = false;
0097 };
0098 
0099 #endif  // G4MAIN_PHG4SUBSYSTEM_H