175{
176 MsgStream log(
msgSvc(), name());
177 log<<MSG::INFO<<"DedxCalibCostheta::WriteHists()"<<endreq;
178
186
188 {
190
191 chientryNo[i] = m_chi[i]->GetEntries();
192 if(m_debug) cout << "get results at " << i << " bin with chi entries " << chientryNo[i] << endl;
193 if(m_chi[i]->GetFunction("gaus"))
194 {
195 chimean[i] = m_chi[i]->GetFunction("gaus")->GetParameter(1);
196 chimeanerr[i] = m_chi[i]->GetFunction("gaus")->GetParError(1);
197 chisigma[i] = m_chi[i]->GetFunction("gaus")->GetParameter(2);
198 chisq[i] = (m_chi[i]->GetFunction("gaus")->GetChisquare())/(m_chi[i]->GetFunction("gaus")->GetNDF());
199 }
200 pos_chientryNo[i] = m_pos_chi[i]->GetEntries();
201 if(m_debug) cout << "get results at " << i << " bin with pos_chi entries " << pos_chientryNo[i] << endl;
202 if(m_pos_chi[i]->GetFunction("gaus"))
203 {
204 pos_chimean[i] = m_pos_chi[i]->GetFunction("gaus")->GetParameter(1);
205 pos_chimeanerr[i] = m_pos_chi[i]->GetFunction("gaus")->GetParError(1);
206 pos_chisigma[i] = m_pos_chi[i]->GetFunction("gaus")->GetParameter(2);
207 pos_chisq[i] = (m_pos_chi[i]->GetFunction("gaus")->GetChisquare())/(m_pos_chi[i]->GetFunction("gaus")->GetNDF());
208 }
209 neg_chientryNo[i] = m_neg_chi[i]->GetEntries();
210 if(m_debug) cout << "get results at " << i << " bin with neg_chi entries " << neg_chientryNo[i] << endl;
211 if(m_neg_chi[i]->GetFunction("gaus"))
212 {
213 neg_chimean[i] = m_neg_chi[i]->GetFunction("gaus")->GetParameter(1);
214 neg_chimeanerr[i] = m_neg_chi[i]->GetFunction("gaus")->GetParError(1);
215 neg_chisigma[i] = m_neg_chi[i]->GetFunction("gaus")->GetParameter(2);
216 neg_chisq[i] = (m_neg_chi[i]->GetFunction("gaus")->GetChisquare())/(m_neg_chi[i]->GetFunction("gaus")->GetNDF());
217 }
218
219 fitentryNo[i] = m_costheta[i]->GetEntries();
220 if(m_debug) cout << "get results at " << i << " bin with fit entries " << fitentryNo[i] << endl;
221 if(m_costheta[i]->GetFunction("gaus"))
222 {
223 fitmean[i] = m_costheta[i]->GetFunction("gaus")->GetParameter(1);
224 fitmeanerr[i] = m_costheta[i]->GetFunction("gaus")->GetParError(1);
225 fitsigma[i] = m_costheta[i]->GetFunction("gaus")->GetParameter(2);
227 fitchisq[i] = (m_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_costheta[i]->GetFunction("gaus")->GetNDF());
228 }
229 pos_fitentryNo[i] = m_pos_costheta[i]->GetEntries();
230 if(m_debug) cout << "get results at " << i << " bin with pos_fit entries " << pos_fitentryNo[i] << endl;
231 if(m_pos_costheta[i]->GetFunction("gaus"))
232 {
233 pos_fitmean[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParameter(1);
234 pos_fitmeanerr[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParError(1);
235 pos_fitsigma[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParameter(2);
237 pos_fitchisq[i] = (m_pos_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_pos_costheta[i]->GetFunction("gaus")->GetNDF());
238 }
239 neg_fitentryNo[i] = m_neg_costheta[i]->GetEntries();
240 if(m_debug) cout << "get results at " << i << " bin with neg_fit entries " << neg_fitentryNo[i] << endl;
241 if(m_neg_costheta[i]->GetFunction("gaus"))
242 {
243 neg_fitmean[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParameter(1);
244 neg_fitmeanerr[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParError(1);
245 neg_fitsigma[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParameter(2);
247 neg_fitchisq[i] = (m_neg_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_neg_costheta[i]->GetFunction("gaus")->GetNDF());
248 }
249
250 if(fitentryNo[i]>100) m_dEdxVsCostheta -> SetBinContent(i+1,fitmean[i]);
251 if(pos_fitentryNo[i]>100) m_pos_dEdxVsCostheta -> SetBinContent(i+1,pos_fitmean[i]);
252 if(neg_fitentryNo[i]>100) m_neg_dEdxVsCostheta -> SetBinContent(i+1,neg_fitmean[i]);
253 }
254
255 double dedx1[
Size] = {0};
256 double costheta1[
Size] = {0};
257 cout << "Vec_dedx.size() = " << Vec_dedx.size() << endl;
258 for(
unsigned int i=0;i<
Size && i< Vec_dedx.size();i++)
259 {
260 dedx1[i] = Vec_dedx[i];
261 costheta1[i] = Vec_costheta[i];
262
263 }
264
265 log<<MSG::INFO<<"begin generating root file!!! "<<endreq;
266 TFile* f =
new TFile(
m_rootfile.c_str(),
"RECREATE");
268 {
269 m_chi[i]->Write();
270 m_pos_chi[i]->Write();
271 m_neg_chi[i]->Write();
272 m_costheta[i]->Write();
273 m_pos_costheta[i]->Write();
274 m_neg_costheta[i]->Write();
275 }
276 m_dEdxVsCostheta->Write();
277 m_pos_dEdxVsCostheta->Write();
278 m_neg_dEdxVsCostheta->Write();
279
280 TTree *costhetacalib = new TTree("costhetacalib","costhetacalib");
281 costhetacalib -> Branch("chientryNo",chientryNo,"chientryNo[80]/D");
282 costhetacalib -> Branch("chimean",chimean,"chimean[80]/D");
283 costhetacalib -> Branch("chimeanerr",chimeanerr,"chimeanerr[80]/D");
284 costhetacalib -> Branch("chisigma",chisigma,"chisigma[80]/D");
285 costhetacalib -> Branch("chisq",chisq,"chisq[80]/D");
286 costhetacalib -> Branch("pos_chientryNo",pos_chientryNo,"pos_chientryNo[80]/D");
287 costhetacalib -> Branch("pos_chimean",pos_chimean,"pos_chimean[80]/D");
288 costhetacalib -> Branch("pos_chimeanerr",pos_chimeanerr,"pos_chimeanerr[80]/D");
289 costhetacalib -> Branch("pos_chisigma",pos_chisigma,"pos_chisigma[80]/D");
290 costhetacalib -> Branch("pos_chisq",pos_chisq,"pos_chisq[80]/D");
291 costhetacalib -> Branch("neg_chientryNo",neg_chientryNo,"neg_chientryNo[80]/D");
292 costhetacalib -> Branch("neg_chimean",neg_chimean,"neg_chimean[80]/D");
293 costhetacalib -> Branch("neg_chimeanerr",neg_chimeanerr,"neg_chimeanerr[80]/D");
294 costhetacalib -> Branch("neg_chisigma",neg_chisigma,"neg_chisigma[80]/D");
295 costhetacalib -> Branch("neg_chisq",neg_chisq,"neg_chisq[80]/D");
296 costhetacalib -> Branch("fitentryNo", fitentryNo, "fitentryNo[80]/D");
297 costhetacalib -> Branch("fitmean", fitmean, "fitmean[80]/D");
298 costhetacalib -> Branch("fitmeanerr", fitmeanerr, "fitmeanerr[80]/D");
299 costhetacalib -> Branch("fitsigma", fitsigma, "fitsigma[80]/D");
300 costhetacalib -> Branch("costheta", gain, "gain[80]/D");
301 costhetacalib -> Branch("fitchisq", fitchisq, "fitchisq[80]/D");
302 costhetacalib -> Branch("pos_fitentryNo", pos_fitentryNo, "pos_fitentryNo[80]/D");
303 costhetacalib -> Branch("pos_fitmean", pos_fitmean, "pos_fitmean[80]/D");
304 costhetacalib -> Branch("pos_fitmeanerr", pos_fitmeanerr, "pos_fitmeanerr[80]/D");
305 costhetacalib -> Branch("pos_fitsigma", pos_fitsigma, "pos_fitsigma[80]/D");
306 costhetacalib -> Branch("pos_gain", pos_gain, "pos_gain[80]/D");
307 costhetacalib -> Branch("pos_fitchisq", pos_fitchisq, "pos_fitchisq[80]/D");
308 costhetacalib -> Branch("neg_fitentryNo", neg_fitentryNo, "neg_fitentryNo[80]/D");
309 costhetacalib -> Branch("neg_fitmean", neg_fitmean, "neg_fitmean[80]/D");
310 costhetacalib -> Branch("neg_fitmeanerr", neg_fitmeanerr, "neg_fitmeanerr[80]/D");
311 costhetacalib -> Branch("neg_fitsigma", neg_fitsigma, "neg_fitsigma[80]/D");
312 costhetacalib -> Branch("neg_gain", neg_gain, "neg_gain[80]/D");
313 costhetacalib -> Branch("neg_fitchisq", neg_fitchisq, "neg_fitchisq[80]/D");
314 costhetacalib -> Branch("cosBin", cosBin, "cosBin[80]/D");
315 costhetacalib -> Branch("costheta1",costheta1,"costheta1[700000]/D");
316 costhetacalib -> Branch("dedx1",dedx1,"dedx1[700000]/D");
317 costhetacalib -> Fill();
318 costhetacalib -> Write();
319
320 TCanvas c1("c1", "canvas", 500, 400);
322 costhetacalib -> Draw("dedx1:costheta1","dedx1>200 && dedx1<1000");
324 m_dEdxVsCostheta->Draw();
326 m_pos_dEdxVsCostheta->Draw();
328 m_neg_dEdxVsCostheta->Draw();
331 {
332 m_chi[i]->Draw();
334 }
336 {
337 m_pos_chi[i]->Draw();
339 }
341 {
342 m_neg_chi[i]->Draw();
344 }
346 {
347 m_costheta[i]->Draw();
349 }
351 {
352 m_pos_costheta[i]->Draw();
354 }
356 {
357 m_neg_costheta[i]->Draw();
359 }
361 f->Close();
362
364 {
365 delete m_chi[i];
366 delete m_pos_chi[i];
367 delete m_neg_chi[i];
368 delete m_costheta[i];
369 delete m_pos_costheta[i];
370 delete m_neg_costheta[i];
371 }
372 delete m_dEdxVsCostheta;
373 delete m_pos_dEdxVsCostheta;
374 delete m_neg_dEdxVsCostheta;
375}