/[PAMELA software]/PamVMC_update/include/PamVMCSDMgr.h
ViewVC logotype

Contents of /PamVMC_update/include/PamVMCSDMgr.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Oct 15 15:52:31 2013 UTC (11 years, 1 month ago) by formato
Branch: MAIN, rel
CVS Tags: reltag, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
PamVMC update

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 #define NTRPL 6 //number of TOF planes
11
12 class PamVMCSDMgr: public TObject {
13
14 private:
15
16 static PamVMCSDMgr * fsd;
17 TMap fsdmap;
18
19 //some trigger sd's for fast use
20 PamVMCDetectorSD* ftrig_sd [NTRPL];
21 TString ftrig_colls[NTRPL];
22 Bool_t fisgoodfortrig; // boolean veriable to indicate that
23 //all triggered sd's are present
24
25 protected:
26 PamVMCSDMgr() {
27 TString tmp[NTRPL]={"S11Y","S12X","S21X","S22Y","S31Y","S32X"};
28 for(Int_t i = 0; i<NTRPL; i++) ftrig_colls[i]=tmp[i];
29 };
30
31 public:
32
33 static PamVMCSDMgr * Instance();
34
35 ~PamVMCSDMgr() {fsdmap.DeleteAll();};
36
37 PamVMCDetectorSD * GetSD(const char *name){
38 return (PamVMCDetectorSD*)fsdmap(name);
39 }
40
41 void SetSD(const char *name, PamVMCDetectorSD *detSD){
42 fsdmap.Add(new TObjString(name),detSD);
43 }
44
45 void Register(){
46
47 TMapIter *n= (TMapIter *)fsdmap.MakeIterator();
48 TObject *o; while(( o=(TObject *) n->Next())) {
49 ((PamVMCDetectorSD *)fsdmap.GetValue(o))->Register();
50 }
51 delete n;
52 //check if all trigger SD's are registered. If some TOF layers
53 //are missed, return false
54 fisgoodfortrig = kTRUE;
55 for(Int_t i = 0; i<NTRPL; i++){
56 ftrig_sd[i]=(PamVMCDetectorSD *)fsdmap.GetValue(ftrig_colls[i]);
57 if(!ftrig_sd[i]) {
58 cout<<"Warning, trigger SD: "<<ftrig_colls[i]<<" is missed, there are no triggers"<<endl;
59 fisgoodfortrig = kFALSE;
60 }
61 }
62 }
63 void Clear(const Option_t* =""){
64 TMapIter *n= (TMapIter *)fsdmap.MakeIterator();
65 TObject *o; while( (o=(TObject *) n->Next())) {
66 ((PamVMCDetectorSD *)fsdmap.GetValue(o))->ClearHitColl();
67 }
68 delete n;
69 }
70
71 void Compress(const Option_t* =""){
72 TMapIter *n= (TMapIter *)fsdmap.MakeIterator();
73 TObject *o; while( (o=(TObject *) n->Next())) {
74 ((PamVMCDetectorSD *)fsdmap.GetValue(o))->Compress();
75 }
76 delete n;
77 }
78
79
80 void PreEvent(const Option_t* =""){
81 TMapIter *n= (TMapIter *)fsdmap.MakeIterator();
82 TObject *o; while( (o=(TObject *) n->Next())) {
83 ((PamVMCDetectorSD *)fsdmap.GetValue(o))->PreEvent();
84 }
85 delete n;
86 }
87
88 void Digitize(const Option_t* =""){
89 TMapIter *n= (TMapIter *)fsdmap.MakeIterator();
90 TObject *o; while( (o=(TObject *) n->Next())) {
91 ((PamVMCDetectorSD *)fsdmap.GetValue(o))->Digitize();
92 }
93 delete n;
94 }
95
96
97 void Print( const Option_t* ="") const {
98 cout << "PamVMCSDMgr, list of SD stored " << endl;
99 cout<<"pointers: "<<endl;
100 TMapIter *n= (TMapIter *)fsdmap.MakeIterator();
101 TObject *o; while( (o=(TObject *) n->Next())) {
102 cout<<"->DETECTOR:"<<fsdmap.GetValue(o)<<endl;
103 ((PamVMCDetectorSD *)fsdmap.GetValue(o))->Print();
104 }
105 delete n;
106 fsdmap.Print();
107 }
108
109 Int_t GetTrigger(){
110 if(!fisgoodfortrig) return 0;
111
112
113 Int_t s1or = ftrig_sd[0]->GetNhits() + ftrig_sd[1]->GetNhits();
114 Int_t s1an = ftrig_sd[0]->GetNhits() * ftrig_sd[1]->GetNhits();
115
116 Int_t s2or = ftrig_sd[2]->GetNhits() + ftrig_sd[3]->GetNhits();
117 Int_t s2an = ftrig_sd[2]->GetNhits() * ftrig_sd[3]->GetNhits();
118
119 Int_t s3or = ftrig_sd[4]->GetNhits() + ftrig_sd[4]->GetNhits();
120 Int_t s3an = ftrig_sd[4]->GetNhits() * ftrig_sd[4]->GetNhits();
121
122 //TOF2
123 if (s1an*s2an*s3an) return 2;
124 //TOF1
125 if (s1or*s2or*s3or) return 1;
126 //TOF4
127 if (s2an*s3an) return 4;
128
129 return 0;
130
131 }
132
133 };
134
135 #endif

  ViewVC Help
Powered by ViewVC 1.1.23