Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:20:20

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 isValid() const override;
0047 
0048   //! PHGeomIOTGeo do NOT own this TGeoVolume * g. Internally, it will use g to make a copy which PHGeomIOTGeo fully owns
0049   void
0050   SetGeometry(const TGeoVolume* g);
0051 
0052   //! Construct TGeoManager. The result TGeoManager is not yet closed and open for further editing
0053   TGeoManager*
0054   ConstructTGeoManager();
0055 
0056   //! Make a copy of TGeoVolume.
0057   //! The caller is responsible for deleting the returned TGeoVolume
0058   //! The caller is also responsible for constructing a valid TGeoManager before calling this function
0059   TGeoVolume*
0060   GetGeometryCopy();
0061 
0062   std::vector<char>&
0063   GetData()
0064   {
0065     return Data;
0066   }
0067 
0068   const std::vector<char>&
0069   GetData() const
0070   {
0071     return Data;
0072   }
0073 
0074  protected:
0075   //! store the streamed geometry and its streamer via a binary stream
0076   std::vector<char> Data;
0077 
0078   ClassDefOverride(PHGeomIOTGeo, 3)
0079 };
0080 
0081 #endif