CMS 3D CMS Logo

Functions
myFunctions.cc File Reference

Go to the source code of this file.

Functions

double crystalball (double *x, double *par)
 
double ene1x1_xtal (double mymatrix[], int xtal)
 
double ene3x3_xtal (double mymatrix[], int xtal)
 
double ene5x5_xtal (double mymatrix[], int xtal)
 
double ene7x7_xtal (double mymatrix[])
 
void energy_ieta (double mymatrix[], double *energyieta)
 
void energy_iphi (double mymatrix[], double *energyiphi)
 
int maxAmplitInMatrix (double myMatrix[])
 
double shapeFunction (double *x, double *par)
 

Function Documentation

◆ crystalball()

double crystalball ( double *  x,
double *  par 
)

Definition at line 98 of file myFunctions.cc.

References JetChargeProducer_cfi::exp, HLT_2022v15_cff::exponent, funct::pow(), and x.

Referenced by DiMuonMassBiasClient::fitLineShape().

98  {
99  // par[0]: mean
100  // par[1]: sigma
101  // par[2]: alpha, crossover point
102  // par[3]: n, length of tail
103  // par[4]: N, normalization
104 
105  double cb = 0.0;
106  double exponent = 0.0;
107  double bla = 0.0;
108 
109  if (x[0] > par[0] - par[2]*par[1]) {
110  exponent = (x[0] - par[0])/par[1];
111  cb = exp(-exponent*exponent/2.);
112  } else {
113  double nenner = pow(par[3]/par[2], par[3])*exp(-par[2]*par[2]/2.);
114  double zaehler = (par[0] - x[0])/par[1] + par[3]/par[2] - par[2];
115  zaehler = pow(zaehler, par[3]);
116  cb = nenner/zaehler;
117  }
118 
119  if (par[4] > 0.) {
120  cb *= par[4];
121  }
122  return cb;
123 }
float x
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ ene1x1_xtal()

double ene1x1_xtal ( double  mymatrix[],
int  xtal 
)

Definition at line 21 of file myFunctions.cc.

22 {
23  double E1x1 = 0.;
24  if (mymatrix[xtal]<-50) { E1x1 = -1000.; }
25  else { E1x1 = mymatrix[xtal]; }
26  return E1x1;
27 }

◆ ene3x3_xtal()

double ene3x3_xtal ( double  mymatrix[],
int  xtal 
)

Definition at line 30 of file myFunctions.cc.

31 {
32  double E3x3 = 0.;
33 
34  if ( (mymatrix[xtal-8]<-50) || (mymatrix[xtal-7]<-50) || (mymatrix[xtal-6]<-50) || (mymatrix[xtal-1]<-50) || (mymatrix[xtal]<-50) || (mymatrix[xtal+1]<-50) || (mymatrix[xtal+6]<-50) || (mymatrix[xtal+7]<-50) || (mymatrix[xtal+8]<-50) )
35  { E3x3 = -1000.; }
36  else
37  { E3x3 = mymatrix[xtal-8] + mymatrix[xtal-7] + mymatrix[xtal-6] + mymatrix[xtal-1] + mymatrix[xtal] + mymatrix[xtal+1] + mymatrix[xtal+6] + mymatrix[xtal+7] + mymatrix[xtal+8]; }
38 
39  return E3x3;
40 }

◆ ene5x5_xtal()

double ene5x5_xtal ( double  mymatrix[],
int  xtal 
)

Definition at line 43 of file myFunctions.cc.

