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"
40 delete m_hqt[lay][
bin];
52 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
53 MsgStream log(
msgSvc,
"QtMdcCalib");
54 log << MSG::INFO <<
"QtMdcCalib::initialize()" << endreq;
57 m_mdcGeomSvc = mdcGeomSvc;
58 m_mdcFunSvc = mdcFunSvc;
59 m_mdcUtilitySvc = mdcUtilitySvc;
68 for(lay=0; lay<m_nlayer; lay++){
69 m_qmin[lay] = m_param.
qmin[lay];
70 m_qmax[lay] = m_param.
qmax[lay];
71 m_qbinw[lay] = (m_qmax[lay] - m_qmin[lay]) / (
double)m_nbin;
74 m_fdQt =
new TFolder(
"fdQt",
"fdQt");
75 m_fdQ_T =
new TFolder(
"QtPlot",
"QtPlot");
76 m_hlist ->
Add(m_fdQt);
77 m_hlist ->
Add(m_fdQ_T);
79 for(lay=0; lay<m_nlayer; lay++){
80 sprintf(hname,
"HQ_Layer%02d", lay);
81 m_hqhit[lay] =
new TH1F(hname,
"", 1500, 0, 3000);
82 m_fdQt ->
Add(m_hqhit[lay]);
84 sprintf(hname,
"HQT_Plot_lay%02d", lay);
85 m_grqt[lay] =
new TGraphErrors();
86 m_grqt[lay]->SetName(hname);
87 m_grqt[lay]->SetMarkerStyle(20);
88 m_grqt[lay]->SetMarkerColor(1);
89 m_fdQ_T->Add(m_grqt[lay]);
91 sprintf(hname,
"HQdelT_Plot_lay%02d", lay);
92 m_grqdt[lay] =
new TGraphErrors();
93 m_grqdt[lay]->SetName(hname);
94 m_grqdt[lay]->SetMarkerStyle(10);
95 m_grqdt[lay]->SetMarkerColor(1);
96 m_fdQ_T->Add(m_grqdt[lay]);
99 sprintf(hname,
"HQT_Lay%02d_Bin%02d", lay,
bin);
100 m_hqt[lay][
bin] =
new TH1F(hname,
"", 200, -1, 1);
101 m_fdQt ->
Add(m_hqt[lay][
bin]);
108 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
109 MsgStream log(
msgSvc,
"QtMdcCalib");
110 log << MSG::DEBUG <<
"QtMdcCalib::fillHist()" << endreq;
115 bool esCutFg =
event->getEsCutFlag();
116 if( ! esCutFg )
return -1;
134 ntrk =
event -> getNTrk();
135 for(i=0; i<ntrk; i++){
136 rectrk =
event -> getRecTrk(i);
137 nhit = rectrk -> getNHits();
140 double dr = rectrk->
getDr();
141 if(fabs(dr) > m_param.
drCut)
continue;
144 double dz = rectrk->
getDz();
145 if(fabs(dz) > m_param.
dzCut)
continue;
148 double p = rectrk -> getP();
149 if((fabs(p) < m_param.
pCut[0]) || (fabs(p) > m_param.
pCut[1]))
continue;
151 for(lay=0; lay<
MdcCalNLayer; lay++) fgHitLay[lay] =
false;
152 for(k=0; k<nhit; k++){
153 rechit = rectrk -> getRecHit(k);
154 lay = rechit -> getLayid();
155 fgHitLay[lay] =
true;
159 for(lay=0; lay<
MdcCalNLayer; lay++)
if(fgHitLay[lay]) nhitlay++;
163 if(m_param.
noiseCut && (!fgNoise))
continue;
165 for(k=0; k<nhit; k++){
166 rechit = rectrk -> getRecHit(k);
167 lay = rechit -> getLayid();
168 doca = rechit -> getDocaInc();
169 dmeas = rechit -> getDmeas();
170 m_resi = rechit -> getResiInc();
171 m_qhit = rechit -> getQhit();
173 m_hqhit[lay] ->
Fill(m_qhit);
175 bin = (int)((m_qhit - m_qmin[lay]) / m_qbinw[lay]);
176 if( (
bin >= 0) && (
bin < m_nbin) ){
177 m_hqt[lay][
bin] ->
Fill( m_resi );
190 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
191 MsgStream log(
msgSvc,
"QtMdcCalib");
192 log << MSG::INFO <<
"QtMdcCalib::updateConst()" << endreq;
207 TF1* funQt =
new TF1(
"funQt",
qtFun, 200, 2000, 2);
209 ofstream fqtlog(
"qtlog");
210 for(lay=0; lay<m_nlayer; lay++){
211 if(0 == m_param.
fgCalib[lay])
continue;
213 fqtlog <<
"Layer" << lay << endl;
215 for(ord=0; ord<m_qtorder; ord++){
216 m_qtpar[lay][ord] = calconst -> getQtpar(lay, ord);
220 entry = m_hqt[lay][
bin] -> GetEntries();
223 deltw = m_hqt[lay][
bin] -> GetMean();
224 qterr = ( m_hqt[lay][
bin]->GetRMS() ) / sqrt((
double)entry);
231 qbcen = ( (double)
bin + 0.5 ) * m_qbinw[lay] + m_qmin[lay];
233 tw = (m_mdcFunSvc->
getTimeWalk(lay, qbcen)) + deltw;
235 m_grqt[lay]->SetPoint(
bin, qbcen, tw);
236 m_grqt[lay]->SetPointError(
bin, 0, qterr);
238 m_grqdt[lay]->SetPoint(
bin, qbcen, deltw);
239 m_grqdt[lay]->SetPointError(
bin, 0, qterr);
241 fqtlog << setw(3) <<
bin
249 m_grqt[lay]->Fit(
"funQt",
"Q+",
"", m_qmin[lay], m_qmax[lay]);
252 for(ord=0; ord<m_qtorder; ord++){
253 qtpar = funQt->GetParameter(ord);
254 qterr = funQt->GetParError(ord);
255 calconst -> resetQtpar(lay, ord, qtpar);
257 fqtlog << setw(12) << qtpar
287 double tw = par[1] / sqrt(
x[0]) + par[0];
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)
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
virtual double getTimeWalk(int layid, double Q) const =0
int fgCalib[MdcCalNLayer]
double qmax[MdcCalNLayer]
double qmin[MdcCalNLayer]
bool getFgNoiseRatio() const
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
static Double_t qtFun(Double_t *x, Double_t *par)
void initialize(TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
int fillHist(MdcCalEvent *event)
int updateConst(MdcCalibConst *calconst)