1#include "GaudiKernel/MsgStream.h"
2#include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/SmartDataPtr.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/PropertyMgr.h"
8#include "GaudiKernel/Bootstrap.h"
9#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/INTupleSvc.h"
23#include "GaudiKernel/NTuple.h"
24#include "GaudiKernel/Bootstrap.h"
25#include "GaudiKernel/IHistogramSvc.h"
26#include "CLHEP/Vector/ThreeVector.h"
27#include "CLHEP/Vector/LorentzVector.h"
28#include "CLHEP/Vector/TwoVector.h"
29using CLHEP::Hep3Vector;
30using CLHEP::Hep2Vector;
31using CLHEP::HepLorentzVector;
32#include "CLHEP/Geometry/Point3D.h"
33#ifndef ENABLE_BACKWARDS_COMPATIBILITY
45typedef std::vector<int>
Vint;
46typedef std::vector<HepLorentzVector>
Vp4;
54 Algorithm(name, pSvcLocator) {
56 declareProperty(
"Vxy0cut", m_vxy0cut=2.0);
57 declareProperty(
"Vz0cut", m_vz0cut=20.0);
58 declareProperty(
"angdcut", m_angdcut=30.0);
59 declareProperty(
"CheckDedx", m_checkDedx = 1);
60 declareProperty(
"CheckTof", m_checkTof = 1);
61 declareProperty(
"CheckExt", m_checkExt = 1);
62 declareProperty(
"CheckEmc", m_checkEmc = 1);
63 declareProperty(
"CheckMuc", m_checkMuc = 1);
64 declareProperty(
"ParticleID", m_particleID = -211);
65 declareProperty(
"Itrack", m_itrack = 0);
66 declareProperty(
"PID_mode", m_pid_mode = 0);
73 MsgStream log(
msgSvc(), name());
75 log << MSG::INFO <<
"in initialize()" << endmsg;
78 NTuplePtr nt1(
ntupleSvc(),
"FILE1/mdctrack");
79 if ( nt1 ) m_tuple1 = nt1;
81 m_tuple1 =
ntupleSvc()->book (
"FILE1/mdctrack", CLID_ColumnWiseTuple,
"ks N-Tuple example");
83 status = m_tuple1->addItem (
"mdc_vx0", m_vx0);
84 status = m_tuple1->addItem (
"mdc_vy0", m_vy0);
85 status = m_tuple1->addItem (
"mdc_vz0", m_vz0);
86 status = m_tuple1->addItem (
"mdc_pch", m_pch);
87 status = m_tuple1->addItem (
"mdc_trackid", m_trackid);
88 status = m_tuple1->addItem (
"mdc_charge", m_charge);
89 status = m_tuple1->addItem (
"mdc_pxy0", m_pxy0);
90 status = m_tuple1->addItem (
"mdc_px0", m_px0);
91 status = m_tuple1->addItem (
"mdc_py0", m_py0);
92 status = m_tuple1->addItem (
"mdc_pz0", m_pz0);
93 status = m_tuple1->addItem (
"mdc_r0", m_r0);
94 status = m_tuple1->addItem (
"mdc_phi", m_phi);
95 status = m_tuple1->addItem (
"mdc_theta", m_theta);
96 status = m_tuple1->addItem (
"mdc_ndof", m_ndof);
97 status = m_tuple1->addItem (
"mdc_nster", m_nster);
98 status = m_tuple1->addItem (
"mdc_stat", m_stat);
99 status = m_tuple1->addItem (
"mdc_angd", m_angd);
100 status = m_tuple1->addItem (
"mdc_rvxy0", m_rvxy0);
101 status = m_tuple1->addItem (
"mdc_rvz0", m_rvz0);
102 status = m_tuple1->addItem (
"mdc_d0", m_d0);
103 status = m_tuple1->addItem (
"mdc_phi0", m_phi0);
104 status = m_tuple1->addItem (
"mdc_kappa", m_kappa);
105 status = m_tuple1->addItem (
"mdc_dz", m_dzhelix);
106 status = m_tuple1->addItem (
"mdc_tanlamda", m_tanlamda);
107 status = m_tuple1->addItem (
"mdc_err11", m_err11);
108 status = m_tuple1->addItem (
"mdc_err21", m_err21);
109 status = m_tuple1->addItem (
"mdc_err22", m_err22);
110 status = m_tuple1->addItem (
"mdc_err31", m_err31);
111 status = m_tuple1->addItem (
"mdc_err32", m_err32);
112 status = m_tuple1->addItem (
"mdc_err33", m_err33);
113 status = m_tuple1->addItem (
"mdc_err41", m_err41);
114 status = m_tuple1->addItem (
"mdc_err42", m_err42);
115 status = m_tuple1->addItem (
"mdc_err43", m_err43);
116 status = m_tuple1->addItem (
"mdc_err44", m_err44);
117 status = m_tuple1->addItem (
"mdc_err51", m_err51);
118 status = m_tuple1->addItem (
"mdc_err52", m_err52);
119 status = m_tuple1->addItem (
"mdc_err53", m_err53);
120 status = m_tuple1->addItem (
"mdc_err54", m_err54);
121 status = m_tuple1->addItem (
"mdc_err55", m_err55);
123 status = m_tuple1->addItem (
"mdc_kal_px", m_mdc_kal_px);
124 status = m_tuple1->addItem (
"mdc_kal_py", m_mdc_kal_py);
125 status = m_tuple1->addItem (
"mdc_kal_pz", m_mdc_kal_pz);
126 status = m_tuple1->addItem (
"mdc_kal_p", m_mdc_kal_p);
127 status = m_tuple1->addItem (
"mdc_kal_pxy", m_mdc_kal_pxy);
128 status = m_tuple1->addItem (
"mdc_kal_costheta", m_mdc_kal_costheta);
130 status = m_tuple1->addItem (
"NGch", m_ngch);
133 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple1) << endmsg;
134 return StatusCode::FAILURE;
142 NTuplePtr nt2(
ntupleSvc(),
"FILE1/dedx");
143 if ( nt2 ) m_tuple2 = nt2;
145 m_tuple2 =
ntupleSvc()->book (
"FILE1/dedx", CLID_ColumnWiseTuple,
"ks N-Tuple example");
147 status = m_tuple2->addItem (
"dedx_ptrk", m_ptrk);
148 status = m_tuple2->addItem (
"dedx_chie", m_chie);
149 status = m_tuple2->addItem (
"dedx_chimu", m_chimu);
150 status = m_tuple2->addItem (
"dedx_chipi", m_chipi);
151 status = m_tuple2->addItem (
"dedx_chik", m_chik);
152 status = m_tuple2->addItem (
"dedx_chip", m_chip);
153 status = m_tuple2->addItem (
"dedx_probPH", m_probPH);
154 status = m_tuple2->addItem (
"dedx_normPH", m_normPH);
155 status = m_tuple2->addItem (
"dedx_ghit", m_ghit);
156 status = m_tuple2->addItem (
"dedx_thit", m_thit);
159 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple2) << endmsg;
160 return StatusCode::FAILURE;
169 if ( nt3 ) m_tuple3 = nt3;
171 m_tuple3 =
ntupleSvc()->book (
"FILE1/ext",CLID_ColumnWiseTuple,
"ks N-Tuple example");
174 status = m_tuple3->addItem (
"ext_tof1", m_tof1);
175 status = m_tuple3->addItem (
"ext_tof1path", m_tof1path);
176 status = m_tuple3->addItem (
"ext_tof1z", m_tof1z);
177 status = m_tuple3->addItem (
"ext_tof1t", m_tof1t);
178 status = m_tuple3->addItem (
"ext_tof1x", m_tof1x);
179 status = m_tuple3->addItem (
"ext_tof1y", m_tof1y);
181 status = m_tuple3->addItem (
"ext_tof2", m_tof2);
182 status = m_tuple3->addItem (
"ext_tof2path", m_tof2path);
183 status = m_tuple3->addItem (
"ext_tof2z", m_tof2z);
184 status = m_tuple3->addItem (
"ext_tof2t", m_tof2t);
185 status = m_tuple3->addItem (
"ext_tof2x", m_tof2x);
186 status = m_tuple3->addItem (
"ext_tof2y", m_tof2y);
188 status = m_tuple3->addItem (
"ext_emctheta", m_emctheta);
189 status = m_tuple3->addItem (
"ext_emcphi", m_emcphi);
190 status = m_tuple3->addItem (
"ext_emcpath", m_emcpath);
192 status = m_tuple3->addItem (
"ext_mucz", m_mucz);
193 status = m_tuple3->addItem (
"ext_muct", m_muct);
194 status = m_tuple3->addItem (
"ext_mucx", m_mucx);
195 status = m_tuple3->addItem (
"ext_mucy", m_mucy);
200 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple3) << endmsg;
201 return StatusCode::FAILURE;
212 if ( nt4 ) m_tuple4 = nt4;
214 m_tuple4 =
ntupleSvc()->book (
"FILE1/tof", CLID_ColumnWiseTuple,
"ks N-Tuple example");
216 status = m_tuple4->addItem (
"tof_path", m_path);
217 status = m_tuple4->addItem (
"tof_zrhit", m_zrhit);
218 status = m_tuple4->addItem (
"tof_ph", m_ph);
219 status = m_tuple4->addItem (
"tof_tof", m_tof);
220 status = m_tuple4->addItem (
"tof_errtof", m_errtof);
221 status = m_tuple4->addItem (
"tof_beta", m_beta);
222 status = m_tuple4->addItem (
"tof_texpe", m_texpe);
223 status = m_tuple4->addItem (
"tof_texpmu", m_texpmu);
224 status = m_tuple4->addItem (
"tof_texppi", m_texppi);
225 status = m_tuple4->addItem (
"tof_texpka", m_texpka);
226 status = m_tuple4->addItem (
"tof_texppro", m_texppro);
227 status = m_tuple4->addItem (
"tof_toffsete", m_toffsete);
228 status = m_tuple4->addItem (
"tof_toffsetmu", m_toffsetmu);
229 status = m_tuple4->addItem (
"tof_toffsetpi", m_toffsetpi);
230 status = m_tuple4->addItem (
"tof_toffsetka", m_toffsetka);
231 status = m_tuple4->addItem (
"tof_toffsetpro", m_toffsetpro);
232 status = m_tuple4->addItem (
"tof_toffsetatpr", m_toffsetatpr);
233 status = m_tuple4->addItem (
"tof_sigmae", m_sigmae);
234 status = m_tuple4->addItem (
"tof_sigmamu", m_sigmamu);
235 status = m_tuple4->addItem (
"tof_sigmapi", m_sigmapi);
236 status = m_tuple4->addItem (
"tof_sigmaka", m_sigmaka);
237 status = m_tuple4->addItem (
"tof_sigmapro", m_sigmapro);
238 status = m_tuple4->addItem (
"tof_sigmaatpr", m_sigmaatpr);
239 status = m_tuple4->addItem (
"tof_quality", m_quality);
240 status = m_tuple4->addItem (
"tof_t0", m_t0);
241 status = m_tuple4->addItem (
"tof_errt0", m_errt0);
242 status = m_tuple4->addItem (
"tof_errz", m_errz);
243 status = m_tuple4->addItem (
"tof_phi", m_phitof);
244 status = m_tuple4->addItem (
"tof_errphi", m_errphi);
245 status = m_tuple4->addItem (
"tof_energy", m_energy);
246 status = m_tuple4->addItem (
"tof_errenergy", m_errenergy);
249 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple4) << endmsg;
250 return StatusCode::FAILURE;
260 if ( nt5 ) m_tuple5 = nt5;
262 m_tuple5 =
ntupleSvc()->book (
"FILE1/emc",CLID_ColumnWiseTuple,
"ks N-Tuple example");
265 status = m_tuple5->addItem (
"emc_x", m_x);
266 status = m_tuple5->addItem (
"emc_y", m_y);
267 status = m_tuple5->addItem (
"emc_z", m_z);
268 status = m_tuple5->addItem (
"emc_theta", m_thetaemc);
269 status = m_tuple5->addItem (
"emc_phi", m_phiemc);
270 status = m_tuple5->addItem (
"emc_dx", m_dx);
271 status = m_tuple5->addItem (
"emc_dy", m_dy);
272 status = m_tuple5->addItem (
"emc_dz", m_dz);
273 status = m_tuple5->addItem (
"emc_dtheta", m_dtheta);
274 status = m_tuple5->addItem (
"emc_dphi", m_dphi);
275 status = m_tuple5->addItem (
"emc_energy", m_energyemc);
276 status = m_tuple5->addItem (
"emc_dE", m_de);
277 status = m_tuple5->addItem (
"emc_eseed", m_eseed);
278 status = m_tuple5->addItem (
"emc_e3x3", m_e3x3);
279 status = m_tuple5->addItem (
"emc_e5x5", m_e5x5);
280 status = m_tuple5->addItem (
"emc_secp", m_secp);
281 status = m_tuple5->addItem (
"emc_latp", m_latp);
284 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple5) << endmsg;
285 return StatusCode::FAILURE;
293 if ( nt6 ) m_tuple6 = nt6;
295 m_tuple6 =
ntupleSvc()->book (
"FILE1/muc",CLID_ColumnWiseTuple,
"ks N-Tuple example");
298 status = m_tuple6->addItem (
"muc_depth", m_depth);
299 status = m_tuple6->addItem (
"muc_chi2", m_chi2);
300 status = m_tuple6->addItem (
"muc_rms", m_rms);
301 status = m_tuple6->addItem (
"muc_xpos", m_xpos);
302 status = m_tuple6->addItem (
"muc_ypos", m_ypos);
303 status = m_tuple6->addItem (
"muc_zpos", m_zpos);
304 status = m_tuple6->addItem (
"muc_xsigma", m_xpossigma);
305 status = m_tuple6->addItem (
"muc_ysigma", m_ypossigma);
306 status = m_tuple6->addItem (
"muc_zsigma", m_zpossigma);
307 status = m_tuple6->addItem (
"muc_px", m_px);
308 status = m_tuple6->addItem (
"muc_py", m_py);
309 status = m_tuple6->addItem (
"muc_pz", m_pz);
310 status = m_tuple6->addItem (
"muc_distance", m_distance);
311 status = m_tuple6->addItem (
"muc_deltaphi", m_deltaphi);
314 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple6) << endmsg;
315 return StatusCode::FAILURE;
323 NTuplePtr nt7(
ntupleSvc(),
"FILE1/runinfo");
324 if ( nt7 ) m_tuple7 = nt7;
326 m_tuple7 =
ntupleSvc()->book (
"FILE1/runinfo",CLID_ColumnWiseTuple,
"ks N-Tuple example");
329 status = m_tuple7->addItem (
"runinfo_runNo", m_runNo);
330 status = m_tuple7->addItem (
"runinfo_event", m_event);
331 status = m_tuple7->addItem (
"runinfo_totcharged", m_totcharged);
332 status = m_tuple7->addItem (
"runinfo_totneutral", m_totneutral);
333 status = m_tuple7->addItem (
"runinfo_tottracks", m_tottracks);
334 status = m_tuple7->addItem (
"runinfo_ngood", m_ngood);
335 status = m_tuple7->addItem (
"runinfo_ncharge", m_ncharge);
336 status = m_tuple7->addItem (
"kal_n", m_kaln);
337 status = m_tuple7->addItem (
"costheta_n", m_costhetan);
338 status = m_tuple7->addItem (
"p_n", m_pn);
339 status = m_tuple7->addItem (
"charge", m_mat_charge);
340 status = m_tuple7->addItem (
"diff_pxy", m_diff_pxy);
341 status = m_tuple7->addItem (
"diff_p", m_diff_pch);
342 status = m_tuple7->addItem (
"diff_costheta", m_diff_costheta);
345 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple7) << endmsg;
346 return StatusCode::FAILURE;
353 NTuplePtr nt8(
ntupleSvc(),
"FILE1/mcpart");
354 if ( nt8 ) m_tuple8 = nt8;
356 m_tuple8 =
ntupleSvc()->book (
"FILE1/mcpart",CLID_ColumnWiseTuple,
"ks N-Tuple example");
358 status = m_tuple8->addItem (
"mcpart_vx", m_vx);
359 status = m_tuple8->addItem (
"mcpart_vy", m_vy);
360 status = m_tuple8->addItem (
"mcpart_vz", m_vz);
361 status = m_tuple8->addItem (
"mcpart_vr0", m_vr0);
362 status = m_tuple8->addItem (
"mcpart_px", m_pxmc);
363 status = m_tuple8->addItem (
"mcpart_py", m_pymc);
364 status = m_tuple8->addItem (
"mcpart_pz", m_pzmc);
365 status = m_tuple8->addItem (
"mcpart_e", m_e);
366 status = m_tuple8->addItem (
"mcpart_p", m_p);
367 status = m_tuple8->addItem (
"mcpart_pxy", m_pxymc);
368 status = m_tuple8->addItem (
"mcpart_theta", m_thetamc);
369 status = m_tuple8->addItem (
"mcpart_costheta", m_costhetamc);
371 status = m_tuple8->addItem (
"mcpart_phi", m_phimc);
372 status = m_tuple8->addItem (
"mcpart_m", m_m);
373 status = m_tuple8->addItem (
"mcpart_pro", m_pro);
374 status = m_tuple8->addItem (
"mcpart_index", m_index);
375 status = m_tuple8->addItem (
"totalcharged", m_mctotcharged);
380 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple8) << endmsg;
381 return StatusCode::FAILURE;
387 NTuplePtr nt9(
ntupleSvc(),
"FILE1/pid_kal");
388 if ( nt9 ) m_tuple9 = nt9;
390 m_tuple9 =
ntupleSvc()->book (
"FILE1/pid_kal", CLID_ColumnWiseTuple,
"ks N-Tuple example");
392 status = m_tuple9->addItem (
"pid_ptrk", m_ptrk_pid);
393 status = m_tuple9->addItem (
"pid_cost", m_cost_pid);
394 status = m_tuple9->addItem (
"pid_dedx", m_dedx_pid);
395 status = m_tuple9->addItem (
"pid_tof1", m_tof1_pid);
396 status = m_tuple9->addItem (
"pid_tof2", m_tof2_pid);
397 status = m_tuple9->addItem (
"prob_pion", m_prob_pid_pion);
398 status = m_tuple9->addItem (
"prob_kaon", m_prob_pid_kaon);
399 status = m_tuple9->addItem (
"prob_proton", m_prob_pid_proton);
401 status = m_tuple9->addItem (
"kal_px", m_kalpx);
402 status = m_tuple9->addItem (
"kal_py", m_kalpy);
403 status = m_tuple9->addItem (
"kal_pz", m_kalpz);
404 status = m_tuple9->addItem (
"kal_p", m_kalp);
405 status = m_tuple9->addItem (
"kal_pxy", m_kalpxy);
407 status = m_tuple9->addItem (
"kal_costheta", m_kalcostheta);
409 status = m_tuple9->addItem (
"kal_d0", m_d0kal);
410 status = m_tuple9->addItem (
"kal_phi0", m_phi0kal);
411 status = m_tuple9->addItem (
"kal_kappa", m_kappakal);
412 status = m_tuple9->addItem (
"kal_dz", m_dzhelixkal);
413 status = m_tuple9->addItem (
"kal_tanlamda", m_tanlamdakal);
414 status = m_tuple9->addItem (
"kal_err11", m_err11kal);
415 status = m_tuple9->addItem (
"kal_err21", m_err21kal);
416 status = m_tuple9->addItem (
"kal_err22", m_err22kal);
417 status = m_tuple9->addItem (
"kal_err31", m_err31kal);
418 status = m_tuple9->addItem (
"kal_err32", m_err32kal);
419 status = m_tuple9->addItem (
"kal_err33", m_err33kal);
420 status = m_tuple9->addItem (
"kal_err41", m_err41kal);
421 status = m_tuple9->addItem (
"kal_err42", m_err42kal);
422 status = m_tuple9->addItem (
"kal_err43", m_err43kal);
423 status = m_tuple9->addItem (
"kal_err44", m_err44kal);
424 status = m_tuple9->addItem (
"kal_err51", m_err51kal);
425 status = m_tuple9->addItem (
"kal_err52", m_err52kal);
426 status = m_tuple9->addItem (
"kal_err53", m_err53kal);
427 status = m_tuple9->addItem (
"kal_err54", m_err54kal);
428 status = m_tuple9->addItem (
"kal_err55", m_err55kal);
429 status = m_tuple9->addItem (
"kal_nn", m_kalnn);
430 status = m_tuple9->addItem (
"costheta_nn", m_costhetann);
431 status = m_tuple9->addItem (
"p_nn", m_pnn);
433 status = m_tuple9->addItem (
"comp_costheta", m_comp_costheta);
438 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple9) << endmsg;
439 return StatusCode::FAILURE;
449 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
450 return StatusCode::SUCCESS;
456 setFilterPassed(
false);
459 MsgStream log(
msgSvc(), name());
460 log << MSG::INFO <<
"in execute()" << endreq;
464 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
465 int runNo=eventHeader->runNumber();
466 int event=eventHeader->eventNumber();
467 log << MSG::DEBUG <<
"run, evtnum = "
482 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
483 << evtRecEvent->totalCharged() <<
" , "
484 << evtRecEvent->totalNeutral() <<
" , "
485 << evtRecEvent->totalTracks() <<endreq;
494 Hep3Vector xorigin(0,0,0);
496 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
501 xorigin.setX(dbv[0]);
502 xorigin.setY(dbv[1]);
503 xorigin.setZ(dbv[2]);
510 SmartDataPtr<Event::McParticleCol> mcParticleCol(eventSvc(),
"/Event/MC/McParticleCol");
512 std::cout<<
"could not retrieve McParticleCol"<<std::endl;
513 return StatusCode::FAILURE;
516 double costhetamc=-9.;
517 Event::McParticleCol::iterator iter_mc=mcParticleCol->begin();
518 HepLorentzVector initialFourMomentum;
519 for(;iter_mc!=mcParticleCol->end();iter_mc++){
520 if(
abs((*iter_mc)->particleProperty())!=
abs(m_particleID))
continue;
521 HepLorentzVector initialPosition=(*iter_mc)->initialPosition();
522 m_vx=initialPosition.x();
523 m_vy=initialPosition.y();
524 m_vz=initialPosition.z();
525 m_vr0=sqrt(m_vx*m_vx+m_vy*m_vy);
527 initialFourMomentum=(*iter_mc)->initialFourMomentum();
528 m_pxmc=initialFourMomentum.px();
529 m_pymc=initialFourMomentum.py();
530 m_pzmc=initialFourMomentum.pz();
531 m_e=initialFourMomentum.e();
532 m_p=sqrt(m_pxmc*m_pxmc+m_pymc*m_pymc+m_pzmc*m_pzmc);
533 m_pxymc=sqrt(m_pxmc*m_pxmc+m_pymc*m_pymc);
534 m_thetamc=initialFourMomentum.theta()*180/(CLHEP::pi);
535 m_phimc=initialFourMomentum.phi()*180/(CLHEP::pi);
536 m_m=initialFourMomentum.m();
537 m_costhetamc=initialFourMomentum.cosTheta();
539 costhetamc=m_costhetamc;
541 m_pro=(*iter_mc)->particleProperty();
542 m_index=(*iter_mc)->trackIndex();
545 m_mctotcharged=evtRecEvent->totalCharged();
548 if(m_costhetamc>-0.7&&m_costhetamc<0.7&&m_pxymc>0.2&&m_pxymc<0.3) mm=1;
550 double pxymc=m_pxymc;
568 double Rang_comp=50.;
570 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
572 if(!(*itTrk)->isMdcTrackValid())
continue;
573 if(!(*itTrk)->isMdcKalTrackValid())
continue;
576 double pch=mdcTrk->
p();
577 double x0=mdcTrk->
x();
578 double y0=mdcTrk->
y();
579 double z0=mdcTrk->
z();
582 double pxy0=mdcTrk->
pxy();
583 double px0=mdcTrk->
px();
584 double py0=mdcTrk->
py();
585 double pz0=mdcTrk->
pz();
586 double r0 = mdcTrk->
r();
587 double phi=mdcTrk->
phi()*180/(CLHEP::pi);
588 double theta=mdcTrk->
theta()*180/(CLHEP::pi);
589 int ndof=mdcTrk->
ndof();
590 int nster=mdcTrk->
nster();
591 int stat= mdcTrk->
stat();
593 double phi0=mdcTrk->
helix(1);
594 double xv=xorigin.x();
595 double yv=xorigin.y();
596 double Rxy=(x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0);
616 HepVector a = mdcTrk->
helix();
623 HepSymMatrix Ea = mdcTrk->
err();
643 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
646 HepVector vecipa = helixip.
a();
647 double Rvxy0=fabs(vecipa[0]);
648 double Rvz0=vecipa[3];
649 double Rvphi0=vecipa[1];
654 HepLorentzVector mdcpos(m_px0,m_py0,m_pz0,m_e);
655 m_angd=initialFourMomentum.angle(mdcpos)*180/(CLHEP::pi);
657 if(fabs(Rvz0) >= m_vz0cut)
continue;
658 if(fabs(Rvxy0) >= m_vxy0cut)
continue;
661 if(m_angd<Rang_comp){
672 nCharge += mdcTrk->
charge();
683 int nGood = iGood.size();
684 log << MSG::DEBUG <<
"nGood, totcharge = " << nGood <<
" , " << nCharge << endreq;
686 if(mm==1&&nGood==0) setFilterPassed(
true);
690 for(
int i = 0; i < nGood; i++) {
700 m_mdc_kal_px=mdcKalTrk->
px();
701 m_mdc_kal_py=mdcKalTrk->
py();
702 m_mdc_kal_pz=mdcKalTrk->
pz();
703 m_mdc_kal_p=sqrt(m_mdc_kal_px*m_mdc_kal_px+m_mdc_kal_py*m_mdc_kal_py+m_mdc_kal_pz*m_mdc_kal_pz);
704 m_mdc_kal_pxy=sqrt(m_mdc_kal_px*m_mdc_kal_px+m_mdc_kal_py*m_mdc_kal_py);
706 m_mdc_kal_costheta=
cos(mdcKalTrk->
theta());
712 double mdc_pxy0=m_pxy0;
713 double mdc_pch=m_pch;
714 double mdc_costheta=
cos(m_theta);
723 m_totcharged=evtRecEvent->totalCharged();
724 m_totneutral=evtRecEvent->totalNeutral();
725 m_tottracks =evtRecEvent->totalTracks();
736 m_costhetan=costhetamc;
744 for(
int i = 0; i < nGood; i++) {
745 if (i != itrack)
continue;
748 m_mat_charge=mdcTrk->
charge();
749 m_diff_pxy=fabs(m_kaln-mdc_pxy0);
750 m_diff_pch=fabs(m_pn-mdc_pch);
751 m_diff_costheta=fabs(m_costhetan-mdc_costheta);
770 for(
int i = 0; i < nGood; i++){
771 if (m_itrack==1&&i != itrack)
continue;
773 if(!(*itTrk)->isMdcTrackValid())
continue;
774 if(!(*itTrk)->isMdcDedxValid())
continue;
777 m_ptrk = mdcTrk->
p();
779 m_chie = dedxTrk->
chiE();
780 m_chimu = dedxTrk->
chiMu();
781 m_chipi = dedxTrk->
chiPi();
782 m_chik = dedxTrk->
chiK();
783 m_chip = dedxTrk->
chiP();
786 m_probPH = dedxTrk->
probPH();
787 m_normPH = dedxTrk->
normPH();
799 for(
int i = 0; i <nGood; i++){
800 if (m_itrack==1&&i != itrack)
continue;
802 if(!(*itTrk)->isExtTrackValid())
continue;
805 m_tof1 =extTrk->
tof1();
812 m_tof2 =extTrk->
tof2();
838 for(
int i = 0; i < nGood; i++){
839 if (m_itrack==1&&i != itrack)
continue;
841 if(!(*itTrk)->isTofTrackValid())
continue;
843 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
844 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
846 m_path=(*iter_tof)->path();
847 m_zrhit=(*iter_tof)->zrhit();
848 m_ph=(*iter_tof)->ph();
849 m_tof=(*iter_tof)->tof();
850 m_errtof=(*iter_tof)->errtof();
851 m_beta=(*iter_tof)->beta();
852 m_texpe=(*iter_tof)->texpElectron();
853 m_texpmu=(*iter_tof)->texpMuon();
854 m_texppi=(*iter_tof)->texpPion();
855 m_texpka=(*iter_tof)->texpKaon();
856 m_texppro=(*iter_tof)->texpProton();
857 m_toffsete=(*iter_tof)->toffsetElectron();
858 m_toffsetmu=(*iter_tof)->toffsetMuon();
859 m_toffsetpi=(*iter_tof)->toffsetPion();
860 m_toffsetka=(*iter_tof)->toffsetKaon();
861 m_toffsetpro=(*iter_tof)->toffsetProton();
862 m_toffsetatpr=(*iter_tof)->toffsetAntiProton();
863 m_sigmae=(*iter_tof)->sigmaElectron();
864 m_sigmamu=(*iter_tof)->sigmaMuon();
865 m_sigmapi=(*iter_tof)->sigmaPion();
866 m_sigmaka=(*iter_tof)->sigmaKaon();
867 m_sigmapro=(*iter_tof)->sigmaProton();
868 m_sigmaatpr=(*iter_tof)->sigmaAntiProton();
869 m_quality=(*iter_tof)->quality();
870 m_t0=(*iter_tof)->t0();
871 m_errt0=(*iter_tof)->errt0();
872 m_errz=(*iter_tof)->errz();
873 m_phitof=(*iter_tof)->phi()*180/(CLHEP::pi);
874 m_errphi=(*iter_tof)->errphi()*180/(CLHEP::pi);
875 m_energy=(*iter_tof)->energy();
876 m_errenergy=(*iter_tof)->errenergy();
888 for(
int i = 0; i < nGood; i++){
889 if (m_itrack==1&&i != itrack)
continue;
891 if(!(*itTrk)->isEmcShowerValid())
continue;
897 m_thetaemc=emcTrk->
theta()*180/(CLHEP::pi);
898 m_phiemc=emcTrk->
phi()*180/(CLHEP::pi);
902 m_dtheta=emcTrk->
dtheta()*180/(CLHEP::pi);
903 m_dphi=emcTrk->
dphi()*180/(CLHEP::pi);
904 m_energyemc=emcTrk->
energy();
906 m_eseed=emcTrk->
eSeed();
907 m_e3x3=emcTrk->
e3x3();
908 m_e5x5=emcTrk->
e5x5();
924 for(
int i = 0; i < nGood; i++) {
925 if(nGood!=1)
continue;
926 if (m_itrack==1&&i != itrack)
continue;
949 m_ptrk_pid = mdcTrk->
p();
974 m_kalpx=mdcKalTrk->
px();
975 m_kalpy=mdcKalTrk->
py();
976 m_kalpz=mdcKalTrk->
pz();
977 m_kalp=sqrt(m_kalpx*m_kalpx+m_kalpy*m_kalpy+m_kalpz*m_kalpz);
978 m_kalpxy=sqrt(m_kalpx*m_kalpx+m_kalpy*m_kalpy);
980 HepLorentzVector ptr;
982 ptr=mdcKalTrk->
p4(0.000511*0.000511);
983 m_kalcostheta=ptr.cosTheta();
985 double kalcostheta=m_kalcostheta;
986 m_comp_costheta=costhetamc-kalcostheta;
988 HepVector k= mdcKalTrk->
helix();
989 HepSymMatrix Ek = mdcKalTrk->
err();
1000 m_err22kal=Ek[1][1];
1002 m_err31kal=Ek[2][0];
1003 m_err32kal=Ek[2][1];
1004 m_err33kal=Ek[2][2];
1005 m_err41kal=Ek[3][0];
1006 m_err42kal=Ek[3][1];
1007 m_err43kal=Ek[3][2];
1008 m_err44kal=Ek[3][3];
1009 m_err51kal=Ek[4][0];
1010 m_err52kal=Ek[4][1];
1011 m_err53kal=Ek[4][2];
1012 m_err54kal=Ek[4][3];
1013 m_err55kal=Ek[4][4];
1017 m_costhetann=costhetamc;
1032 for(
int i = 0; i < nGood; i++){
1033 if (m_itrack==1&&i != itrack)
continue;
1035 if(!(*itTrk)->isMucTrackValid())
continue;
1038 m_depth=mucTrk->
depth();
1039 m_chi2=mucTrk->
chi2();
1040 m_rms=mucTrk->
rms();
1041 m_xpos=mucTrk->
xPos();
1042 m_ypos=mucTrk->
yPos();
1043 m_zpos=mucTrk->
zPos();
1051 m_deltaphi=mucTrk->
deltaPhi()*180/(CLHEP::pi);
1059 return StatusCode::SUCCESS;
1066 cout<<
"total number: "<<
Ncut0<<endl;
1067 cout<<
"nGood: "<<
Ncut1<<endl;
1068 MsgStream log(
msgSvc(), name());
1069 log << MSG::INFO <<
"in finalize()" << endmsg;
1070 return StatusCode::SUCCESS;
double sin(const BesAngle a)
double cos(const BesAngle a)
EvtRecTrackCol::iterator EvtRecTrackIterator
HepGeom::Point3D< double > HepPoint3D
std::vector< HepLorentzVector > Vp4
double secondMoment() const
const double tof1Path() const
const double mucPosSigmaAlongZ() const
const double emcPosSigmaAlongTheta() const
const double emcPosSigmaAlongPhi() const
const double tof2PosSigmaAlongY() const
const double mucPosSigmaAlongX() const
const double tof1() const
const double tof2() const
const double tof2PosSigmaAlongZ() const
const double tof1PosSigmaAlongX() const
const double tof2Path() const
const double tof2PosSigmaAlongT() const
const double mucPosSigmaAlongY() const
const double tof1PosSigmaAlongY() const
const double emcPath() const
const double tof1PosSigmaAlongT() const
const double mucPosSigmaAlongT() const
const double tof2PosSigmaAlongX() const
const double tof1PosSigmaAlongZ() const
const HepVector & helix() const
const double theta() const
static void setPidType(PidType pidType)
const HepSymMatrix & err() const
const HepLorentzVector p4() const
const double theta() const
const HepSymMatrix err() const
const int trackId() const
const HepVector helix() const
......
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
int methodProbability() const
int onlyPionKaonProton() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
double chiTof2(int n) const
void identify(const int pidcase)
void usePidSys(const int pidsys)
static ParticleID * instance()
bool IsPidInfoValid() const
double chiTof1(int n) const
double probProton() const
double chiDedx(int n) const
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol