22 |
static PamVMCDigMgr * fdig; |
static PamVMCDigMgr * fdig; |
23 |
TMap fdigmap; |
TMap fdigmap; |
24 |
|
|
25 |
/* This method calls only from manager. It is owner of all |
|
|
digitizer objects */ |
|
|
void SetDIG(const char *name, PamVMCDigitizer *detDIG){ |
|
|
fdigmap.Add(new TObjString(name),detDIG); |
|
|
fdigmap.Print(); |
|
|
} |
|
|
|
|
26 |
|
|
27 |
protected: |
protected: |
28 |
PamVMCDigMgr(){ |
PamVMCDigMgr(){ |
33 |
SetDIG("TSPA", new PamVMCTrkDig()); |
SetDIG("TSPA", new PamVMCTrkDig()); |
34 |
SetDIG("S4",new PamVMCS4Dig()); |
SetDIG("S4",new PamVMCS4Dig()); |
35 |
SetDIG("NDTI",new PamVMCNDDig()); |
SetDIG("NDTI",new PamVMCNDDig()); |
36 |
SetDIG("RunHeader", new PamVMCDigRunHeader()); |
//SetDIG("RunHeader", new PamVMCDigRunHeader()); |
37 |
SetDIG("RunTrailer", new PamVMCDigRunTrailer()); |
//SetDIG("RunTrailer", new PamVMCDigRunTrailer()); |
38 |
} |
} |
39 |
|
|
40 |
public: |
public: |
47 |
return (PamVMCDigitizer*)fdigmap(name); |
return (PamVMCDigitizer*)fdigmap(name); |
48 |
} |
} |
49 |
|
|
50 |
|
/* This method calls from manager and from external digitizer. It is owner of all |
51 |
|
digitizer objects */ |
52 |
|
void SetDIG(const char *name, PamVMCDigitizer *detDIG){ |
53 |
|
fdigmap.Add(new TObjString(name),detDIG); |
54 |
|
fdigmap.Print(); |
55 |
|
} |
56 |
|
/* This method needs only for external digitizer, kill all default digitizers */ |
57 |
|
void Reset() { fdigmap.Delete(); } |
58 |
|
|
59 |
|
/* Setting pointer to random objects for all Digitizers */ |
60 |
/* All digitizers load calibrations and calibrate */ |
/* All digitizers load calibrations and calibrate */ |
61 |
void LoadCalib(){ |
void Initialize(TRandom* random){ |
62 |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
63 |
TObject *o; while( o=(TObject *) n->Next()) { |
TObject *o; while( (o=(TObject *) n->Next())) { |
64 |
((PamVMCDigitizer *)fdigmap.GetValue(o))->LoadCalib(); |
((PamVMCDigitizer *)fdigmap.GetValue(o))->LoadCalib(); |
65 |
|
((PamVMCDigitizer *)fdigmap.GetValue(o))->SetRandom(random); |
66 |
} |
} |
67 |
} |
} |
68 |
|
|
69 |
/* This calls digitization for all detector */ |
/* This calls digitization for all detector */ |
70 |
void Digitize(Int_t EventNo, Int_t PrimaryPDG){ |
void Digitize(Int_t EventNo, Int_t PrimaryPDG){ |
71 |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
72 |
TObject *o; while( o=(TObject *) n->Next()) { |
TObject *o; while( (o=(TObject *) n->Next())) { |
73 |
((PamVMCDigitizer *)fdigmap.GetValue(o))->Digitize(); |
((PamVMCDigitizer *)fdigmap.GetValue(o))->Digitize(); |
74 |
} |
} |
75 |
|
|
117 |
to raw-file only once, when run is over */ |
to raw-file only once, when run is over */ |
118 |
void FinishRun(){ |
void FinishRun(){ |
119 |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
120 |
TObject *o; while( o=(TObject *) n->Next()) { |
TObject *o; while( (o=(TObject *) n->Next())) { |
121 |
((PamVMCDigitizer *)fdigmap.GetValue(o))->FinishRun(); |
((PamVMCDigitizer *)fdigmap.GetValue(o))->FinishRun(); |
122 |
} |
} |
123 |
} |
} |
126 |
|
|
127 |
void PrintCollections(){ |
void PrintCollections(){ |
128 |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
TMapIter *n= (TMapIter *)fdigmap.MakeIterator(); |
129 |
TObject *o; while( o=(TObject *) n->Next()) { |
TObject *o; while( (o=(TObject *) n->Next())) { |
130 |
((PamVMCDigitizer *)fdigmap.GetValue(o))->PrintCollections(); |
((PamVMCDigitizer *)fdigmap.GetValue(o))->PrintCollections(); |
131 |
} |
} |
132 |
} |
} |