206{
207 MsgStream log(
msgSvc(), name());
208 log<<MSG::INFO<<"DedxCalibDocaEAng::WriteHists()"<<endreq;
209
211 double Out_entryNo[totalNo]={0},Out_mean[totalNo]={0},Out_sigma[totalNo]={0},Out_fitmean[totalNo]={0},Out_fitmeanerr[totalNo]={0},Out_fitsigma[totalNo]={0},Out_gain[totalNo]={0};
212 double Iner_entryNo[totalNo]={0},Iner_mean[totalNo]={0},Iner_sigma[totalNo]={0},Iner_fitmean[totalNo]={0},Iner_fitmeanerr[totalNo]={0},Iner_fitsigma[totalNo]={0},Iner_gain[totalNo]={0};
213 double Id_doca[totalNo]={0},Ip_eangle[totalNo]={0},doca[totalNo]={0},eangle[totalNo]={0},chisq[totalNo]={0};
214
215 double Norm(0),
count(0);
217 {
219 {
223 int iE=0,i=0;
224 for(;i<14;i++)
225 {
226 if(ip>=iE && ip<iE+Eangle_cut_bin[i]) break;
227 iE=iE+Eangle_cut_bin[i];
228 }
229
230 eangle[
id*
NumSlicesEAng+ip] = Eangle_value_cut[i] + (ip-iE+0.5)*(Eangle_value_cut[i+1]-Eangle_value_cut[i])/Eangle_cut_bin[i];
231
232
233 Out_entryNo[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetEntries();
234 Out_mean[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetMean();
235 Out_sigma[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetRMS();
236
238
240 {
241 Out_fitmean[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"mylan")->GetParameter(1);
242 Out_fitmeanerr[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"mylan")->GetParError(1);
243 Out_fitsigma[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"mylan")->GetParameter(2);
244
245 chisq[
id*
NumSlicesEAng+ip] = (m_docaeangle[id][ip]->GetFunction(
"mylan")-> GetChisquare())/(m_docaeangle[
id][ip]->GetFunction(
"mylan")-> GetNDF());
246 }
248 {
249 Out_fitmean[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"landaun")->GetParameter(1);
250 Out_fitmeanerr[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"landaun")->GetParError(1);
251 Out_fitsigma[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"landaun")->GetParameter(2);
252 chisq[
id*
NumSlicesEAng+ip] = (m_docaeangle[id][ip]->GetFunction(
"landaun")-> GetChisquare())/(m_docaeangle[
id][ip]->GetFunction(
"landaun")-> GetNDF());
253 }
255 {
256 Out_fitmean[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"Landau")->GetParameter(1);
257 Out_fitmeanerr[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"Landau")->GetParError(1);
258 Out_fitsigma[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"Landau")->GetParameter(2);
259 chisq[
id*
NumSlicesEAng+ip] = (m_docaeangle[id][ip]->GetFunction(
"Landau")-> GetChisquare())/(m_docaeangle[
id][ip]->GetFunction(
"Landau")-> GetNDF());
260 }
262 {
263 Out_fitmean[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"Vavilov")->GetParameter(1);
264 Out_fitmeanerr[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"Vavilov")->GetParError(1);
265 Out_fitsigma[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"Vavilov")->GetParameter(2);
266 chisq[
id*
NumSlicesEAng+ip] = (m_docaeangle[id][ip]->GetFunction(
"Vavilov")-> GetChisquare())/(m_docaeangle[
id][ip]->GetFunction(
"Vavilov")-> GetNDF());
267 }
269 {
270 Out_fitmean[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"AsymGauss")->GetParameter(1);
271 Out_fitmeanerr[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"AsymGauss")->GetParError(1);
272 Out_fitsigma[
id*
NumSlicesEAng+ip] = m_docaeangle[id][ip]->GetFunction(
"AsymGauss")->GetParameter(2);
273 chisq[
id*
NumSlicesEAng+ip] = (m_docaeangle[id][ip]->GetFunction(
"AsymGauss")-> GetChisquare())/(m_docaeangle[
id][ip]->GetFunction(
"AsymGauss")-> GetNDF());
274 }
275
276 m_DocaEAngAverdE -> SetBinContent(
id+1, ip+1, Out_fitmean[
id*
NumSlicesEAng+ip]);
280 }
281 }
282 }
284 cout<<
"count= "<<
count<<
" average value of doca eangle bins: "<<Norm<<endl;
285 for(Int_t i=0;i<totalNo;i++)
286 {
287 if(Out_entryNo[i]>10 && Out_fitmean[i]>0 && Out_fitsigma[i]>0) Out_gain[i]=Out_fitmean[i]/Norm;
288 else Out_gain[i] = 0;
289 }
290
291 log<<MSG::INFO<<"begin generating root file!!! "<<endreq;
292 TFile*
f =
new TFile(
m_rootfile.c_str(),
"recreate");
294 {
296 {
297 m_docaeangle[id][ip]->Write();
298 }
299 }
300 m_DocaEAngAverdE->Write();
301
302 TTree* ddgcalib = new TTree("ddgcalib", "ddgcalib");
303 ddgcalib -> Branch("Out_hits", Out_entryNo, "Out_entryNo[1600]/D");
304 ddgcalib -> Branch("Out_mean", Out_mean, "Out_mean[1600]/D");
305 ddgcalib -> Branch("Out_sigma", Out_sigma, "Out_sigma[1600]/D");
306 ddgcalib -> Branch("Out_fitmean", Out_fitmean, "Out_fitmean[1600]/D");
307 ddgcalib -> Branch("Out_fitmeanerr", Out_fitmeanerr, "Out_fitmeanerr[1600]/D");
308 ddgcalib -> Branch("Out_chi", Out_fitsigma, "Out_fitsigma[1600]/D");
309 ddgcalib -> Branch("Out_gain", Out_gain, "Out_gain[1600]/D");
310 ddgcalib -> Branch("Iner_hits", Iner_entryNo, "Iner_entryNo[1600]/D");
311 ddgcalib -> Branch("Iner_mean", Iner_mean, "Iner_mean[1600]/D");
312 ddgcalib -> Branch("Iner_sigma", Iner_sigma, "Iner_sigma[1600]/D");
313 ddgcalib -> Branch("Iner_fitmean", Iner_fitmean, "Iner_fitmean[1600]/D");
314 ddgcalib -> Branch("Iner_fitmeanerr", Iner_fitmeanerr, "Iner_fitmeanerr[1600]/D");
315 ddgcalib -> Branch("Iner_chi", Iner_fitsigma, "Iner_fitsigma[1600]/D");
316 ddgcalib -> Branch("Iner_gain", Iner_gain, "Iner_gain[1600]/D");
317 ddgcalib -> Branch("Id_doca", Id_doca, "Id_doca[1600]/D");
318 ddgcalib -> Branch("Ip_eangle", Ip_eangle, "Ip_eangle[1600]/D");
319 ddgcalib -> Branch("chisq", chisq, "chisq[1600]/D");
320 ddgcalib -> Branch("doca", doca, "doca[1600]/D");
321 ddgcalib -> Branch("eangle", eangle, "eangle[1600]/D");
322 ddgcalib -> Fill();
323 ddgcalib -> Write();
325
326 TCanvas c1("c1", "canvas", 500, 400);
329 {
331 {
332 m_docaeangle[id][ip]->Draw();
334 }
335 }
337
339 {
341 {
342 delete m_docaeangle[id][ip];
343 }
344 }
345 delete m_DocaEAngAverdE;
346}
DOUBLE_PRECISION count[3]