#ifndef _PHYSICS_TOWER_VIEW_HH_ #define _PHYSICS_TOWER_VIEW_HH_ #ifdef USE_CDFEDM2 ///////////////////////////////////////////////////////////////////////////////////////////////// // // Component: PhysicsTowerView.hh // Purpose: This class is a container for pointers to data // in the PhysicsTowerData object. // // Created: 19/06/99 Pierre Savard // // History: 13/09/99 Pierre Savard // Integrate in new EDM // //////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include "Edm/EventRecord.hh" #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/TowerKey.hh" #include "CalorObjects/PhysicsTower.hh" #include "CalorObjects/PhysicsTowerData.hh" //ROOT headers #include "TBuffer.h" // namespace calor { typedef std::vector Towers; class PhysicsTowerView{ public: typedef PhysicsTowerView value_type; // // Memory management // PhysicsTowerView(); PhysicsTowerView(const PhysicsTowerView& rhs); PhysicsTowerView& operator=(const PhysicsTowerView& rhs); ~PhysicsTowerView(); public: Towers& contents(); const Towers& contents() const; void print(std::ostream& os) const ; // // Manipulation and access // void add(const PhysicsTower* tower); void appendTowers(const PhysicsTowerView& view); void erase(Towers::iterator it); // Towers::const_iterator find(TowerKey& key) const; Towers::const_iterator begin() const; Towers::const_iterator end() const; Towers::iterator begin(); Towers::iterator end(); void push_back(const PhysicsTower* tower); void resize(int size); int size() const; void clear(); // EDM stuff void readFromBuffer(TBuffer& iobuffer, Version_t version); void writeToBuffer(TBuffer& iobuffer, Version_t version); void makeTowerKeys(); // this is used when we stream out data bool restorePointers(EventRecord* p_record, PhysicsTowerData_ch& data) const; // // Printing // friend std::ostream& operator<<(std::ostream& os, const PhysicsTowerView& ptv); private: // int PhysicsTowerCollectionId; // rcpid // I wish I did not have to do this but puffing jets appears to require this mutable Towers _container; std::vector _keys; // The pointers are streamed out as tower // keys. }; // // Inline stuff // inline Towers::const_iterator PhysicsTowerView::begin() const { return _container.begin();} inline Towers::const_iterator PhysicsTowerView::end() const{ return _container.end();} inline Towers::iterator PhysicsTowerView::begin(){ return _container.begin();} inline Towers::iterator PhysicsTowerView::end(){ return _container.end();} inline void PhysicsTowerView::clear() {_container.clear();} // inline void PhysicsTowerView::erase(const PhysicsTower* tower) {_container.erase(tower);} // inline void PhysicsTowerView::erase(iter tower) {_container.erase(tower);} inline void PhysicsTowerView::erase(Towers::iterator it){_container.erase(it);} inline void PhysicsTowerView::push_back(const PhysicsTower* tower) {_container.push_back(tower);} inline int PhysicsTowerView::size() const {return _container.size();} inline void PhysicsTowerView::resize(int size) {_container.resize(size);} inline Towers& PhysicsTowerView::contents() { return _container; } inline const Towers& PhysicsTowerView::contents() const { return _container; } // } // namespace calor #endif // USE_CDFEDM2 #endif // _PHYSICS_TOWER_VIEW_HH_