1 |
#ifndef PAMVMCSDMGR_H |
2 |
#define PAMVMCSDMGR_H |
3 |
#include <iostream> |
4 |
|
5 |
#include "TString.h" |
6 |
#include "TObjString.h" |
7 |
#include "TMap.h" |
8 |
#include "PamVMCDetectorSD.h" |
9 |
|
10 |
|
11 |
class PamVMCSDMgr: public TObject { |
12 |
|
13 |
private: |
14 |
|
15 |
static PamVMCSDMgr * fsd; |
16 |
TMap fsdmap; |
17 |
|
18 |
protected: |
19 |
PamVMCSDMgr() {;}; |
20 |
|
21 |
public: |
22 |
|
23 |
static PamVMCSDMgr * Instance(); |
24 |
|
25 |
~PamVMCSDMgr() {fsdmap.DeleteAll();}; |
26 |
|
27 |
PamVMCDetectorSD * GetSD(const char *name){ |
28 |
return (PamVMCDetectorSD*)fsdmap(name); |
29 |
} |
30 |
|
31 |
void SetSD(const char *name, PamVMCDetectorSD *detSD){ |
32 |
fsdmap.Add(new TObjString(name),detSD); |
33 |
} |
34 |
|
35 |
void Register(){ |
36 |
// std::cout <<" Into Register() " << std::endl; |
37 |
TMapIter *n= (TMapIter *)fsdmap.MakeIterator(); |
38 |
TObject *o; while(( o=(TObject *) n->Next())) { |
39 |
//cout<<"!!KEY=<<"<< endl; |
40 |
((PamVMCDetectorSD *)fsdmap.GetValue(o))->Register(); |
41 |
} |
42 |
} |
43 |
|
44 |
void Clear(const Option_t* =""){ |
45 |
TMapIter *n= (TMapIter *)fsdmap.MakeIterator(); |
46 |
TObject *o; while( (o=(TObject *) n->Next())) { |
47 |
((PamVMCDetectorSD *)fsdmap.GetValue(o))->ClearHitColl(); |
48 |
} |
49 |
} |
50 |
|
51 |
void Compress(const Option_t* =""){ |
52 |
TMapIter *n= (TMapIter *)fsdmap.MakeIterator(); |
53 |
TObject *o; while( (o=(TObject *) n->Next())) { |
54 |
((PamVMCDetectorSD *)fsdmap.GetValue(o))->Compress(); |
55 |
} |
56 |
} |
57 |
|
58 |
|
59 |
void PreEvent(const Option_t* =""){ |
60 |
TMapIter *n= (TMapIter *)fsdmap.MakeIterator(); |
61 |
TObject *o; while( (o=(TObject *) n->Next())) { |
62 |
((PamVMCDetectorSD *)fsdmap.GetValue(o))->PreEvent(); |
63 |
} |
64 |
} |
65 |
|
66 |
void Digitize(const Option_t* =""){ |
67 |
TMapIter *n= (TMapIter *)fsdmap.MakeIterator(); |
68 |
TObject *o; while( (o=(TObject *) n->Next())) { |
69 |
((PamVMCDetectorSD *)fsdmap.GetValue(o))->Digitize(); |
70 |
} |
71 |
} |
72 |
|
73 |
|
74 |
void Print( const Option_t* ="") const { |
75 |
cout << "PamVMCSDMgr, list of SD stored " << endl; |
76 |
fsdmap.Print(); |
77 |
} |
78 |
|
79 |
}; |
80 |
|
81 |
#endif |