44 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
45 MsgStream log(
msgSvc,
"T0MdcCalib");
46 log << MSG::INFO <<
"T0MdcCalib::initialize()" << endreq;
49 m_mdcGeomSvc = mdcGeomSvc;
50 m_mdcFunSvc = mdcFunSvc;
51 m_mdcUtilitySvc = mdcUtilitySvc;
63 m_fdT0 =
new TFolder(
"fdT0",
"fdT0");
64 m_hlist ->
Add(m_fdT0);
66 m_fdResiWire =
new TFolder(
"ResiWire",
"ResiWire");
67 m_hlist->Add(m_fdResiWire);
69 nwire = m_mdcGeomSvc -> getWireSize();
70 for(i=0; i<nwire; i++){
71 lay = m_mdcGeomSvc -> Wire(i) -> Layer();
72 cel = m_mdcGeomSvc -> Wire(i) -> Cell();
74 sprintf(hname,
"Resi%04d_Lay%02d_Cell%03d_L", i, lay, cel);
75 m_hleft[i] =
new TH1F(hname,
"", 400, -2.0, 2.0);
76 m_fdT0 ->
Add(m_hleft[i]);
78 sprintf(hname,
"Resi%04d_Lay%02d_Cell%03d_R", i, lay, cel);
79 m_hright[i] =
new TH1F(hname,
"", 400, -2.0, 2.0);
80 m_fdT0 ->
Add(m_hright[i]);
83 m_hLrResiSum =
new TH1F(
"LrResiSum",
"", 200, -0.5, 0.5);
84 m_fdResiWire->Add(m_hLrResiSum);
86 m_hLrResiSub =
new TH1F(
"LrResiSub",
"", 200, -0.5, 0.5);
87 m_fdResiWire->Add(m_hLrResiSub);
92 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
93 MsgStream log(
msgSvc,
"T0MdcCalib");
94 log << MSG::DEBUG <<
"T0MdcCalib::fillHist()" << endreq;
99 bool esCutFg =
event->getEsCutFlag();
100 if( ! esCutFg )
return -1;
121 ntrk =
event -> getNTrk();
122 if((ntrk < m_param.
nTrkCut[0]) || (ntrk > m_param.
nTrkCut[1]))
return -1;
124 for(i=0; i<ntrk; i++){
125 rectrk =
event -> getRecTrk(i);
126 nhit = rectrk -> getNHits();
129 double dr = rectrk->
getDr();
130 if(fabs(dr) > m_param.
drCut)
continue;
133 double dz = rectrk->
getDz();
134 if(fabs(dz) > m_param.
dzCut)
continue;
137 double p = rectrk -> getP();
138 if((fabs(p) < m_param.
pCut[0]) || (fabs(p) > m_param.
pCut[1]))
continue;
140 for(lay=0; lay<
MdcCalNLayer; lay++) fgHitLay[lay] =
false;
141 for(k=0; k<nhit; k++){
142 rechit = rectrk -> getRecHit(k);
143 lay = rechit -> getLayid();
144 fgHitLay[lay] =
true;
148 for(lay=0; lay<
MdcCalNLayer; lay++)
if(fgHitLay[lay]) nhitlay++;
152 if(m_param.
noiseCut && (!fgNoise))
continue;
155 for(k=0; k<nhit; k++){
156 rechit = rectrk -> getRecHit(k);
157 lay = rechit -> getLayid();
158 cel = rechit -> getCellid();
159 wir = m_mdcGeomSvc -> Wire(lay, cel) -> Id();
160 lr = rechit -> getLR();
161 doca = rechit -> getDocaExc();
162 dmeas = rechit -> getDmeas();
163 resi = rechit -> getResiExc();
164 stat = rechit -> getStat();
166 if(1 != stat)
continue;
168 if( (fabs(doca) < m_docaMin[lay]) ||
169 (fabs(doca) > m_docaMax[lay]) ||
170 (fabs(resi) > m_param.
resiCut[lay]) ){
175 if( ! fgHitLay[1] )
continue;
176 }
else if(42 == lay){
177 if( ! fgHitLay[41] )
continue;
179 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) )
continue;
184 m_hleft[wir] ->
Fill(resi);
186 m_hright[wir] ->
Fill(resi);
189 std::cout <<
"wireid: " << wir << std::endl;
202 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
203 MsgStream log(
msgSvc,
"T0MdcCalib");
204 log << MSG::INFO <<
"T0MdcCalib::updateConst()" << endreq;
228 nwire = m_mdcGeomSvc -> getWireSize();
229 std::cout <<
"totwire: " << nwire << std::endl;
230 for(i=0; i<nwire; i++){
231 lay = m_mdcGeomSvc -> Wire(i) -> Layer();
234 entry_l = m_hleft[i] -> GetEntries();
235 mean_l = m_hleft[i] -> GetMean();
239 entry_r = m_hright[i] -> GetEntries();
240 mean_r = m_hright[i] -> GetMean();
244 delt0 = 0.5 * (mean_l + mean_r) / m_vdr;
248 if(0 == m_param.
fgWireCal[i]) delt0 = 0.0;
250 resiLrSum = 0.5 * (mean_l + mean_r);
251 resiLrSub = 0.5 * (mean_l - mean_r);
252 m_hLrResiSum->Fill(resiLrSum);
253 m_hLrResiSub->Fill(resiLrSub);
255 t0 = calconst -> getT0(i);
258 calconst -> resetT0(i, t0);
259 calconst -> resetDelT0(i, delt0);
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)