107 MsgStream log(
msgSvc(), name());
111 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
113 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
114 return( StatusCode::FAILURE);
118 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
120 log << MSG::FATAL <<
"Could not find Mdc track collection!!" << endreq;
121 return( StatusCode::FAILURE);
124 RecMdcTrackCol::iterator iterTrk=mdcTrackCol->begin();
127 double cost1=-999,cost2=-999,
phi1=-999,
phi2=-999;
128 int hit1=-999,hit2=-999,shit1=-999,shit2=-999,charg1=-999,charg2=-999;
129 double mdcbalance=-999;
131 unsigned int ntrk=mdcTrackCol->size();
132 double kappa=-999,tanl=-999,sint=-999;
133 double p=-999,theta=-999,phi=-999;
134 double vz1=-999,vz2=-999,vr1=-999,vr2=-999;
137 for(;iterTrk!= mdcTrackCol->end();iterTrk++) {
141 phi=(*iterTrk)->helix(1);
142 kappa=(*iterTrk)->helix(2);
143 tanl=(*iterTrk)->helix(4);
145 theta=0.5*3.1415926-atan(tanl);
150 if(
abs(kappa)>0.001&&
abs(sint)>0.01){
151 p=
abs(1./kappa)/sint;
155 log << MSG::WARNING <<
"FastTrk=>"<<
" kappa=" <<kappa<<
"; sint="<<sint<<endreq;
165 vz1=(*iterTrk)->helix(3);
167 vr1=(*iterTrk)->helix(0);
169 hit1=(*iterTrk)->getNhits();
171 shit1=(*iterTrk)->nster();
173 charg1=(*iterTrk)->charge();
179 vz2=(*iterTrk)->helix(3);
180 vr2=(*iterTrk)->helix(0);
181 hit2=(*iterTrk)->getNhits();
182 shit2=(*iterTrk)->nster();
183 charg2=(*iterTrk)->charge();
185 log << MSG::DEBUG <<
"p=" <<p <<
", "<<
"theta="<<theta
186 <<
", phi="<<phi<<
", vz="<<(*iterTrk)->helix(3)<<
", vr="<<(*iterTrk)->helix(0)<<endreq;
187 if(
cos(theta)>0) mdcbalance +=1.;
188 else if(
cos(theta)<0) mdcbalance -=1.;
190 if(ntrk>=2) mdcbalance /= ntrk;
200 log << MSG::INFO <<
"ntrk=" << ntrk <<
"; mdc balance=" <<mdcbalance
201 <<
"; pmax1="<< max1 <<
"; pmax2="<< max2
202 <<
"; acol="<< acol<<
"; cost1="<<cost1<<
"; cost2="<<cost2<<endreq;
205 m_ntrk->setValue(ntrk);
206 m_acol->setValue(acol);
207 m_mbal->setValue(mdcbalance);
208 m_pmax1->setValue(max1);
209 m_pmax2->setValue(max2);
210 m_cost1->setValue(cost1);
211 m_cost2->setValue(cost2);
215 m_ef->addToEFVec(ntrk, 6);
216 m_ef->appToEFVec(max1, 7);
217 m_ef->appToEFVec(cost1, 8);
218 m_ef->appToEFVec(vz1, 9);
220 m_ef->appToEFVec(vr1, 11);
221 m_ef->addToEFVec(hit1, 12);
222 m_ef->addToEFVec(shit1, 13);
223 m_ef->appToEFVec(max2, 14);
224 m_ef->appToEFVec(cost2, 15);
225 m_ef->appToEFVec(vz2, 16);
227 m_ef->appToEFVec(vr2, 18);
228 m_ef->addToEFVec(hit2, 19);
229 m_ef->addToEFVec(shit2, 20);
230 m_ef->appToEFVec(acol, 21);
231 m_ef->setVecBit(
true, 0, 4);
232 if(ntrk==0)
m_ef->addToEFVec(1, 1);
233 else if(ntrk==1)
m_ef->addToEFVec(8, 1);
234 else if(ntrk>=2)
m_ef->addToEFVec(16,1);
235 else m_ef->addToEFVec(0, 1);
237 m_ef->addToEFVec(charg1, 23);
238 m_ef->addToEFVec(charg2, 24);
242 return StatusCode::SUCCESS;