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