42 Double_t sqrt2 = TMath::Sqrt(2);
43 val = TMath::Gaus(x2, mean, sigma, 1) - TMath::Gaus(x1, mean, sigma, 1);
44 val *= -2.*sigma*sigma/(TMath::Erf((x2-mean)/sqrt2/sigma)-TMath::Erf((x1-mean)/sqrt2/sigma));
53 string out_basename = argv[0];
55 out_basename = argv[3];
65 const double event_time = t0 + 1*
units::ms;
69 for(
int i=0; i<6; i++){
73 vertex +
Vector(0, 0, 0.1*stepsize)),
81 const double nsigma = 3.0;
89 const double t_min = event_time - 1*
units::s;
90 const double t_max = event_time + 1*
units::s;
91 const int nt = (t_max-t_min)/t_sample;
96 const double p_min = -10*p_sample;
97 const double p_max = 10*p_sample;
98 const int np = (p_max-p_min)/p_sample;
99 const Binning pbins(np, p_min, p_max);
104 TCanvas* canvas =
new TCanvas(
"c",
"canvas",1000,1000);
105 gStyle->SetOptStat(0);
124 for(
auto depo :
depos)
126 auto drifted = std::make_shared<Gen::TransportedDepo>(depo, field_origin.x(),
drift_speed);
127 double center_time = drifted->time();
128 double center_pitch = drifted->pos().z();
131 <<
" time-T0=" << (drifted->time()-
t0)/
units::us<<
"us" 132 <<
" pt=" << drifted->pos() /
units::mm <<
" mm\n";
137 charge[5 - pcount] =
new TF1(Form(
"charge%d",5-pcount),
"1", center_pitch-0.01, center_pitch+0.01);
141 charge[5 - pcount] =
new TF1(Form(
"charge%d",5-pcount),
"[0]*TMath::Gaus(x, [1], [2], 0)", -0.3, 0.9);
142 charge[5 - pcount]->SetParameters(1, center_pitch, sigma_pitch);
143 charge[5 - pcount]->SetNpx(1000);
151 cout<<
"Offset bin: "<<offsetbin<<
std::endl;
153 for(
unsigned int i=0; i<
weight.size(); i++)
155 if(10-offsetbin-i==0){
158 cout<<
"weight "<<check<<
endl;
159 y[5 - pcount] =
weight[i];
160 x[5 - pcount] = center_pitch;
161 yc[5 - pcount] =
check;
162 xc[5 - pcount] = center_pitch;
168 cout<<
"Points: "<<pcount<<
endl;
169 cout<<
"Weights: "<<wcount<<
endl;
170 for(
int i=0; i<pcount; i++)
172 cout<<x[i]<<
", "<<y[i]<<
endl;
176 TGraph *
graph =
new TGraph(6, x, y);
177 graph->SetTitle(
"Gaussian");
178 TGraph *graphc =
new TGraph(6, xc, yc);
180 graph->GetXaxis()->SetLimits(-0.3, 0.9);
181 graph->GetYaxis()->SetRangeUser(0, 1.1);
183 graphc->Draw(
"* same");
184 graphc->SetMarkerColor(kRed);
185 graphc->SetMarkerStyle(24);
186 graphc->SetMarkerSize(2);
187 TBox bb(0, 0, 0.3, 1.1);
188 bb.SetLineColor(kRed);
189 bb.SetFillColorAlpha(7, 0.4);
192 Int_t
color[6] = {2, 4, 6, 8, 9, 1};
193 for(
int i=0; i<pcount; i++)
195 charge[i]->Draw(
"same");
196 charge[i]->SetLineColor(color[i]);
197 charge[i]->SetLineStyle(kDashed);
200 canvas->Print(Form(
"%s-Gaus7.pdf", out_basename.c_str()),
"pdf");
double WeightGaus(double x1, double x2, double mean, double sigma)
code to link reconstructed objects back to the MC truth information
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
static const double eplus
std::shared_ptr< IRandom > pointer
Access subclass facet by pointer.
void add_track(double time, const WireCell::Ray &ray, double dedx=-1.0)
D3Vector< double > Point
A 3D Cartesian point in double precision.
const std::vector< double > weights() const
def graph(desc, maker=maker)
void set_sampling(const Binning &tbin, const Binning &pbin, double nsigma=3.0, IRandom::pointer fluctuate=nullptr, unsigned int weightstrat=1)
bool check(const std::vector< std::vector< float > > &outputs)
Binning tbins(nticks, t0, t0+readout_time)
A producer of depositions created from some number of simple, linear tracks.
int main(const int argc, char *argv[])
int poffset_bin() const
Return the absolute impact bin in the binning corresponding to column 0 of the patch.
WireCell::IDepo::vector depos()
Point Vector
An alias for Point.
double edge(int ind) const
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
QTextStream & endl(QTextStream &s)