BOSS 7.0.1
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 ()
 
virtual void init (TObjArray *hlist, MdcCosGeom *pGeom)=0
 
virtual void mergeHist (TFile *fhist)=0
 
virtual void calib (MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
 

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 {
7 cout << "Calibration type: XtCalib" << endl;
8}

◆ ~XtCalib()

XtCalib::~XtCalib ( )

Definition at line 10 of file XtCalib.cpp.

10 {
11}

Member Function Documentation

◆ calib()

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

Implements CalibBase.

Definition at line 55 of file XtCalib.cpp.

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

◆ init()

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

Implements CalibBase.

Definition at line 13 of file XtCalib.cpp.

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

◆ mergeHist()

void XtCalib::mergeHist ( TFile *  fhist)
virtual

Implements CalibBase.

Definition at line 33 of file XtCalib.cpp.

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

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