1#include "MdcCalibAlg/XtInteMdcCalib.h"
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/IMessageSvc.h"
5#include "GaudiKernel/StatusCode.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/Bootstrap.h"
23 m_tbinWid[lay][0] = 5.0;
24 m_tbinWid[lay][1] = 10.0;
25 m_tbinWid[lay][2] = 20.0;
27 m_tbinLim[lay][0] = -10.0;
28 m_tbinLim[lay][1] = 30.0;
29 if(lay < 8) m_tbinLim[lay][2] = 210.0;
30 else m_tbinLim[lay][2] = 350.0;
31 m_tbinLim[lay][3] = 990.0;
40 for(
int iEntr=0; iEntr<NENTR; iEntr++){
41 for(
int lr=0; lr<2; lr++){
42 delete m_pfNear[lay][iEntr][lr];
43 delete m_pfMid[lay][iEntr][lr];
44 delete m_pfFar[lay][iEntr][lr];
45 delete m_grXt[lay][iEntr][lr];
56 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
57 MsgStream log(
msgSvc,
"XtInteMdcCalib");
58 log << MSG::INFO <<
"XtInteMdcCalib::initialize()" << endreq;
61 m_mdcGeomSvc = mdcGeomSvc;
62 m_mdcFunSvc = mdcFunSvc;
63 m_mdcUtilitySvc = mdcUtilitySvc;
67 m_fdPf =
new TFolder(
"fdProfile",
"fdProfile");
68 m_hlist -> Add(m_fdPf);
72 for(
int iEntr=0; iEntr<NENTR; iEntr++){
73 for(
int lr=0; lr<2; lr++){
74 sprintf(hname,
"xt%02d_%02d_%d_gr", lay, iEntr, lr);
75 m_grXt[lay][iEntr][lr] =
new TGraph();
76 m_grXt[lay][iEntr][lr]->SetName(hname);
77 m_fdPf->Add(m_grXt[lay][iEntr][lr]);
79 int xbinN = (int)((m_tbinLim[lay][1] - m_tbinLim[lay][0])/m_tbinWid[lay][0] + 0.5);
80 sprintf(hname,
"xt%02d_%02d_%d_near", lay, iEntr, lr);
81 m_pfNear[lay][iEntr][lr] =
new TProfile(hname, hname, xbinN, m_tbinLim[lay][0], m_tbinLim[lay][1]);
82 m_fdPf->Add(m_pfNear[lay][iEntr][lr]);
84 int xbinM = (int)((m_tbinLim[lay][2] - m_tbinLim[lay][1])/m_tbinWid[lay][1] + 0.5);
85 sprintf(hname,
"xt%02d_%02d_%d_mid", lay, iEntr, lr);
86 m_pfMid[lay][iEntr][lr] =
new TProfile(hname, hname, xbinM, m_tbinLim[lay][1], m_tbinLim[lay][2]);
87 m_fdPf->Add(m_pfMid[lay][iEntr][lr]);
89 int xbinF = (int)((m_tbinLim[lay][3] - m_tbinLim[lay][2])/m_tbinWid[lay][2] + 0.5);
90 sprintf(hname,
"xt%02d_%02d_%d_far", lay, iEntr, lr);
91 m_pfFar[lay][iEntr][lr] =
new TProfile(hname, hname, xbinF, m_tbinLim[lay][2], m_tbinLim[lay][3]);
92 m_fdPf->Add(m_pfFar[lay][iEntr][lr]);
106 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
107 MsgStream log(
msgSvc,
"XtInteMdcCalib");
108 log << MSG::DEBUG <<
"XtInteMdcCalib::fillHist()" << endreq;
113 bool esCutFg =
event->getEsCutFlag();
114 if( ! esCutFg )
return -1;
145 int ntrk =
event -> getNTrk();
146 for(i=0; i<ntrk; i++){
148 rectrk =
event->getRecTrk(i);
149 nhit = rectrk -> getNHits();
152 dr = rectrk->
getDr();
153 if(fabs(dr) > m_param.
drCut)
continue;
156 dz = rectrk->
getDz();
157 if(fabs(dz) > m_param.
dzCut)
continue;
160 fgHitLay[lay] =
false;
163 for(k=0; k<nhit; k++){
164 rechit = rectrk -> getRecHit(k);
165 lay = rechit -> getLayid();
166 doca = rechit -> getDocaInc();
167 resi = rechit -> getResiInc();
168 fgHitLay[lay] =
true;
175 if(! fgTrk)
continue;
179 if(fgHitLay[lay]) nhitlay++;
183 for(k=0; k<nhit; k++){
184 rechit = rectrk -> getRecHit(k);
185 lay = rechit -> getLayid();
186 doca = rechit -> getDocaInc();
187 resi = rechit -> getResiInc();
188 iLR = rechit -> getLR();
189 entrance = rechit -> getEntra();
190 tdr = rechit -> getTdrift();
192 if( (fabs(doca) > m_docaMax[lay]) ||
193 (fabs(resi) > m_param.
resiCut[lay]) ){
198 if( ! fgHitLay[1] )
continue;
199 }
else if(42 == lay){
200 if( ! fgHitLay[41] )
continue;
202 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) )
continue;
205 iEntr = m_mdcFunSvc -> getXtEntrIndex(entrance);
206 int npoint = m_grXt[lay][iEntr][iLR]->GetN();
207 if(npoint < m_nMaxGrPoint) m_grXt[lay][iEntr][iLR]->SetPoint(npoint, tdr, fabs(doca));
209 if(tdr<m_tbinLim[lay][0])
continue;
210 else if(tdr<m_tbinLim[lay][1]) m_pfNear[lay][iEntr][iLR]->Fill(tdr, fabs(doca));
211 else if(tdr<m_tbinLim[lay][2]) m_pfMid[lay][iEntr][iLR]->Fill(tdr, fabs(doca));
212 else if(tdr<m_tbinLim[lay][3]) m_pfFar[lay][iEntr][iLR]->Fill(tdr, fabs(doca));
220 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
221 MsgStream log(
msgSvc,
"XtInteMdcCalib");
222 log << MSG::INFO <<
"XtInteMdcCalib::updateConst()" << endreq;
double resiCut[MdcCalNLayer]
virtual void initialize(TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
virtual int updateConst(MdcCalibConst *calconst)=0
virtual int fillHist(MdcCalEvent *event)=0
void initialize(TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
int updateConst(MdcCalibConst *calconst)
int fillHist(MdcCalEvent *event)