emcTowerContainerv3.h

Go to the documentation of this file.
00001 #ifndef __EMCTOWERCONTAINERV3_H__
00002 #define __EMCTOWERCONTAINERV3_H__
00003 
00004 #ifndef __EMCTOWERCONTAINER_H__
00005 #include "emcTowerContainer.h"
00006 #endif
00007 #ifndef __EMCTOWERCONTENTV3_H__
00008 #include "emcTowerContentv3.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 emcTowerContainerv3 : public emcTowerContainer
00022 {
00023 public:
00024 
00025   emcTowerContainerv3();
00026 
00027   emcTowerContainerv3(const emcTowerContainerv3&);
00028 
00029   emcTowerContainerv3& operator=(const emcTowerContainerv3&);
00030 
00031   emcTowerContainerv3* clone(void) const;
00032 
00033   emcTowerContainerv3* create(void) const;
00034 
00035   virtual ~emcTowerContainerv3();
00036 
00037   unsigned int capacity(void) const;
00038 
00039   emcTowerContentv3* addTower(unsigned int i);
00040 
00041   emcTowerContentv3* addTower(unsigned int i, const emcTowerContent&);
00042 
00043   emcTowerContentv3* findTower(int towerID) const;
00044 
00045   emcTowerContentv3* 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(emcTowerContainerv3& dest) const;
00066   bool expand(unsigned int);
00067   bool expand_for(unsigned int);
00068 
00069   static const unsigned int fgDefaultSize;
00070   static const unsigned int fgMaxSize;
00071 
00072   mutable std::map<int,int> fTowerIdToIndex; 
00073   mutable bool fTowerIdToIndexIsUpToDate; 
00074 
00075   ClassDef(emcTowerContainerv3,1) // Array of emcTowerContentv3
00076 };
00077 #endif