| 1 | #ifndef PDETECTOR_H | 
| 2 | #define PDETECTOR_H | 
| 3 | #include <string> | 
| 4 | #include <iostream> | 
| 5 | #include <map> | 
| 6 | #include "pHit.h" | 
| 7 | #include "TObject.h" | 
| 8 |  | 
| 9 | using std::cout; | 
| 10 | using std::endl; | 
| 11 | using std::string; | 
| 12 | using std::map; | 
| 13 |  | 
| 14 | class pDetector : public TObject { | 
| 15 |  | 
| 16 | public: | 
| 17 |  | 
| 18 |  | 
| 19 | pDetector(const string & s=0, pHit *p=0): _name(s) | 
| 20 | { | 
| 21 | if(p!=0)AddHit(p); | 
| 22 | }; | 
| 23 |  | 
| 24 | virtual ~pDetector(){}; | 
| 25 |  | 
| 26 | void AddHit(pHit *p){_hits.push_back(p); Print();} | 
| 27 | //   void AddHit(const char *c){ | 
| 28 | //       _hits.push_back(pUtil::GetpHit(_name,c)); | 
| 29 | //   } | 
| 30 | void Print() const { | 
| 31 | cout << " pDetector: " << GetDetName() << endl; | 
| 32 | cout << " pHit stored: " << endl; | 
| 33 | for( pHitColl::const_iterator p=_hits.begin(); p!= _hits.end();++p) | 
| 34 | (*p)->Print(); | 
| 35 | } | 
| 36 |  | 
| 37 | pHit* GetHit(const int n) {return _hits[n];} | 
| 38 | pHitColl* GetHitColl() {return &_hits;} | 
| 39 | string GetDetName() const {return _name;} | 
| 40 | void SetDetName(const string & s){_name=s;} | 
| 41 |  | 
| 42 | private: | 
| 43 | string _name; | 
| 44 | pHitColl _hits; | 
| 45 |  | 
| 46 | public: | 
| 47 |  | 
| 48 | //#ifndef __GNUC__ | 
| 49 | ClassDef(pDetector,1); | 
| 50 | //#endif | 
| 51 | }; | 
| 52 |  | 
| 53 | typedef map<string,pDetector*> pDetMap; | 
| 54 |  | 
| 55 | #endif //PDETECTOR_H | 
| 56 |  |