TBench.h

Go to the documentation of this file.
00001 #ifndef ROOT_TBENCH
00002 #define ROOT_TBENCH
00003    
00004 #include "TClonesArray.h"
00005 namespace stdext {}
00006 #include <vector>
00007 #include <deque>
00008 #include <list>
00009 #include <set>
00010 #include <map>
00011 
00012 #ifndef R__GLOBALSTL
00013 #ifndef WIN32
00014 using std::vector;
00015 using std::list;
00016 using std::deque;
00017 using std::set;
00018 using std::multiset;
00019 using std::map;
00020 using std::multimap;
00021 #else
00022 using namespace std;
00023 using namespace stdext;
00024 #endif
00025 #endif
00026 #ifdef R__HPUX
00027 namespace std {
00028   using ::make_pair;
00029   using ::pair;
00030 }
00031 #endif
00032 
00033 #ifdef __CINT__
00034 template<class a,class b,class c> class hash_map : public map<a,b,c> {};
00035 template<class a,class b> class hash_set : public set<a,b> {};
00036 template<class a,class b,class c> class hash_multimap : public multimap<a,b,c> {};
00037 template<class a,class b> class hash_multiset : public multiset<a,b> {};
00038 #else
00039 //#include <hash_map>
00040 //#include <hash_set>
00041 #endif
00042 
00043 //-------------------------------------------------------------
00044 class THit {
00045 protected:
00046   float     fX;         //x position at center
00047   float     fY;         //y position at center
00048   float     fZ;         //z position at center
00049   int       fNpulses;   //Number of pulses
00050   int      *fPulses;    //[fNpulses]
00051   int       fTime[10];  //time at the 10 layers
00052 public:
00053 
00054   THit();
00055   THit(const THit &);
00056   THit(int time);
00057   virtual ~THit();
00058 
00059   void  Set (int time);
00060   inline int Get(int i) { return fTime[i]; }
00061   bool operator==(const THit& c) const { return this==&c;}
00062   bool operator<(const THit& c) const { return this<&c;}
00063   THit& operator=(const THit& c);
00064   friend TBuffer &operator<<(TBuffer &b, const THit *hit);
00065 
00066   ClassDef(THit,1) // the hit class
00067 };
00068 
00069 namespace stdext {
00070   template<class T>  inline size_t __gnu_cxx_hash_obj(const T& __o) {
00071     unsigned long __h = 0;
00072     const char* s = (const char*)&__o;
00073     for (size_t i=0; i<sizeof(T); ++s, ++i)
00074       __h = 5*__h + *s;
00075     return size_t(__h);
00076   }
00077 
00078   template <class _Key> struct hash { };
00079   inline size_t hash_value(const THit& s)  {
00080     return __gnu_cxx_hash_obj(s);
00081   }
00082 }
00083 #if defined R__TEMPLATE_OVERLOAD_BUG
00084 template <> 
00085 #endif
00086 inline TBuffer &operator>>(TBuffer &buf,THit *&obj)
00087 {
00088    obj = new THit();
00089    obj->Streamer(buf);
00090    return buf;
00091 }
00092 
00093 //-------------------------------------------------------------
00094 class TObjHit : public TObject, public THit {
00095 
00096 public:
00097 
00098   TObjHit();
00099   TObjHit(int time);
00100   virtual ~TObjHit(){;}
00101 
00102   ClassDef(TObjHit,1) // the hit class
00103 };
00104 
00105 //-------------------------------------------------------------
00106 class TSTLhit {
00107 protected:
00108   Int_t            fNhits;
00109   vector <THit>    fList1;
00110 
00111 public:
00112 
00113   TSTLhit();
00114   TSTLhit(int nmax);
00115   void Clear(Option_t *option="");
00116   virtual ~TSTLhit();
00117   void MakeEvent(int ievent);
00118   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00119   Int_t ReadTree();
00120 
00121   ClassDef(TSTLhit,1) // STL vector of THit
00122 };
00123 //-------------------------------------------------------------
00124 class TSTLhitList {
00125 protected:
00126   Int_t            fNhits;
00127   list   <THit>    fList1;
00128 
00129 public:
00130 
00131   TSTLhitList();
00132   TSTLhitList(int nmax);
00133   void Clear(Option_t *option="");
00134   virtual ~TSTLhitList();
00135   void MakeEvent(int ievent);
00136   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00137   Int_t ReadTree();
00138 
00139   ClassDef(TSTLhitList,1) // STL vector of THit
00140 };
00141 
00142 //-------------------------------------------------------------
00143 class TSTLhitDeque {
00144 protected:
00145   Int_t            fNhits;
00146   deque  <THit>    fList1;
00147 
00148 public:
00149 
00150   TSTLhitDeque();
00151   TSTLhitDeque(int nmax);
00152   void Clear(Option_t *option="");
00153   virtual ~TSTLhitDeque();
00154   void MakeEvent(int ievent);
00155   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00156   Int_t ReadTree();
00157 
00158   ClassDef(TSTLhitDeque,1) // STL vector of THit
00159 };
00160       
00161 //-------------------------------------------------------------
00162 class TSTLhitMultiset {
00163 protected:
00164   Int_t            fNhits;
00165   multiset  <THit>    fList1;
00166 
00167 public:
00168 
00169   TSTLhitMultiset();
00170   TSTLhitMultiset(int nmax);
00171   void Clear(Option_t *option="");
00172   virtual ~TSTLhitMultiset();
00173   void MakeEvent(int ievent);
00174   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00175   Int_t ReadTree();
00176 
00177   ClassDef(TSTLhitMultiset,1) // STL vector of THit
00178 };
00179 
00180 //-------------------------------------------------------------
00181 class TSTLhitSet {
00182 protected:
00183   Int_t            fNhits;
00184   set  <THit>    fList1;
00185 
00186 public:
00187 
00188   TSTLhitSet();
00189   TSTLhitSet(int nmax);
00190   void Clear(Option_t *option="");
00191   virtual ~TSTLhitSet();
00192   void MakeEvent(int ievent);
00193   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00194   Int_t ReadTree();
00195 
00196   ClassDef(TSTLhitSet,1) // STL vector of THit
00197 };
00198 //-------------------------------------------------------------
00199 class TSTLhitMap {
00200 protected:
00201   Int_t            fNhits;
00202   map  <int,THit>    fList1;
00203 
00204 public:
00205 
00206   TSTLhitMap();
00207   TSTLhitMap(int nmax);
00208   void Clear(Option_t *option="");
00209   virtual ~TSTLhitMap();
00210   void MakeEvent(int ievent);
00211   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00212   Int_t ReadTree();
00213 
00214   ClassDef(TSTLhitMap,1) // STL vector of THit
00215 };
00216 //-------------------------------------------------------------
00217 class TSTLhitMultiMap {
00218 protected:
00219   Int_t                fNhits;
00220   multimap  <int,THit> fList1;
00221 
00222 public:
00223 
00224   TSTLhitMultiMap();
00225   TSTLhitMultiMap(int nmax);
00226   void Clear(Option_t *option="");
00227   virtual ~TSTLhitMultiMap();
00228   void MakeEvent(int ievent);
00229   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00230   Int_t ReadTree();
00231 
00232   ClassDef(TSTLhitMultiMap,1) // STL vector of THit
00233 };
00234 #if 0
00235 //-------------------------------------------------------------
00236 class TSTLhitHashSet {
00237 protected:
00238   Int_t            fNhits;
00239   hash_set  <THit> fList1;
00240 
00241 public:
00242 
00243   TSTLhitHashSet();
00244   TSTLhitHashSet(int nmax);
00245   void Clear(Option_t *option="");
00246   virtual ~TSTLhitHashSet();
00247   void MakeEvent(int ievent);
00248   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00249   Int_t ReadTree();
00250 
00251   ClassDef(TSTLhitHashSet,1) // STL vector of THit
00252 };
00253 //-------------------------------------------------------------
00254 class TSTLhitHashMultiSet {
00255 protected:
00256   Int_t            fNhits;
00257   hash_multiset  <THit>    fList1;
00258 
00259 public:
00260 
00261   TSTLhitHashMultiSet();
00262   TSTLhitHashMultiSet(int nmax);
00263   void Clear(Option_t *option="");
00264   virtual ~TSTLhitHashMultiSet();
00265   void MakeEvent(int ievent);
00266   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00267   Int_t ReadTree();
00268 
00269   ClassDef(TSTLhitHashMultiSet,1) // STL vector of THit
00270 };
00271 #endif
00272 //-------------------------------------------------------------
00273 class TSTLhitStar {
00274 protected:
00275   Int_t            fNhits;
00276   vector <THit*>   fList2; //
00277 
00278 public:
00279 
00280   TSTLhitStar();
00281   TSTLhitStar(int nmax);
00282   void Clear(Option_t *option="");
00283   virtual ~TSTLhitStar();
00284   void MakeEvent(int ievent);
00285   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00286   Int_t ReadTree();
00287 
00288   ClassDef(TSTLhitStar,1) // STL vector of pointers to THit
00289 };
00290 //-------------------------------------------------------------
00291 class TSTLhitStarList {
00292 protected:
00293   Int_t            fNhits;
00294   list <THit*>   fList2; //
00295 
00296 public:
00297 
00298   TSTLhitStarList();
00299   TSTLhitStarList(int nmax);
00300   void Clear(Option_t *option="");
00301   virtual ~TSTLhitStarList();
00302   void MakeEvent(int ievent);
00303   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00304   Int_t ReadTree();
00305 
00306   ClassDef(TSTLhitStarList,1) // STL vector of pointers to THit
00307 };
00308 //-------------------------------------------------------------
00309 class TSTLhitStarDeque {
00310 protected:
00311   Int_t            fNhits;
00312   deque <THit*>   fList2; //
00313 
00314 public:
00315 
00316   TSTLhitStarDeque();
00317   TSTLhitStarDeque(int nmax);
00318   void Clear(Option_t *option="");
00319   virtual ~TSTLhitStarDeque();
00320   void MakeEvent(int ievent);
00321   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00322   Int_t ReadTree();
00323 
00324   ClassDef(TSTLhitStarDeque,1) // STL vector of pointers to THit
00325 };
00326 
00327 //-------------------------------------------------------------
00328 class TSTLhitStarSet {
00329 protected:
00330   Int_t            fNhits;
00331   set <THit*>   fList2; //
00332 
00333 public:
00334 
00335   TSTLhitStarSet();
00336   TSTLhitStarSet(int nmax);
00337   void Clear(Option_t *option="");
00338   virtual ~TSTLhitStarSet();
00339   void MakeEvent(int ievent);
00340   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00341   Int_t ReadTree();
00342 
00343   ClassDef(TSTLhitStarSet,1) // STL vector of pointers to THit
00344 };
00345       
00346 //-------------------------------------------------------------
00347 class TSTLhitStarMultiSet {
00348 protected:
00349   Int_t            fNhits;
00350   multiset <THit*>   fList2; //
00351 
00352 public:
00353 
00354   TSTLhitStarMultiSet();
00355   TSTLhitStarMultiSet(int nmax);
00356   void Clear(Option_t *option="");
00357   virtual ~TSTLhitStarMultiSet();
00358   void MakeEvent(int ievent);
00359   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00360   Int_t ReadTree();
00361 
00362   ClassDef(TSTLhitStarMultiSet,1) // STL vector of pointers to THit
00363 };
00364       
00365 //-------------------------------------------------------------
00366 class TSTLhitStarMap {
00367 protected:
00368   Int_t            fNhits;
00369   map <int,THit*>   fList2; //
00370 
00371 public:
00372 
00373   TSTLhitStarMap();
00374   TSTLhitStarMap(int nmax);
00375   void Clear(Option_t *option="");
00376   virtual ~TSTLhitStarMap();
00377   void MakeEvent(int ievent);
00378   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00379   Int_t ReadTree();
00380 
00381   ClassDef(TSTLhitStarMap,1) // STL vector of pointers to THit
00382 };
00383       
00384 //-------------------------------------------------------------
00385 class TSTLhitStarMultiMap {
00386 protected:
00387   Int_t            fNhits;
00388   multimap<int,THit*>   fList2; //
00389 
00390 public:
00391 
00392   TSTLhitStarMultiMap();
00393   TSTLhitStarMultiMap(int nmax);
00394   void Clear(Option_t *option="");
00395   virtual ~TSTLhitStarMultiMap();
00396   void MakeEvent(int ievent);
00397   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00398   Int_t ReadTree();
00399 
00400   ClassDef(TSTLhitStarMultiMap,1) // STL vector of pointers to THit
00401 };
00402       
00403 //-------------------------------------------------------------
00404 class TCloneshit {
00405 protected:
00406   Int_t            fNhits;
00407   TClonesArray    *fList3; //->
00408 
00409 public:
00410 
00411   TCloneshit();
00412   TCloneshit(int nmax);
00413   void Clear(Option_t *option="");
00414   virtual ~TCloneshit();
00415   void MakeEvent(int ievent);
00416   Int_t MakeTree(int mode, int nevents, int compression, int split, float &cx);
00417   Int_t ReadTree();
00418 
00419   ClassDef(TCloneshit,1) // TClonesArray of TObjHit
00420 };
00421 
00422 #endif

Generated on Tue Jul 5 15:16:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1