26 double cePulserVoltage(
int iaIn,
const double rfLines[6],
double r6,
double vfpga) {
28 if ( r6 < 0.0 )
return 0.0;
29 if ( iaIn < 0 )
return 0.0;
30 if ( iaIn > 63 )
return 0.0;
33 double con2 = r6 > 0.0 ? 1.0/r6 : 0.0;
34 for (
Index ilin=0; ilin<6; ++ilin ) {
35 double rfLine = rfLines[ilin];
36 if ( rfLine <= 0.0 )
continue;
37 double conLine = 1.0/rfLine;
39 if ( (ia >> ilin) & 0
x1) con2 += conLine;
45 double rtot = 1.0/con1 + 1.0/con2;
61 double cePulser(
int ia,
const double rfLines[6],
double r6,
double qvscale) {
62 if ( ia == 0 )
return 0.0;
63 if ( ia > 63 )
return 0.0;
64 if ( ia < 0 )
return cePulser(-ia, rfLines, r6, qvscale);
77 double qvscale = pars[7];
88 double qvscale = pars[7];
89 return cePulser(ia, pars, r6, qvscale);
100 pf->SetParName(0,
"R0");
101 pf->SetParName(1,
"R1");
102 pf->SetParName(2,
"R2");
103 pf->SetParName(3,
"R3");
104 pf->SetParName(4,
"R4");
105 pf->SetParName(5,
"R5");
106 pf->SetParName(6,
"R6");
107 pf->SetParName(7,
"Vfpga");
108 pf->SetParameter(0, 32.40);
109 pf->SetParameter(1, 16.02);
110 pf->SetParameter(2, 8.06);
111 pf->SetParameter(3, 4.02);
112 pf->SetParameter(4, 2.00);
113 pf->SetParameter(5, 1.00);
114 pf->SetParameter(6, 1.00);
115 pf->SetParameter(7, 1.8);
116 if (
tol > 0.0 &&
tol < 1.0 ) {
117 double fmin = 1 -
tol;
118 double fmax = 1 +
tol;
119 for (
Index ipar=0; ipar<npar; ++ipar ) {
120 double val = pf->GetParameter(ipar);
121 pf->SetParLimits(ipar, fmin*val, fmax*val);
140 const Index npar = 8;
141 if ( pf->GetNpar() <
int(npar) ) {
142 cout << myname <<
"Function has fewer than " << npar <<
" parameters." <<
endl;
145 if ( pf->GetNpar() <
int(ipoff + npar) ) {
146 cout << myname <<
"Function has fewer than " << npar <<
" parameters after offset " 147 << ipoff <<
"." <<
endl;
150 pf->SetParName(ipoff + 0,
"R0");
151 pf->SetParName(ipoff + 1,
"R1");
152 pf->SetParName(ipoff + 2,
"R2");
153 pf->SetParName(ipoff + 3,
"R3");
154 pf->SetParName(ipoff + 4,
"R4");
155 pf->SetParName(ipoff + 5,
"R5");
156 pf->SetParName(ipoff + 6,
"R6");
157 pf->SetParName(ipoff + 7,
"QVscale");
158 pf->SetParameter(ipoff + 0, 32.40);
159 pf->SetParameter(ipoff + 1, 16.02);
160 pf->SetParameter(ipoff + 2, 8.06);
161 pf->SetParameter(ipoff + 3, 4.02);
162 pf->SetParameter(ipoff + 4, 2.00);
163 pf->SetParameter(ipoff + 5, 1.00);
164 pf->SetParameter(ipoff + 6, 1.00);
165 pf->SetParameter(ipoff + 7, 1.8*183.0);
166 if (
tol > 0.0 &&
tol < 1.0 ) {
167 double fmin = 1 -
tol;
168 double fmax = 1 +
tol;
169 for (
Index ipar=ipoff; ipar<ipoff+npar; ++ipar ) {
170 double val = pf->GetParameter(ipar);
171 pf->SetParLimits(ipar, fmin*val, fmax*val);
183 const Index npar = 8;
int initCePulserTF1(TF1 *pf, unsigned int ipoff, double tol=0.01)
TF1 * cePulserVoltageTF1(std::string fname="cepulserVoltage", double tol=0.01)
double cePulser(int ia, const double rfLines[6], double r6, double qvscale)
double cePulserVoltage(int iaIn, const double rfLines[6], double r6, double vfpga)
TF1 * cePulserTF1(std::string fname="cepulser", double tol=0.01)
QTextStream & endl(QTextStream &s)