52 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
53 MsgStream log(
msgSvc,
"QtMdcCalib");
54 log << MSG::INFO <<
"QtMdcCalib::initialize()" << endreq;
57 m_mdcGeomSvc = mdcGeomSvc;
58 m_mdcFunSvc = mdcFunSvc;
59 m_mdcUtilitySvc = mdcUtilitySvc;
68 for(lay=0; lay<m_nlayer; lay++){
69 m_qmin[lay] = m_param.
qmin[lay];
70 m_qmax[lay] = m_param.
qmax[lay];
71 m_qbinw[lay] = (m_qmax[lay] - m_qmin[lay]) / (
double)m_nbin;
74 m_fdQt =
new TFolder(
"fdQt",
"fdQt");
75 m_fdQ_T =
new TFolder(
"QtPlot",
"QtPlot");
76 m_hlist -> Add(m_fdQt);
77 m_hlist -> Add(m_fdQ_T);
79 for(lay=0; lay<m_nlayer; lay++){
80 sprintf(hname,
"HQ_Layer%02d", lay);
81 m_hqhit[lay] =
new TH1F(hname,
"", 1500, 0, 3000);
82 m_fdQt -> Add(m_hqhit[lay]);
84 sprintf(hname,
"HQT_Plot_lay%02d", lay);
85 m_grqt[lay] =
new TGraphErrors();
86 m_grqt[lay]->SetName(hname);
87 m_grqt[lay]->SetMarkerStyle(20);
88 m_grqt[lay]->SetMarkerColor(1);
89 m_fdQ_T->Add(m_grqt[lay]);
91 sprintf(hname,
"HQdelT_Plot_lay%02d", lay);
92 m_grqdt[lay] =
new TGraphErrors();
93 m_grqdt[lay]->SetName(hname);
94 m_grqdt[lay]->SetMarkerStyle(10);
95 m_grqdt[lay]->SetMarkerColor(1);
96 m_fdQ_T->Add(m_grqdt[lay]);
99 sprintf(hname,
"HQT_Lay%02d_Bin%02d", lay,
bin);
100 m_hqt[lay][
bin] =
new TH1F(hname,
"", 200, -1, 1);
101 m_fdQt -> Add(m_hqt[lay][
bin]);
108 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
109 MsgStream log(
msgSvc,
"QtMdcCalib");
110 log << MSG::DEBUG <<
"QtMdcCalib::fillHist()" << endreq;
115 bool esCutFg =
event->getEsCutFlag();
116 if( ! esCutFg )
return -1;
134 ntrk =
event -> getNTrk();
135 for(i=0; i<ntrk; i++){
136 rectrk =
event -> getRecTrk(i);
137 nhit = rectrk -> getNHits();
140 double dr = rectrk->
getDr();
141 if(fabs(dr) > m_param.
drCut)
continue;
144 double dz = rectrk->
getDz();
145 if(fabs(dz) > m_param.
dzCut)
continue;
147 for(lay=0; lay<
MdcCalNLayer; lay++) fgHitLay[lay] =
false;
148 for(k=0; k<nhit; k++){
149 rechit = rectrk -> getRecHit(k);
150 lay = rechit -> getLayid();
151 fgHitLay[lay] =
true;
155 for(lay=0; lay<
MdcCalNLayer; lay++)
if(fgHitLay[lay]) nhitlay++;
159 if(m_param.
noiseCut && (!fgNoise))
continue;
161 for(k=0; k<nhit; k++){
162 rechit = rectrk -> getRecHit(k);
163 lay = rechit -> getLayid();
164 doca = rechit -> getDocaInc();
165 dmeas = rechit -> getDmeas();
166 m_resi = rechit -> getResiInc();
167 m_qhit = rechit -> getQhit();
169 m_hqhit[lay] -> Fill(m_qhit);
171 bin = (int)((m_qhit - m_qmin[lay]) / m_qbinw[lay]);
172 if( (
bin >= 0) && (
bin < m_nbin) ){
173 m_hqt[lay][
bin] -> Fill( m_resi );
182 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
183 MsgStream log(
msgSvc,
"QtMdcCalib");
184 log << MSG::INFO <<
"QtMdcCalib::updateConst()" << endreq;
199 TF1* funQt =
new TF1(
"funQt",
qtFun, 200, 2000, 2);
201 ofstream fqtlog(
"qtlog");
202 for(lay=0; lay<m_nlayer; lay++){
203 if(0 == m_param.
fgCalib[lay])
continue;
205 fqtlog <<
"Layer" << lay << endl;
207 for(ord=0; ord<m_qtorder; ord++){
208 m_qtpar[lay][ord] = calconst -> getQtpar(lay, ord);
212 entry = m_hqt[lay][
bin] -> GetEntries();
215 deltw = m_hqt[lay][
bin] -> GetMean();
216 qterr = ( m_hqt[lay][
bin]->GetRMS() ) / sqrt((
double)entry);
223 qbcen = ( (double)
bin + 0.5 ) * m_qbinw[lay] + m_qmin[lay];
225 tw = (m_mdcFunSvc->
getTimeWalk(lay, qbcen)) + deltw;
227 m_grqt[lay]->SetPoint(
bin, qbcen, tw);
228 m_grqt[lay]->SetPointError(
bin, 0, qterr);
230 m_grqdt[lay]->SetPoint(
bin, qbcen, deltw);
231 m_grqdt[lay]->SetPointError(
bin, 0, qterr);
233 fqtlog << setw(3) <<
bin
241 m_grqt[lay]->Fit(
"funQt",
"Q+",
"", m_qmin[lay], m_qmax[lay]);
244 for(ord=0; ord<m_qtorder; ord++){
245 qtpar = funQt->GetParameter(ord);
246 qterr = funQt->GetParError(ord);
247 calconst -> resetQtpar(lay, ord, qtpar);
249 fqtlog << setw(12) << qtpar