34{
35
36 ISvcLocator* svcLocator = Gaudi::svcLocator();
37 StatusCode sc = svcLocator->service("BesGlobalTrigSvc", m_tmpSvc);
39
40
41 int barHitCount = 0;
42 int endHitCount = 0;
43
44 NBTOF1 = false;
45 NBTOF2 = false;
46 NETOF1 = false;
47 NETOF2 = false;
48 NTOF1 = false;
49
50 TBB = false;
51 ETBB = false;
52
53 bHitpos.clear();
54 ecapHitpos.clear();
55 wcapHitpos.clear();
56
57 if(!m_TofHitCount) std::cerr<<"can not get TofHitCount pointer"<<std::endl;
58
59 std::vector<int> barHitmap;
60 std::vector<int> endHitmap;
61 std::vector<int> barHitId1;
62 std::vector<int> barHitId2;
63 std::vector<int> ecapHitId;
64 std::vector<int> wcapHitId;
65 std::vector<int>::iterator
iter;
66
67 barHitmap.clear();
68 endHitmap.clear();
69 barHitId1.clear();
70 barHitId2.clear();
71 ecapHitId.clear();
72 wcapHitId.clear();
73
78
79 for(unsigned int btofId = 0; btofId < barHitId1.size(); btofId++) barHitmap.push_back(barHitId1[btofId]);
80 for(unsigned int btofId = 0; btofId < barHitId2.size(); btofId++) barHitmap.push_back(88+barHitId2[btofId]);
81 for(unsigned int etofId = 0; etofId < ecapHitId.size(); etofId++) endHitmap.push_back(ecapHitId[etofId]);
82 for(unsigned int etofId = 0; etofId < wcapHitId.size(); etofId++) endHitmap.push_back(48+wcapHitId[etofId]);
83
84
85
86
87
88
89
90
91 int scinNo;
92 for(int btofId = 0; btofId < 88; btofId++) {
94 if((find(barHitId1.begin(),barHitId1.end(),btofId)!=barHitId1.end()) ) {
95 bHitpos.push_back(btofId);
96 }
97 }
99 if(btofId != 87) {
100 if((find(barHitId1.begin(),barHitId1.end(),btofId)!=barHitId1.end()) ||
101 (find(barHitId2.begin(),barHitId2.end(),btofId)!=barHitId2.end()) ||
102 (find(barHitId2.begin(),barHitId2.end(),btofId+1)!=barHitId2.end()) ) {
103 bHitpos.push_back(btofId);
104 }
105 }
106 if(btofId == 87) {
107 if((find(barHitId1.begin(),barHitId1.end(),btofId)!=barHitId1.end()) ||
108 (find(barHitId2.begin(),barHitId2.end(),btofId)!=barHitId2.end()) ||
109 (find(barHitId2.begin(),barHitId2.end(),0)!=barHitId2.end()) ) {
110 bHitpos.push_back(btofId);
111 }
112 }
113 }
114 }
115
116 for(
iter=ecapHitId.begin();
iter!=ecapHitId.end();
iter++)
117 {
118 scinNo = (int) (*
iter)/2;
119 if(find(ecapHitpos.begin(),ecapHitpos.end(),scinNo)==ecapHitpos.end())
120 {
121 ecapHitpos.push_back(scinNo);
122 }
123 }
124
125 for(
iter=wcapHitId.begin();
iter!=wcapHitId.end();
iter++)
126 {
127 scinNo = (int)*
iter/2;
128 if(find(wcapHitpos.begin(),wcapHitpos.end(),scinNo)==wcapHitpos.end())
129 {
130 wcapHitpos.push_back(scinNo);
131 }
132 }
133
134
135
136 for(int btofId = 0; btofId < 88; btofId++) {
137 if(btofId == 0) {
138 if((find(bHitpos.begin(),bHitpos.end(),btofId) != bHitpos.end()) &&
139 (find(bHitpos.begin(),bHitpos.end(),87) == bHitpos.end())) {
140 barHitCount++;
141 }
142 }
143 else {
144 if((find(bHitpos.begin(),bHitpos.end(),btofId) != bHitpos.end()) &&
145 (find(bHitpos.begin(),bHitpos.end(),btofId-1) == bHitpos.end())) {
146 barHitCount++;
147 }
148 }
149 }
150
151 for(int etofId = 0; etofId < 48; etofId++) {
152 if(etofId == 0) {
153 if((find(wcapHitId.begin(),wcapHitId.end(),etofId) != wcapHitId.end()) &&
154 (find(wcapHitId.begin(),wcapHitId.end(),47) == wcapHitId.end())) {
155 endHitCount++;
156 }
157 if((find(ecapHitId.begin(),ecapHitId.end(),etofId) != ecapHitId.end()) &&
158 (find(ecapHitId.begin(),ecapHitId.end(),47) == ecapHitId.end())) {
159 endHitCount++;
160 }
161 }
162 else {
163 if((find(wcapHitId.begin(),wcapHitId.end(),etofId) != wcapHitId.end()) &&
164 (find(wcapHitId.begin(),wcapHitId.end(),etofId-1) == wcapHitId.end())) {
165 endHitCount++;
166 }
167 if((find(ecapHitId.begin(),ecapHitId.end(),etofId) != ecapHitId.end()) &&
168 (find(ecapHitId.begin(),ecapHitId.end(),etofId-1) == ecapHitId.end())) {
169 endHitCount++;
170 }
171 }
172 }
173
174 if(barHitCount>=1) NBTOF1 = true;
175 if(barHitCount>=2) NBTOF2 = true;
176 if(endHitCount>=1) NETOF1 = true;
177 if(endHitCount>=2) NETOF2 = true;
178 if((NBTOF1 == true) || (NETOF1 == true)) NTOF1 = true;
179
181 {
183 for(int i=0;i<13;i++)
184 {
185 if(scinNo+38+i<88)
186 {
187 if(find(bHitpos.begin(),bHitpos.end(),scinNo+38+i)!=bHitpos.end()) TBB = true;
188 }
189 if(scinNo+38+i>=88)
190 {
191 if(find(bHitpos.begin(),bHitpos.end(),scinNo+38+i-88)!=bHitpos.end()) TBB = true;
192 }
193 }
194 }
195 for(
iter=wcapHitId.begin();
iter!=wcapHitId.end();
iter++)
196 {
198 for(int i=0;i<9;i++)
199 {
200 if(scinNo+20+i<48)
201 {
202 if(find(ecapHitId.begin(),ecapHitId.end(),scinNo+20+i)!=ecapHitId.end()) ETBB = true;
203 }
204 if(scinNo+20+i>=48)
205 {
206 if(find(ecapHitId.begin(),ecapHitId.end(),scinNo+20+i-48)!=ecapHitId.end()) ETBB = true;
207 }
208 }
209 }
210 map<int,vector<int>,greater<int> > mHitId;
211 mHitId.clear();
212 typedef pair<int, vector<int> > vpair;
213
214
215
216
217
218
219
220
221
222
223 mHitId.insert(vpair(0,ecapHitpos));
224 mHitId.insert(vpair(1,bHitpos));
225 mHitId.insert(vpair(2,wcapHitpos));
226
237}
void setETofHitMap(vector< int > i)
void setBTofHitMap(vector< int > i)
void setTofHitPos(map< int, vector< int >, greater< int > > i)
std::vector< int > & GetwcapHit()
std::vector< int > & GetecapHit()
std::vector< int > & GetbarrelHit1()
std::vector< int > & GetbarrelHit2()