Go to the documentation of this file.00001
00002
00003
00004
00005
00006 int maxAmplitInMatrix(double myMatrix[])
00007 {
00008 int maxXtal = 999;
00009 double maxADC = -999.;
00010
00011 for (int icry=0; icry<49; icry++) {
00012 if (myMatrix[icry] > maxADC){
00013 maxADC = myMatrix[icry];
00014 maxXtal = icry;
00015 }}
00016
00017 return maxXtal;
00018 }
00019
00020
00021 double ene1x1_xtal(double mymatrix[], int xtal)
00022 {
00023 double E1x1 = 0.;
00024 if (mymatrix[xtal]<-50) { E1x1 = -1000.; }
00025 else { E1x1 = mymatrix[xtal]; }
00026 return E1x1;
00027 }
00028
00029
00030 double ene3x3_xtal(double mymatrix[], int xtal)
00031 {
00032 double E3x3 = 0.;
00033
00034 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) )
00035 { E3x3 = -1000.; }
00036 else
00037 { 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]; }
00038
00039 return E3x3;
00040 }
00041
00042
00043 double ene5x5_xtal(double mymatrix[], int xtal)
00044 {
00045 double E5x5 = 0.;
00046
00047 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) )
00048 { E5x5 = -1000.; }
00049 else
00050 { 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]; }
00051
00052 return E5x5;
00053 }
00054
00055
00056 void energy_ieta(double mymatrix[], double *energyieta)
00057 {
00058 for(int jj = 0 ; jj < 5 ; jj++) energyieta[jj] = 0.0;
00059
00060 for(int jj = 0 ; jj < 5 ; jj++){
00061 for (int ii = 0; ii < 5 ; ii++) energyieta[jj] += mymatrix[(8+jj)+7*ii];
00062 }
00063 }
00064
00065
00066 void energy_iphi(double mymatrix[], double *energyiphi)
00067 {
00068 for(int jj = 0 ; jj < 5 ; jj++) energyiphi[jj] = 0.0;
00069
00070 for(int jj = 0 ; jj < 5 ; jj++){
00071 for (int ii = 0; ii < 5 ; ii++) energyiphi[jj] += mymatrix[(8+7*jj)+ii];
00072 }
00073 }
00074
00075
00076
00077 double ene7x7_xtal(double mymatrix[])
00078 {
00079 double E7x7 = 0.;
00080
00081 for (int ii=0;ii<49;ii++)
00082 {
00083 if (mymatrix[ii]<-50)
00084 E7x7 = -1000.;
00085 else
00086 E7x7 += mymatrix[ii];
00087 }
00088
00089 return E7x7;
00090 }
00091
00092
00093
00094
00095
00096
00097
00098 double crystalball(double *x, double *par) {
00099
00100
00101
00102
00103
00104
00105 double cb = 0.0;
00106 double exponent = 0.0;
00107 double bla = 0.0;
00108
00109 if (x[0] > par[0] - par[2]*par[1]) {
00110 exponent = (x[0] - par[0])/par[1];
00111 cb = exp(-exponent*exponent/2.);
00112 } else {
00113 double nenner = pow(par[3]/par[2], par[3])*exp(-par[2]*par[2]/2.);
00114 double zaehler = (par[0] - x[0])/par[1] + par[3]/par[2] - par[2];
00115 zaehler = pow(zaehler, par[3]);
00116 cb = nenner/zaehler;
00117 }
00118
00119 if (par[4] > 0.) {
00120 cb *= par[4];
00121 }
00122 return cb;
00123 }
00124
00125 double shapeFunction(double *x, double *par) {
00126
00127
00128
00129
00130
00131 double ret_val;
00132 if(x[0]>0.)
00133 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];
00134 else
00135 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];
00136
00137 return ret_val;
00138 }