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

Go to the source code of this file.

Functions

double offsetLineShifted (double *px, double *ppar)
 
double offsetLineFull (double *px, double *ppar)
 
double offsetLine (double *px, double *ppar)
 
double offsetLinePed (double *px, double *ppar)
 
TF1 * offsetLineTF1 (double off=0.0, double slope=1.0, double xmin=-10.0, double xmax=10.0, std::string fname="offsetLine")
 
TF1 * offsetLinePedTF1 (double off=0.0, double slope=1.0, double ped=0.0, double xmin=-10.0, double xmax=10.0, std::string fname="offsetLinePed")
 
TF1 * offsetLineFullTF1 (double off=0.0, double slope=1.0, double ped=0.0, double sneg=1.0, double xmin=-10.0, double xmax=10.0, std::string fname="offsetLinePed")
 
TF1 * offsetLineShiftedTF1 (double off=0.0, double slope=1.0, double ped=0.0, double sneg=1.0, double shif=0.0, double xmin=-10.0, double xmax=10.0, std::string fname="offsetLineShifted")
 

Function Documentation

double offsetLine ( double *  px,
double *  ppar 
)
inline

Definition at line 69 of file offsetLine.h.

69  {
70  double xoff = ppar[0];
71  double gain = ppar[1];
72  double x = px[0];
73  if ( xoff > 0.0 ) {
74  if ( x > xoff ) return gain*(x-xoff);
75  if ( x < -xoff ) return gain*(x+xoff);
76  } else {
77  double y0 = -gain*xoff;
78  if ( x > 0.0 ) return y0 + gain*x;
79  else if ( x < 0.0 ) return -y0 + gain*x;
80  }
81  return 0.0;
82 }
list x
Definition: train.py:276
double offsetLineFull ( double *  px,
double *  ppar 
)
inline

Definition at line 49 of file offsetLine.h.

49  {
50  double xoff = ppar[0];
51  double scal = ppar[1];
52  double yped = ppar[2];
53  double sneg = ppar[3];
54  double x = px[0];
55  double gain = scal;
56  if ( x < 0.0 ) gain *= sneg;
57  if ( xoff > 0.0 ) {
58  if ( x > xoff ) return yped + gain*(x-xoff);
59  if ( x < -xoff ) return yped + gain*(x+xoff);
60  } else {
61  double y0 = -gain*xoff;
62  if ( x > 0.0 ) return yped + y0 + gain*x;
63  else if ( x < 0.0 ) return yped - y0 + gain*x;
64  }
65  return yped;
66 }
list x
Definition: train.py:276
TF1* offsetLineFullTF1 ( double  off = 0.0,
double  slope = 1.0,
double  ped = 0.0,
double  sneg = 1.0,
double  xmin = -10.0,
double  xmax = 10.0,
std::string  fname = "offsetLinePed" 
)
inline

Definition at line 117 of file offsetLine.h.

120  {
121  TF1* pf = new TF1(fname.c_str(), offsetLineFull, xmin, xmax, 4);
122  pf->SetParName(0, "Offset");
123  pf->SetParName(1, "Slope");
124  pf->SetParName(2, "Pedestal");
125  pf->SetParName(3, "NegScale");
126  pf->SetParameter(0, off);
127  pf->SetParameter(1, slope);
128  pf->SetParameter(2, ped);
129  pf->SetParameter(3, sneg);
130  return pf;
131 }
double offsetLineFull(double *px, double *ppar)
Definition: offsetLine.h:49
double offsetLinePed ( double *  px,
double *  ppar 
)
inline

Definition at line 85 of file offsetLine.h.

85  {
86  double yped = ppar[2];
87  return yped + offsetLine(px, ppar);
88 }
double offsetLine(double *px, double *ppar)
Definition: offsetLine.h:69
TF1* offsetLinePedTF1 ( double  off = 0.0,
double  slope = 1.0,
double  ped = 0.0,
double  xmin = -10.0,
double  xmax = 10.0,
std::string  fname = "offsetLinePed" 
)
inline

Definition at line 103 of file offsetLine.h.

105  {
106  TF1* pf = new TF1(fname.c_str(), offsetLinePed, xmin, xmax, 3);
107  pf->SetParName(0, "Offset");
108  pf->SetParName(1, "Slope");
109  pf->SetParName(2, "Pedestal");
110  pf->SetParameter(0, off);
111  pf->SetParameter(1, slope);
112  pf->SetParameter(2, ped);
113  return pf;
114 }
double offsetLinePed(double *px, double *ppar)
Definition: offsetLine.h:85
double offsetLineShifted ( double *  px,
double *  ppar 
)
inline

Definition at line 26 of file offsetLine.h.

26  {
27  double xoff = ppar[0];
28  double scal = ppar[1];
29  double yped = ppar[2];
30  double sneg = ppar[3];
31  double shif = ppar[4];
32  double x = px[0];
33  double gain = scal;
34  if ( x > 0.0 ) yped += shif;
35  if ( x < 0.0 ) yped -= shif;
36  if ( x < 0.0 ) gain *= sneg;
37  if ( xoff > 0.0 ) {
38  if ( x > xoff ) return yped + gain*(x-xoff);
39  if ( x < -xoff ) return yped + gain*(x+xoff);
40  } else {
41  double y0 = -gain*xoff;
42  if ( x > 0.0 ) return yped + y0 + gain*x;
43  else if ( x < 0.0 ) return yped - y0 + gain*x;
44  }
45  return yped;
46 }
list x
Definition: train.py:276
TF1* offsetLineShiftedTF1 ( double  off = 0.0,
double  slope = 1.0,
double  ped = 0.0,
double  sneg = 1.0,
double  shif = 0.0,
double  xmin = -10.0,
double  xmax = 10.0,
std::string  fname = "offsetLineShifted" 
)
inline

Definition at line 134 of file offsetLine.h.

137  {
138  TF1* pf = new TF1(fname.c_str(), offsetLineShifted, xmin, xmax, 5);
139  pf->SetParName(0, "Offset");
140  pf->SetParName(1, "Slope");
141  pf->SetParName(2, "Pedestal");
142  pf->SetParName(3, "NegScale");
143  pf->SetParName(4, "Shift");
144  pf->SetParameter(0, off);
145  pf->SetParameter(1, slope);
146  pf->SetParameter(2, ped);
147  pf->SetParameter(3, sneg);
148  pf->SetParameter(4, shif);
149  return pf;
150 }
double offsetLineShifted(double *px, double *ppar)
Definition: offsetLine.h:26
TF1* offsetLineTF1 ( double  off = 0.0,
double  slope = 1.0,
double  xmin = -10.0,
double  xmax = 10.0,
std::string  fname = "offsetLine" 
)
inline

Definition at line 91 of file offsetLine.h.

93  {
94  TF1* pf = new TF1(fname.c_str(), offsetLine, xmin, xmax, 2);
95  pf->SetParName(0, "Offset");
96  pf->SetParName(1, "Slope");
97  pf->SetParameter(0, off);
98  pf->SetParameter(1, slope);
99  return pf;
100 }
double offsetLine(double *px, double *ppar)
Definition: offsetLine.h:69