28 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
29 MsgStream log(
msgSvc,
"MdcCalRecTrk");
30 log << MSG::DEBUG <<
"MdcCalRecTrk::setRecTrk()" << endreq;
32 m_dr = (*it_trk)->helix(0);
33 m_phi0 = (*it_trk)->helix(1);
34 m_kappa = (*it_trk)->helix(2);
35 m_dz = (*it_trk)->helix(3);
36 m_tanl = (*it_trk)->helix(4);
37 m_chisq = (*it_trk)->chi2();
38 m_nhits = (*it_trk)->getNhits();
39 m_helix = (*it_trk)->helix();
40 m_helixerr = (*it_trk)->err();
44 if(0 == m_pid)
mass = 0.000511;
45 else if(1 == m_pid)
mass = 0.105658;
46 else if(2 == m_pid)
mass = 0.139570;
47 else if(3 == m_pid)
mass = 0.493677;
48 else if(4 == m_pid)
mass = 0.938272;
49 else if(5 == m_pid)
mass = 0.139570;
50 else log << MSG::FATAL <<
"wrong particle type" << endreq;
51 m_p4 = (*it_trk)->p4(
mass);
57 m_p = m_pt * sqrt( m_tanl * m_tanl + 1.0 );
59 HitRefVec gothits = (*it_trk) -> getVecHits();
60 HitRefVec::iterator it_hit = gothits.begin();
62 for(; it_hit != gothits.end(); it_hit++){
65 m_rechit.push_back(rechit);
71 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
72 MsgStream log(
msgSvc,
"MdcCalRecTrk");
73 log << MSG::DEBUG <<
"MdcCalRecTrk::setKalTrk()" << endreq;
81 else log << MSG::FATAL <<
"wrong particle type" << endreq;
83 m_dr = (*it_trk)->dr();
84 m_phi0 = (*it_trk)->fi0();
85 m_kappa = (*it_trk)->kappa();
86 m_dz = (*it_trk)->dz();
87 m_tanl = (*it_trk)->tanl();
88 m_chisq = (*it_trk)->chi2();
91 m_p4.setPx(-
sin(m_phi0) / fabs(m_kappa));
92 m_p4.setPy(
cos(m_phi0) / fabs(m_kappa));
93 m_p4.setPz(m_tanl / fabs(m_kappa));
94 double p3 = m_p4.mag();
96 if(0 == m_pid)
mass = 0.000511;
97 else if(1 == m_pid)
mass = 0.105658;
98 else if(2 == m_pid)
mass = 0.139570;
99 else if(3 == m_pid)
mass = 0.493677;
100 else if(4 == m_pid)
mass = 0.938272;
101 else if(5 == m_pid)
mass = 0.139570;
107 m_pt = 1.0 / m_kappa;
108 m_p = m_pt * sqrt( m_tanl * m_tanl + 1.0 );
114 HelixSegRefVec::iterator it_hit = gothelixsegs.begin();
118 for(; it_hit != gothelixsegs.end(); it_hit++){
121 m_rechit.push_back(rechit);
131 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
132 MsgStream log(
msgSvc,
"MdcCalib");
134 IDataProviderSvc* eventSvc =
NULL;
135 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
136 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc,
"/Event/Digi/MdcDigiCol");
138 log << MSG::FATAL <<
"Could not find event" << endreq;
143 bool hitCel[43][288];
144 for(lay=0; lay<43; lay++){
145 for(cel=0; cel<288; cel++){
146 hitCel[lay][cel] =
false;
150 MdcDigiCol::iterator
iter = mdcDigiCol->begin();
154 for(;
iter != mdcDigiCol->end();
iter++, digiId++) {
156 id = (aDigi)->identify();
159 fgOverFlow = (aDigi) -> getOverflow();
162 if ( ((fgOverFlow & 3) !=0 ) || ((fgOverFlow & 12) != 0) ||
167 if ( ((fgOverFlow & 1) !=0 ) || (aDigi->
getTimeChannel() == 0x7FFFFFFF) ) goodT =
false;
172 hitCel[lay][cel] =
true;
175 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc,
"/Event/Recon/RecMdcTrackCol");
177 log << MSG::ERROR <<
"Could not find RecMdcTrackCol" << endreq;
183 RecMdcTrackCol::iterator it_trk = newtrkCol->begin();
184 for(it_trk = newtrkCol->begin(); it_trk != newtrkCol->end(); it_trk++){
185 HitRefVec gothits = (*it_trk) -> getVecHits();
186 HitRefVec::iterator it_hit = gothits.begin();
187 HepVector helix = (*it_trk)->helix();
188 HepSymMatrix helixErr = (*it_trk)->err();
189 double phi0Rec = (*it_trk)->helix(1);
191 if(phi0Rec>phi0) delphi = phi0Rec - phi0;
192 else delphi = phi0 - phi0Rec;
193 if(delphi > CLHEP::pi) delphi -= CLHEP::pi;
194 if(delphi > (CLHEP::pi*0.17))
continue;
204 for(lay=0; lay<8; lay++){
205 double docamin = 0.7;
206 if(lay>7) docamin = 0.9;
209 for(cel=0; cel<ncel; cel++){
211 const MdcGeoWire* pWire = m_mdcGeomSvc -> Wire(lay, cel);
214 double rr = sqrt( (xx * xx) + (yy * yy) );
215 if( yy >= 0 ) wphi = acos(xx / rr);
216 else wphi = CLHEP::twopi - acos(xx / rr);
218 double phiTrk = phi0 + CLHEP::halfpi;
219 if(phiTrk > CLHEP::twopi) phiTrk -= CLHEP::twopi;
220 if( !( (fabs(wphi-phiTrk) < dphi) || (fabs(wphi+CLHEP::twopi-phiTrk) < dphi) ||
221 (fabs(wphi-CLHEP::twopi-phiTrk) < dphi) ) ){
225 double doca = m_mdcUtilitySvc->
doca(lay, cel, helix, helixErr);
227 if(fabs(doca) < fabs(docamin)){
233 if(lay<4) nhitLay1++;
234 else if(lay<8) nhitLay2++;
235 else if(lay<20) nhitLay3++;
237 for(
int ii=(-nNoiRange); ii<=nNoiRange; ii++){
239 int icell = celmin + ii;
240 if(icell >= ncel) icell -= ncel;
241 if(icell < 0) icell += ncel;
243 if(hitCel[lay][icell]){
245 else if(lay<8) nhitT2++;
246 else if(lay<20) nhitT3++;
252 if((nhitLay1<=0) || (nhitLay2<=0) || (nhitLay3<=0) || (nhitLay4<=0))
return false;
253 double ratio1 = (double)nhitT1 / ((
double)nhitLay1 * (
double)nNoiRange*2.0);
254 double ratio2 = (double)nhitT2 / ((
double)nhitLay2 * (
double)nNoiRange*2.0);
255 double ratio3 = (double)nhitT3 / ((
double)nhitLay3 * (
double)nNoiRange*2.0);
256 double ratio4 = (double)nhitT4 / ((
double)nhitLay4 * (
double)nNoiRange*2.0);
258 if((ratio1>0.08) || (ratio2>0.08) || (ratio3>0.03) || (ratio4>0.03))
return false;
virtual double doca(int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired=true, bool doSag=true) const =0