Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:59

0001 // $Id: $
0002 
0003 /*!
0004  * \file PHGeomTGeo.h
0005  * \brief 
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision:   $
0008  * \date $Date: $
0009  */
0010 
0011 #ifndef PHGEOMETRY_PHGEOMTGEO_H
0012 #define PHGEOMETRY_PHGEOMTGEO_H
0013 
0014 #include <phool/PHObject.h>
0015 
0016 #include <iostream>
0017 
0018 class TGeoManager;
0019 
0020 /*!
0021  * \brief PHGeomTGeo provide run-time access to TGeoManger.
0022  * It is transient object and it shall NOT be saved to DST.
0023  * For DST storage, please use PHGeomIOTGeo
0024  * For operation of this class with DST node, please use PHGeomUtility
0025  */
0026 class PHGeomTGeo : public PHObject
0027 {
0028  public:
0029   PHGeomTGeo();
0030   ~PHGeomTGeo() override;
0031 
0032   /** identify Function from PHObject
0033       @param os Output Stream
0034    */
0035   void identify(std::ostream& os = std::cout) const override;
0036 
0037   /// Clear Event
0038   void Reset() override;
0039 
0040   /// isValid returns non zero if object contains vailid data
0041   int isValid() const override;
0042 
0043   //! Assign TGeoManager object.
0044   //! Once assigned, the TGeoManager will be locked to avoid a second TGeoManager override gGeoManager and lead to an invalid PHGeomTGeo
0045   //! The pointer TGeoManager should be the current gGeoManager
0046   void
0047   SetGeometry(TGeoManager* g);
0048 
0049   TGeoManager*
0050   GetGeometry();
0051 
0052   //! Since ROOT force TGeoManager is a unique object via global pointer gGeoManager,
0053   //! this function checks whether _fGeom is still the current gGeoManager which avoids operates on an invalid pointer
0054   bool ConsistencyCheck() const;
0055 
0056  protected:
0057   //! store and stream the full geometry via DST objects
0058   TGeoManager* _fGeom;
0059 };
0060 
0061 #endif