"10.05.2011 by Jan Kaplon (jan.kaplon@cern.ch)"



Clear[zin, cf, kv, taup0,tauf,uin,tfe,cb,cis,respsim,cros1,crosstalk,itrs,ilost,ChargeRead,ChargeLost];

"FE input impedance in s domain for charge preamplifier";
zin=((1+s taup0)/(kv s cf));


"voltage at preamplifier input in s domain for delta dirac current input";

uin=(zin/(1+s (cb+2 cis) zin));"simplified, assuming zero input impedance for neighboring channels";

FullSimplify[uin];

"CR-RC2 transfer function for front end";

tfe=(tauf/(((1+s tauf))^3)) ;

"FE response simplified";
respsim= InverseLaplaceTransform[ tfe,s,t,tauf>0&&taup0>tauf];

"FE crosstalk (first neighbor)";
cros1=tfe uin (1/((1/(s cis))+zin));
FullSimplify[cros1,tauf>taui&&taup0>tauf&&taui>0];
crosstalk= InverseLaplaceTransform[cros1,s,t];

"FE response including detector backplane";
respfs=tfe uin (1/zin);
FullSimplify[respfs,tauf>taui&&taup0>tauf&&taui>0];
respfull= InverseLaplaceTransform[respfs,s,t];

"Current transfer to amplifier input";
itrs=uin (1/zin);
FullSimplify[itrs,tauf>taui&&taup0>tauf&&taui>0];
itrsresp=InverseLaplaceTransform[itrs,s,t];


"Charge transfered to amplifier input";
ChargeRead=(∫_0^∞)itrsresp\[DifferentialD]t;


cf=125 (10^(-15));"preamplifier feedback capacitor";
tauf=10 (10^(-9)); "tau constant of the CR-RC2 shaper; 10ns for CR-RC2 and 20ns peaking time";
cb=4 (10^(-12));"backplane capacitance of the detector";
cis=7 (10^(-12));"interstrip capacitance of the detector";
taup0=200 (10^(-9));"first, dominant pole of the preamplifier stage";
kv=14000;"open loop gain of the preamplifier";


"Response in readout channel"
FullSimplify[respfull]
"Cross talk" 
FullSimplify[crosstalk]
"Response for channel not loaded with the detector (reference)"
Plot[respsim,{t,0,160 (10^(-9))},Frame->True, GridLines->Automatic]
FindMaximum[respsim,{t,10 (10^(-9)),30 (10^(-9))}]
"Response for channel loaded with the detector"
Plot[respfull,{t,1 (10^(-9)),160 (10^(-9))},Frame->True, GridLines->Automatic]
FindMaximum[respfull,{t,10 (10^(-9)),30 (10^(-9))}]
"Cross talk"
Plot[crosstalk,{t,1 (10^(-9)),160 (10^(-9))}, PlotRange->{-0.01,0.02},Frame->True, GridLines->Automatic]
FindMaximum[crosstalk,{t,1 (10^(-9)),30 (10^(-9))}]
"current to the front end input"
Plot[itrsresp,{t,1 (10^(-9)) ,160 (10^(-9 ))},PlotRange->{-4 (10^7),4 (10^8)},Frame->True, GridLines->Automatic]
"Charge transfered to amplifier input"
ChargeRead