58 MsgStream log(
msgSvc(), name());
60 log << MSG::INFO <<
"in initialize()" << endmsg;
64 if ( nt1 ) m_tuple1 = nt1;
66 m_tuple1 =
ntupleSvc()->book (
"FILE1/vxyz", CLID_ColumnWiseTuple,
"track N-Tuple example");
68 status = m_tuple1->addItem (
"vx0", m_vx0);
69 status = m_tuple1->addItem (
"vy0", m_vy0);
70 status = m_tuple1->addItem (
"vz0", m_vz0);
71 status = m_tuple1->addItem (
"vr0", m_vr0);
74 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple1) << endmsg;
75 return StatusCode::FAILURE;
80 if ( nt2 ) m_tuple2 = nt2;
82 m_tuple2 =
ntupleSvc()->book (
"FILE1/ks", CLID_ColumnWiseTuple,
"ks N-Tuple example");
84 status = m_tuple2->addItem (
"ksmass", m_ksmass);
85 status = m_tuple2->addItem (
"ksd", m_ksd);
86 status = m_tuple2->addItem (
"ksmode", m_ksmode);
89 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple2) << endmsg;
90 return StatusCode::FAILURE;
95 if ( nt3 ) m_tuple3 = nt3;
97 m_tuple3 =
ntupleSvc()->book (
"FILE1/pi0", CLID_ColumnWiseTuple,
"pi0 N-Tuple example");
99 status = m_tuple3->addItem (
"pi0mass", m_pi0mass);
100 status = m_tuple3->addItem (
"pi0mode", m_pi0mode);
103 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple3) << endmsg;
104 return StatusCode::FAILURE;
108 NTuplePtr nt4(
ntupleSvc(),
"FILE1/tagD");
109 if ( nt4 ) m_tuple4 = nt4;
111 m_tuple4 =
ntupleSvc()->book (
"FILE1/tagD", CLID_ColumnWiseTuple,
"DTag N-Tuple example");
113 status = m_tuple4->addItem (
"mode", m_mode);
114 status = m_tuple4->addItem (
"type", m_type);
115 status = m_tuple4->addItem (
"charge", m_charge);
116 status = m_tuple4->addItem (
"charm", m_charm);
117 status = m_tuple4->addItem (
"numofchildren", m_numofchildren);
118 status = m_tuple4->addItem (
"mass", m_mass);
119 status = m_tuple4->addItem (
"mBC", m_mBC);
120 status = m_tuple4->addItem (
"deltaE", m_deltae);
121 status = m_tuple4->addItem (
"E", m_e);
122 status = m_tuple4->addItem (
"notherTrk", m_ntrk);
125 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple4) << endmsg;
126 return StatusCode::FAILURE;
135 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
136 return StatusCode::SUCCESS;
143 MsgStream log(
msgSvc(), name());
144 log << MSG::INFO <<
"in execute()" << endreq;
146 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
147 int runNo=eventHeader->runNumber();
148 int eventNo=eventHeader->eventNumber();
155 SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol(eventSvc(),
"/Event/EvtRec/EvtRecVeeVertexCol");
156 if ( ! evtRecVeeVertexCol ) {
157 log << MSG::FATAL <<
"Could not find EvtRecVeeVertexCol" << endreq;
158 return StatusCode::FAILURE;
162 SmartDataPtr<EvtRecPi0Col> recPi0Col(eventSvc(),
"/Event/EvtRec/EvtRecPi0Col");
164 log << MSG::FATAL <<
"Could not find EvtRecPi0Col" << endreq;
165 return StatusCode::FAILURE;
170 Hep3Vector xorigin(0,0,0);
172 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
177 xorigin.setX(vertex[0]);
178 xorigin.setY(vertex[1]);
179 xorigin.setZ(vertex[2]);
190 return StatusCode::SUCCESS;
196 cout<<
"size of dtag:******:"<<iter_end-iter_begin<<endl;
206 cout<<
" there are "<< mode.size() <<
" candidates for this mode" <<endl;
207 for(
int i=0; i < mode.size(); i++){
210 cout<<
"No."<<i+1<<
" candidate deltaE is : "<< (*iter)->deltaE()<<endl;
217 for (
DTagToolIterator iter_dtag=iter_begin; iter_dtag != iter_end; iter_dtag++){
220 cout<<
"***********"<<endl;
221 cout<<
"***********"<<endl;
222 dtagTool<< iter_dtag;
231 HepLorentzVector
p4=(*iter_dtag)->p4();
232 p4.boost(-0.011,0,0);
234 Hep3Vector
p3=
p4.v();
236 m_mode=(*iter_dtag)->decayMode();
237 m_type=(*iter_dtag)->type();
238 m_charge=(*iter_dtag)->charge();
239 m_charm=(*iter_dtag)->charm();
240 m_numofchildren=(*iter_dtag)->numOfChildren();
241 m_mass=(*iter_dtag)->mass();
242 m_mBC=(*iter_dtag)->mBC();
243 m_e=(*iter_dtag)->beamE();
244 m_deltae=(*iter_dtag)->deltaE();
246 SmartRefVector<EvtRecTrack> tracks=(*iter_dtag)->tracks();
247 SmartRefVector<EvtRecTrack> othertracks=(*iter_dtag)->otherTracks();
248 SmartRefVector<EvtRecTrack> othershowers=(*iter_dtag)->otherShowers();
249 m_ntrk=othertracks.size();
256 cout<<
"same side track 1 charge is:"<<mdcKalTrk1->
charge()<<endl;
257 cout<<
"same side track 2 charge is:"<<mdcKalTrk2->
charge()<<endl;
259 for(
int tk=0; tk<othertracks.size(); tk++){
261 double pch=mdcTrk->
p();
262 double x0=mdcTrk->
x();
263 double y0=mdcTrk->
y();
264 double z0=mdcTrk->
z();
265 double phi0=mdcTrk->
helix(1);
266 double xp=xorigin.x();
267 double yp=xorigin.y();
268 double Rxy=(x0-xp)*
cos(phi0)+(y0-yp)*
sin(phi0);
275 nCharge += mdcTrk->
charge();
277 std::cout<<
"other side track ID is: "<<othertracks[tk]->trackId()<<std::endl;
279 if(dtagTool.
isPion(othertracks[tk]) )
280 cout<<
"it is pion"<<endl;
281 if(dtagTool.
isKaon(othertracks[tk]) )
282 cout<<
"it is kaon"<<endl;
288 for(
int i=0; i<othershowers.size(); i++){
302 m_mode=(*iter_dtag)->decayMode();
303 m_type=(*iter_dtag)->type();
304 m_charge=(*iter_dtag)->charge();
305 m_charm=(*iter_dtag)->charm();
306 m_numofchildren=(*iter_dtag)->numOfChildren();
307 m_mass=(*iter_dtag)->mass();
308 m_mBC=(*iter_dtag)->mBC();
309 m_e=(*iter_dtag)->beamE();
310 m_deltae=(*iter_dtag)->deltaE();
312 SmartRefVector<EvtRecTrack> othertracks=(*iter_dtag)->otherTracks();
313 m_ntrk=othertracks.size();
321 vector<int> pi0id= dtagTool.
pi0Id(iter_dtag);
322 cout<<
"xxxxxxxxxxxxxxxxxxxxxxxxx"<<
"num of pi0 is:"<<pi0id.size()<<endl;
324 for(
int i=0; i<pi0id.size(); i++){
326 cout<<
"pi0Mass: " << (*pi0Itr)->unconMass() << endl;
331 SmartRefVector<EvtRecTrack> showers=(*iter_dtag)->showers();
333 for(EvtRecPi0Col::iterator pi0Itr = recPi0Col->begin();
334 pi0Itr < recPi0Col->end(); pi0Itr++){
340 int heGammaTrkId = heGammaTrk->
trackId();
341 int leGammaTrkId = leGammaTrk->
trackId();
343 if((heGammaTrkId != showers[0]->trackId())&&
344 (heGammaTrkId != showers[1]->trackId()))
continue;
345 if((leGammaTrkId != showers[0]->trackId())&&
346 (leGammaTrkId != showers[1]->trackId()))
continue;
351 cout<<
"pi0Mass: " << (*pi0Itr)->unconMass() << endl;
352 cout<<
" E(high): " << heGamma->
energy() << endl;
353 cout<<
" E(low) : " << leGamma->
energy() << endl;
355 m_pi0mass = (*pi0Itr)->unconMass();
356 m_pi0mode = (*iter_dtag)->decayMode();
373 m_mode=(*iter_dtag)->decayMode();
374 m_type=(*iter_dtag)->type();
375 m_charge=(*iter_dtag)->charge();
376 m_charm=(*iter_dtag)->charm();
377 m_numofchildren=(*iter_dtag)->numOfChildren();
378 m_mass=(*iter_dtag)->mass();
379 m_mBC=(*iter_dtag)->mBC();
380 m_e=(*iter_dtag)->beamE();
381 m_deltae=(*iter_dtag)->deltaE();
383 SmartRefVector<EvtRecTrack> othertracks=(*iter_dtag)->otherTracks();
384 m_ntrk=othertracks.size();
391 vector<int> ksid= dtagTool.
ksId(iter_dtag);
392 cout<<
"xxxxxxxxxxxxxxxxxxxxxxxxx"<<
"num of ks is:"<<ksid.size()<<endl;
394 for(
int i=0; i<ksid.size(); i++){
396 cout<<
"ksMass: " << (*ksItr)->mass() << endl;
402 SmartRefVector<EvtRecTrack> tracks=(*iter_dtag)->tracks();
404 for(EvtRecVeeVertexCol::iterator ksItr = evtRecVeeVertexCol->begin();
405 ksItr < evtRecVeeVertexCol->end(); ksItr++){
408 if((*ksItr)->vertexId() != 310)
continue;
413 int ksChild1TrkId = aKsChild1Trk->
trackId();
414 int ksChild2TrkId = aKsChild2Trk->
trackId();
416 if((ksChild1TrkId != tracks[0]->trackId())&&
417 (ksChild1TrkId != tracks[1]->trackId()))
continue;
418 if((ksChild2TrkId != tracks[0]->trackId())&&
419 (ksChild2TrkId != tracks[1]->trackId()))
continue;
421 cout<<
"ksMass: " << (*ksItr)->mass() << endl;
423 Hep3Vector ks_D3(0,0,0);
424 ks_D3.set((*ksItr)->w()[4],(*ksItr)->w()[5],(*ksItr)->w()[6]);
426 m_ksmass = (*ksItr)->mass();
428 m_ksmode = (*iter_dtag)->decayMode();
444 m_mode=(*iter_dtag)->decayMode();
445 m_type=(*iter_dtag)->type();
446 m_charge=(*iter_dtag)->charge();
447 m_charm=(*iter_dtag)->charm();
448 m_numofchildren=(*iter_dtag)->numOfChildren();
449 m_mass=(*iter_dtag)->mass();
450 m_mBC=(*iter_dtag)->mBC();
451 m_e=(*iter_dtag)->beamE();
452 m_deltae=(*iter_dtag)->deltaE();
454 SmartRefVector<EvtRecTrack> othertracks=(*iter_dtag)->otherTracks();
455 m_ntrk=othertracks.size();
465 m_mode=(*iter_dtag)->decayMode();
466 m_type=(*iter_dtag)->type();
467 m_charge=(*iter_dtag)->charge();
468 m_charm=(*iter_dtag)->charm();
469 m_numofchildren=(*iter_dtag)->numOfChildren();
470 m_mass=(*iter_dtag)->mass();
471 m_mBC=(*iter_dtag)->mBC();
472 m_e=(*iter_dtag)->beamE();
473 m_deltae=(*iter_dtag)->deltaE();
475 SmartRefVector<EvtRecTrack> othertracks=(*iter_dtag)->otherTracks();
476 m_ntrk=othertracks.size();
486 cout<<
"**************"<<endl;
487 cout<<
"**************"<<endl;
488 cout<<
"test print only D0/Dp/Ds modes"<<endl;
491 vector<int> d0itindex= dtagTool.
D0modes();
492 for(
int i=0; i< d0itindex.size(); i++){
494 cout<<
"No."<<i+1<<
" D0 mode is :"<< (*iter)->decayMode()<<endl;
498 vector<int> dpitindex= dtagTool.
Dpmodes();
499 for(
int i=0; i< dpitindex.size(); i++){
501 cout<<
"No."<<i+1<<
" Dp mode is :"<< (*iter)->decayMode()<<endl;
505 vector<int> dsitindex= dtagTool.
Dsmodes();
506 for(
int i=0; i< dsitindex.size(); i++){
508 cout<<
"No."<<i+1<<
" Ds mode is :"<< (*iter)->decayMode()<<endl;
514 cout<<
"**************"<<endl;
515 cout<<
"**************"<<endl;
516 cout<<
"test single tag "<<endl;
519 cout<<
" find single tag mode: "<< (*dtagTool.
stag())->decayMode() <<endl;
523 cout<<
"cosmic and lepton backgaround veto"<<endl;
524 cout<<
" find single tag mode: "<< (*dtagTool.
stag())->decayMode() <<endl;
529 cout<<
"**************"<<endl;
530 cout<<
"**************"<<endl;
531 cout<<
"test double tag "<<endl;
538 cout<<
" find double tag mode 1 :"<<endl;
539 dtagTool<<dtagTool.
dtag1();
540 cout<<
" find double tag mode 2: "<< endl;
541 dtagTool<<dtagTool.
dtag2();
547 cout<<
" find double tag mode 1 :"<<endl;
548 dtagTool<<dtagTool.
dtag1();
549 cout<<
" find double tag mode 2: "<< endl;
550 dtagTool<<dtagTool.
dtag2();
557 cout<<
" double tag by invariant mass:"<<endl;
558 cout<<
" find double tag mode 1 :"<<endl;
559 dtagTool<<dtagTool.
dtag1();
560 cout<<
" find double tag mode 2: "<< endl;
561 dtagTool<<dtagTool.
dtag2();
568 vector<DTagToolIterator> vdtag1=dtagTool.
vdtag1();
569 vector<DTagToolIterator> vdtag2=dtagTool.
vdtag2();
571 cout<<
" list of all doule tags:"<<endl;
572 for(
int i=0;i<vdtag1.size();i++){
573 cout<<
" find double tag mode 1 :"<<endl;
575 cout<<
" find double tag mode 2: "<< endl;