00001 #ifndef IrfTkrLayer_H 00002 #define IrfTkrLayer_H 1 00003 00004 // Include files 00005 #include <iostream> 00006 #include "GaudiKernel/Kernel.h" 00007 #include "GaudiKernel/StreamBuffer.h" 00008 #include "GaudiKernel/ContainedObject.h" 00009 #include "GlastEvent/TopLevel/Definitions.h" 00010 00011 #include "GlastEvent/Irf/IrfTkrHit.h" 00012 00013 // Externals 00014 extern const CLID& CLID_IrfTkrLayer; 00015 00016 00017 //------------------------------------------------------------------------------ 00018 // 00019 // ClassName: IrfTkrLayer 00020 // 00021 // Description: Essential information of the IrfTkrLayer 00022 // 00023 // It contains: 00024 // - id 00025 // - max energy energy 00026 // - vector of hit strips 00027 // 00028 // 00029 //------------------------------------------------------------------------------ 00030 00041 class IrfTkrLayer : virtual public ContainedObject { 00042 00043 public: 00045 IrfTkrLayer() { } 00046 00048 virtual ~IrfTkrLayer() { } 00049 00051 virtual const CLID& clID() const { return IrfTkrLayer::classID(); } 00052 static const CLID& classID() { return CLID_IrfTkrLayer; } 00053 00055 unsigned int id () const { return m_id; } 00056 void setId (long value) { m_id = value; } 00057 00059 float MaxEnergy () const { return m_energy; } 00060 void setMaxEnergy (float value) { m_energy = value; } 00061 00063 void clearHits () { 00064 for (IrfTkrHitVector::iterator it = m_hitVector.begin(); it != m_hitVector.end(); it++) { 00065 m_hitVector.erase(it); 00066 } 00067 } 00068 00070 void addHit (IrfTkrHit *hit) { m_hitVector.push_back(hit); } 00071 00073 IrfTkrHitVector* getHits() { return &m_hitVector; } 00074 00076 virtual StreamBuffer& serialize( StreamBuffer& s ); 00077 virtual StreamBuffer& serialize( StreamBuffer& s ) const; 00078 virtual std::ostream& fillStream( std::ostream& s ) const; 00079 00080 private: 00081 unsigned int m_id; // ID of layer 00082 float m_energy; // max energy in layer 00083 IrfTkrHitVector m_hitVector; // list of hit strips 00084 }; 00085 00086 inline StreamBuffer& IrfTkrLayer::serialize( StreamBuffer& s ) const { 00087 s = ContainedObject::serialize(s); 00088 s 00089 << m_id 00090 << m_energy 00091 << m_hitVector.size(); 00092 for (IrfTkrHitVector::const_iterator hit = m_hitVector.begin(); hit != m_hitVector.end(); hit++) { 00093 s = (*hit)->serialize(s); 00094 } 00095 return s; 00096 } 00097 00098 00099 inline StreamBuffer& IrfTkrLayer::serialize( StreamBuffer& s ) { 00100 s = ContainedObject::serialize(s); 00101 int nSize; 00102 s 00103 >> m_id 00104 >> m_energy 00105 >> nSize; 00106 for (int iHit = 0; iHit < nSize; iHit++){ 00107 IrfTkrHit* curHit = new IrfTkrHit(); 00108 s = curHit->serialize(s); 00109 this->addHit(curHit); 00110 } 00111 00112 return s; 00113 } 00114 00115 00116 inline std::ostream& IrfTkrLayer::fillStream( std::ostream& s ) const { 00117 return s 00118 << "class IrfTkrLayer :" 00119 << "\n Max Energy = " 00120 << m_energy 00121 << "\n Si Layer id = " << m_id 00122 << "\n hit strips = " << m_hitVector; 00123 } 00124 00125 // Definition of all container types of IrfTkrLayer 00126 template <class TYPE> class ObjectVector; 00127 typedef ObjectVector<IrfTkrLayer> IrfTkrLayerVector; 00128 template <class TYPE> class ObjectList; 00129 typedef ObjectList<IrfTkrLayer> IrfTkrLayerList; 00130 00131 00132 #endif // IrfTkrLayer_H
1.2.3 written by Dimitri van Heesch,
© 1997-2000