BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
XtCalib Class Reference

#include <XtCalib.h>

Inheritance diagram for XtCalib:

Public Member Functions

 XtCalib ()
 ~XtCalib ()
void init (TObjArray *hlist, MdcCosGeom *pGeom)
void mergeHist (TFile *fhist)
void calib (MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)
Public Member Functions inherited from CalibBase
 CalibBase ()
virtual ~CalibBase ()

Detailed Description

Definition at line 11 of file XtCalib.h.

Constructor & Destructor Documentation

◆ XtCalib()

XtCalib::XtCalib ( )

Definition at line 6 of file XtCalib.cpp.

6{ cout << "Calibration type: XtCalib" << endl; }

◆ ~XtCalib()

XtCalib::~XtCalib ( )

Definition at line 8 of file XtCalib.cpp.

8{}

Member Function Documentation

◆ calib()

void XtCalib::calib ( MdcCalibConst * calconst,
TObjArray * newXtList,
TObjArray * r2tList )
virtual

Implements CalibBase.

Definition at line 61 of file XtCalib.cpp.

61 {
62 CalibBase::calib( calconst, newXtList, r2tList );
63
64 Int_t ierflg;
65 Int_t istat;
66 Int_t nvpar;
67 Int_t nparx;
68 Double_t fmin;
69 Double_t edm;
70 Double_t errdef;
71 Double_t arglist[10];
72
73 TMinuit* gmxt = new TMinuit( 6 );
74 gmxt->SetPrintLevel( -1 );
75 gmxt->SetFCN( fcnXT );
76 gmxt->SetErrorDef( 1.0 );
77 gmxt->mnparm( 0, "xtpar0", 0, 0.1, 0, 0, ierflg );
78 gmxt->mnparm( 1, "xtpar1", 0, 0.1, 0, 0, ierflg );
79 gmxt->mnparm( 2, "xtpar2", 0, 0.1, 0, 0, ierflg );
80 gmxt->mnparm( 3, "xtpar3", 0, 0.1, 0, 0, ierflg );
81 gmxt->mnparm( 4, "xtpar4", 0, 0.1, 0, 0, ierflg );
82 gmxt->mnparm( 5, "xtpar5", 0, 0.1, 0, 0, ierflg );
83 arglist[0] = 0;
84 gmxt->mnexcm( "SET NOW", arglist, 0, ierflg );
85
86 TMinuit* gmxtEd = new TMinuit( 1 );
87 gmxtEd->SetPrintLevel( -1 );
88 gmxtEd->SetFCN( fcnXtEdge );
89 gmxtEd->SetErrorDef( 1.0 );
90 gmxtEd->mnparm( 0, "xtpar0", 0, 0.1, 0, 0, ierflg );
91 arglist[0] = 0;
92 gmxtEd->mnexcm( "SET NOW", arglist, 0, ierflg );
93
94 // double xtpar;
95 int i;
96 Stat_t histEntry;
97 double xtpar;
98 double xterr;
99 double tbcen;
100 double deltx;
101 double xcor;
102 double xerr;
103 double xtini[8];
104 double xtfit[8];
105 ofstream fxtlog( "xtlog" );
106 for ( int lay = 0; lay < 43; lay++ )
107 {
108 if ( 0 == gFgCalib[lay] ) continue;
109 for ( int iEntr = 0; iEntr < gNEntr[lay]; iEntr++ )
110 {
111 for ( int iLR = 0; iLR < NLR; iLR++ )
112 {
113 fxtlog << "Layer " << setw( 3 ) << lay << setw( 3 ) << iEntr << setw( 3 ) << iLR
114 << endl;
115 for ( int ord = 0; ord < NXTPAR; ord++ )
116 {
117 if ( 0 == iEntr ) xtpar = calconst->getXtpar( lay, 8, iLR, ord );
118 else if ( 1 == iEntr ) xtpar = calconst->getXtpar( lay, 9, iLR, ord );
119 xtini[ord] = xtpar;
120 xtfit[ord] = xtpar;
121 }
122 Tmax = xtini[6];
123
124 for ( int bin = 0; bin <= NXTBIN; bin++ )
125 {
126 histEntry = (int)( m_hxt[lay][iEntr][iLR][bin]->GetEntries() );
127 if ( histEntry > 100 )
128 {
129 deltx = m_hxt[lay][iEntr][iLR][bin]->GetMean();
130 xerr = m_hxt[lay][iEntr][iLR][bin]->GetRMS();
131 }
132 else { continue; }
133
134 if ( bin < NXTBIN ) tbcen = ( (double)bin + 0.5 ) * gTbinw;
135 else tbcen = xtini[6]; // m_tm[lay][iEntr][iLR];
136 xcor = xtFun( tbcen, xtini ) - deltx;
137
138 if ( ( tbcen <= Tmax ) || ( bin == NXTBIN ) )
139 {
140 TBINCEN.push_back( tbcen );
141 XMEAS.push_back( xcor );
142 ERR.push_back( xerr );
143 }
144 else
145 {
146 TBINCENED.push_back( tbcen );
147 XMEASED.push_back( xcor );
148 ERRED.push_back( xerr );
149 }
150 fxtlog << setw( 3 ) << bin << setw( 15 ) << deltx << setw( 15 ) << xcor << setw( 15 )
151 << tbcen << setw( 15 ) << xerr << endl;
152 } // end of bin loop
153
154 if ( XMEAS.size() < 12 )
155 {
156 TBINCEN.clear();
157 XMEAS.clear();
158 ERR.clear();
159
160 TBINCENED.clear();
161 XMEASED.clear();
162 ERRED.clear();
163
164 continue;
165 }
166
167 for ( int ord = 0; ord <= 5; ord++ )
168 {
169 arglist[0] = ord + 1;
170 arglist[1] = xtini[ord];
171 gmxt->mnexcm( "SET PARameter", arglist, 2, ierflg );
172 }
173
174 // fix the xtpar[0] at 0
175 if ( 1 == gfixXtC0 )
176 {
177 arglist[0] = 1;
178 arglist[1] = 0.0;
179 gmxt->mnexcm( "SET PARameter", arglist, 2, ierflg );
180 gmxt->mnexcm( "FIX", arglist, 1, ierflg );
181 }
182
183 arglist[0] = 1000;
184 arglist[1] = 0.1;
185 gmxt->mnexcm( "MIGRAD", arglist, 2, ierflg );
186 gmxt->mnstat( fmin, edm, errdef, nvpar, nparx, istat );
187
188 fxtlog << "Xtpar: " << endl;
189 if ( ( 0 == ierflg ) && ( istat >= 2 ) )
190 {
191 for ( int ord = 0; ord <= 5; ord++ )
192 {
193 gmxt->GetParameter( ord, xtpar, xterr );
194 // calconst -> resetXtpar(lay, iEntr, iLR, ord, xtpar);
195 xtfit[ord] = xtpar;
196
197 if ( 1 == gNEntr[lay] )
198 {
199 for ( i = 0; i < 18; i++ ) calconst->resetXtpar( lay, i, iLR, ord, xtpar );
200 }
201 else if ( 2 == gNEntr[lay] )
202 {
203 if ( 0 == iEntr )
204 {
205 for ( i = 0; i < 9; i++ ) // entr<0
206 calconst->resetXtpar( lay, i, iLR, ord, xtpar );
207 }
208 else
209 {
210 for ( i = 9; i < 18; i++ ) // entr>0
211 calconst->resetXtpar( lay, i, iLR, ord, xtpar );
212 }
213 }
214 fxtlog << setw( 15 ) << xtpar << setw( 15 ) << xterr << endl;
215 }
216 }
217 else
218 {
219 for ( int ord = 0; ord <= 5; ord++ )
220 { fxtlog << setw( 15 ) << xtini[ord] << setw( 15 ) << "0" << endl; }
221 }
222 fxtlog << setw( 15 ) << Tmax << setw( 15 ) << "0" << endl;
223
224 // release the first parameter
225 if ( 1 == gfixXtC0 )
226 {
227 arglist[0] = 1;
228 gmxt->mnexcm( "REL", arglist, 1, ierflg );
229 }
230
231 Dmax = xtFun( Tmax, xtfit );
232
233 if ( XMEASED.size() >= 3 )
234 {
235 // fit xt in the edge area
236 arglist[0] = 1;
237 arglist[1] = xtini[7];
238 gmxtEd->mnexcm( "SET PARameter", arglist, 2, ierflg );
239
240 arglist[0] = 1000;
241 arglist[1] = 0.1;
242 gmxtEd->mnexcm( "MIGRAD", arglist, 2, ierflg );
243 gmxtEd->mnstat( fmin, edm, errdef, nvpar, nparx, istat );
244
245 if ( ( 0 == ierflg ) && ( istat >= 2 ) )
246 {
247 gmxtEd->GetParameter( 0, xtpar, xterr );
248 if ( xtpar < 0.0 ) xtpar = 0.0;
249 // calconst -> resetXtpar(lay, iEntr, iLR, 7, xtpar);
250
251 if ( 1 == gNEntr[lay] )
252 {
253 for ( i = 0; i < 18; i++ ) calconst->resetXtpar( lay, i, iLR, 7, xtpar );
254 }
255 else if ( 2 == gNEntr[lay] )
256 {
257 if ( 0 == iEntr )
258 {
259 for ( i = 0; i < 9; i++ ) calconst->resetXtpar( lay, i, iLR, 7, xtpar );
260 }
261 else
262 {
263 for ( i = 9; i < 18; i++ ) calconst->resetXtpar( lay, i, iLR, 7, xtpar );
264 }
265 }
266 fxtlog << setw( 15 ) << xtpar << setw( 15 ) << xterr << endl;
267 }
268 else { fxtlog << setw( 15 ) << xtini[7] << setw( 15 ) << "0" << endl; }
269 }
270 else { fxtlog << setw( 15 ) << xtini[7] << setw( 15 ) << "0" << endl; }
271 fxtlog << "Tm " << setw( 15 ) << Tmax << " Dmax " << setw( 15 ) << Dmax << endl;
272
273 TBINCEN.clear();
274 XMEAS.clear();
275 ERR.clear();
276 TBINCENED.clear();
277 XMEASED.clear();
278 ERRED.clear();
279 } // lr loop
280 } // entrance loop
281 } // layer loop
282 fxtlog.close();
283
284 renameHist();
285 delete gmxt;
286 delete gmxtEd;
287}
*******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 xtFun(double t, double xtpar[])
vector< double > XMEAS
void fcnXT(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
void fcnXtEdge(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
vector< double > ERR
vector< double > XMEASED
vector< double > ERRED
vector< double > TBINCEN
vector< double > TBINCENED
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
void resetXtpar(int lay, int entr, int lr, int order, double val)
double getXtpar(int lay, int entr, int lr, int order)

◆ init()

void XtCalib::init ( TObjArray * hlist,
MdcCosGeom * pGeom )
virtual

Implements CalibBase.

Definition at line 10 of file XtCalib.cpp.

10 {
11 CalibBase::init( hlist, pGeom );
12
13 m_fdXt = new TFolder( "mfdxt", "fdxt" );
14 hlist->Add( m_fdXt );
15
16 char hname[200];
17 for ( int lay = 0; lay < 43; lay++ )
18 {
19 for ( int iEntr = 0; iEntr < gNEntr[lay]; iEntr++ )
20 {
21 for ( int lr = 0; lr < NLR; lr++ )
22 {
23 for ( int bin = 0; bin <= NXTBIN; bin++ )
24 {
25 sprintf( hname, "mHxt%02d_E%02d_LR%01d_B%02d", lay, iEntr, lr, bin );
26 m_hxt[lay][iEntr][lr][bin] = new TH1D( hname, "", 300, -1.5, 1.5 );
27 m_fdXt->Add( m_hxt[lay][iEntr][lr][bin] );
28 }
29 }
30 }
31 }
32}
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)
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
Definition CalibBase.cpp:12

◆ mergeHist()

void XtCalib::mergeHist ( TFile * fhist)
virtual

Implements CalibBase.

Definition at line 34 of file XtCalib.cpp.

34 {
35 CalibBase::mergeHist( fhist );
36
37 char hname[200];
38 TFolder* fd = (TFolder*)fhist->Get( "fdXt" );
39 for ( int lay = 0; lay < 43; lay++ )
40 {
41 for ( int iEntr = 0; iEntr < gNEntr[lay]; iEntr++ )
42 {
43 for ( int lr = 0; lr < NLR; lr++ )
44 {
45 for ( int bin = 0; bin <= NXTBIN; bin++ )
46 {
47 sprintf( hname, "Hxt%02d_E%02d_LR%01d_B%02d", lay, iEntr, lr, bin );
48 TH1F* hist = (TH1F*)fd->FindObjectAny( hname );
49 m_hxt[lay][iEntr][lr][bin]->Add( hist );
50 // if((0==lay)&&(0==iEntr)&&(0==lr)&&(50==bin)){
51 // cout << setw(15) << hist->GetEntries()
52 // << setw(15) <<
53 // m_hxt[lay][iEntr][lr][bin]->GetEntries() << endl;
54 // }
55 }
56 }
57 }
58 }
59}
virtual void mergeHist(TFile *fhist)=0

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