81 {
83
84 int ord;
86 TF1* fxtDr =
new TF1(
"fxtDr",
xtFitFun, 0, 300, 6);
87 TF1* fxtEd =
new TF1(
"fxtEd",
xtFitEdge, 150, 500, 1);
88 if(1 ==
gfixXtC0) fxtDr -> FixParameter(0, 0);
89
90 for(
int lay=0; lay<
NLAYER; lay++){
91 for(
int iEntr=0; iEntr<
NENTRXT; iEntr++){
92 for(
int lr=0; lr<
NLR; lr++){
93 m_fgFit[lay][iEntr][lr] = false;
95
96 if(m_nhitIn[lay][iEntr][lr] > 1000){
97 Tmax = calconst -> getXtpar(lay, iEntr, lr, 6);
98
99 m_grxt[lay][iEntr][lr] ->
Fit(
"fxtDr",
"Q+",
"", 0,
Tmax);
100 for(ord=0; ord<6; ord++){
101 xtpar[lay][iEntr][lr][ord] = fxtDr->GetParameter(ord);
102 }
103 xtpar[lay][iEntr][lr][6] =
Tmax;
104
106 for(ord=0; ord<6; ord++)
Dmax += xtpar[lay][iEntr][lr][ord] * pow(
Tmax, ord);
107
108 if(m_nhitEd[lay][iEntr][lr] > 300){
109 m_grxt[lay][iEntr][lr] ->
Fit(
"fxtEd",
"Q+",
"",
Tmax,
Tmax+300);
110 xtpar[lay][iEntr][lr][7] = fxtEd->GetParameter(0);
111 if(xtpar[lay][iEntr][lr][7] < 0.0) xtpar[lay][iEntr][lr][7] = 0.0;
112 } else{
113 xtpar[lay][iEntr][lr][7] = 0.0;
114 }
115
116 m_fgFit[lay][iEntr][lr] = true;
117 }
118
119 }
120 }
121 }
122
123 ofstream fxtlog("xtlog");
124 for(
int lay=0; lay<
NLAYER; lay++){
125 for(
int iEntr=0; iEntr<
NENTRXT; iEntr++){
126 for(
int lr=0; lr<
NLR; lr++){
127 fxtlog << setw(3) << lay << setw(3) << iEntr << setw(3) << lr;
128
129 int fgUpdate = -1;
130 if(m_fgFit[lay][iEntr][lr]){
131 fgUpdate = 1;
132 for(ord=0; ord<8; ord++) calconst->
resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntr][lr][ord]);
133 } else{
134 int iEntrNew = findXtEntr(lay, iEntr, lr);
135 if(-1 != iEntrNew){
136 fgUpdate = 2;
137 for(ord=0; ord<8; ord++){
138 calconst->
resetXtpar(lay, iEntr, lr, ord, xtpar[lay][iEntrNew][lr][ord]);
139 }
140 }
141 }
142 fxtlog << setw(3) << fgUpdate;
143 for(ord=0; ord<8; ord++){
144 double par = calconst -> getXtpar(lay, iEntr, lr, ord);
145 if(6==ord) fxtlog << setw(9) << par;
146 else fxtlog << setw(14) << par;
147 }
148 fxtlog << endl;
149 }
150 }
151 }
152 fxtlog.close();
153
154 cout << "Xt update finished. File xtlog was written." << endl;
155
156 renameHist();
157 delete fxtDr;
158 delete fxtEd;
159}
Double_t xtFitEdge(Double_t *x, Double_t par[])
Double_t xtFitFun(Double_t *x, Double_t par[])
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
void resetXtpar(int lay, int entr, int lr, int order, double val)