emcTowerContainerv2.h

Go to the documentation of this file.
00001 #ifndef __EMCTOWERCONTAINERV2_H__
00002 #define __EMCTOWERCONTAINERV2_H__
00003 
00004 #ifndef __EMCTOWERCONTAINER_H__
00005 #include "emcTowerContainer.h"
00006 #endif
00007 #ifndef __EMCTOWERCONTENTV2_H__
00008 #include "emcTowerContentv2.h" 
00009 #endif
00010 // this latter include is needed so the compiler knows that it derives from
00011 // emcTowerContent and so the addTower and getTower methods
00012 // are considered as overriding methods and not overloading or hiding ones.
00013 #include <map>
00014 
00015 class TClonesArray;
00016 
00021 class emcTowerContainerv2 : public emcTowerContainer
00022 {
00023 public:
00024 
00025   emcTowerContainerv2();
00026 
00027   emcTowerContainerv2(const emcTowerContainerv2&);
00028 
00029   emcTowerContainerv2& operator=(const emcTowerContainerv2&);
00030 
00031   emcTowerContainerv2* clone(void) const;
00032 
00033   emcTowerContainerv2* create(void) const;
00034 
00035   virtual ~emcTowerContainerv2();
00036 
00037   unsigned int capacity(void) const;
00038 
00039   emcTowerContentv2* addTower(unsigned int i);
00040 
00041   emcTowerContentv2* addTower(unsigned int i, const emcTowerContent&);
00042 
00043   emcTowerContentv2* findTower(int towerID) const;
00044 
00045   emcTowerContentv2* getTower(unsigned int i) const;
00046 
00047   void identify(std::ostream& os=std::cout) const;
00048 
00049   int isValid() const;
00050 
00051   bool removeTower(unsigned int i);
00052 
00053   void Reset();
00054 
00055   bool resize(unsigned int newsize);
00056 
00057   unsigned int size(void) const;
00058 
00059 protected:
00060 
00061   TClonesArray* fEmcTowers;
00062 
00063 private:
00064   void allocate(unsigned int thesize);
00065   void copy(emcTowerContainerv2& dest) const;
00066 
00067   static const unsigned int fgDefaultSize;
00068   static const unsigned int fgMaxSize;
00069 
00070   mutable std::map<int,int> fTowerIdToIndex; 
00071   mutable bool fTowerIdToIndexIsUpToDate; 
00072 
00073   ClassDef(emcTowerContainerv2,1) // Array of emcTowerContentv2
00074 };
00075 #endif