9#include <reconstruction/dbobjects/CDCDedxInjectionTime.h>
16 if (svar !=
"mean" && svar !=
"reso") {
17 B2WARNING(
"wrong variable input, choose mean or reso");
21 std::string sring[2] = {
"ler",
"her"};
22 TCanvas* cdraw =
new TCanvas(
"cdraw",
"cdraw", 900, 500);
26 for (
int ir = 0; ir < 2; ir++) {
28 unsigned int iv = ir * 3 + 1 ;
29 if (svar ==
"reso") iv = ir * 3 + 2 ;
33 if (sizev == 0 || sizet == 0) {
34 B2ERROR(
"empty calibration vector");
38 std::vector<unsigned int> tedges(sizet);
41 std::string hname = Form(
"hconst_%s_%s_%s", svar.data(), sring[ir].data(), sfx.data());
42 std::string title = Form(
"%s corrections;injection-time (#mu-sec);%s", svar.data(), svar.data());
43 TH1F hconst(hname.data(), title.data(), sizet - 1, 0, sizet - 1);
45 for (
unsigned int ib = 0; ib < sizev; ib++) {
48 double ledge = tedges[ib];
49 double uedge = tedges[ib + 1];
52 if (ledge < 2e4)label = Form(
"%0.01f-%0.01fK", ledge / 1e3, uedge / 1e3);
53 else if (ledge < 1e5)label = Form(
"%0.00f-%0.00fK", ledge / 1e3, uedge / 1e3);
54 else label = Form(
"%0.01f-%0.01fM", ledge / 1e6, uedge / 1e6);
56 hconst.SetBinContent(ib + 1, corr);
57 hconst.SetBinError(ib + 1, corr * 0.001);
58 hconst.GetXaxis()->SetBinLabel(ib + 1, Form(
"%s", label.data()));
59 B2INFO(
"ring: " << sring[ir] <<
", time (" << ledge <<
"-" << uedge <<
"), mean: " << corr <<
"");
63 hconst.SetMarkerColor(ir + 1);
64 hconst.SetMarkerSize(1.05);
65 hconst.SetMarkerStyle(24);
66 hconst.GetXaxis()->SetLabelOffset(-0.055);
67 hconst.GetYaxis()->SetRangeUser(0.60, 1.10);
68 if (svar ==
"reso")hconst.GetYaxis()->SetRangeUser(0.01, 0.20);
70 if (ir == 0)hconst.DrawCopy(
"");
71 else hconst.DrawCopy(
" same");
74 cdraw->SaveAs(Form(
"cdcdedx_timeinject_const_%s_%s.pdf", svar.data(), sfx.data()));
82 if (svar !=
"mean" && svar !=
"reso") {
83 B2ERROR(
"wrong var input, choose mean or reso");
87 if (std::isnan(ring) || std::isnan(time))
return 1.0;
90 B2ERROR(
"wrong ring input, choose 0 or 1");
94 unsigned int iv = ring * 3 + 1 ;
95 if (svar ==
"reso") iv = ring * 3 + 2 ;
99 if (sizet == 0 || sizev == 0) {
100 B2ERROR(
"calibration vectors are empty");
104 std::vector<unsigned int> tedges(sizet);
107 if (time >= 5e6)time = 5e6 - 10;
115 int thisbin = it, nextbin = it;
116 if (center != time && it > 0) {
121 if (it < sizet - 2)nextbin = it + 1;
122 else thisbin = it - 1;
129 if (it == 1) nextbin = it;
130 else nextbin = it + 1;
147 if (thisbin != nextbin)
148 newdedx = thisdedx + ((nextdedx - thisdedx) / (nexttime - thistime)) * (time - thistime);
unsigned int getTimeBin(const std::vector< unsigned int > &array, unsigned int value) const
Return time bin for the given time array.
void printCorrection(std::string svar, std::string sfx) const
Return dE/dx mean or norm-reso value for the given time and ring.
double getCorrection(std::string svar, unsigned int ring, unsigned int time) const
Return dE/dx mean or norm-reso value for the given time and ring.
std::vector< std::vector< double > > m_injectionvar
CDC dE/dx injection time payloads for dEdx mean and reso.
Abstract base class for different kinds of events.