99 TFolder* fdcom = (TFolder*)fhist->Get(
"Common");
100 TFolder* fdTmap = (TFolder*)fhist->Get(
"Thitmap");
101 TFolder* fdTraw = (TFolder*)fhist->Get(
"Traw");
102 TFolder* fdTrawCel = (TFolder*)fhist->Get(
"TrawCell");
103 TFolder* fdQmap = (TFolder*)fhist->Get(
"Qhitmap");
104 TFolder* fdQraw = (TFolder*)fhist->Get(
"Qraw");
105 TFolder* fdQrawCel = (TFolder*)fhist->Get(
"QrawCell");
109 hist = (TH1F*)fdcom->FindObjectAny(
"T_Hitmap_Layer");
110 m_hLayerHitmapT->Add(hist);
112 hist = (TH1F*)fdcom->FindObjectAny(
"T_Hitmap_Wire");
113 m_hWireHitMapT->Add(hist);
115 hist = (TH1F*)fdcom->FindObjectAny(
"Q_Hitmap_Layer");
116 m_hLayerHitmapQ->Add(hist);
118 hist = (TH1F*)fdcom->FindObjectAny(
"Q_Hitmap_Wire");
119 m_hWireHitMapQ->Add(hist);
121 hist = (TH1F*)fdcom->FindObjectAny(
"TesAll");
122 m_hTesAll->Add(hist);
124 hist = (TH1F*)fdcom->FindObjectAny(
"TesCal");
125 m_hTesCal->Add(hist);
127 hist = (TH1F*)fdcom->FindObjectAny(
"Tes_Flag");
128 m_hTesFlag->Add(hist);
130 for(
int lay=0; lay<
NLAYER; lay++){
131 sprintf(hname,
"T_hitmap_Lay%02d", lay);
132 hist = (TH1F*)fdTmap->FindObjectAny(hname);
133 m_hlaymapT[lay]->Add(hist);
135 sprintf(hname,
"TDC_Lay%02d", lay);
136 hist = (TH1F*)fdTraw->FindObjectAny(hname);
137 m_htdc[lay]->Add(hist);
139 sprintf(hname,
"Traw_Lay%02d", lay);
140 hist = (TH1F*)fdTraw->FindObjectAny(hname);
141 m_htraw[lay]->Add(hist);
143 sprintf(hname,
"Q_hitmap_Lay%02d", lay);
144 hist = (TH1F*)fdQmap->FindObjectAny(hname);
145 m_hlaymapQ[lay]->Add(hist);
147 sprintf(hname,
"Qraw_Lay%02d", lay);
148 hist = (TH1F*)fdQraw->FindObjectAny(hname);
149 m_hqraw[lay]->Add(hist);
152 for(
int wir=0; wir<
NWIRE; wir++){
153 int lay = m_pGeom -> getWire(wir) -> getLayerId();
154 int cel = m_pGeom -> getWire(wir) -> getCellId();
156 sprintf(hname,
"Traw_%02d_%03d_%04d", lay, cel, wir);
157 hist = (TH1F*)fdTrawCel->FindObjectAny(hname);
158 m_htrawCel[wir]->Add(hist);
160 sprintf(hname,
"Qraw_%02d_%03d_%04d", lay, cel, wir);
161 hist = (TH1F*)fdQrawCel->FindObjectAny(hname);
162 m_hqrawCel[wir]->Add(hist);
178 double chindfTmin[
NLAYER];
179 double chindfTmax[
NLAYER];
184 for(lay=0; lay<
NLAYER; lay++){
186 chindfTmin[lay] = -1;
187 sprintf(funname,
"ftmin%02d", lay);
188 ftmin[lay] =
new TF1(funname, funTmin, 0, 150, 6);
191 Stat_t nEntryTot = 0;
192 for(
int ibin=1; ibin<=25; ibin++){
193 Stat_t entry = m_htraw[lay]->GetBinContent(ibin);
196 double c0Ini = (double)nEntryTot / 25.0;
197 double c1Ini = (m_htraw[lay]->GetMaximum()) - c0Ini;
199 ftmin[lay] -> SetParameter(0, c0Ini);
200 ftmin[lay] -> SetParameter(1, c1Ini);
201 ftmin[lay] -> SetParameter(2, 0);
202 ftmin[lay] -> SetParameter(4, initT0);
203 ftmin[lay] -> SetParameter(5, 1);
206 gStyle -> SetOptFit(11);
207 chisq = ftmin[lay]->GetChisquare();
208 ndf = ftmin[lay]->GetNDF();
209 chindfTmin[lay] = chisq / ndf;
212 t0Fit[lay] = ftmin[lay]->GetParameter(4);
218 if(0 == fitTminFg[lay]){
220 t0Cal[lay] = calconst->
getT0(wir);
227 for(lay=0; lay<
NLAYER; lay++){
229 chindfTmax[lay] = -1;
230 sprintf(funname,
"ftmax%02d", lay);
231 ftmax[lay] =
new TF1(funname, funTmax, 250, 500, 4);
234 ftmax[lay] -> SetParameter(2,
gInitTm[lay]);
235 ftmax[lay] -> SetParameter(3, 10);
238 gStyle -> SetOptFit(11);
239 chisq = ftmax[lay]->GetChisquare();
240 ndf = ftmax[lay]->GetNDF();
241 chindfTmax[lay] = chisq / ndf;
244 tmax[lay] = ftmax[lay]->GetParameter(2);
248 if(0 == fitTmaxFg[lay]){
249 tmax[lay] = (calconst->
getXtpar(lay, 0, 0, 6)) + t0Fit[lay];
254 ofstream ft0(
"iniT0.dat");
255 for(lay=0; lay<
NLAYER; lay++){
256 ft0 << setw(5) << lay << setw(3) << fitTminFg[lay]
257 << setw(12) << t0Cal[lay] << setw(12) << t0Fit[lay]
258 << setw(12) << chindfTmin[lay] << setw(5) << fitTmaxFg[lay]
259 << setw(12) << tmax[lay] << setw(12) << tmax[lay] - t0Fit[lay]
260 << setw(12) << chindfTmax[lay] << endl;
263 cout <<
"iniT0.dat was written." << endl;
267 int nwire = m_pGeom -> getWireSize();
268 for(i=0; i<nwire; i++){
269 lay = m_pGeom -> getWire(i) -> getLayerId();
271 calconst -> resetT0(i, t0Cal[lay]);
272 calconst -> resetDelT0(i, 0.0);
282 double xtini[8] = {0, 0.03, 0, 0, 0, 0, 999.9, 0};
283 for(lay=0; lay<
NLAYER; lay++){
286 for(iEntr=0; iEntr<
NENTRXT; iEntr++){
287 for(lr=0; lr<
NLR; lr++){
288 for(ord=0; ord<
NXTPAR; ord++){
290 xtpar = tmax[lay] - t0Fit[lay];
294 calconst -> resetXtpar(lay, iEntr, lr, ord, xtpar);
301 for(lay=0; lay<
NLAYER; lay++){
302 calconst -> resetQtpar0(lay, 0.0);
303 calconst -> resetQtpar1(lay, 0.0);
309 for(lay=0; lay<
NLAYER; lay++){
310 for(iEntr=0; iEntr<
NENTRSD; iEntr++){
311 for(lr=0; lr<2; lr++){
313 calconst -> resetSdpar(lay, iEntr, lr,
bin, sdpar);
322 for(lay=0; lay<
NLAYER; lay++){
323 for(iEntr=0; iEntr<
NENTRXT; iEntr++){
324 for(lr=0; lr<
NLR; lr++){
325 xtpar = tmax[lay] - t0Fit[lay];
326 calconst -> resetXtpar(lay, iEntr, lr, 6, xtpar);
333 for(lay=0; lay<
NLAYER; lay++){