#include "PndSdsTotChargeConversion.h" #include "TMath.h" ///Default constructor PndSdsTotChargeConversion::PndSdsTotChargeConversion(Int_t VerboseLevel) : PndSdsChargeConversion(kToT){ SetParameter("ftr", 100.); SetParameter("fa", 60.); SetParameter("fth", 3000.); SetParameter("fclk", 50.); ftimestep = 1. / GetParameter("fclk") * 1000.; fVerboseLevel = VerboseLevel; StartExecute(); Warning("constructor","default constructor used"); if (fVerboseLevel>0){ std::cout<<"Tot parameter "<0){ std::cout<<"Tot parameter "< now set to 60 e/ns"); SetParameter("fa",60.); } Q = charge; Qt = GetParameter("fth"); //Error handling: if there is a parameter leading to a division by zero Q=Qt=1 is set to prevent this if (Qt < 0){ Error("ConvertChargeToDigiValue(Double_t charge)","threshold is less than zero -> now set to 0 eV"); Qt = 0.; } if ((Q <= Qt) or (Q <= 0)){ Warning("ConvertChargeToDigiValue(Double_t charge)","charge is equal or less than threshold -> zero TOT"); Q = 1.; Qt = 1.; } t1e = (GetParameter("ftr")*Qt/Q+ftimeoffset); //exact time when signal is over threshold t2e = (Q-Qt)/GetParameter("fa")+ftimeoffset+GetParameter("ftr"); //exact time when signal is again below threshold //return (t2e-t1e); //turn off clock return GetTotWC(); } Double_t PndSdsTotChargeConversion::GetRelativeError(Double_t Charge) { // formula from D.Pohl/FZJ his sources? // dQ_rec a / (Q_t - a*t_c)/2 + (Q - Q_t)(t_c/Q - 1/a)*a/2 \. // ------ = - * dt_max * | 1 + ---------------------------------------------------------------------- | // Q_rec 2 \ sqrt{ [ (Q_t - a*t_c)/2 + (Q - Q_t)(t_c/Q - 1/a)*a/2 ]^2 + a*Q_t*t_c } / // // a 1 / 2Qt - Qt*Qc/Q - Q \. // = - * ----- * | 1 + --------------------------------------- | // 2 f_clk \ sqrt{ [2Qt - Qt*Qc/Q - Q]^2 + 4*Qc*Qt } / // Q = Charge; Qt = GetParameter("fth"); // threshold Double_t a = GetParameter("fa"); // const current Double_t tc = GetParameter("ftr");// time to load capacitor fully Double_t Qc = a*tc; // storable capacitor charge Double_t temp = 2.*Qt - Qt*Qc/Q - Q; temp = temp/(sqrt(temp*temp + 4*Qc*Qt)); temp = 0.5*a*(1+temp)/GetParameter("fclk"); return temp; } Int_t PndSdsTotChargeConversion::GetTimeStamp(Double_t time) { Int_t temp = (Int_t)(time / ftimestep); // [clockcycles] time = temp*ftimestep + ftimestep; //[ns] to the following clock tick return (Int_t)TMath::Ceil(time); // [ns] with 1 ns number precision, casting cuts trailing digits, like floor() } Double_t PndSdsTotChargeConversion::GetTotWC(){ //calculates start time, stop time with a clock fstarttime = (Int_t) ( t1e / ftimestep ) * ftimestep + ftimestep; //quantization of the start signal fstoptime = (Int_t) ( t2e / ftimestep ) * ftimestep + ftimestep; //quantization of the stop signal /* std::cout<<" start point exact: "<