1#ifndef G_COMPONENT_ANALYTIC_FIELD_H
2#define G_COMPONENT_ANALYTIC_FIELD_H
20 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
21 double& ey,
double& ez,
Medium*& m,
int& status);
22 void ElectricField(
const double x,
const double y,
const double z,
double& ex,
23 double& ey,
double& ez,
double& v,
Medium*& m,
28 void WeightingField(
const double x,
const double y,
const double z,
29 double& wx,
double& wy,
double& wz,
30 const std::string label);
32 const std::string label);
34 bool GetBoundingBox(
double& x0,
double& y0,
double& z0,
double& x1,
35 double& y1,
double& z1);
37 bool IsWireCrossed(
double x0,
double y0,
double z0,
double x1,
double y1,
38 double z1,
double& xc,
double& yc,
double& zc);
40 bool IsInTrapRadius(
double x0,
double y0,
double z0,
double& xw,
double& yx,
44 void AddWire(
const double x,
const double y,
const double diameter,
45 const double voltage,
const std::string label,
46 const double length = 100.,
const double tension = 50.,
47 const double rho = 19.3,
const int ntrap = 5);
49 void AddTube(
const double radius,
const double voltage,
const int nEdges,
50 const std::string label);
52 void AddPlaneX(
const double x,
const double voltage,
const std::string label);
54 void AddPlaneY(
const double y,
const double voltage,
const std::string label);
56 void AddStripOnPlaneX(
const char direction,
const double x,
const double smin,
57 const double smax,
const std::string label,
58 const double gap = -1.);
59 void AddStripOnPlaneY(
const char direction,
const double y,
const double smin,
60 const double smax,
const std::string label,
61 const double gap = -1.);
69 void AddCharge(
const double x,
const double y,
const double z,
99 bool GetWire(
const int i,
double& x,
double& y,
double& diameter,
100 double& voltage, std::string& label,
double& length,
101 double& charge,
int& ntrap);
105 bool GetPlaneX(
const int i,
double& x,
double& voltage, std::string& label);
106 bool GetPlaneY(
const int i,
double& y,
double& voltage, std::string& label);
108 bool GetTube(
double& r,
double& voltage,
int& nEdges, std::string& label);
119 std::string cellType;
136 std::string cellTypeFourier;
138 int mxmin, mxmax, mymin, mymax;
142 std::vector<std::string> readout;
169 std::vector<double> weight;
171 std::vector<double> dens;
173 std::vector<double> cnalso;
178 std::vector<double> cosph2;
179 std::vector<double> sinph2;
180 std::vector<double> amp2;
183 std::vector<double> b2sin;
186 std::complex<double> zmult;
190 std::vector<std::complex<double> > wmap;
193 std::vector<std::vector<double> > cc1;
194 std::vector<std::vector<double> > cc2;
198 double corvta, corvtb, corvtc;
206 double coplax, coplay;
230 std::vector<strip> strips1;
233 std::vector<strip> strips2;
236 std::vector<plane> planes;
245 std::vector<std::vector<double> > a;
247 std::vector<std::vector<std::complex<double> > > sigmat;
249 std::vector<std::vector<double> > qplane;
257 std::vector<charge3d> ch3d;
264 void UpdatePeriodicity();
265 void Reset() { CellInit(); }
271 bool PrepareStrips();
273 bool PrepareSignals();
274 bool SetupWireSignals();
275 bool SetupPlaneSignals();
292 bool IprA00(
const int mx,
const int my);
293 bool IprB2X(
const int my);
294 bool IprB2Y(
const int mx);
301 bool SetupDipole() {
return true; }
307 int Field(
const double xin,
const double yin,
const double zin,
double& ex,
308 double& ey,
double& ez,
double& volt,
const bool opt);
309 void FieldA00(
const double xpos,
const double ypos,
double& ex,
double& ey,
310 double& volt,
const bool opt);
311 void FieldB1X(
const double xpos,
const double ypos,
double& ex,
double& ey,
312 double& volt,
const bool opt);
313 void FieldB1Y(
const double xpos,
const double ypos,
double& ex,
double& ey,
314 double& volt,
const bool opt);
315 void FieldB2X(
const double xpos,
const double ypos,
double& ex,
double& ey,
316 double& volt,
const bool opt);
317 void FieldB2Y(
const double xpos,
const double ypos,
double& ex,
double& ey,
318 double& volt,
const bool opt);
319 void FieldC10(
const double xpos,
const double ypos,
double& ex,
double& ey,
320 double& volt,
const bool opt);
321 void FieldC2X(
const double xpos,
const double ypos,
double& ex,
double& ey,
322 double& volt,
const bool opt);
323 void FieldC2Y(
const double xpos,
const double ypos,
double& ex,
double& ey,
324 double& volt,
const bool opt);
325 void FieldC30(
const double xpos,
const double ypos,
double& ex,
double& ey,
326 double& volt,
const bool opt);
327 void FieldD10(
const double xpos,
const double ypos,
double& ex,
double& ey,
328 double& volt,
const bool opt);
329 void FieldD20(
const double xpos,
const double ypos,
double& ex,
double& ey,
330 double& volt,
const bool opt);
331 void FieldD30(
const double xpos,
const double ypos,
double& ex,
double& ey,
332 double& volt,
const bool opt);
335 void Field3dA00(
const double x,
const double y,
const double z,
double& ex,
336 double& ey,
double& ez,
double& volt);
337 void Field3dB2X(
const double x,
const double y,
const double z,
double& ex,
338 double& ey,
double& ez,
double& volt);
339 void Field3dB2Y(
const double x,
const double y,
const double z,
double& ex,
340 double& ey,
double& ez,
double& volt);
341 void Field3dD10(
const double x,
const double y,
const double z,
double& ex,
342 double& ey,
double& ez,
double& volt);
344 bool Wfield(
const double xpos,
const double ypos,
const double zpos,
345 double& ex,
double& ey,
double& ez,
double& volt,
const int isw,
347 void WfieldWireA00(
const double xpos,
const double ypos,
double& ex,
348 double& ey,
double& volt,
const int mx,
const int my,
349 const int sw,
const bool opt);
350 void WfieldWireB2X(
const double xpos,
const double ypos,
double& ex,
351 double& ey,
double& volt,
const int my,
const int sw,
353 void WfieldWireB2Y(
const double xpos,
const double ypos,
double& ex,
354 double& ey,
double& volt,
const int mx,
const int sw,
356 void WfieldWireC2X(
const double xpos,
const double ypos,
double& ex,
357 double& ey,
double& volt,
const int sw,
const bool opt);
358 void WfieldWireC2Y(
const double xpos,
const double ypos,
double& ex,
359 double& ey,
double& volt,
const int sw,
const bool opt);
360 void WfieldWireC30(
const double xpos,
const double ypos,
double& ex,
361 double& ey,
double& volt,
const int sw,
const bool opt);
362 void WfieldWireD10(
const double xpos,
const double ypos,
double& ex,
363 double& ey,
double& volt,
const int sw,
const bool opt);
364 void WfieldWireD30(
const double xpos,
const double ypos,
double& ex,
365 double& ey,
double& volt,
const int sw,
const bool opt);
366 void WfieldPlaneA00(
const double xpos,
const double ypos,
double& ex,
367 double& ey,
double& volt,
const int mx,
const int my,
368 const int iplane,
const bool opt);
369 void WfieldPlaneB2X(
const double xpos,
const double ypos,
double& ex,
370 double& ey,
double& volt,
const int my,
const int iplane,
372 void WfieldPlaneB2Y(
const double xpos,
const double ypos,
double& ex,
373 double& ey,
double& volt,
const int mx,
const int iplane,
375 void WfieldPlaneC2X(
const double xpos,
const double ypos,
double& ex,
376 double& ey,
double& volt,
const int iplane,
378 void WfieldPlaneC2Y(
const double xpos,
const double ypos,
double& ex,
379 double& ey,
double& volt,
const int iplane,
381 void WfieldPlaneC30(
const double xpos,
const double ypos,
double& ex,
382 double& ey,
double& volt,
const int iplane,
384 void WfieldPlaneD10(
const double xpos,
const double ypos,
double& ex,
385 double& ey,
double& volt,
const int iplane,
387 void WfieldPlaneD30(
const double xpos,
const double ypos,
double& ex,
388 double& ey,
double& volt,
const int iplane,
390 void WfieldStripZ(
const double xpos,
const double ypos,
double& ex,
391 double& ey,
double& volt,
const int ip,
const int is,
393 void WfieldStripXy(
const double xpos,
const double ypos,
const double zpos,
394 double& ex,
double& ey,
double& ez,
double& volt,
395 const int ip,
const int is,
const bool opt);
398 double Ph2(
const double xpos,
const double ypos);
399 double Ph2Lim(
const double radius) {
400 return -log(abs(zmult) * radius * (1. - 3. * p1 + 5. * p2));
402 void E2Sum(
const double xpos,
const double ypos,
double& ex,
double& ey);
405 void ConformalMap(std::complex<double> z, std::complex<double>& ww,
406 std::complex<double>& wd);
407 void InitializeCoefficientTables();
409 bool InTube(
const double x0,
const double y0,
const double a,
const int n);
412 void Cartesian2Polar(
const double x0,
const double y0,
double& r,
415 if (x0 == 0. && y0 == 0.) {
419 r =
sqrt(x0 * x0 + y0 * y0);
420 theta = 180. * atan2(y0, x0) / Pi;
423 void Polar2Cartesian(
const double r,
const double theta,
double& x0,
426 x0 = r *
cos(Pi * theta / 180.);
427 y0 = r *
sin(Pi * theta / 180.);
432 void RTheta2RhoPhi(
const double rho,
const double phi,
double& r,
DoubleAc cos(const DoubleAc &f)
DoubleAc sqrt(const DoubleAc &f)
DoubleAc sin(const DoubleAc &f)
DoubleAc exp(const DoubleAc &f)
bool GetVoltageRange(double &pmin, double &pmax)
void AddPlaneX(const double x, const double voltage, const std::string label)
void AddWire(const double x, const double y, const double diameter, const double voltage, const std::string label, const double length=100., const double tension=50., const double rho=19.3, const int ntrap=5)
void SetPeriodicityX(const double s)
bool IsInTrapRadius(double x0, double y0, double z0, double &xw, double &yx, double &rw)
bool GetPeriodicityY(double &s)
void AddCharge(const double x, const double y, const double z, const double q)
void AddReadout(const std::string label)
std::string GetCellType()
void AddStripOnPlaneX(const char direction, const double x, const double smin, const double smax, const std::string label, const double gap=-1.)
void AddTube(const double radius, const double voltage, const int nEdges, const std::string label)
bool IsWireCrossed(double x0, double y0, double z0, double x1, double y1, double z1, double &xc, double &yc, double &zc)
bool GetPlaneX(const int i, double &x, double &voltage, std::string &label)
bool GetPeriodicityX(double &s)
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string label)
void AddStripOnPlaneY(const char direction, const double y, const double smin, const double smax, const std::string label, const double gap=-1.)
bool GetBoundingBox(double &x0, double &y0, double &z0, double &x1, double &y1, double &z1)
void AddPlaneY(const double y, const double voltage, const std::string label)
double WeightingPotential(const double x, const double y, const double z, const std::string label)
bool GetWire(const int i, double &x, double &y, double &diameter, double &voltage, std::string &label, double &length, double &charge, int &ntrap)
~ComponentAnalyticField()
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)
void DisableChargeCheck()
void SetPeriodicityY(const double s)
bool GetPlaneY(const int i, double &y, double &voltage, std::string &label)
bool GetTube(double &r, double &voltage, int &nEdges, std::string &label)