59 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
60 MsgStream log(
msgSvc,
"MilleAlign");
61 log << MSG::INFO <<
"MilleAlign::initialize()" << endreq;
64 m_mdcGeomSvc = mdcGeomSvc;
65 m_mdcFunSvc = mdcFunSvc;
66 m_mdcUtilitySvc = mdcUtilitySvc;
69 m_hresAll =
new TH1F(
"HResAllInc",
"", 200, -1.0, 1.0);
70 m_hlist->Add(m_hresAll);
72 m_hresInn =
new TH1F(
"HResInnInc",
"", 200, -1.0, 1.0);
73 m_hlist->Add(m_hresInn);
75 m_hresStp =
new TH1F(
"HResStpInc",
"", 200, -1.0, 1.0);
76 m_hlist->Add(m_hresStp);
78 m_hresOut =
new TH1F(
"HResOutInc",
"", 200, -1.0, 1.0);
79 m_hlist->Add(m_hresOut);
83 sprintf(hname,
"Res_Layer%02d", lay);
84 m_hresLay[lay] =
new TH1F(hname,
"", 200, -1.0, 1.0);
85 m_hlist->Add(m_hresLay[lay]);
88 m_hresAllRec =
new TH1F(
"HResAllRecInc",
"", 200, -1.0, 1.0);
89 m_hlist->Add(m_hresAllRec);
91 sprintf(hname,
"Res_LayerRec%02d", lay);
92 m_hresLayRec[lay] =
new TH1F(hname,
"", 200, -1.0, 1.0);
93 m_hlist->Add(m_hresLayRec[lay]);
97 m_hddoca =
new TH1F(
"delt_doca",
"", 200, -1.0, 1.0);
98 m_hlist->Add(m_hddoca);
101 sprintf(hname,
"delt_docaLay%02d", lay);
102 m_hddocaLay[lay] =
new TH1F(hname,
"", 200, -1.0, 1.0);
103 m_hlist->Add(m_hddocaLay[lay]);
119 m_pMilleAlign -> InitMille(&m_dofs[0], &m_sigm[0], m_nglo, m_nloc,
122 m_derGB.resize(m_npar);
123 m_derNonLin.resize(m_npar);
124 m_par.resize(m_npar);
125 m_error.resize(m_npar);
126 m_pull.resize(m_npar);
128 m_derLC.resize(m_nloc);
131 std::vector<double> constTX;
132 std::vector<double> constTY;
133 std::vector<double> constRZ;
135 std::vector<double> constTXE;
136 std::vector<double> constTXW;
137 std::vector<double> constTYE;
138 std::vector<double> constTYW;
139 std::vector<double> constRZE;
140 std::vector<double> constRZW;
142 constTX.resize(m_npar);
143 constTY.resize(m_npar);
144 constRZ.resize(m_npar);
146 constTXE.resize(m_npar);
147 constTXW.resize(m_npar);
148 constTYE.resize(m_npar);
149 constTYW.resize(m_npar);
150 constRZE.resize(m_npar);
151 constRZW.resize(m_npar);
153 for(i=0; i<m_npar; i++){
183 m_pMilleAlign -> ConstF(&constTXE[0], 0.0);
184 m_pMilleAlign -> ConstF(&constTXW[0], 0.0);
185 m_pMilleAlign -> ConstF(&constTYE[0], 0.0);
186 m_pMilleAlign -> ConstF(&constTYW[0], 0.0);
187 m_pMilleAlign -> ConstF(&constRZE[0], 0.0);
188 m_pMilleAlign -> ConstF(&constRZW[0], 0.0);
193 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
194 MsgStream log(
msgSvc,
"MilleAlign");
195 log << MSG::DEBUG <<
"MilleAlign::fillTree()" << endreq;
225 int ntrk =
event -> getNTrk();
226 if( (ntrk<m_param.
nTrkCut[0]) || (ntrk>m_param.
nTrkCut[1]))
return false;
228 for(itrk=0; itrk<ntrk; itrk++){
229 rectrk =
event->getRecTrk(itrk);
232 trkpar[0] = rectrk -> getDr();
233 trkpar[1] = rectrk -> getPhi0();
234 trkpar[2] = rectrk -> getKappa();
235 trkpar[3] = rectrk -> getDz();
236 trkpar[4] = rectrk -> getTanLamda();
238 int nHit = rectrk -> getNHits();
239 if(nHit < m_param.
nHitCut)
continue;
240 if(fabs(trkpar[0]) > m_param.
drCut)
continue;
241 if(fabs(trkpar[3]) > m_param.
dzCut)
continue;
243 HepVector rechelix = rectrk->
getHelix();
244 HepVector helix = rectrk->
getHelix();
248 for(ihit=0; ihit<nHit; ihit++){
249 rechit = rectrk -> getRecHit(ihit);
250 lr = rechit->
getLR();
251 lay = rechit -> getLayid();
252 cel = rechit -> getCellid();
253 pWire = m_mdcGeomSvc -> Wire(lay, cel);
254 dmeas = rechit -> getDmeas();
255 zhit = rechit -> getZhit();
256 hitSigm = rechit -> getErrDmeas();
258 wpos[0] = pWire -> Backward().x();
259 wpos[1] = pWire -> Backward().y();
260 wpos[2] = pWire -> Backward().z();
261 wpos[3] = pWire -> Forward().x();
262 wpos[4] = pWire -> Forward().y();
263 wpos[5] = pWire -> Forward().z();
264 wpos[6] = pWire -> Tension();
267 double doca = (m_mdcUtilitySvc->
doca(lay, cel, helix, helixErr))*10.0;
269 resi = -1.0*dmeas - doca;
270 if ((fabs(doca) < m_docaCut[lay][0]) || (fabs(doca) > m_docaCut[lay][1]) ||
271 (fabs(resi) > m_resiCut[lay]))
continue;
274 resiRec = rechit -> getResiIncLR();
276 double dd = fabs(doca) - fabs(rechit->
getDocaInc());
277 m_hddoca ->
Fill(dd);
278 m_hddocaLay[lay] ->
Fill(dd);
281 m_hresAll->Fill(resi);
282 if(lay < 8) m_hresInn->Fill(resi);
283 else if(lay < 20) m_hresStp->Fill(resi);
284 else m_hresOut->Fill(resi);
285 m_hresLay[lay]->Fill(resi);
287 m_hresAllRec->Fill(resiRec);
288 m_hresLayRec[lay]->Fill(resiRec);
291 m_pMilleAlign -> ZerLoc(&m_derGB[0], &m_derLC[0], &m_derNonLin[0]);
294 for(ipar=0; ipar<m_nloc; ipar++){
295 if( ! getDeriLoc(ipar, lay, cel ,rechelix, helixErr, deri) ){
296 cout <<
"getDeriLoc == false!" << setw(12) << itrk << setw(12) << ipar << endl;
299 m_derLC[ipar] = deri;
303 for(ipar=0; ipar<m_nGloHit; ipar++){
304 iparGB = getAlignParId(lay, ipar);
305 if( ! getDeriGlo(ipar, iparGB, lay, cel, helix, helixErr, wpos, deri) )
307 cout <<
"getDeriGlo == false!" << setw(12) << itrk << setw(12) << ipar << endl;
310 m_derGB[iparGB] = deri;
312 m_pMilleAlign -> EquLoc(&m_derGB[0], &m_derLC[0], &m_derNonLin[0], resi, hitSigm);
316 bool sc = m_pMilleAlign -> FitLoc(m_pMilleAlign->
GetTrackNumber(), trkparms, 0);
317 if(sc) m_pMilleAlign -> SetTrackNumber( m_pMilleAlign->
GetTrackNumber()+1 );