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 PHGeomIOTGeo.h
0005  * \brief 
0006  * \author Jin Huang <jhuang@bnl.gov>
0007  * \version $Revision:   $
0008  * \date $Date: $
0009  */
0010 
0011 #ifndef PHGEOMETRY_PHGEOMIOTGEO_H
0012 #define PHGEOMETRY_PHGEOMIOTGEO_H
0013 
0014 #include <phool/PHObject.h>
0015 
0016 #include <iostream>
0017 #include <vector>
0018 
0019 class TGeoVolume;
0020 class TGeoManager;
0021 
0022 /*!
0023  * \brief PHGeomIOTGeo store geometry information to DST files in the format of binary streamed TGeoVolume. It completely owns the geometry object
0024  * For run-time use of TGeoManager, please use PHGeomTGeo
0025  * For operation of this class with DST node, please use PHGeomUtility
0026  */
0027 class PHGeomIOTGeo : public PHObject
0028 {
0029  public:
0030   PHGeomIOTGeo();
0031   ~PHGeomIOTGeo() override;
0032 
0033   PHObject* CloneMe() const override {return new PHGeomIOTGeo(*this);}
0034 
0035   /** identify Function from PHObject
0036    @param os Output Stream
0037    */
0038   void
0039   identify(std::ostream& os = std::cout) const override;
0040 
0041   /// Clear Event
0042   void
0043   Reset() override;
0044 
0045   /// isValid returns non zero if object contains vailid data
0046   int
0047   isValid() const override;
0048 
0049   //! PHGeomIOTGeo do NOT own this TGeoVolume * g. Internally, it will use g to make a copy which PHGeomIOTGeo fully owns
0050   void
0051   SetGeometry(const TGeoVolume* g);
0052 
0053   //! Construct TGeoManager. The result TGeoManager is not yet closed and open for further editing
0054   TGeoManager*
0055   ConstructTGeoManager();
0056 
0057   //! Make a copy of TGeoVolume.
0058   //! The caller is responsible for deleting the returned TGeoVolume
0059   //! The caller is also responsible for constructing a valid TGeoManager before calling this function
0060   TGeoVolume*
0061   GetGeometryCopy();
0062 
0063   std::vector<char>&
0064   GetData()
0065   {
0066     return Data;
0067   }
0068 
0069   const std::vector<char>&
0070   GetData() const
0071   {
0072     return Data;
0073   }
0074 
0075  protected:
0076   //! store the streamed geometry and its streamer via a binary stream
0077   std::vector<char> Data;
0078 
0079   ClassDefOverride(PHGeomIOTGeo, 3)
0080 };
0081 
0082 #endif