127 {
128
129 MsgStream log(
msgSvc(), name());
130
131 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
132 int runNo=eventHeader->runNumber();
133 int event=eventHeader->eventNumber();
134
137
139
140
141
142
143 double Ebeam = 3.773/2.0;
144
146 for(int i = 0; i < 3467; i++) {
147 if(
runNo == p_run[i]) {Ebeam = p_Ecm[i]/2.0;}
148 }
149 }
150
152 {
154
155
156
157 }
158
159 if(
nD0%1000==0) cout<<
"SD0TagAlg-13-11-15pp = "<<
nD0<<
" "<<
runNo<<
" "<<
event<<
" "<<Ebeam*2<<endl;
160
161 Hep3Vector xorigin(0,0,0);
163 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
167 xorigin.setX(dbv[0]);
168 xorigin.setY(dbv[1]);
169 xorigin.setZ(dbv[2]);
170 }
171
172
173 Vint iCharge_good; iCharge_good.clear();
174 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
176 if(!(*itTrk)->isMdcTrackValid()) continue;
178
179 HepVector a = mdcTrk->
helix();
180 HepSymMatrix Ea = mdcTrk->
err();
182 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
184 helixip.pivot(IP);
185 HepVector vecipa = helixip.a();
186 double Rvxy0=fabs(vecipa[0]);
187 double Rvz0=vecipa[3];
188 double costheta =
cos(mdcTrk->
theta());
189
190 if(fabs(Rvxy0) >= 1.0) continue;
191 if(fabs(Rvz0) >= 10.0) continue;
192 if(fabs(costheta) >= 0.930) continue;
193 iCharge_good.push_back(i);
194 }
195
196
197 Vint iGam; iGam.clear();
198 for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
200 if(!(*itTrk)->isEmcShowerValid()) continue;
202
203
204
209
210 int emctdc = emcTrk->
time();
211 if(emctdc>14||emctdc<0) continue;
212
213 double eraw = emcTrk->
energy();
214 double theta = emcTrk->
theta();
215 int Module = 0;
216 if(fabs(
cos(theta)) < 0.80 && eraw > 0.025){ Module = 1; }
217 if(fabs(
cos(theta)) > 0.86 && fabs(
cos(theta)) < 0.92 && eraw > 0.05) { Module = 2; }
218 if(Module == 0) continue;
219 iGam.push_back((*itTrk)->trackId());
220 }
221
224
225
226 int ntk;
227 double tagmass,
ebeam,tagmode,ksmass,dlte;
228
229 Vint tagtrk; tagtrk.clear();
230 Vint tagGam; tagGam.clear();
231
232 HepLorentzVector tagp;
233
234 double mass_bc_temp, mass_kf_temp, kf_chi2_temp, mks_temp, mpi0_temp, ptag_temp;
235 int Charge_candidate_D = 0;
236 double EGam_max_0 = 0;
237
238 for(int i1 = 0; i1 < 2; i1++) {
239 if(Seperate_Charge == 2 ) { Charge_candidate_D = Charge_default; i1 = 2;}
240 if(Seperate_Charge == 1 ) { Charge_candidate_D = pow(-1,i1); }
241 if(Seperate_Charge == 0 ) { Charge_candidate_D = 0; i1 = 2; }
242
243 for(int i = 0; i < 15; i++) {
244 EGam_max_0 = 0;
245 int mdslct=pow(2.,i);
247 sing.
Mdset(event,evtRecTrkCol,iCharge_good,iGam,mdslct,Ebeam, PID_flag,Charge_candidate_D);
249 if(oktag) {
250
251
252
253
256
257 if((
abs(tagmode) == 11 ||
abs(tagmode) == 15 ||
abs(tagmode) == 19)) {
258
259 for(int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++) {
261 int itrk = (*itTrk)->trackId();
262 if(!(*itTrk)->isEmcShowerValid()) continue;
264
265 int emctdc = emcTrk->
time();
266 if(emctdc>14||emctdc<0) continue;
267
268 Hep3Vector emcpos(emcTrk->
x(), emcTrk->
y(), emcTrk->
z());
269 double dang = 200.;
270 for(int j = 0; j < tagtrk.size(); j++) {
272 if(!(*jtTrk)->isExtTrackValid()) continue;
276 double angd = extpos.angle(emcpos);
277 if(angd < dang) dang = angd;
278 }
279 dang = dang * 180 / (CLHEP::pi);
280 if(fabs(dang)<20.) continue;
281
282 double eraw = emcTrk->
energy();
283 if(eraw > EGam_max_0) EGam_max_0 = eraw;
284 }
285 }
286
287 m_cosmic_ok = cosmic_ok;
288 m_EGam_max_0 = EGam_max_0;
289 m_nGood = iCharge_good.size();
290 m_nGam = iGam.size();
292 m_event = event;
293
297
298 m_tuple1->write();
299
300
301
302
303
304 }
305
306 }
307 }
308
309 return StatusCode::SUCCESS;
310
311}
EvtRecTrackCol::iterator EvtRecTrackIterator
double cos(const BesAngle a)
const Hep3Vector emcPosition() const
const int emcVolumeNumber() const
const double theta() const
const HepSymMatrix err() const
const HepVector helix() const
......
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
void Mdset(double event, SmartDataPtr< EvtRecTrackCol > evtRecTrkCol, Vint iGood, Vint iGam, int mdset, double Ebeam, int PID_flag, int Charge_candidate_D)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol