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]++;
214 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
215 MsgStream log(
msgSvc,
"GrXtMdcCalib");
216 log << MSG::INFO <<
"GrXtMdcCalib::updateConst()" << endreq;
222 TF1* fxtDr =
new TF1(
"fxtDr",
xtfun, 0, 300, 6);
223 TF1* fxtEd =
new TF1(
"fxtEd",
xtedge, 150, 500, 1);
224 if(1 == m_param.
fixXtC0) fxtDr -> FixParameter(0, 0);
229 m_fgFit[lay][iEntr][lr] =
false;
230 if(0 == m_param.
fgCalib[lay])
continue;
232 if(m_nhit[lay][iEntr][lr] > 1000){
233 TMAX = calconst -> getXtpar(lay, iEntr, lr, 6);
235 m_grxt[lay][iEntr][lr] ->
Fit(
"fxtDr",
"Q+",
"", 0, TMAX);
237 for(ord=0; ord<6; ord++){
238 xtpar[lay][iEntr][lr][ord] = fxtDr->GetParameter(ord);
240 xtpar[lay][iEntr][lr][6] = TMAX;
243 for(ord=0; ord<6; ord++) DMAX += xtpar[lay][iEntr][lr][ord] * pow(TMAX, ord);
245 m_grxt[lay][iEntr][lr] ->
Fit(
"fxtEd",
"Q+",
"", TMAX, TMAX+300);
246 xtpar[lay][iEntr][lr][7] = fxtEd->GetParameter(0);
247 if(xtpar[lay][iEntr][lr][7] < 0.0) xtpar[lay][iEntr][lr][7] = 0.0;
248 m_fgFit[lay][iEntr][lr] =
true;
259 ofstream fxtlog(
"xtlog");
263 fxtlog << setw(3) << lay << setw(3) << iEntr << setw(3) << lr;
266 if(m_fgFit[lay][iEntr][lr]){
268 for(ord=0; ord<8; ord++) calconst->
resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntr][lr][ord]);
273 for(ord=0; ord<8; ord++){
274 calconst->
resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntrNew][lr][ord]);
278 fxtlog << setw(3) << fgUpdate;
279 for(ord=0; ord<8; ord++){
280 double par = calconst -> getXtpar(lay, iEntr, lr, ord);
281 fxtlog << setw(14) << par;
289 cout <<
"Xt update finished. File xtlog was written." << endl;
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)