BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
QtMdcCalib Class Reference

#include <QtMdcCalib.h>

+ Inheritance diagram for QtMdcCalib:

Public Member Functions

 QtMdcCalib ()
 
 ~QtMdcCalib ()
 
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
 
void setParam (MdcCalParams &param)
 
int fillHist (MdcCalEvent *event)
 
int updateConst (MdcCalibConst *calconst)
 
void clear ()
 
 QtMdcCalib ()
 
 ~QtMdcCalib ()
 
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
 
void setParam (MdcCalParams &param)
 
int fillHist (MdcCalEvent *event)
 
int updateConst (MdcCalibConst *calconst)
 
void clear ()
 
- Public Member Functions inherited from MdcCalib
 MdcCalib ()
 
virtual ~MdcCalib ()
 
virtual void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
 
virtual void setParam (MdcCalParams &param)=0
 
virtual int fillHist (MdcCalEvent *event)=0
 
virtual int updateConst (MdcCalibConst *calconst)=0
 
virtual void clear ()=0
 
 MdcCalib ()
 
virtual ~MdcCalib ()
 
virtual void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
 
virtual void setParam (MdcCalParams &param)=0
 
virtual int fillHist (MdcCalEvent *event)=0
 
virtual int updateConst (MdcCalibConst *calconst)=0
 
virtual void clear ()=0
 

Static Public Member Functions

static Double_t qtFun (Double_t *x, Double_t *par)
 
static Double_t qtFun (Double_t *x, Double_t *par)
 

Detailed Description

Constructor & Destructor Documentation

◆ QtMdcCalib() [1/2]

QtMdcCalib::QtMdcCalib ( )

Definition at line 21 of file QtMdcCalib.cxx.

21 {
22 m_vdr = 0.03;
23
24 m_nlayer = MdcCalNLayer;
25 m_qtorder = MdcCalQtOrd;
26 m_nbin = MdcCalNQBin;
27 m_innNLay = MdcCalInnNLay;
28}

◆ ~QtMdcCalib() [1/2]

QtMdcCalib::~QtMdcCalib ( )

Definition at line 30 of file QtMdcCalib.cxx.

30 {
31}

◆ QtMdcCalib() [2/2]

QtMdcCalib::QtMdcCalib ( )

◆ ~QtMdcCalib() [2/2]

QtMdcCalib::~QtMdcCalib ( )

Member Function Documentation

◆ clear() [1/2]

void QtMdcCalib::clear ( )
virtual

Implements MdcCalib.

Definition at line 33 of file QtMdcCalib.cxx.

33 {
34 int bin;
35 for(int lay=0; lay<MdcCalNLayer; lay++){
36 delete m_hqhit[lay];
37 delete m_grqt[lay];
38 delete m_grqdt[lay];
39 for(bin=0; bin<MdcCalQtOrd; bin++){
40 delete m_hqt[lay][bin];
41 }
42 }
43 delete m_fdQt;
44 delete m_fdQ_T;
45
47}
*******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
Definition: FoamA.h:85
virtual void clear()=0
Definition: MdcCalib.cxx:76

◆ clear() [2/2]

void QtMdcCalib::clear ( )
virtual

Implements MdcCalib.

◆ fillHist() [1/2]

int QtMdcCalib::fillHist ( MdcCalEvent event)
virtual

Implements MdcCalib.

Definition at line 106 of file QtMdcCalib.cxx.

