3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/SmartDataPtr.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/PropertyMgr.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
48const double me = 0.000511;
49const double mpi = 0.13957;
51const double mmu = 0.105658;
53const double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
54const double velc = 29.9792458;
55const double PI = 3.1415926;
57typedef std::vector<int>
Vint;
58typedef std::vector<HepLorentzVector>
Vp4;
65 Algorithm(name, pSvcLocator) {
67 declareProperty(
"Vr0cut", m_vr0cut=1.0);
68 declareProperty(
"Vz0cut", m_vz0cut=5.0);
69 declareProperty(
"TrackCosThetaCut",m_cosThetaCut=0.93);
70 declareProperty(
"PipiDangCut",m_pipi_dang_cut=0.98);
72 declareProperty(
"CheckDedx", m_checkDedx =
true);
73 declareProperty(
"CheckTof", m_checkTof =
true);
75 declareProperty(
"Subsample", m_subsample_flag=
false);
76 declareProperty(
"Trigger", m_trigger_flag=
false);
77 declareProperty(
"DistinEMuon", m_distin_emuon=2.0);
79 declareProperty(
"EventRate", m_eventrate=
false);
80 declareProperty(
"ChanDet", m_chan_det=1);
85 MsgStream log(
msgSvc(), name());
87 log << MSG::INFO <<
"in initialize()" << endmsg;
92 if ( nt1 ) m_tuple1 = nt1;
94 m_tuple1 =
ntupleSvc()->book (
"FILE1/vxyz", CLID_ColumnWiseTuple,
"ks N-Tuple example");
96 status = m_tuple1->addItem (
"vx0", m_vx0);
97 status = m_tuple1->addItem (
"vy0", m_vy0);
98 status = m_tuple1->addItem (
"vz0", m_vz0);
99 status = m_tuple1->addItem (
"vr0", m_vr0);
102 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple1) << endmsg;
103 return StatusCode::FAILURE;
107 NTuplePtr nt2(
ntupleSvc(),
"FILE1/photon");
108 if ( nt2 ) m_tuple2 = nt2;
110 m_tuple2 =
ntupleSvc()->book (
"FILE1/photon", CLID_ColumnWiseTuple,
"ks N-Tuple example");
112 status = m_tuple2->addItem (
"dthe", m_dthe);
113 status = m_tuple2->addItem (
"dphi", m_dphi);
114 status = m_tuple2->addItem (
"dang", m_dang);
115 status = m_tuple2->addItem (
"eraw", m_eraw);
116 status = m_tuple2->addItem (
"nGam", m_nGam);
119 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple2) << endmsg;
120 return StatusCode::FAILURE;
126 NTuplePtr nt3(
ntupleSvc(),
"FILE1/dedx");
127 if ( nt3 ) m_tuple3 = nt3;
129 m_tuple3 =
ntupleSvc()->book (
"FILE1/dedx", CLID_ColumnWiseTuple,
"ks N-Tuple example");
131 status = m_tuple3->addItem (
"ptrk", m_ptrk);
132 status = m_tuple3->addItem (
"chie", m_chie);
133 status = m_tuple3->addItem (
"chimu", m_chimu);
134 status = m_tuple3->addItem (
"chipi", m_chipi);
135 status = m_tuple3->addItem (
"chik", m_chik);
136 status = m_tuple3->addItem (
"chip", m_chip);
137 status = m_tuple3->addItem (
"probPH", m_probPH);
138 status = m_tuple3->addItem (
"normPH", m_normPH);
139 status = m_tuple3->addItem (
"ghit", m_ghit);
140 status = m_tuple3->addItem (
"thit", m_thit);
143 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple3) << endmsg;
144 return StatusCode::FAILURE;
150 NTuplePtr nt4(
ntupleSvc(),
"FILE1/tofe");
151 if ( nt4 ) m_tuple4 = nt4;
153 m_tuple4 =
ntupleSvc()->book (
"FILE1/tofe",CLID_ColumnWiseTuple,
"ks N-Tuple example");
155 status = m_tuple4->addItem (
"ptrk", m_ptot_etof);
156 status = m_tuple4->addItem (
"cntr", m_cntr_etof);
157 status = m_tuple4->addItem (
"path", m_path_etof);
158 status = m_tuple4->addItem (
"ph", m_ph_etof);
159 status = m_tuple4->addItem (
"rhit", m_rhit_etof);
160 status = m_tuple4->addItem (
"qual", m_qual_etof);
161 status = m_tuple4->addItem (
"tof", m_tof_etof);
162 status = m_tuple4->addItem (
"te", m_te_etof);
163 status = m_tuple4->addItem (
"tmu", m_tmu_etof);
164 status = m_tuple4->addItem (
"tpi", m_tpi_etof);
165 status = m_tuple4->addItem (
"tk", m_tk_etof);
166 status = m_tuple4->addItem (
"tp", m_tp_etof);
169 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple4) << endmsg;
170 return StatusCode::FAILURE;
178 NTuplePtr nt5(
ntupleSvc(),
"FILE1/tof1");
179 if ( nt5 ) m_tuple5 = nt5;
181 m_tuple5 =
ntupleSvc()->book (
"FILE1/tof1", CLID_ColumnWiseTuple,
"ks N-Tuple example");
183 status = m_tuple5->addItem (
"ptrk", m_ptot_btof1);
184 status = m_tuple5->addItem (
"cntr", m_cntr_btof1);
185 status = m_tuple5->addItem (
"path", m_path_btof1);
186 status = m_tuple5->addItem (
"ph", m_ph_btof1);
187 status = m_tuple5->addItem (
"zhit", m_zhit_btof1);
188 status = m_tuple5->addItem (
"qual", m_qual_btof1);
189 status = m_tuple5->addItem (
"tof", m_tof_btof1);
190 status = m_tuple5->addItem (
"te", m_te_btof1);
191 status = m_tuple5->addItem (
"tmu", m_tmu_btof1);
192 status = m_tuple5->addItem (
"tpi", m_tpi_btof1);
193 status = m_tuple5->addItem (
"tk", m_tk_btof1);
194 status = m_tuple5->addItem (
"tp", m_tp_btof1);
197 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple5) << endmsg;
198 return StatusCode::FAILURE;
205 NTuplePtr nt6(
ntupleSvc(),
"FILE1/tof2");
206 if ( nt6 ) m_tuple6 = nt6;
208 m_tuple6 =
ntupleSvc()->book (
"FILE1/tof2", CLID_ColumnWiseTuple,
"ks N-Tuple example");
210 status = m_tuple6->addItem (
"ptrk", m_ptot_btof2);
211 status = m_tuple6->addItem (
"cntr", m_cntr_btof2);
212 status = m_tuple6->addItem (
"path", m_path_btof2);
213 status = m_tuple6->addItem (
"ph", m_ph_btof2);
214 status = m_tuple6->addItem (
"zhit", m_zhit_btof2);
215 status = m_tuple6->addItem (
"qual", m_qual_btof2);
216 status = m_tuple6->addItem (
"tof", m_tof_btof2);
217 status = m_tuple6->addItem (
"te", m_te_btof2);
218 status = m_tuple6->addItem (
"tmu", m_tmu_btof2);
219 status = m_tuple6->addItem (
"tpi", m_tpi_btof2);
220 status = m_tuple6->addItem (
"tk", m_tk_btof2);
221 status = m_tuple6->addItem (
"tp", m_tp_btof2);
224 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple6) << endmsg;
225 return StatusCode::FAILURE;
230 NTuplePtr nt8(
ntupleSvc(),
"FILE1/infmom");
231 if ( nt8 ) m_tuple8 = nt8;
233 m_tuple8 =
ntupleSvc()->book (
"FILE1/infmom", CLID_ColumnWiseTuple,
"information with momentum method");
235 status = m_tuple8->addItem (
"momlepp", m_mom_lepp );
236 status = m_tuple8->addItem (
"momlepmm", m_mom_lepm );
237 status = m_tuple8->addItem (
"mompionm", m_mom_pionm );
238 status = m_tuple8->addItem (
"mompionp", m_mom_pionp );
239 status = m_tuple8->addItem (
"pipidang", m_pipi_dang );
240 status = m_tuple8->addItem (
"cmslepp", m_cms_lepp );
241 status = m_tuple8->addItem (
"cmslepm", m_cms_lepm );
242 status = m_tuple8->addItem (
"invtwopi", m_mass_twopi );
243 status = m_tuple8->addItem (
"invjpsi", m_mass_jpsi );
244 status = m_tuple8->addItem (
"recoil", m_mass_recoil);
245 status = m_tuple8->addItem (
"invmass", m_inv_mass );
246 status = m_tuple8->addItem (
"totene", m_tot_e );
247 status = m_tuple8->addItem (
"totpx", m_tot_px );
248 status = m_tuple8->addItem (
"totpy", m_tot_py );
249 status = m_tuple8->addItem (
"totpz", m_tot_pz );
250 status = m_tuple8->addItem (
"epratio", m_ep_ratio );
251 status = m_tuple8->addItem (
"eveflag", m_event_flag );
252 status = m_tuple8->addItem (
"tplepratiom", m_trans_ratio_lepm );
253 status = m_tuple8->addItem (
"tplepratiop", m_trans_ratio_lepp );
254 status = m_tuple8->addItem (
"tppionratiom", m_trans_ratio_pionm );
255 status = m_tuple8->addItem (
"tppionratiop", m_trans_ratio_pionp );
256 status = m_tuple8->addItem (
"run", m_run );
257 status = m_tuple8->addItem (
"event", m_event );
258 status = m_tuple8->addItem (
"ntrack", m_index, 0, 4 );
259 status = m_tuple8->addIndexedItem (
"costhe", m_index, m_cos_theta );
260 status = m_tuple8->addIndexedItem (
"phi", m_index, m_phi );
261 status = m_tuple8->addIndexedItem (
"fourmom", m_index, 4, m_four_mom);
262 status = m_tuple8->addItem (
"pionmat", m_pion_matched);
263 status = m_tuple8->addItem (
"lepmat", m_lep_matched);
265 status = m_tuple8->addItem(
"indexmc", m_idxmc, 0, 100);
266 status = m_tuple8->addIndexedItem(
"pdgid", m_idxmc, m_pdgid);
267 status = m_tuple8->addIndexedItem(
"motheridx", m_idxmc, m_motheridx);
268 status = m_tuple8->addItem(
"truepp", m_true_pionp);
269 status = m_tuple8->addItem(
"truepm", m_true_pionm);
272 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple8) << endmsg;
273 return StatusCode::FAILURE;
281 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
282 return StatusCode::SUCCESS;
291 MsgStream log(
msgSvc(), name());
292 log << MSG::INFO <<
"in execute()" << endreq;
294 StatusCode sc=StatusCode::SUCCESS;
296 setFilterPassed(
false);
298 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
300 log << MSG::ERROR <<
"EventHeader not found" << endreq;
301 return StatusCode::SUCCESS;
303 int run(eventHeader->runNumber());
304 int event(eventHeader->eventNumber());
305 if(event%1000==0) cout <<
"run: " << run <<
" event: " <<
event << endl;
307 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(),
"/Event/EvtRec/EvtRecEvent");
309 log << MSG::ERROR <<
"EvtRecEvent not found" << endreq;
310 return StatusCode::SUCCESS;
312 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
313 << evtRecEvent->totalCharged() <<
" , "
314 << evtRecEvent->totalNeutral() <<
" , "
315 << evtRecEvent->totalTracks() <<endreq;
317 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),
"/Event/EvtRec/EvtRecTrackCol");
319 log << MSG::ERROR <<
"EvtRecTrackCol" << endreq;
320 return StatusCode::SUCCESS;
326 log << MSG::FATAL <<
"Could not find Trigger Data for physics analysis" << endreq;
327 return StatusCode::FAILURE;
330 log << MSG::DEBUG <<
"Trigger conditions: " << endreq;
331 for(
int i=0; i < 48; i++){
332 log << MSG::DEBUG <<
"i:" << i <<
" name:" << trigData->getTrigCondName(i) <<
" cond:" << trigData->getTrigCondition(i) << endreq;
335 int m_trig_tot(0), m_trig_which(-1);
337 for(
int j=0; j<16; j++){
338 if(trigData->getTrigChannel(j)){
343 if(m_trig_tot==1 && m_trig_which==m_chan_det)
m_cout_everat++;
349 if(evtRecEvent->totalCharged()<3 || evtRecTrkCol->size()<3 || evtRecEvent->totalTracks()>99 || evtRecTrkCol->size()>99)
return StatusCode::SUCCESS;
353 Vint iGood; iGood.clear();
354 int m_num[4]={0,0,0,0};
356 m_pion_matched = 0; m_lep_matched = 0;
357 HepLorentzVector m_lv_pionp, m_lv_pionm, m_lv_lepp, m_lv_lepm, m_lv_ele, m_lv_pos, m_lv_mum, m_lv_mup;
359 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
361 if(!(*itTrk)->isMdcKalTrackValid())
continue;
368 if(fabs(m_vz0) >= m_vz0cut)
continue;
369 if(m_vr0 >= m_vr0cut)
continue;
371 nCharge += mdcTrk->
charge();
372 if(mdcTrk->
p()<1.0){
if((*itTrk)->isEmcShowerValid()) m_pion_matched ++; }
373 else{
if((*itTrk)->isEmcShowerValid()) m_lep_matched ++; }
379 m_lv_pionp = mdcTrk->
p4(
xmass[2]);
384 m_lv_pos = mdcTrk->
p4(
xmass[0]);
386 m_lv_mup = mdcTrk->
p4(
xmass[1]);
393 m_lv_pionm = mdcTrk->
p4(
xmass[2]);
398 m_lv_ele = mdcTrk->
p4(
xmass[0]);
400 m_lv_mum = mdcTrk->
p4(
xmass[1]);
406 int nGood = iGood.size();
407 log << MSG::DEBUG <<
"With KalmanTrack, ngood, totcharge = " << nGood <<
" , " << nCharge << endreq;
408 if(nGood<3 || nGood>4)
return sc;
412 for(
int i=0; i< evtRecEvent->totalTracks(); i++){
414 if(!(*itTrk)->isEmcShowerValid())
continue;
416 m_ep_ratio += emcTrk->
energy();
419 if(m_ep_ratio > m_distin_emuon){
420 m_lv_lepp = m_lv_pos;
421 m_lv_lepm = m_lv_ele;
424 m_lv_lepp = m_lv_mup;
425 m_lv_lepm = m_lv_mum;
428 HepLorentzVector m_lv_lab(0.04,0,0,3.686);
430 if(nCharge)
return sc;
434 if(m_num[0]>1 || m_num[1]>1 || m_num[2]>1 || m_num[3]>1)
return sc;
436 if(nCharge != -1)
return StatusCode::SUCCESS;
437 m_lv_pionp = m_lv_lab - m_lv_pionm - m_lv_lepp - m_lv_lepm;
438 if(m_lv_pionp.vect().cosTheta()>m_cosThetaCut)
return StatusCode::SUCCESS;
442 if(nCharge != 1)
return StatusCode::SUCCESS;
443 m_lv_pionm = m_lv_lab - m_lv_pionp - m_lv_lepp - m_lv_lepm;
444 if(m_lv_pionm.vect().cosTheta()>m_cosThetaCut)
return StatusCode::SUCCESS;
448 if(nCharge != -1)
return StatusCode::SUCCESS;
449 m_lv_lepp = m_lv_lab - m_lv_pionp - m_lv_pionm - m_lv_lepm;
450 if(m_lv_lepp.vect().cosTheta()>m_cosThetaCut)
return StatusCode::SUCCESS;
454 if(nCharge != 1)
return StatusCode::SUCCESS;
455 m_lv_lepm = m_lv_lab - m_lv_pionp - m_lv_pionm - m_lv_lepp;
456 if(m_lv_lepm.vect().cosTheta()>m_cosThetaCut)
return StatusCode::SUCCESS;
464 HepLorentzVector m_lv_recoil, m_lv_jpsi;
465 m_lv_recoil = m_lv_lab - m_lv_pionp - m_lv_pionm;
466 m_lv_jpsi = m_lv_lepp + m_lv_lepm;
468 m_mass_twopi = (m_lv_pionp + m_lv_pionm).m();
469 m_mass_recoil = m_lv_recoil.m();
470 m_mass_jpsi = m_lv_jpsi.m();
473 if( m_mass_recoil < 3.05 || m_mass_recoil > 3.15 )
return sc;
474 if( m_mass_jpsi < 3.0 || m_mass_jpsi > 3.2 )
return sc;
477 HepLorentzVector m_ttm(m_lv_jpsi + m_lv_pionp + m_lv_pionm);
478 if(m_ttm.m()>4 || m_ttm.m()<3)
return sc;
481 m_pipi_dang = m_lv_pionp.vect().cosTheta(m_lv_pionm.vect());
483 m_mom_pionp = m_lv_pionp.vect().mag();
484 m_mom_pionm = m_lv_pionm.vect().mag();
485 m_mom_lepp = m_lv_lepp.vect().mag();
486 m_mom_lepm = m_lv_lepm.vect().mag();
487 m_trans_ratio_lepp = m_lv_lepp.vect().perp()/m_lv_lepp.vect().mag();
488 m_trans_ratio_lepm = m_lv_lepm.vect().perp()/m_lv_lepm.vect().mag();
489 m_trans_ratio_pionp = m_lv_pionp.vect().perp()/m_lv_pionp.vect().mag();
490 m_trans_ratio_pionm = m_lv_pionm.vect().perp()/m_lv_pionm.vect().mag();
492 Hep3Vector m_boost_jpsi(m_lv_recoil.boostVector());
493 HepLorentzVector m_lv_cms_lepp(boostOf(m_lv_lepp,-m_boost_jpsi));
494 HepLorentzVector m_lv_cms_lepm(boostOf(m_lv_lepm,-m_boost_jpsi));
495 m_cms_lepm = m_lv_cms_lepm.vect().mag();
496 m_cms_lepp = m_lv_cms_lepp.vect().mag();
497 log << MSG::DEBUG <<
"jpsi four momentum in cms " << m_lv_cms_lepp + m_lv_cms_lepm <<endreq;
499 m_inv_mass = m_ttm.m();
501 m_tot_px = m_ttm.px();
502 m_tot_py = m_ttm.py();
503 m_tot_pz = m_ttm.pz();
506 HepLorentzVector m_lv_book(0,0,0,0);
507 for(m_index=0; m_index<4; m_index++){
509 case 0: m_lv_book = m_lv_pionp;
511 case 1: m_lv_book = m_lv_pionm;
513 case 2: m_lv_book = m_lv_lepp;
515 case 3: m_lv_book = m_lv_lepm;
517 default: m_lv_book.setE(2008);
519 m_cos_theta[m_index] = m_lv_book.vect().cosTheta();
520 m_phi[m_index] = m_lv_book.vect().phi();
521 m_four_mom[m_index][0] = m_lv_book.e();
522 m_four_mom[m_index][1] = m_lv_book.px();
523 m_four_mom[m_index][2] = m_lv_book.py();
524 m_four_mom[m_index][3] = m_lv_book.pz();
527 if(m_subsample_flag) setFilterPassed(
true);
528 else if(m_mass_recoil>3.08 && m_mass_recoil<3.12 && m_mass_jpsi>3.0 && m_mass_jpsi<3.2 && m_cms_lepp<1.7 && m_cms_lepp>1.4 && m_cms_lepm<1.7 && m_cms_lepm>1.4 && m_event_flag==4 && m_pipi_dang<m_pipi_dang_cut) setFilterPassed(
true);
532 SmartDataPtr<Event::McParticleCol> mcParticleCol(eventSvc(),
"/Event/MC/McParticleCol");
534 int m_numParticle(0), m_true_pid(0);
536 log << MSG::ERROR <<
"Could not retrieve McParticelCol" << endreq;
537 return StatusCode::FAILURE;
540 bool psipDecay(
false);
542 Event::McParticleCol::iterator iter_mc = mcParticleCol->begin();
543 for (; iter_mc != mcParticleCol->end(); iter_mc++){
544 if ((*iter_mc)->primaryParticle())
continue;
545 if (!(*iter_mc)->decayFromGenerator())
continue;
547 if ((*iter_mc)->particleProperty()==100443){
549 rootIndex = (*iter_mc)->trackIndex();
551 if (!psipDecay)
continue;
552 int mcidx = ((*iter_mc)->mother()).trackIndex() - rootIndex;
553 int pdgid = (*iter_mc)->particleProperty();
554 m_pdgid[m_numParticle] = pdgid;
555 m_motheridx[m_numParticle] = mcidx;
559 if((*iter_mc)->particleProperty() == 211) m_true_pionp = (*iter_mc)->initialFourMomentum().vect().mag();
560 if((*iter_mc)->particleProperty() == -211) m_true_pionm = (*iter_mc)->initialFourMomentum().vect().mag();
562 m_idxmc = m_numParticle;
571 Vint iGam; iGam.clear();
572 for(
int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
574 if(!(*itTrk)->isEmcShowerValid())
continue;
576 Hep3Vector emcpos(emcTrk->
x(), emcTrk->
y(), emcTrk->
z());
581 for(
int j = 0; j < evtRecEvent->totalCharged(); j++) {
583 if(!(*jtTrk)->isExtTrackValid())
continue;
588 double angd = extpos.angle(emcpos);
589 double thed = extpos.theta() - emcpos.theta();
590 double phid = extpos.deltaPhi(emcpos);
591 thed = fmod(thed+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
592 phid = fmod(phid+CLHEP::twopi+CLHEP::twopi+
pi, CLHEP::twopi) - CLHEP::pi;
594 if(fabs(thed) < fabs(dthe)) dthe = thed;
595 if(fabs(phid) < fabs(dphi)) dphi = phid;
596 if(angd < dang) dang = angd;
598 if(dang>=200)
continue;
599 double eraw = emcTrk->
energy();
600 dthe = dthe * 180 / (CLHEP::pi);
601 dphi = dphi * 180 / (CLHEP::pi);
602 dang = dang * 180 / (CLHEP::pi);
610 iGam.push_back((*itTrk)->trackId());
613 m_nGam = iGam.size();
614 log << MSG::DEBUG <<
"num Good Photon " << m_nGam <<
" , " <<evtRecEvent->totalNeutral()<<endreq;
622 for(
int i = 0; i < nGood; i++) {
624 if(!(*itTrk)->isMdcDedxValid())
continue;
628 m_ptrk = mdcTrk->
p();
629 m_chie = dedxTrk->
chiE();
630 m_chimu = dedxTrk->
chiMu();
631 m_chipi = dedxTrk->
chiPi();
632 m_chik = dedxTrk->
chiK();
633 m_chip = dedxTrk->
chiP();
636 m_probPH = dedxTrk->
probPH();
637 m_normPH = dedxTrk->
normPH();
647 int m_endcap_cout(0), m_layer1_cout(0), m_layer2_cout(0);
648 for(
int i = 0; i < nGood; i++) {
650 if(!(*itTrk)->isTofTrackValid())
continue;
653 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
655 double ptrk = mdcTrk->
p();
657 for( SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin() ;iter_tof != tofTrkCol.end(); iter_tof++ ) {
659 status->
setStatus((*iter_tof)->status());
662 if( status->
layer()!=0 )
continue;
663 double path = (*iter_tof)->path();
664 double tof = (*iter_tof)->tof();
665 double ph = (*iter_tof)->ph();
666 double rhit = (*iter_tof)->zrhit();
667 double qual = 0.0 + (*iter_tof)->quality();
668 double cntr = 0.0 + (*iter_tof)->tofID();
670 for(
int j = 0; j < 5; j++) {
672 double beta = sqrt(1+gb*gb);
673 texp[j] = path*beta/
velc;
682 m_te_etof = tof - texp[0];
683 m_tmu_etof = tof - texp[1];
684 m_tpi_etof = tof - texp[2];
685 m_tk_etof = tof - texp[3];
686 m_tp_etof = tof - texp[4];
692 if(status->
layer()==1){
693 double path=(*iter_tof)->path();
694 double tof = (*iter_tof)->tof();
695 double ph = (*iter_tof)->ph();
696 double rhit = (*iter_tof)->zrhit();
697 double qual = 0.0 + (*iter_tof)->quality();
698 double cntr = 0.0 + (*iter_tof)->tofID();
700 for(
int j = 0; j < 5; j++) {
702 double beta = sqrt(1+gb*gb);
703 texp[j] = path*beta/
velc;
713 m_te_btof1 = tof - texp[0];
714 m_tmu_btof1 = tof - texp[1];
715 m_tpi_btof1 = tof - texp[2];
716 m_tk_btof1 = tof - texp[3];
717 m_tp_btof1 = tof - texp[4];
722 if(status->
layer()==2){
723 double path=(*iter_tof)->path();
724 double tof = (*iter_tof)->tof();
725 double ph = (*iter_tof)->ph();
726 double rhit = (*iter_tof)->zrhit();
727 double qual = 0.0 + (*iter_tof)->quality();
728 double cntr = 0.0 + (*iter_tof)->tofID();
730 for(
int j = 0; j < 5; j++) {
732 double beta = sqrt(1+gb*gb);
733 texp[j] = path*beta/
velc;
743 m_te_btof2 = tof - texp[0];
744 m_tmu_btof2 = tof - texp[1];
745 m_tpi_btof2 = tof - texp[2];
746 m_tk_btof2 = tof - texp[3];
747 m_tp_btof2 = tof - texp[4];
759 return StatusCode::SUCCESS;
765 MsgStream log(
msgSvc(), name());
766 log << MSG::INFO <<
"in finalize()" << endmsg;
767 if(m_eventrate) cout <<
"all event: " << m_cout_all << endl <<
"only channel " << m_chan_det <<
": " <<
m_cout_everat << endl;
768 cout <<
"all event: " << m_cout_all << endl <<
"all collection point is OK: " <<
m_cout_col << endl <<
"charged tracks >=3: " <<
m_cout_charge << endl <<
"good charged tracks [3,4]: " <<
m_cout_nGood << endl <<
"after momentum assign: " <<
m_cout_mom << endl <<
"after recoild mass cut: " <<
m_cout_recoil << endl;
769 return StatusCode::SUCCESS;
EvtRecTrackCol::iterator EvtRecTrackIterator
static long m_cout_col(0)
HepGeom::Point3D< double > HepPoint3D
std::vector< HepLorentzVector > Vp4
static long m_cout_everat(0)
static long m_cout_charge(0)
static long m_cout_nGood(0)
static long m_cout_recoil(0)
static long m_cout_mom(0)
const Hep3Vector emcPosition() const
const int emcVolumeNumber() const
static void setPidType(PidType pidType)
const HepLorentzVector p4() const
unsigned int layer() const
void setStatus(unsigned int status)
_EXTERN_ std::string TrigData