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;
136 for(lay=0; lay<
MdcCalNLayer; lay++) fgHitLay[lay] =
false;
137 for(k=0; k<nhit; k++){
138 rechit = rectrk -> getRecHit(k);
139 lay = rechit -> getLayid();
140 fgHitLay[lay] =
true;
144 for(lay=0; lay<
MdcCalNLayer; lay++)
if(fgHitLay[lay]) nhitlay++;
148 if(m_param.
noiseCut && (!fgNoise))
continue;
151 for(k=0; k<nhit; k++){
152 rechit = rectrk -> getRecHit(k);
153 lay = rechit -> getLayid();
154 cel = rechit -> getCellid();
155 wir = m_mdcGeomSvc -> Wire(lay, cel) -> Id();
156 lr = rechit -> getLR();
157 doca = rechit -> getDocaExc();
158 dmeas = rechit -> getDmeas();
159 resi = rechit -> getResiExc();
160 stat = rechit -> getStat();
162 if(1 != stat)
continue;
164 if( (fabs(doca) < m_docaMin[lay]) ||
165 (fabs(doca) > m_docaMax[lay]) ||
166 (fabs(resi) > m_param.
resiCut[lay]) ){
171 if( ! fgHitLay[1] )
continue;
172 }
else if(42 == lay){
173 if( ! fgHitLay[41] )
continue;
175 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) )
continue;
180 m_hleft[wir] -> Fill(resi);
182 m_hright[wir] -> Fill(resi);
185 std::cout <<
"wireid: " << wir << std::endl;
194 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
195 MsgStream log(
msgSvc,
"T0MdcCalib");
196 log << MSG::INFO <<
"T0MdcCalib::updateConst()" << endreq;
220 nwire = m_mdcGeomSvc -> getWireSize();
221 std::cout <<
"totwire: " << nwire << std::endl;
222 for(i=0; i<nwire; i++){
223 lay = m_mdcGeomSvc -> Wire(i) -> Layer();
226 entry_l = m_hleft[i] -> GetEntries();
227 mean_l = m_hleft[i] -> GetMean();
231 entry_r = m_hright[i] -> GetEntries();
232 mean_r = m_hright[i] -> GetMean();
236 delt0 = 0.5 * (mean_l + mean_r) / m_vdr;
241 resiLrSum = 0.5 * (mean_l + mean_r);
242 resiLrSub = 0.5 * (mean_l - mean_r);
243 m_hLrResiSum->Fill(resiLrSum);
244 m_hLrResiSub->Fill(resiLrSub);
246 t0 = calconst -> getT0(i);
249 calconst -> resetT0(i, t0);
250 calconst -> resetDelT0(i, delt0);