106 {
107 IMessageSvc* msgSvc;
108 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
109 MsgStream log(msgSvc, "QtMdcCalib");
110 log << MSG::DEBUG << "QtMdcCalib::fillHist()" << endreq;
111
112 MdcCalib::fillHist(event);
113
114 // get EsTimeCol
115 bool esCutFg = event->getEsCutFlag();
116 if( ! esCutFg ) return -1;
117
118 int i;
119 int k;
120 int bin;
121 int lay;
122
123 double doca;
124 double dmeas;
125
126 int ntrk;
127 int nhit;
128
129 bool fgHitLay[MdcCalNLayer];
130
131 MdcCalRecTrk* rectrk;
132 MdcCalRecHit* rechit;
133
134 ntrk = event -> getNTrk();
135 for(i=0; i<ntrk; i++){
136 rectrk = event -> getRecTrk(i);
137 nhit = rectrk -> getNHits();
138
139 // dr cut
140 double dr = rectrk->getDr();
141 if(fabs(dr) > m_param.drCut) continue;
142
143 // dz cut
144 double dz = rectrk->getDz();
145 if(fabs(dz) > m_param.dzCut) continue;
146
147 for(lay=0; lay<MdcCalNLayer; lay++) fgHitLay[lay] = false;
148 for(k=0; k<nhit; k++){
149 rechit = rectrk -> getRecHit(k);
150 lay = rechit -> getLayid();
151 fgHitLay[lay] = true;
152 }
153
154 int nhitlay = 0;
155 for(lay=0; lay<MdcCalNLayer; lay++) if(fgHitLay[lay]) nhitlay++;
156 if(nhitlay < m_param.nHitLayCut) continue;
157
158 bool fgNoise = rectrk->getFgNoiseRatio();
159 if(m_param.noiseCut && (!fgNoise)) continue;
160
161 for(k=0; k<nhit; k++){
162 rechit = rectrk -> getRecHit(k);
163 lay = rechit -> getLayid();
164 doca = rechit -> getDocaInc();
165 dmeas = rechit -> getDmeas();
166 m_resi = rechit -> getResiInc();
167 m_qhit = rechit -> getQhit();
168
169 m_hqhit[lay] -> Fill(m_qhit);
170
171 bin = (int)((m_qhit - m_qmin[lay]) / m_qbinw[lay]);
172 if( (bin >= 0) && (bin < m_nbin) ){
173 m_hqt[lay][bin] -> Fill( m_resi );
174 }
175 }
176 }
177 return 1;
178}
virtual int fillHist(MdcCalEvent *event)=0
Definition: MdcCalib.cxx:692

◆ fillHist() [2/2]

int QtMdcCalib::fillHist ( MdcCalEvent event)
virtual

Implements MdcCalib.

◆ initialize() [1/2]

void QtMdcCalib::initialize ( TObjArray *  hlist,
IMdcGeomSvc mdcGeomSvc,
IMdcCalibFunSvc mdcFunSvc,
IMdcUtilitySvc mdcUtilitySvc 
)
virtual

Implements MdcCalib.

Definition at line 49 of file QtMdcCalib.cxx.

