106 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
107 MsgStream log(
msgSvc,
"PreXtMdcCalib");
108 log << MSG::DEBUG <<
"PreXtMdcCalib::fillHist()" << endreq;
120 IDataProviderSvc* eventSvc =
NULL;
121 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
126 m_t0[lay] = m_mdcFunSvc -> getT0(lay, 0);
127 m_mdcFunSvc->
getXtpar(lay, 0, 0, xtpar);
128 m_tm[lay] = xtpar[6];
134 double tes = -9999.0;
136 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,
"/Event/Recon/RecEsTimeCol");
137 if( (!aevtimeCol) || (aevtimeCol->size()==0) ){
141 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
142 for(; iter_evt!=aevtimeCol->end(); iter_evt++){
143 tes = (*iter_evt)->getTest();
144 esTimeflag = (*iter_evt)->getStat();
147 bool flagTes =
false;
148 for(
int iEs=0; iEs<m_param.
nEsFlag; iEs++){
149 if(esTimeflag == m_param.
esFlag[iEs]){
154 if(-1 == esTimeflag)
return -1;
156 if( (m_param.
esCut) && ((!flagTes) || (tes < m_param.
tesMin) || (tes > m_param.
tesMax)) )
return -1;
159 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc,
"/Event/Digi/MdcDigiCol");
161 log << MSG::FATAL <<
"Could not find event" << endreq;
164 MdcDigiCol::iterator
iter = mdcDigiCol->begin();
166 for(;
iter != mdcDigiCol->end();
iter++, digiId++) {
168 id = (aDigi)->identify();
172 tdc = (aDigi) -> getTimeChannel();
173 adc = (aDigi) -> getChargeChannel();
174 fgOverFlow = (aDigi) -> getOverflow();
176 trec = traw - tes - m_t0[lay];
181 if ( ((fgOverFlow & 1) !=0 ) || ((fgOverFlow & 12) != 0) ||
188 if(trec < m_tm[lay]){
190 m_htrec[lay]->Fill(trec);
191 m_nhitTot->Fill(lay);
194 if(trec < m_tbin[
bin]){
195 m_nEntries[lay][
bin]++;
196 m_nhitBin[lay]->Fill(m_tbin[
bin]);
209 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
210 MsgStream log(
msgSvc,
"PreXtMdcCalib");
211 log << MSG::DEBUG <<
"PreXtMdcCalib::updateConst()" << endreq;
221 double pi = 3.141592653;
228 TF1* funXt =
new TF1(
"funXt", xtfun, 0, 300, 6);
229 funXt -> FixParameter(0, 0.0);
230 funXt -> SetParameter(1, 0.03);
231 funXt -> SetParameter(2, 0.0);
232 funXt -> SetParameter(3, 0.0);
233 funXt -> SetParameter(4, 0.0);
234 funXt -> SetParameter(5, 0.0);
236 ofstream fxtlog(
"preXtpar.dat");
238 sprintf(hname,
"grPreXt%02d", lay);
239 m_grXt[lay] =
new TGraph();
240 m_grXt[lay] -> SetName(hname);
242 m_fdPreXt ->
Add(m_grXt[lay]);
244 layRad = m_mdcGeomSvc -> Layer(lay) -> Radius();
245 ncel = m_mdcGeomSvc -> Layer(lay) -> NCell();
246 dm =
pi * layRad / ncel;
248 fxtlog <<
"layer " << lay << endl;
250 dist[
bin] = dm * m_nEntries[lay][
bin] / m_nTot[lay];
251 m_grXt[lay] -> SetPoint(
bin, m_tbin[
bin], dist[
bin]);
252 fxtlog << setw(4) <<
bin << setw(15) << m_tbin[
bin]
253 << setw(15) << dist[
bin] << setw(15) << dm
254 << setw(10) << m_nEntries[lay][
bin]
255 << setw(10) << m_nTot[lay] << endl;
257 if(m_tbin[
bin] >= m_tm[lay])
break;
261 m_grXt[lay] ->
Fit(funXt,
"Q",
"", 0.0, m_tm[lay]);
262 for(ord=0; ord<6; ord++){
263 xtpar[ord] = funXt -> GetParameter(ord);
268 for(ord=0; ord<6; ord++){
269 calconst -> resetXtpar(lay, iEntr, iLR, ord, xtpar[ord]);
274 for(ord=0; ord<6; ord++) xtpar[ord] = calconst->
getXtpar(lay, 0, 0, ord);
277 for(ord=0; ord<6; ord++) fxtlog << setw(14) << xtpar[ord];
278 fxtlog << setw(10) << m_tm[lay] <<
" 0" << endl;
281 cout <<
"preXt.dat 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)