44 {
45  double E5x5 = 0.;
46 
47  if( (mymatrix[xtal-16]<-50) || (mymatrix[xtal-15]<-50) || (mymatrix[xtal-14]<-50) || (mymatrix[xtal-13]<-50) || (mymatrix[xtal-12]<-50) || (mymatrix[xtal-9]<-50) || (mymatrix[xtal-8]<-50) || (mymatrix[xtal-7]<-50) || (mymatrix[xtal-6]<-50) || (mymatrix[xtal-5]<-50) || (mymatrix[xtal-2]<-50) || (mymatrix[xtal-1]<-50) || (mymatrix[xtal]<-50) || (mymatrix[xtal+1]<-50) || (mymatrix[xtal+2]<-50) || (mymatrix[xtal+5]<-50) || (mymatrix[xtal+6]<-50) || (mymatrix[xtal+7]<-50) || (mymatrix[xtal+8]<-50) || (mymatrix[xtal+9]<-50) || (mymatrix[xtal+12]<-50) || (mymatrix[xtal+13]<-50) || (mymatrix[xtal+14]<-50) || (mymatrix[xtal+15]<-50) || (mymatrix[xtal+16]<-50) )
48  { E5x5 = -1000.; }
49  else
50  { E5x5 = mymatrix[xtal-16] + mymatrix[xtal-15] + mymatrix[xtal-14] + mymatrix[xtal-13] + mymatrix[xtal-12] + mymatrix[xtal-9] + mymatrix[xtal-8] + mymatrix[xtal-7] + mymatrix[xtal-6] + mymatrix[xtal-5] + mymatrix[xtal-2] + mymatrix[xtal-1] + mymatrix[xtal] + mymatrix[xtal+1] + mymatrix[xtal+2] + mymatrix[xtal+5] + mymatrix[xtal+6] + mymatrix[xtal+7] + mymatrix[xtal+8] + mymatrix[xtal+9] + mymatrix[xtal+12] + mymatrix[xtal+13] + mymatrix[xtal+14] + mymatrix[xtal+15] + mymatrix[xtal+16]; }
51 
52  return E5x5;
53 }

◆ ene7x7_xtal()

double ene7x7_xtal ( double  mymatrix[])

Definition at line 77 of file myFunctions.cc.

References cuy::ii.

78 {
79  double E7x7 = 0.;
80 
81  for (int ii=0;ii<49;ii++)
82  {
83  if (mymatrix[ii]<-50)
84  E7x7 = -1000.;
85  else
86  E7x7 += mymatrix[ii];
87  }
88 
89  return E7x7;
90 }
ii
Definition: cuy.py:589

◆ energy_ieta()

void energy_ieta ( double  mymatrix[],
double *  energyieta 
)

Definition at line 56 of file myFunctions.cc.

References cuy::ii, and findQualityFiles::jj.

57 {
58  for(int jj = 0 ; jj < 5 ; jj++) energyieta[jj] = 0.0;
59 
60  for(int jj = 0 ; jj < 5 ; jj++){
61  for (int ii = 0; ii < 5 ; ii++) energyieta[jj] += mymatrix[(8+jj)+7*ii];
62  }
63 }
ii
Definition: cuy.py:589

◆ energy_iphi()

void energy_iphi ( double  mymatrix[],
double *  energyiphi 
)

Definition at line 66 of file myFunctions.cc.

References cuy::ii, and findQualityFiles::jj.

67 {
68  for(int jj = 0 ; jj < 5 ; jj++) energyiphi[jj] = 0.0;
69 
70  for(int jj = 0 ; jj < 5 ; jj++){
71  for (int ii = 0; ii < 5 ; ii++) energyiphi[jj] += mymatrix[(8+7*jj)+ii];
72  }
73 }
ii
Definition: cuy.py:589

◆ maxAmplitInMatrix()

int maxAmplitInMatrix ( double  myMatrix[])

Definition at line 6 of file myFunctions.cc.

7 {
8  int maxXtal = 999;
9  double maxADC = -999.;
10 
11  for (int icry=0; icry<49; icry++) {
12  if (myMatrix[icry] > maxADC){
13  maxADC = myMatrix[icry];
14  maxXtal = icry;
15  }}
16 
17  return maxXtal;
18 }

◆ shapeFunction()

double shapeFunction ( double *  x,
double *  par 
)

Definition at line 125 of file myFunctions.cc.

References x.

125  {
126 
127  // par[0] = constant value
128  // par[1], par[2], par[3]: a3, a2 x>0 pol3
129  // par[4], par[5], par[6]: a3, a2 x<=0 pol3
130 
131  double ret_val;
132  if(x[0]>0.)
133  ret_val = par[0] + par[1]*x[0]*x[0] + par[2]*x[0]*x[0]*x[0] + par[3]*x[0]*x[0]*x[0]*x[0];
134  else
135  ret_val = par[0] + par[4]*x[0]*x[0] + par[5]*x[0]*x[0]*x[0] + par[6]*x[0]*x[0]*x[0]*x[0];
136 
137  return ret_val;
138 }
float x