50 {
51 IMessageSvc* msgSvc;
52 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
53 MsgStream log(msgSvc, "QtMdcCalib");
54 log << MSG::INFO << "QtMdcCalib::initialize()" << endreq;
55
56 m_hlist = hlist;
57 m_mdcGeomSvc = mdcGeomSvc;
58 m_mdcFunSvc = mdcFunSvc;
59 m_mdcUtilitySvc = mdcUtilitySvc;
60
61 MdcCalib::initialize(m_hlist, m_mdcGeomSvc, m_mdcFunSvc, m_mdcUtilitySvc);
62
63 int bin;
64 int lay;
65 double qbinw;
66 char hname[200];
67
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;
72 }
73
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);
78
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]);
83
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]);
90
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]);
97
98 for(bin=0; bin<m_nbin; bin++){
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]);
102 }
103 }
104}
virtual void initialize(TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
Definition: MdcCalib.cxx:202

◆ initialize() [2/2]

void QtMdcCalib::initialize ( TObjArray *  hlist,
IMdcGeomSvc mdcGeomSvc,
IMdcCalibFunSvc mdcFunSvc,
IMdcUtilitySvc mdcUtilitySvc 
)
virtual

Implements MdcCalib.

◆ qtFun() [1/2]

Double_t QtMdcCalib::qtFun ( Double_t *  x,
Double_t *  par 
)
static

Definition at line 278 of file QtMdcCalib.cxx.

278 {
279 double tw = par[1] / sqrt(x[0]) + par[0];
280 return tw;
281}

Referenced by updateConst().

◆ qtFun() [2/2]

static Double_t QtMdcCalib::qtFun ( Double_t *  x,
Double_t *  par 
)
static

◆ setParam() [1/2]

void QtMdcCalib::setParam ( MdcCalParams param)
inlinevirtual

Implements MdcCalib.

Definition at line 52 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/QtMdcCalib.h.

52 {
53 MdcCalib::setParam(param);
54 m_param = param;
55}
virtual void setParam(MdcCalParams &param)=0

◆ setParam() [2/2]

void QtMdcCalib::setParam ( MdcCalParams param)
virtual

Implements MdcCalib.

◆ updateConst() [1/2]

int QtMdcCalib::updateConst ( MdcCalibConst calconst)
virtual

Implements MdcCalib.

Definition at line 180 of file QtMdcCalib.cxx.

180 {
181 IMessageSvc* msgSvc;
182 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
183 MsgStream log(msgSvc, "QtMdcCalib");
184 log << MSG::INFO << "QtMdcCalib::updateConst()" << endreq;
185
186 MdcCalib::updateConst(calconst);
187
188 int lay;
189 int bin;
190 int ord;
191
192 Stat_t entry;
193 double qtpar;
194 double qbcen;
195 double tw;
196 double deltw;
197 double qterr;
198
199 TF1* funQt = new TF1("funQt", qtFun, 200, 2000, 2);
200
201 ofstream fqtlog("qtlog");
202 for(lay=0; lay<m_nlayer; lay++){
203 if(0 == m_param.fgCalib[lay]) continue;
204
205 fqtlog << "Layer" << lay << endl;
206
207 for(ord=0; ord<m_qtorder; ord++){
208 m_qtpar[lay][ord] = calconst -> getQtpar(lay, ord);
209 }
210
211 for(bin=0; bin<m_nbin; bin++){
212 entry = m_hqt[lay][bin] -> GetEntries();
213
214 if(entry > 300){
215 deltw = m_hqt[lay][bin] -> GetMean();
216 qterr = ( m_hqt[lay][bin]->GetRMS() ) / sqrt((double)entry);
217 deltw /= m_vdr;
218 qterr /= m_vdr;
219 } else{
220 continue;
221 }
222
223 qbcen = ( (double)bin + 0.5 ) * m_qbinw[lay] + m_qmin[lay];
224// tw = qtFun(qbcen, m_qtpar[lay]) + deltw;
225 tw = (m_mdcFunSvc->getTimeWalk(lay, qbcen)) + deltw;
226
227 m_grqt[lay]->SetPoint(bin, qbcen, tw);
228 m_grqt[lay]->SetPointError(bin, 0, qterr);
229
230 m_grqdt[lay]->SetPoint(bin, qbcen, deltw);
231 m_grqdt[lay]->SetPointError(bin, 0, qterr);
232
233 fqtlog << setw(3) << bin
234 << setw(12) << deltw
235 << setw(12) << tw
236 << setw(12) << qbcen
237 << setw(12) << qterr
238 << endl;
239 }
240
241 m_grqt[lay]->Fit("funQt", "Q+", "", m_qmin[lay], m_qmax[lay]);
242
243 fqtlog << "Qtpar: ";
244 for(ord=0; ord<m_qtorder; ord++){
245 qtpar = funQt->GetParameter(ord);
246 qterr = funQt->GetParError(ord);
247 calconst -> resetQtpar(lay, ord, qtpar);
248
249 fqtlog << setw(12) << qtpar
250 << setw(12) << qterr
251 << endl;
252 }
253
254// if( (0 == ierflg) && (3 == istat) ){
255// for(ord=0; ord<m_qtorder; ord++){
256// gmqt -> GetParameter(ord, qtpar, qterr);
257// calconst -> resetQtpar(lay, ord, qtpar);
258
259// fqtlog << setw(12) << qtpar
260// << setw(12) << qterr
261// << endl;
262// }
263// } else{
264// fqtlog << setw(12) << m_qtpar[lay][0]
265// << setw(12) << "0"
266// << setw(12) << m_qtpar[lay][1]
267// << setw(12) << "0"
268// << endl;
269// }
270
271 } // end of layer loop
272
273 fqtlog.close();
274 delete funQt;
275 return 1;
276}
virtual double getTimeWalk(int layid, double Q) const =0
virtual int updateConst(MdcCalibConst *calconst)=0
Definition: MdcCalib.cxx:1322
static Double_t qtFun(Double_t *x, Double_t *par)
Definition: QtMdcCalib.cxx:278

◆ updateConst() [2/2]

int QtMdcCalib::updateConst ( MdcCalibConst calconst)
virtual

Implements MdcCalib.


The documentation for this class was generated from the following files: