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 double p = rectrk -> getP();
161 if((fabs(p) < m_param.
pCut[0]) || (fabs(p) > m_param.
pCut[1]))
continue;
164 double phi0 = rectrk -> getPhi0();
165 double phiTrk = phi0 + CLHEP::halfpi;
166 if(phiTrk > CLHEP::twopi) phiTrk -= CLHEP::twopi;
167 if(m_param.
cosmicDwTrk && (phiTrk<CLHEP::pi))
continue;
171 fgHitLay[lay] =
false;
174 for(k=0; k<nhit; k++){
175 rechit = rectrk -> getRecHit(k);
176 lay = rechit -> getLayid();
177 doca = rechit -> getDocaInc();
178 resi = rechit -> getResiInc();
179 fgHitLay[lay] =
true;
186 if(! fgTrk)
continue;
190 if(fgHitLay[lay]) nhitlay++;
194 for(k=0; k<nhit; k++){
195 rechit = rectrk -> getRecHit(k);
196 lay = rechit -> getLayid();
197 doca = rechit -> getDocaInc();
198 resi = rechit -> getResiInc();
199 iLR = rechit -> getLR();
200 entrance = rechit -> getEntra();
201 tdr = rechit -> getTdrift();
203 if( (fabs(doca) > m_docaMax[lay]) ||
204 (fabs(resi) > m_param.
resiCut[lay]) ){
209 if( ! fgHitLay[1] )
continue;
210 }
else if(42 == lay){
211 if( ! fgHitLay[41] )
continue;
213 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) )
continue;
218 for(
int iPM=0; iPM<nPM; iPM++){
219 if(0==iPM) iEntr = m_mdcFunSvc -> getXtEntrIndex(entrance);
220 else iEntr = m_mdcFunSvc -> getXtEntrIndex(-1.0*entrance);
222 int npoint = m_grXt[lay][iEntr][iLR]->GetN();
223 if(npoint < m_nMaxGrPoint) m_grXt[lay][iEntr][iLR]->SetPoint(npoint, tdr, fabs(doca));
225 if(tdr<m_tbinLim[lay][0])
continue;
226 else if(tdr<m_tbinLim[lay][1]) m_pfNear[lay][iEntr][iLR]->Fill(tdr, fabs(doca));
227 else if(tdr<m_tbinLim[lay][2]) m_pfMid[lay][iEntr][iLR]->Fill(tdr, fabs(doca));
228 else if(tdr<m_tbinLim[lay][3]) m_pfFar[lay][iEntr][iLR]->Fill(tdr, fabs(doca));
241 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
242 MsgStream log(
msgSvc,
"XtInteMdcCalib");
243 log << MSG::INFO <<
"XtInteMdcCalib::updateConst()" << endreq;
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)
double resiCut[MdcCalNLayer]
virtual void printCut() const =0
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)