Functions
coldelecResponse.h File Reference
#include "TF1.h"
#include <string>

Go to the source code of this file.

Functions

double coldelecResponse (double time, double gain, double shaping)
 
double coldelecResponseFunction (double *x, double *pars)
 
TF1 * coldelecResponseTF1 (double gainIn, double shapingIn, double t0, std::string fname="ceresp")
 

Function Documentation

double coldelecResponse ( double  time,
double  gain,
double  shaping 
)
inline

Definition at line 30 of file coldelecResponse.h.

30  {
31  if (time <=0 || time >= 10*shaping) { // range of validity
32  return 0.0;
33  }
34 
35  const double reltime = time/shaping;
36 
37  // a scaling is needed to make the anti-Lapalace peak match the expected gain
38  // fixme: this scaling is slightly dependent on shaping time. See response.py
39  gain *= 10*1.012;
40 
41  return 4.31054*exp(-2.94809*reltime)*gain
42  -2.6202*exp(-2.82833*reltime)*cos(1.19361*reltime)*gain
43  -2.6202*exp(-2.82833*reltime)*cos(1.19361*reltime)*cos(2.38722*reltime)*gain
44  +0.464924*exp(-2.40318*reltime)*cos(2.5928*reltime)*gain
45  +0.464924*exp(-2.40318*reltime)*cos(2.5928*reltime)*cos(5.18561*reltime)*gain
46  +0.762456*exp(-2.82833*reltime)*sin(1.19361*reltime)*gain
47  -0.762456*exp(-2.82833*reltime)*cos(2.38722*reltime)*sin(1.19361*reltime)*gain
48  +0.762456*exp(-2.82833*reltime)*cos(1.19361*reltime)*sin(2.38722*reltime)*gain
49  -2.620200*exp(-2.82833*reltime)*sin(1.19361*reltime)*sin(2.38722*reltime)*gain
50  -0.327684*exp(-2.40318*reltime)*sin(2.5928*reltime)*gain +
51  +0.327684*exp(-2.40318*reltime)*cos(5.18561*reltime)*sin(2.5928*reltime)*gain
52  -0.327684*exp(-2.40318*reltime)*cos(2.5928*reltime)*sin(5.18561*reltime)*gain
53  +0.464924*exp(-2.40318*reltime)*sin(2.5928*reltime)*sin(5.18561*reltime)*gain;
54 }
double coldelecResponseFunction ( double *  x,
double *  pars 
)
inline

Definition at line 57 of file coldelecResponse.h.

57  {
58  double gain = pars[0];
59  double time = x[0];
60  double shaping = pars[1];
61  double offset = pars[2];
62  return coldelecResponse(time-offset, gain, shaping);
63 }
double coldelecResponse(double time, double gain, double shaping)
list x
Definition: train.py:276
TF1* coldelecResponseTF1 ( double  gainIn,
double  shapingIn,
double  t0,
std::string  fname = "ceresp" 
)
inline

Definition at line 66 of file coldelecResponse.h.

66  {
67  double gain = gainIn != 0.0 ? gainIn : 10.0;
68  double shaping = shapingIn > 0 ? shapingIn : 1.0;
69  bool havePars = gainIn > 0 && shaping > 0.0;
70  //TF1* pf = new TF1(fname.c_str(), coldelecResponseFunction, t0, t0+10.0, 3, 1, false);
71  TF1* pf = new TF1(fname.c_str(), coldelecResponseFunction, t0, t0+10.0*shaping, 3);
72  pf->SetParName(0, "Height");
73  pf->SetParName(1, "Shaping");
74  pf->SetParName(2, "T0");
75  pf->SetParameter(0, gain);
76  pf->SetParameter(1, shaping);
77  pf->SetParameter(2, t0);
78  double limfac = havePars ? 2.0 : 10.0;
79  if ( gain > 0.0 ) {
80  pf->SetParLimits(0, gain/limfac, limfac*gain);
81  } else {
82  pf->SetParLimits(0, limfac*gain, gain/limfac);
83  }
84  pf->SetParLimits(1, shaping/limfac, limfac*shaping);
85  return pf;
86 }
double coldelecResponseFunction(double *x, double *pars)