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

#include <XtMdcCalib.h>

+ Inheritance diagram for XtMdcCalib:

Public Member Functions

 XtMdcCalib ()
 
 ~XtMdcCalib ()
 
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
 
void setParam (MdcCalParams &param)
 
int fillHist (MdcCalEvent *event)
 
int updateConst (MdcCalibConst *calconst)
 
void clear ()
 
int getHxtKey (int lay, int entr, int lr, int bin) const
 
 XtMdcCalib ()
 
 ~XtMdcCalib ()
 
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
 
void setParam (MdcCalParams &param)
 
int fillHist (MdcCalEvent *event)
 
int updateConst (MdcCalibConst *calconst)
 
void clear ()
 
int getHxtKey (int lay, int entr, int lr, int bin) const
 
- 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 void fcnXT (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 
static void fcnXtEdge (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 
static double xtFun (double t, double xtpar[])
 
static void fcnXT (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 
static void fcnXtEdge (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 
static double xtFun (double t, double xtpar[])
 

Static Public Attributes

static std::vector< double > XMEAS
 
static std::vector< double > TBINCEN
 
static std::vector< double > ERR
 
static double Tmax
 
static double Dmax
 
static std::vector< double > XMEASED
 
static std::vector< double > TBINCENED
 
static std::vector< double > ERRED
 

Detailed Description

Constructor & Destructor Documentation

◆ XtMdcCalib() [1/2]

XtMdcCalib::XtMdcCalib ( )

Definition at line 34 of file XtMdcCalib.cxx.

34 {
35 m_nbin = 50; // m_nbin=50 before 2011-11-16
36 m_nLR = 3;
37 m_nxtpar = 8;
38
39 for(int lay=0; lay<43; lay++){
40 if(lay < 15) m_nEntr[lay] = 1;
41 else m_nEntr[lay] = 2; // for entr>0 and entr<0
42 }
43
44 m_tbinw = 10.0;
45 m_fgIni = false;
46}

◆ ~XtMdcCalib() [1/2]

XtMdcCalib::~XtMdcCalib ( )

Definition at line 48 of file XtMdcCalib.cxx.

48 {
49}

◆ XtMdcCalib() [2/2]

XtMdcCalib::XtMdcCalib ( )

◆ ~XtMdcCalib() [2/2]

XtMdcCalib::~XtMdcCalib ( )

Member Function Documentation

◆ clear() [1/2]

void XtMdcCalib::clear ( )
virtual

Implements MdcCalib.

Definition at line 51 of file XtMdcCalib.cxx.

51 {
52 cout << "~XtMdcCalib" << endl;
53
54 unsigned int i;
55 for(i=0; i<m_hxt.size(); i++){
56 delete m_hxt[i];
57 if(0 == (i % 1000)) cout << "delete hxt[" << i << "]" << endl;
58 }
59 delete m_fdXt;
60 m_hxt.clear();
61 m_hxtmap.clear();
62
64}
virtual void clear()=0
Definition: MdcCalib.cxx:76

◆ clear() [2/2]

void XtMdcCalib::clear ( )
virtual

Implements MdcCalib.

◆ fcnXT() [1/2]

void XtMdcCalib::fcnXT ( Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
static

Definition at line 517 of file XtMdcCalib.cxx.

518 {
519 unsigned int i;
520 int ord;
521 Double_t deta;
522 Double_t chisq = 0.0;
523 Double_t dfit;
524
525 for(i=0; i<TBINCEN.size(); i++){
526 dfit = 0;
527 for(ord=0; ord<=5; ord++){
528 dfit += par[ord] * pow(TBINCEN[i], ord);
529 }
530 deta = (dfit - XMEAS[i]) / ERR[i];
531 chisq += deta * deta;
532 }
533
534 f = chisq;
535}

Referenced by updateConst().

◆ fcnXT() [2/2]

static void XtMdcCalib::fcnXT ( Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
static

◆ fcnXtEdge() [1/2]

void XtMdcCalib::fcnXtEdge ( Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
static

Definition at line 555 of file XtMdcCalib.cxx.

556 {
557 unsigned int i;
558 Double_t deta;
559 Double_t chisq = 0.0;
560 Double_t dfit;
561
562 for(i=0; i<TBINCENED.size(); i++){
563 dfit = par[0] * (TBINCENED[i] - Tmax) + Dmax;
564 deta = (dfit - XMEASED[i]) / ERRED[i];
565 chisq += deta * deta;
566 }
567
568 f = chisq;
569}

Referenced by updateConst().

◆ fcnXtEdge() [2/2]

static void XtMdcCalib::fcnXtEdge ( Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
static

◆ fillHist() [1/2]

int XtMdcCalib::fillHist ( MdcCalEvent event)
virtual

Implements MdcCalib.

Definition at line 114 of file XtMdcCalib.cxx.

114 {
115 IMessageSvc* msgSvc;
116 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
117 MsgStream log(msgSvc, "XtMdcCalib");
118 log << MSG::DEBUG << "XtMdcCalib::fillHist()" << endreq;
119
120 MdcCalib::fillHist(event);
121
122 // get EsTimeCol
123 bool esCutFg = event->getEsCutFlag();
124 if( ! esCutFg ) return -1;
125
126 int i;
127 int k;
128 int lay;
129 int iLR;
130 int iEntr;
131 int bin;
132 int key;
133 int hid;
134
135 double dr;
136 double dz;
137 double tdr;
138 double doca;
139 double resi;
140 double entrance;
141 int stat;
142
143 double xtpar[MdcCalXtNPars];
144 int nhitlay;
145 bool fgHitLay[MdcCalNLayer];
146
147 if(! m_fgIni){
148 for(lay=0; lay<MdcCalNLayer; lay++){
149 if(lay < 8) m_docaMax[lay] = m_param.maxDocaInner;
150 else m_docaMax[lay] = m_param.maxDocaOuter;
151 }
152
153 for(lay=0; lay<MdcCalNLayer; lay++){
154 for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
155 for(iLR=0; iLR<MdcCalLR; iLR++){
156// m_mdcFunSvc -> getXtpar(lay, iEntr, iLR, xtpar);
157 if(0 == iEntr) m_mdcFunSvc -> getXtpar(lay, 8, iLR, xtpar);
158 else if(1 == iEntr) m_mdcFunSvc -> getXtpar(lay, 9, iLR, xtpar);
159 m_tm[lay][iEntr][iLR] = xtpar[6];
160 }
161 }
162 }
163 m_fgIni = true;
164 }
165
166 MdcCalRecTrk* rectrk;
167 MdcCalRecHit* rechit;
168
169 int nhit;
170 int ntrk = event -> getNTrk();
171 if((ntrk < m_param.nTrkCut[0]) || (ntrk > m_param.nTrkCut[1])) return -1;
172 for(i=0; i<ntrk; i++){
173 rectrk = event->getRecTrk(i);
174 nhit = rectrk -> getNHits();
175
176 // dr cut
177 dr = rectrk->getDr();
178 if(fabs(dr) > m_param.drCut) continue;
179
180 // dz cut
181 dz = rectrk->getDz();
182 if(fabs(dz) > m_param.dzCut) continue;
183
184 for(lay=0; lay<MdcCalNLayer; lay++){
185 fgHitLay[lay] = false;
186 }
187
188 for(k=0; k<nhit; k++){
189 rechit = rectrk -> getRecHit(k);
190 lay = rechit -> getLayid();
191 fgHitLay[lay] = true;
192 }
193
194 nhitlay = 0;
195 for(lay=0; lay<MdcCalNLayer; lay++){
196 if(fgHitLay[lay]) nhitlay++;
197 }
198 if(nhitlay < m_param.nHitLayCut) continue;
199
200// bool fgNoise = rectrk->getFgNoiseRatio();
201// if(m_param.noiseCut && (!fgNoise)) continue;
202
203 for(k=0; k<nhit; k++){
204 rechit = rectrk -> getRecHit(k);
205 lay = rechit -> getLayid();
206 doca = rechit -> getDocaInc();
207 iLR = rechit -> getLR();
208 entrance = rechit -> getEntra();
209 resi = rechit -> getResiInc();
210 tdr = rechit -> getTdrift();
211 stat = rechit -> getStat();
212
213 if(1 != stat) continue;
214
215 if( (fabs(doca) > m_docaMax[lay]) ||
216 (fabs(resi) > m_param.resiCut[lay]) ){
217 continue;
218 }
219
220 if(0 == lay){
221 if( ! fgHitLay[1] ) continue;
222 } else if(42 == lay){
223 if( ! fgHitLay[41] ) continue;
224 } else{
225 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) ) continue;
226 }
227
228 iEntr = m_mdcFunSvc -> getXtEntrIndex(entrance);
229 if(1 == m_nEntr[lay]){
230 iEntr = 0;
231 } else if(2 == m_nEntr[lay]){
232 if(entrance > 0.0) iEntr = 1;
233 else iEntr = 0;
234 }
235
236 bin = (int)(tdr / m_tbinw);
237
238 // left-right separately
239 key = getHxtKey(lay, iEntr, iLR, bin);
240 if((bin < m_nbin) && (1 == m_hxtmap.count(key))){
241 hid = m_hxtmap[key];
242 m_hxt[hid] -> Fill( resi );
243 }
244
245 // left-right in common
246 key = getHxtKey(lay, iEntr, 2, bin);
247 if((bin < m_nbin) && (1 == m_hxtmap.count(key))){
248 hid = m_hxtmap[key];
249 m_hxt[hid] -> Fill( resi );
250 }
251
252 if(fabs(tdr - m_tm[lay][iEntr][iLR]) < 5){
253 key = getHxtKey(lay, iEntr, iLR, m_nbin);
254 if( 1 == m_hxtmap.count(key) ){
255 hid = m_hxtmap[key];
256 m_hxt[hid] -> Fill( resi );
257 }
258
259 key = getHxtKey(lay, iEntr, 2, m_nbin);
260 if( 1 == m_hxtmap.count(key) ){
261 hid = m_hxtmap[key];
262 m_hxt[hid] -> Fill( resi );
263 }
264 }
265
266 } // hit loop
267 } // track loop
268 return 1;
269}
*******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
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42
virtual int fillHist(MdcCalEvent *event)=0
Definition: MdcCalib.cxx:692
int getHxtKey(int lay, int entr, int lr, int bin) const
Definition: XtMdcCalib.cxx:506

◆ fillHist() [2/2]

int XtMdcCalib::fillHist ( MdcCalEvent event)
virtual

Implements MdcCalib.

◆ getHxtKey() [1/2]

int XtMdcCalib::getHxtKey ( int  lay,
int  entr,
int  lr,
int  bin 
) const

Definition at line 506 of file XtMdcCalib.cxx.

506 {
507 int key;
508
509 key = ( (lay << HXTLAYER_INDEX) & HXTLAYER_MASK ) |
510 ( (entr << HXTENTRA_INDEX) & HXTENTRA_MASK ) |
511 ( (lr << HXTLR_INDEX) & HXTLR_MASK ) |
512 ( (bin << HXTBIN_INDEX) & HXTBIN_MASK );
513
514 return key;
515}

Referenced by fillHist(), initialize(), and updateConst().

◆ getHxtKey() [2/2]

int XtMdcCalib::getHxtKey ( int  lay,
int  entr,
int  lr,
int  bin 
) const

◆ initialize() [1/2]

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

Implements MdcCalib.

Definition at line 67 of file XtMdcCalib.cxx.

68 {
69 IMessageSvc* msgSvc;
70 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
71 MsgStream log(msgSvc, "XtMdcCalib");
72 log << MSG::INFO << "XtMdcCalib::initialize()" << endreq;
73
74 m_hlist = hlist;
75 m_mdcGeomSvc = mdcGeomSvc;
76 m_mdcFunSvc = mdcFunSvc;
77 m_mdcUtilitySvc = mdcUtilitySvc;
78
79 MdcCalib::initialize(m_hlist, m_mdcGeomSvc, m_mdcFunSvc, m_mdcUtilitySvc);
80
81 int lay;
82 int iLR;
83 int iEntr;
84 int bin;
85 int hid;
86 int key;
87 char hname[200];
88 TH1D* hist;
89
90 m_fdXt = new TFolder("fdXt", "fdXt");
91 m_hlist -> Add(m_fdXt);
92
93 m_nlayer = m_mdcGeomSvc -> getLayerSize();
94
95 hid = 0;
96 for(lay=0; lay<m_nlayer; lay++){
97 for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
98 for(iLR=0; iLR<m_nLR; iLR++){
99 for(bin=0; bin<=m_nbin; bin++){
100 sprintf(hname, "Hxt%02d_E%02d_LR%01d_B%02d", lay, iEntr, iLR, bin);
101 hist = new TH1D(hname, "", 300, -1.5, 1.5);
102 m_hxt.push_back( hist );
103 m_fdXt -> Add( hist );
104
105 key = getHxtKey(lay, iEntr, iLR, bin);
106 m_hxtmap.insert( valType2( key, hid ) );
107 hid++;
108 }
109 }
110 }
111 }
112}
map< int, int >::value_type valType2
Definition: XtMdcCalib.cxx:22
virtual void initialize(TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
Definition: MdcCalib.cxx:202

◆ initialize() [2/2]

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

Implements MdcCalib.

◆ setParam() [1/2]

void XtMdcCalib::setParam ( MdcCalParams param)
inlinevirtual

Implements MdcCalib.

Definition at line 79 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/XtMdcCalib.h.

79 {
80 MdcCalib::setParam(param);
81 m_param = param;
82}
virtual void setParam(MdcCalParams &param)=0

◆ setParam() [2/2]

void XtMdcCalib::setParam ( MdcCalParams param)
virtual

Implements MdcCalib.

◆ updateConst() [1/2]

int XtMdcCalib::updateConst ( MdcCalibConst calconst)
virtual

Implements MdcCalib.

Definition at line 271 of file XtMdcCalib.cxx.

271 {
272 IMessageSvc* msgSvc;
273 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
274 MsgStream log(msgSvc, "XtMdcCalib");
275 log << MSG::INFO << "XtMdcCalib::updateConst()" << endreq;
276
277 MdcCalib::updateConst(calconst);
278
279 int i;
280 int hid;
281 int lay;
282 int iLR;
283 int iEntr;
284 int bin;
285 int ord;
286 int key;
287
288 Stat_t entry;
289 double xtpar;
290 double xterr;
291 double tbcen;
292 double deltx;
293 double xcor;
294 double xerr;
295 double xtini[8];
296 double xtfit[8];
297
298 Int_t ierflg;
299 Int_t istat;
300 Int_t nvpar;
301 Int_t nparx;
302 Double_t fmin;
303 Double_t edm;
304 Double_t errdef;
305 Double_t arglist[10];
306
307 TMinuit* gmxt = new TMinuit(6);
308 gmxt -> SetPrintLevel(-1);
309 gmxt -> SetFCN(fcnXT);
310 gmxt -> SetErrorDef(1.0);
311 gmxt -> mnparm(0, "xtpar0", 0, 0.1, 0, 0, ierflg);
312 gmxt -> mnparm(1, "xtpar1", 0, 0.1, 0, 0, ierflg);
313 gmxt -> mnparm(2, "xtpar2", 0, 0.1, 0, 0, ierflg);
314 gmxt -> mnparm(3, "xtpar3", 0, 0.1, 0, 0, ierflg);
315 gmxt -> mnparm(4, "xtpar4", 0, 0.1, 0, 0, ierflg);
316 gmxt -> mnparm(5, "xtpar5", 0, 0.1, 0, 0, ierflg);
317 arglist[0] = 0;
318 gmxt -> mnexcm("SET NOW", arglist, 0, ierflg);
319
320 TMinuit* gmxtEd = new TMinuit(1);
321 gmxtEd -> SetPrintLevel(-1);
322 gmxtEd -> SetFCN(fcnXtEdge);
323 gmxtEd -> SetErrorDef(1.0);
324 gmxtEd -> mnparm(0, "xtpar0", 0, 0.1, 0, 0, ierflg);
325 arglist[0] = 0;
326 gmxtEd -> mnexcm("SET NOW", arglist, 0, ierflg);
327
328 ofstream fxtlog("xtlog");
329 for(lay=0; lay<m_nlayer; lay++){
330 if(0 == m_param.fgCalib[lay]) continue;
331
332 for(iEntr=0; iEntr<m_nEntr[lay]; iEntr++){
333 for(iLR=0; iLR<m_nLR; iLR++){
334
335 fxtlog << "Layer " << setw(3) << lay << setw(3) << iEntr
336 << setw(3) << iLR << endl;
337
338 for(ord=0; ord<m_nxtpar; ord++){
339// xtpar = calconst -> getXtpar(lay, iEntr, iLR, ord);
340 if(0 == iEntr) xtpar = calconst -> getXtpar(lay, 8, iLR, ord);
341 else if(1 == iEntr) xtpar = calconst -> getXtpar(lay, 9, iLR, ord);
342
343 xtini[ord] = xtpar;
344 xtfit[ord] = xtpar;
345 }
346
347 Tmax = xtini[6];
348
349 for(bin=0; bin<=m_nbin; bin++){
350 key = getHxtKey(lay, iEntr, iLR, bin);
351 hid = m_hxtmap[key];
352
353 entry = m_hxt[hid] -> GetEntries();
354 if(entry > 100){
355 deltx = m_hxt[hid] -> GetMean();
356 xerr = m_hxt[hid]->GetRMS();
357 } else{
358 continue;
359 }
360
361 if(bin < m_nbin)
362 tbcen = ( (double)bin + 0.5 ) * m_tbinw;
363 else tbcen = m_tm[lay][iEntr][iLR];
364 xcor = xtFun(tbcen, xtini) - deltx;
365
366 if((tbcen <= Tmax) || (bin == m_nbin)){
367 TBINCEN.push_back( tbcen );
368 XMEAS.push_back( xcor );
369 ERR.push_back( xerr );
370 } else{
371 TBINCENED.push_back( tbcen );
372 XMEASED.push_back( xcor );
373 ERRED.push_back( xerr );
374 }
375 fxtlog << setw(3) << bin
376 << setw(15) << deltx
377 << setw(15) << xcor
378 << setw(15) << tbcen
379 << setw(15) << xerr
380 << endl;
381 } // end of bin loop
382
383 if( XMEAS.size() < 12 ){
384 TBINCEN.clear();
385 XMEAS.clear();
386 ERR.clear();
387
388 TBINCENED.clear();
389 XMEASED.clear();
390 ERRED.clear();
391
392 continue;
393 }
394
395 for(ord=0; ord<=5; ord++){
396 arglist[0] = ord + 1;
397 arglist[1] = xtini[ord];
398 gmxt -> mnexcm("SET PARameter", arglist, 2, ierflg);
399 }
400
401 // fix the xtpar[0] at 0
402 if(1 == m_param.fixXtC0){
403 arglist[0] = 1;
404 arglist[1] = 0.0;
405 gmxt -> mnexcm("SET PARameter", arglist, 2, ierflg);
406 gmxt -> mnexcm("FIX", arglist, 1, ierflg);
407 }
408
409 arglist[0] = 1000;
410 arglist[1] = 0.1;
411 gmxt -> mnexcm("MIGRAD", arglist, 2, ierflg);
412 gmxt -> mnstat(fmin, edm, errdef, nvpar, nparx, istat);
413
414 fxtlog << "Xtpar: " << endl;
415 if( (0 == ierflg) && (istat >= 2) ){
416 for(ord=0; ord<=5; ord++){
417 gmxt -> GetParameter(ord, xtpar, xterr);
418// calconst -> resetXtpar(lay, iEntr, iLR, ord, xtpar);
419 xtfit[ord] = xtpar;
420
421 if(1 == m_nEntr[lay]){
422 for(i=0; i<18; i++)
423 calconst -> resetXtpar(lay, i, iLR, ord, xtpar);
424 } else if(2 == m_nEntr[lay]){
425 if(0 == iEntr){
426 for(i=0; i<9; i++) // entr<0
427 calconst->resetXtpar(lay, i, iLR, ord, xtpar);
428 } else{
429 for(i=9; i<18; i++) // entr>0
430 calconst->resetXtpar(lay, i, iLR, ord, xtpar);
431 }
432 }
433 fxtlog << setw(15) << xtpar << setw(15) << xterr << endl;
434 }
435 } else{
436 for(ord=0; ord<=5; ord++){
437 fxtlog << setw(15) << xtini[ord] << setw(15) << "0" << endl;
438 }
439 }
440 fxtlog << setw(15) << Tmax << setw(15) << "0" << endl;
441
442 // release the first parameter
443 if(1 == m_param.fixXtC0){
444 arglist[0] = 1;
445 gmxt -> mnexcm("REL", arglist, 1, ierflg);
446 }
447
448 Dmax = xtFun(Tmax, xtfit);
449
450 if( XMEASED.size() >= 3 ){
451 // fit xt in the edge area
452 arglist[0] = 1;
453 arglist[1] = xtini[7];
454 gmxtEd -> mnexcm("SET PARameter", arglist, 2, ierflg);
455
456 arglist[0] = 1000;
457 arglist[1] = 0.1;
458 gmxtEd -> mnexcm("MIGRAD", arglist, 2, ierflg);
459 gmxtEd -> mnstat(fmin, edm, errdef, nvpar, nparx, istat);
460
461 if( (0 == ierflg) && (istat >=2) ){
462 gmxtEd -> GetParameter(0, xtpar, xterr);
463 if(xtpar < 0.0) xtpar = 0.0;
464 if(m_param.fixXtEdge) xtpar = xtini[7];
465// calconst -> resetXtpar(lay, iEntr, iLR, 7, xtpar);
466
467 if(1 == m_nEntr[lay]){
468 for(i=0; i<18; i++)
469 calconst -> resetXtpar(lay, i, iLR, 7, xtpar);
470 } else if(2 == m_nEntr[lay]){
471 if(0 == iEntr){
472 for(i=0; i<9; i++)
473 calconst->resetXtpar(lay, i, iLR, 7, xtpar);
474 } else{
475 for(i=9; i<18; i++)
476 calconst->resetXtpar(lay, i, iLR, 7, xtpar);
477 }
478 }
479 fxtlog << setw(15) << xtpar << setw(15) << xterr << endl;
480 } else {
481 fxtlog << setw(15) << xtini[7] << setw(15) << "0" << endl;
482 }
483 } else {
484 fxtlog << setw(15) << xtini[7] << setw(15) << "0" << endl;
485 }
486 fxtlog << "Tm " << setw(15) << Tmax
487 << " Dmax " << setw(15) << Dmax << endl;
488
489 TBINCEN.clear();
490 XMEAS.clear();
491 ERR.clear();
492 TBINCENED.clear();
493 XMEASED.clear();
494 ERRED.clear();
495 } // end of l-r loop
496 } // end of entrance angle loop
497 } // end of layer loop
498
499 fxtlog.close();
500 delete gmxt;
501 delete gmxtEd;
502 cout << "Xt update finished" << endl;
503 return 1;
504}
void resetXtpar(int lay, int entr, int lr, int order, double val)
virtual int updateConst(MdcCalibConst *calconst)=0
Definition: MdcCalib.cxx:1322
static double xtFun(double t, double xtpar[])
Definition: XtMdcCalib.cxx:537
static void fcnXT(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
Definition: XtMdcCalib.cxx:517
static void fcnXtEdge(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
Definition: XtMdcCalib.cxx:555

◆ updateConst() [2/2]

int XtMdcCalib::updateConst ( MdcCalibConst calconst)
virtual

Implements MdcCalib.

◆ xtFun() [1/2]

double XtMdcCalib::xtFun ( double  t,
double  xtpar[] 
)
static

Definition at line 537 of file XtMdcCalib.cxx.

537 {
538 int ord;
539 double dist = 0.0;
540 double tmax = xtpar[6];
541
542 if(t < tmax ){
543 for(ord=0; ord<=5; ord++){
544 dist += xtpar[ord] * pow(t, ord);
545 }
546 }else{
547 for(ord=0; ord<=5; ord++){
548 dist += xtpar[ord] * pow(tmax, ord);
549 }
550 dist += xtpar[7] * (t - tmax);
551 }
552
553 return dist;
554}
int t()
Definition: t.c:1

Referenced by updateConst().

◆ xtFun() [2/2]

static double XtMdcCalib::xtFun ( double  t,
double  xtpar[] 
)
static

Member Data Documentation

◆ Dmax

double XtMdcCalib::Dmax
static

◆ ERR

vector< double > XtMdcCalib::ERR
static

Definition at line 32 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/XtMdcCalib.h.

Referenced by fcnXT(), and updateConst().

◆ ERRED

vector< double > XtMdcCalib::ERRED
static

◆ TBINCEN

vector< double > XtMdcCalib::TBINCEN
static

Definition at line 31 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/XtMdcCalib.h.

Referenced by fcnXT(), and updateConst().

◆ TBINCENED

vector< double > XtMdcCalib::TBINCENED
static

◆ Tmax

double XtMdcCalib::Tmax
static

◆ XMEAS

vector< double > XtMdcCalib::XMEAS
static

Definition at line 30 of file InstallArea/include/MdcCalibAlg/MdcCalibAlg/XtMdcCalib.h.

Referenced by fcnXT(), and updateConst().

◆ XMEASED

vector< double > XtMdcCalib::XMEASED
static

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