183{
184 MsgStream log(
msgSvc(), name());
185 log<<MSG::INFO<<"DedxCalibCostheta::WriteHists()"<<endreq;
186
194
196 {
198
199 chientryNo[i] = m_chi[i]->GetEntries();
200 if(m_debug) cout << "get results at " << i << " bin with chi entries " << chientryNo[i] << endl;
201 if(m_chi[i]->GetFunction("gaus"))
202 {
203 chimean[i] = m_chi[i]->GetFunction("gaus")->GetParameter(1);
204 chimeanerr[i] = m_chi[i]->GetFunction("gaus")->GetParError(1);
205 chisigma[i] = m_chi[i]->GetFunction("gaus")->GetParameter(2);
206 chisq[i] = (m_chi[i]->GetFunction("gaus")->GetChisquare())/(m_chi[i]->GetFunction("gaus")->GetNDF());
207 }
208 pos_chientryNo[i] = m_pos_chi[i]->GetEntries();
209 if(m_debug) cout << "get results at " << i << " bin with pos_chi entries " << pos_chientryNo[i] << endl;
210 if(m_pos_chi[i]->GetFunction("gaus"))
211 {
212 pos_chimean[i] = m_pos_chi[i]->GetFunction("gaus")->GetParameter(1);
213 pos_chimeanerr[i] = m_pos_chi[i]->GetFunction("gaus")->GetParError(1);
214 pos_chisigma[i] = m_pos_chi[i]->GetFunction("gaus")->GetParameter(2);
215 pos_chisq[i] = (m_pos_chi[i]->GetFunction("gaus")->GetChisquare())/(m_pos_chi[i]->GetFunction("gaus")->GetNDF());
216 }
217 neg_chientryNo[i] = m_neg_chi[i]->GetEntries();
218 if(m_debug) cout << "get results at " << i << " bin with neg_chi entries " << neg_chientryNo[i] << endl;
219 if(m_neg_chi[i]->GetFunction("gaus"))
220 {
221 neg_chimean[i] = m_neg_chi[i]->GetFunction("gaus")->GetParameter(1);
222 neg_chimeanerr[i] = m_neg_chi[i]->GetFunction("gaus")->GetParError(1);
223 neg_chisigma[i] = m_neg_chi[i]->GetFunction("gaus")->GetParameter(2);
224 neg_chisq[i] = (m_neg_chi[i]->GetFunction("gaus")->GetChisquare())/(m_neg_chi[i]->GetFunction("gaus")->GetNDF());
225 }
226
227 fitentryNo[i] = m_costheta[i]->GetEntries();
228 if(m_debug) cout << "get results at " << i << " bin with fit entries " << fitentryNo[i] << endl;
229 if(m_costheta[i]->GetFunction("gaus"))
230 {
231 fitmean[i] = m_costheta[i]->GetFunction("gaus")->GetParameter(1);
232 fitmeanerr[i] = m_costheta[i]->GetFunction("gaus")->GetParError(1);
233 fitsigma[i] = m_costheta[i]->GetFunction("gaus")->GetParameter(2);
235 fitchisq[i] = (m_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_costheta[i]->GetFunction("gaus")->GetNDF());
236 }
237 pos_fitentryNo[i] = m_pos_costheta[i]->GetEntries();
238 if(m_debug) cout << "get results at " << i << " bin with pos_fit entries " << pos_fitentryNo[i] << endl;
239 if(m_pos_costheta[i]->GetFunction("gaus"))
240 {
241 pos_fitmean[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParameter(1);
242 pos_fitmeanerr[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParError(1);
243 pos_fitsigma[i] = m_pos_costheta[i]->GetFunction("gaus")->GetParameter(2);
245 pos_fitchisq[i] = (m_pos_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_pos_costheta[i]->GetFunction("gaus")->GetNDF());
246 }
247 neg_fitentryNo[i] = m_neg_costheta[i]->GetEntries();
248 if(m_debug) cout << "get results at " << i << " bin with neg_fit entries " << neg_fitentryNo[i] << endl;
249 if(m_neg_costheta[i]->GetFunction("gaus"))
250 {
251 neg_fitmean[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParameter(1);
252 neg_fitmeanerr[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParError(1);
253 neg_fitsigma[i] = m_neg_costheta[i]->GetFunction("gaus")->GetParameter(2);
255 neg_fitchisq[i] = (m_neg_costheta[i]->GetFunction("gaus")->GetChisquare())/(m_neg_costheta[i]->GetFunction("gaus")->GetNDF());
256 }
257
258 if(m_ave){
259 fitmean[i] = (pos_fitmean[i] + neg_fitmean[i])/2;
260 fitmeanerr[i] = sqrt(pow(pos_fitmeanerr[i],2) + pow(neg_fitmeanerr[i],2));
261 fitsigma[i] = sqrt(pow(pos_fitsigma[i],2) + pow(neg_fitsigma[i],2));
263 fitchisq[i] = (pos_fitchisq[i] + neg_fitchisq[i])/2;
264 }
265
266 if(fitentryNo[i]>100) m_dEdxVsCostheta -> SetBinContent(i+1,fitmean[i]);
267 if(pos_fitentryNo[i]>100) m_pos_dEdxVsCostheta -> SetBinContent(i+1,pos_fitmean[i]);
268 if(neg_fitentryNo[i]>100) m_neg_dEdxVsCostheta -> SetBinContent(i+1,neg_fitmean[i]);
269 }
270
271 double dedx1[
Size] = {0};
272 double costheta1[
Size] = {0};
273 cout << "Vec_dedx.size() = " << Vec_dedx.size() << endl;
274 for(
unsigned int i=0;i<
Size && i< Vec_dedx.size();i++)
275 {
276 dedx1[i] = Vec_dedx[i];
277 costheta1[i] = Vec_costheta[i];
278
279 }
280
281 log<<MSG::INFO<<"begin generating root file!!! "<<endreq;
282 TFile*
f =
new TFile(
m_rootfile.c_str(),
"RECREATE");
284 {
285 m_chi[i]->Write();
286 m_pos_chi[i]->Write();
287 m_neg_chi[i]->Write();
288 m_costheta[i]->Write();
289 m_pos_costheta[i]->Write();
290 m_neg_costheta[i]->Write();
291 }
292 m_dEdxVsCostheta->Write();
293 m_pos_dEdxVsCostheta->Write();
294 m_neg_dEdxVsCostheta->Write();
295
296 TTree *costhetacalib = new TTree("costhetacalib","costhetacalib");
297 costhetacalib ->
Branch(
"chientryNo",chientryNo,
"chientryNo[80]/D");
298 costhetacalib ->
Branch(
"chimean",chimean,
"chimean[80]/D");
299 costhetacalib ->
Branch(
"chimeanerr",chimeanerr,
"chimeanerr[80]/D");
300 costhetacalib ->
Branch(
"chisigma",chisigma,
"chisigma[80]/D");
301 costhetacalib ->
Branch(
"chisq",chisq,
"chisq[80]/D");
302 costhetacalib ->
Branch(
"pos_chientryNo",pos_chientryNo,
"pos_chientryNo[80]/D");
303 costhetacalib ->
Branch(
"pos_chimean",pos_chimean,
"pos_chimean[80]/D");
304 costhetacalib ->
Branch(
"pos_chimeanerr",pos_chimeanerr,
"pos_chimeanerr[80]/D");
305 costhetacalib ->
Branch(
"pos_chisigma",pos_chisigma,
"pos_chisigma[80]/D");
306 costhetacalib ->
Branch(
"pos_chisq",pos_chisq,
"pos_chisq[80]/D");
307 costhetacalib ->
Branch(
"neg_chientryNo",neg_chientryNo,
"neg_chientryNo[80]/D");
308 costhetacalib ->
Branch(
"neg_chimean",neg_chimean,
"neg_chimean[80]/D");
309 costhetacalib ->
Branch(
"neg_chimeanerr",neg_chimeanerr,
"neg_chimeanerr[80]/D");
310 costhetacalib ->
Branch(
"neg_chisigma",neg_chisigma,
"neg_chisigma[80]/D");
311 costhetacalib ->
Branch(
"neg_chisq",neg_chisq,
"neg_chisq[80]/D");
312 costhetacalib ->
Branch(
"fitentryNo", fitentryNo,
"fitentryNo[80]/D");
313 costhetacalib ->
Branch(
"fitmean", fitmean,
"fitmean[80]/D");
314 costhetacalib ->
Branch(
"fitmeanerr", fitmeanerr,
"fitmeanerr[80]/D");
315 costhetacalib ->
Branch(
"fitsigma", fitsigma,
"fitsigma[80]/D");
316 costhetacalib ->
Branch(
"costheta", gain,
"gain[80]/D");
317 costhetacalib ->
Branch(
"fitchisq", fitchisq,
"fitchisq[80]/D");
318 costhetacalib ->
Branch(
"pos_fitentryNo", pos_fitentryNo,
"pos_fitentryNo[80]/D");
319 costhetacalib ->
Branch(
"pos_fitmean", pos_fitmean,
"pos_fitmean[80]/D");
320 costhetacalib ->
Branch(
"pos_fitmeanerr", pos_fitmeanerr,
"pos_fitmeanerr[80]/D");
321 costhetacalib ->
Branch(
"pos_fitsigma", pos_fitsigma,
"pos_fitsigma[80]/D");
322 costhetacalib ->
Branch(
"pos_gain", pos_gain,
"pos_gain[80]/D");
323 costhetacalib ->
Branch(
"pos_fitchisq", pos_fitchisq,
"pos_fitchisq[80]/D");
324 costhetacalib ->
Branch(
"neg_fitentryNo", neg_fitentryNo,
"neg_fitentryNo[80]/D");
325 costhetacalib ->
Branch(
"neg_fitmean", neg_fitmean,
"neg_fitmean[80]/D");
326 costhetacalib ->
Branch(
"neg_fitmeanerr", neg_fitmeanerr,
"neg_fitmeanerr[80]/D");
327 costhetacalib ->
Branch(
"neg_fitsigma", neg_fitsigma,
"neg_fitsigma[80]/D");
328 costhetacalib ->
Branch(
"neg_gain", neg_gain,
"neg_gain[80]/D");
329 costhetacalib ->
Branch(
"neg_fitchisq", neg_fitchisq,
"neg_fitchisq[80]/D");
330 costhetacalib ->
Branch(
"cosBin", cosBin,
"cosBin[80]/D");
331 costhetacalib ->
Branch(
"costheta1",costheta1,
"costheta1[700000]/D");
332 costhetacalib ->
Branch(
"dedx1",dedx1,
"dedx1[700000]/D");
333 costhetacalib ->
Fill();
334 costhetacalib ->
Write();
335
336 TCanvas c1("c1", "canvas", 500, 400);
338 costhetacalib ->
Draw(
"dedx1:costheta1",
"dedx1>200 && dedx1<1000");
340 m_dEdxVsCostheta->Draw();
342 m_pos_dEdxVsCostheta->Draw();
344 m_neg_dEdxVsCostheta->Draw();
347 {
348 m_chi[i]->Draw();
350 }
352 {
353 m_pos_chi[i]->Draw();
355 }
357 {
358 m_neg_chi[i]->Draw();
360 }
362 {
363 m_costheta[i]->Draw();
365 }
367 {
368 m_pos_costheta[i]->Draw();
370 }
372 {
373 m_neg_costheta[i]->Draw();
375 }
378
380 {
381 delete m_chi[i];
382 delete m_pos_chi[i];
383 delete m_neg_chi[i];
384 delete m_costheta[i];
385 delete m_pos_costheta[i];
386 delete m_neg_costheta[i];
387 }
388 delete m_dEdxVsCostheta;
389 delete m_pos_dEdxVsCostheta;
390 delete m_neg_dEdxVsCostheta;
391}
curve Branch("CurveSize",&CurveSize,"CurveSize/I")