static const double cm=1;
static const double volt=1;
static const double e=1.6e-19*
C;
static const double epsilonGe=15.8;
double V(double *coordinates, double *parameters)
{
double x = coordinates[0];
double x0= parameters[0];
double x1= parameters[1];
double v0= parameters[2];
double v1= parameters[3];
double rho=parameters[4];
double c2= (v1-v0)/(x1-x0) - a/2*(x1+x0);
double c1= (v0*x1-v1*x0)/(x1-x0) + a/2*x0*x1;
return a*x*x/2 + c2*x + c1;
}
double E(double *coordinates, double *parameters)
{
double x = coordinates[0];
double x0= parameters[0];
double x1= parameters[1];
double v0= parameters[2];
double v1= parameters[3];
double rho=parameters[4];
double c2= (v1-v0)/(x1-x0) - a/2*(x1+x0);
return -a*x - c2;
}
const int n=5;
double rho[n]={-3.5e10*e/
cm3, -1.5e10*e/
cm3, 0, 1.5e10*e/
cm3, 3.5e10*e/
cm3};
void drawV()
{
TLegend *l = new TLegend(0.15,0.60,0.40,0.95);
l->SetHeader("Impurity [cm^{-3}]");
TF1 *fV[n]={0};
double x0[n]={0}, x1[n], v0[n]={0}, v1[n];
for (int i=0; i<n; i++) {
fV[i] = new TF1(Form("fV%d",i), V, x0[i], x1[i], 5);
fV[i]->SetParameters(x0[i],x1[i],v0[i],v1[i],rho[i]);
fV[i]->SetLineStyle(i+2);
fV[i]->SetLineColor(i+2);
if (i+2==4) fV[i]->SetLineStyle(1);
if (i+2==4) fV[i]->SetLineColor(kBlack);
if (i+2==5) fV[i]->SetLineColor(kBlue);
if (i==0) fV[i]->Draw(); else fV[i]->Draw("same");
l->AddEntry(fV[i],Form(
"%8.1e",-rho[i]/e*
cm3),
"l");
}
fV[0]->SetTitle(";Vertical position in planar detector [cm];Voltage [V]");
l->Draw();
gPad->Print("Vx.png");
}
void drawE()
{
TCanvas *c = new TCanvas;
TLegend *l = new TLegend(0.45,0.65,0.67,0.98);
l->SetHeader("Impurity [cm^{-3}]");
TF1 *fE[n]={0};
double x0[n]={0}, x1[n], v0[n]={0}, v1[n];
for (int i=0; i<n; i++) {
fE[i] = new TF1(Form("fE%d",i), E, x0[i], x1[i], 5);
fE[i]->SetParameters(x0[i],x1[i],v0[i],v1[i],rho[i]);
fE[i]->SetLineStyle(i+2);
fE[i]->SetLineColor(i+2);
if (i+2==4) fE[i]->SetLineStyle(1);
if (i+2==4) fE[i]->SetLineColor(kBlack);
if (i+2==5) fE[i]->SetLineColor(kBlue);
if (i==0) fE[i]->Draw(); else fE[i]->Draw("same");
l->AddEntry(fE[i],Form(
"%8.1e",-rho[i]/e*
cm3),
"l");
}
fE[0]->SetTitle(";Vertical position in planar detector [cm];Electric field [V/cm]");
l->Draw();
c->Print("Ex.png");
}
void planar()
{
gROOT->SetStyle("GeFiCa");
gStyle->SetTitleOffset(1.2,"Y");
gStyle->SetPadRightMargin(0.01);
gStyle->SetPadLeftMargin(0.12);
gStyle->SetPadTopMargin(0.01);
gStyle->SetPadBottomMargin(0.11);
drawV();
drawE();
}