48 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
49 MsgStream log(
msgSvc,
"GrXtMdcCalib");
50 log << MSG::INFO <<
"GrXtMdcCalib::initialize()" << endreq;
53 m_mdcGeomSvc = mdcGeomSvc;
54 m_mdcFunSvc = mdcFunSvc;
55 m_mdcUtilitySvc = mdcUtilitySvc;
64 m_fdXt =
new TFolder(
"fdXtGr",
"fdXtGr");
65 m_hlist -> Add(m_fdXt);
67 m_haxis =
new TH2F(
"axis",
"", 50, 0, 300, 50, 0, 9);
68 m_haxis -> SetStats(0);
69 m_fdXt -> Add(m_haxis);
74 m_nhit[lay][iEntr][iLR] = 0;
76 sprintf(hname,
"grXt%02d_%02d_lr%01d", lay, iEntr, iLR);
77 m_grxt[lay][iEntr][iLR] =
new TGraph();
78 m_grxt[lay][iEntr][iLR] -> SetName(hname);
81 m_fdXt -> Add(m_grxt[lay][iEntr][iLR]);
89 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
90 MsgStream log(
msgSvc,
"GrXtMdcCalib");
91 log << MSG::DEBUG <<
"GrXtMdcCalib::fillHist()" << endreq;
96 bool esCutFg =
event->getEsCutFlag();
97 if( ! esCutFg )
return -1;
128 int ntrk =
event -> getNTrk();
129 for(i=0; i<ntrk; i++){
131 rectrk =
event->getRecTrk(i);
132 nhit = rectrk -> getNHits();
135 dr = rectrk->
getDr();
136 if(fabs(dr) > m_param.
drCut)
continue;
139 dz = rectrk->
getDz();
140 if(fabs(dz) > m_param.
dzCut)
continue;
143 fgHitLay[lay] =
false;
146 for(k=0; k<nhit; k++){
147 rechit = rectrk -> getRecHit(k);
148 lay = rechit -> getLayid();
149 doca = rechit -> getDocaInc();
150 resi = rechit -> getResiInc();
151 fgHitLay[lay] =
true;
158 if(! fgTrk)
continue;
162 if(fgHitLay[lay]) nhitlay++;
166 for(k=0; k<nhit; k++){
167 rechit = rectrk -> getRecHit(k);
168 lay = rechit -> getLayid();
169 doca = rechit -> getDocaInc();
170 resi = rechit -> getResiInc();
171 iLR = rechit -> getLR();
172 entrance = rechit -> getEntra();
173 tdr = rechit -> getTdrift();
175 if( (fabs(doca) > m_docaMax[lay]) ||
176 (fabs(resi) > m_param.
resiCut[lay]) ){
181 if( ! fgHitLay[1] )
continue;
182 }
else if(42 == lay){
183 if( ! fgHitLay[41] )
continue;
185 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) )
continue;
188 iEntr = m_mdcFunSvc -> getXtEntrIndex(entrance);
191 if(m_nhit[lay][iEntr][iLR] < m_maxNhit){
192 m_grxt[lay][iEntr][iLR] -> SetPoint(m_nhit[lay][iEntr][iLR],
194 m_nhit[lay][iEntr][iLR]++;
198 if(m_nhit[lay][iEntr][2] < m_maxNhit){
199 m_grxt[lay][iEntr][2] -> SetPoint(m_nhit[lay][iEntr][2],
201 m_nhit[lay][iEntr][2]++;
210 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
211 MsgStream log(
msgSvc,
"GrXtMdcCalib");
212 log << MSG::INFO <<
"GrXtMdcCalib::updateConst()" << endreq;
218 TF1* fxtDr =
new TF1(
"fxtDr",
xtfun, 0, 300, 6);
219 TF1* fxtEd =
new TF1(
"fxtEd",
xtedge, 150, 500, 1);
220 if(1 == m_param.
fixXtC0) fxtDr -> FixParameter(0, 0);
225 m_fgFit[lay][iEntr][lr] =
false;
226 if(0 == m_param.
fgCalib[lay])
continue;
228 if(m_nhit[lay][iEntr][lr] > 1000){
229 TMAX = calconst -> getXtpar(lay, iEntr, lr, 6);
231 m_grxt[lay][iEntr][lr] ->
Fit(
"fxtDr",
"Q+",
"", 0, TMAX);
233 for(ord=0; ord<6; ord++){
234 xtpar[lay][iEntr][lr][ord] = fxtDr->GetParameter(ord);
236 xtpar[lay][iEntr][lr][6] = TMAX;
239 for(ord=0; ord<6; ord++) DMAX += xtpar[lay][iEntr][lr][ord] * pow(TMAX, ord);
241 m_grxt[lay][iEntr][lr] ->
Fit(
"fxtEd",
"Q+",
"", TMAX, TMAX+300);
242 xtpar[lay][iEntr][lr][7] = fxtEd->GetParameter(0);
243 if(xtpar[lay][iEntr][lr][7] < 0.0) xtpar[lay][iEntr][lr][7] = 0.0;
244 m_fgFit[lay][iEntr][lr] =
true;
255 ofstream fxtlog(
"xtlog");
259 fxtlog << setw(3) << lay << setw(3) << iEntr << setw(3) << lr;
262 if(m_fgFit[lay][iEntr][lr]){
264 for(ord=0; ord<8; ord++) calconst->
resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntr][lr][ord]);
269 for(ord=0; ord<8; ord++){
270 calconst->
resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntrNew][lr][ord]);
274 fxtlog << setw(3) << fgUpdate;
275 for(ord=0; ord<8; ord++){
276 double par = calconst -> getXtpar(lay, iEntr, lr, ord);
277 fxtlog << setw(14) << par;
285 cout <<
"Xt update finished. File xtlog was written." << endl;