CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
TFParams Class Reference

#include <TFParams.h>

Inheritance diagram for TFParams:

Public Member Functions

double computePulseWidth (int, double, double)
 
void copie_colonne_mat (matrice, matrice, int)
 
void diff_mat (matrice, matrice, matrice)
 
double f3deg (int, double parom[dimout], double mask[dimmat], double adcpj[dimmat], double errpj[dimmat][dimmat])
 
double fitpj (double **, double *, double **, double noise_val, int debug)
 
double inv3x3 (double a[3][3], double b[3][3])
 
double inverpj (int, double g[dimmat][dimmat], double ginv[dimmat][dimmat])
 
void inverse_mat (matrice, matrice)
 
double lastShape (Double_t *, Double_t *)
 
double lastShape2 (Double_t *, Double_t *)
 
double mixShape (Double_t *, Double_t *)
 
double parab (double *, Int_t, Int_t, double *)
 
Double_t polfit (Int_t ns, Int_t imax, Double_t par3d[dimout], Double_t errpj[dimmat][dimmat], double *)
 
void print_mat (matrice)
 
void print_mat_nk (matrice, int)
 
void produit_mat (matrice, matrice, matrice)
 
void produit_mat_int (matrice, matrice, matrice)
 
double pulseShapepj (Double_t *, Double_t *)
 
double pulseShapepj2 (Double_t *, Double_t *)
 
void set_const (int, int, int, double, double, int)
 
void somme_mat_int (matrice, matrice)
 
void somme_mat_int_scale (matrice, matrice, double)
 
 TFParams (int size=SDIM2, int size_sh=PLSHDIM)
 
void transpose_mat (matrice, matrice)
 
void zero_mat (matrice)
 
void zero_mat_nk (matrice, int)
 
 ~TFParams () override
 

Public Attributes

char name_mat [10]
 

Static Public Attributes

static constexpr unsigned int dimmat = 30
 
static constexpr unsigned int dimout = 10
 
static constexpr unsigned int nbmax_cell = 1000
 
static constexpr int PLSHDIM = 650
 
static constexpr int SDIM2 = 10
 

Private Attributes

double a1ini
 
double a2ini
 
double a3ini
 
double adclu [26]
 
int METHODE
 
int nevtmax
 
int ns
 
int nsmax
 
int nsmin
 
double step_shape
 
double weight_matrix [10][10]
 

Detailed Description

Definition at line 38 of file TFParams.h.

Constructor & Destructor Documentation

TFParams::TFParams ( int  size = SDIM2,
int  size_sh = PLSHDIM 
)

Definition at line 23 of file TFParams.cc.

References mps_fire::i, and dqmiolumiharvest::j.

23  {
24  //int sdim = size;
25  //int plshdim = size_sh;
26 
27  for (int i = 0; i < 10; i++) {
28  for (int j = 0; j < 10; j++) {
29  weight_matrix[i][j] = 8.;
30  }
31  }
32 }
double weight_matrix[10][10]
Definition: TFParams.h:56
TFParams::~TFParams ( )
inlineoverride

Definition at line 63 of file TFParams.h.

63 {};

Member Function Documentation

double TFParams::computePulseWidth ( int  methode,
double  alpha_here,
double  beta_here 
)

Definition at line 1158 of file TFParams.cc.

References dt, testEve_cfg::level, and hltrates_dqm_sourceclient-live_cfg::offset.

1158  {
1159  // level of amplitude where we calculate the width ( level = 0.5 if at 50 % )
1160  // (level = 0.3 if at 30 % )
1161  double level = 0.30;
1162  // fixed parameters
1163  double amplitude = 1.00;
1164  double offset = 7.00;
1165  double amp_max = amplitude;
1166 
1167  // steps in time
1168  double t_min = offset - 4.50;
1169  double t_max = offset + 12.50;
1170 
1171  int t_step_max = 3000;
1172  double delta_t = (double)((t_max - t_min) / t_step_max);
1173 
1174  // Loop over time ( Loop 2 --> get width )
1175  int t_amp_half_flag = 0;
1176  double t_amp_half_min = 999.;
1177  double t_amp_half_max = -999.;
1178 
1179  for (int t_step = 0; t_step < t_step_max; t_step++) {
1180  double t_val = t_min + (double)t_step * delta_t;
1181  double albet = alpha_here * beta_here;
1182  double dt = t_val - offset;
1183  double amp = 0;
1184 
1185  if (methode == 2) { // electronic function
1186  if ((t_val - offset) > -albet) {
1187  amp = amplitude * TMath::Power((1 + (dt / (alpha_here * beta_here))), alpha_here) *
1188  TMath::Exp(-1.0 * (dt / beta_here));
1189  } else {
1190  amp = 1.;
1191  }
1192  }
1193 
1194  if (amp > (amp_max * level) && t_amp_half_flag == 0) {
1195  t_amp_half_flag = 1;
1196  t_amp_half_min = t_val;
1197  }
1198 
1199  if (amp < (amp_max * level) && t_amp_half_flag == 1) {
1200  t_amp_half_flag = 2;
1201  t_amp_half_max = t_val;
1202  }
1203  }
1204 
1205  // Compute Width
1206  double width = (t_amp_half_max - t_amp_half_min);
1207 
1208  return width;
1209 }
float dt
Definition: AMPTWrapper.h:136
tuple level
Definition: testEve_cfg.py:47
void TFParams::copie_colonne_mat ( matrice  A,
matrice  M,
int  nk 
)

Definition at line 579 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

579  {
580  int i, j;
581  int k;
582  /* resultat de la copie de A dans un vecteur colonne M */
583  k = 0;
584  for (i = 0; i < A.nb_lignes; i++) {
585  for (j = 0; j < A.nb_colonnes; j++) {
586  M.coeff[nk][k] = A.coeff[i][j];
587  printf(" copie nk %d i %d j %d k %d A %e M %e \n ", nk, i, j, k, A.coeff[i][j], M.coeff[nk][k]);
588  k++;
589  }
590  }
591  return;
592 }
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::diff_mat ( matrice  A,
matrice  B,
matrice  M 
)

Definition at line 562 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

562  {
563  int i, j;
564  //resultat de la difference A-B = M
565  if (A.nb_lignes != B.nb_lignes) {
566  printf(" Erreur : difference de matrices de tailles incompatibles \n ");
567  M.coeff = nullptr;
568  return;
569  }
570  M.nb_lignes = A.nb_lignes;
571  M.nb_colonnes = A.nb_colonnes;
572  for (i = 0; i < M.nb_lignes; i++) {
573  for (j = 0; j < M.nb_colonnes; j++) {
574  M.coeff[i][j] = A.coeff[i][j] - B.coeff[i][j];
575  }
576  }
577  return;
578 }
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
double TFParams::f3deg ( int  nmxu,
double  parom[dimout],
double  mask[dimmat],
double  adcpj[dimmat],
double  errpj[dimmat][dimmat] 
)

Definition at line 805 of file TFParams.cc.

References CommonMethods::delta(), validate-o2o-wbm::f, h, mps_fire::i, isotrackApplyRegressor::k, cmsLHEtoEOSManager::l, alignCSCRings::s, mathSSE::sqrt(), submitPVValidationJobs::t, and createJobs::tmp.

806  {
807  /* */
808  /* fit 3rd degree polynomial */
809  /* nmxu = nb of samples in sample data array adcpj[]
810  parom values of parameters
811  errpj inverse of the error matrix
812  fplo3dg uses only the diagonal terms of errpj[][]
813 */
814  int i, k, l /*,iworst*/;
815  double h, t2, tm, delta, tmp;
816  double xki2, dif, difmx, deglib;
817  double t[dimmat], f[dimmat][4];
818  double cov[dimmat][dimmat], bv[4], invcov[dimmat][dimmat], s /*, deter*/;
819 
820  deglib = (double)nmxu - 4.;
821  for (i = 0; i < nmxu; i++) {
822  t[i] = i;
823  f[i][0] = 1.;
824  f[i][1] = t[i];
825  f[i][2] = t[i] * t[i];
826  f[i][3] = f[i][2] * t[i];
827  }
828  /* computation of covariance matrix */
829  for (k = 0; k < 4; k++) {
830  for (l = 0; l < 4; l++) {
831  s = 0.;
832  for (i = 0; i < nmxu; i++) {
833  s = s + f[i][k] * f[i][l] * errpj[i][i] * mask[i];
834  }
835  cov[k][l] = s;
836  }
837  s = 0.;
838  for (i = 0; i < nmxu; i++) {
839  s = s + f[i][k] * adcpj[i] * errpj[i][i] * mask[i];
840  }
841  bv[k] = s;
842  }
843  /* parameters */
844  /*deter =*/inverpj(4, cov, invcov);
845  for (k = 0; k < 4; k++) {
846  s = 0.;
847  for (l = 0; l < 4; l++) {
848  s = s + bv[l] * invcov[l][k];
849  }
850  parom[k] = s;
851  }
852 
853  if (parom[3] == 0.) {
854  parom[4] = -1000.;
855  parom[5] = -1000.;
856  parom[6] = -1000.;
857  return 1000000.;
858  }
859  /* worst hit and ki2 */
860  xki2 = 0.;
861  difmx = 0.;
862  for (i = 0; i < nmxu; i++) {
863  t2 = t[i] * t[i];
864  h = parom[0] + parom[1] * t[i] + parom[2] * t2 + parom[3] * t2 * t[i];
865  dif = (adcpj[i] - h) * mask[i];
866  if (dif > difmx) {
867  // iworst=i ;
868  difmx = dif;
869  }
870  }
871  if (deglib > 0.5)
872  xki2 = xki2 / deglib;
873  /* amplitude and maximum position */
874  delta = parom[2] * parom[2] - 3. * parom[3] * parom[1];
875  if (delta > 0.) {
876  delta = sqrt(delta);
877  tm = -(delta + parom[2]) / (3. * parom[3]);
878  tmp = (delta - parom[2]) / (3. * parom[3]);
879  } else {
880  parom[4] = -1000.;
881  parom[5] = -1000.;
882  parom[6] = -1000.;
883  return xki2;
884  }
885  parom[4] = tm;
886  parom[5] = parom[0] + parom[1] * tm + parom[2] * tm * tm + parom[3] * tm * tm * tm;
887  parom[6] = tmp;
888  // printf("par --------> %f %f %f %f \n",parom[3],parom[2],parom[1],parom[0]);
889 
890  return xki2;
891 }
double inverpj(int, double g[dimmat][dimmat], double ginv[dimmat][dimmat])
Definition: TFParams.cc:894
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr unsigned int dimmat
Definition: TFParams.h:40
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
tmp
align.sh
Definition: createJobs.py:716
double TFParams::fitpj ( double **  adcval,
double *  parout,
double **  db_i,
double  noise_val,
int  debug 
)

Definition at line 34 of file TFParams.cc.

References isotrackTrainRegressor::a1, isotrackTrainRegressor::a2, alpha, TtFullHadDaughter::B, b1, b2, HLT_FULL_cff::beta, gen::C, HLT_FULL_cff::chi2, matrice::coeff, gather_cfg::cout, cree_mat(), cree_mat_prod(), dqmPostProcessing_online::DB, CommonMethods::delta(), dt, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, relval_steps::k2, log, nevt, nsamp, ntrack, gpuVertexFinder::printf(), submitPVValidationJobs::t, X, BeamSpotPI::Y, and BeamSpotPI::Z.

Referenced by TShapeAnalysis::computeShape().

34  {
35 #define dimn 10
36 #define dimin 10
37 #define plshdim 300
38 #define nsamp 10
39 #define ntrack 500
40  //#define debug debug1
41 
42  // ******************************************************************
43  // * Definitions of variables used in the routine
44  // ******************************************************************
45 
46  double a1, a2, a3, b1, b2;
47  int iter, nevt;
48  //double errpj[dimmat][dimmat] ;
49  double bi[ntrack][2], dbi[ntrack][2];
50  double zi[ntrack][2];
51  double par3degre[3];
52  int ioktk[ntrack], nk, nborn_min = 0, nborn_max = 0;
53  double cti[ntrack][6], dm1i[ntrack][4];
54  double par[4], tsig[1];
55  double amp, delta[nsamp], delta2, fun;
56  double num_fit_min[ntrack], num_fit_max[ntrack];
57  int i, j, k, imax[ntrack];
58 
59  double ampmax[ntrack], dt, t;
60  double chi2, chi2s, da1[nsamp], da2[nsamp], db1[nsamp], db2[nsamp];
61  double chi2tot;
62  double fact2;
63  double albet, dtsbeta, variab, alpha, beta;
64  double unsurs1 /*,unsurs2*/;
65  // double fit3 ;
66  int numb_a, numb_b, numb_x;
67 
68  fun = 0;
69  chi2s = 0;
70  chi2tot = 0;
71  matrice DA, DAT, BK, DB, DBT, C, CT, D, DM1, CDM1, CDM1CT, Z, CDM1Z, YK, Y, B, X, XINV, RES2;
72  matrice A_CROISS, ZMCT;
73 
74  double *amplu;
75  amplu = new double[nsamp];
76 
77  parout[0] = 0.;
78  parout[1] = 0.;
79  parout[2] = 0.;
80 
81  //
82  // Initialisation of fit parameters
83  //
84 
85  a1 = a1ini;
86  a2 = a2ini;
87  a3 = a3ini;
88  if (METHODE == 2) {
89  a2 = a3ini; // for lastshape BETA is the third parameter ( ... ! )
90  }
91  if (debug == 1) {
92  printf(" ------> __> valeurs de a1 %f a2 %f a3 %f\n", a1, a2, a3);
93  }
94  for (i = 0; i < ntrack; i++) {
95  for (j = 0; j < 2; j++) {
96  bi[i][j] = (double)0.;
97  dbi[i][j] = (double)0.;
98  zi[i][j] = (double)0.;
99  cti[i][j] = (double)0.;
100  dm1i[i][j] = (double)0.;
101  }
102  }
103 
104  numb_a = 2;
105 
106  //
107  // Matrices initialisation
108  //
109 
110  numb_x = 1;
111  numb_b = 2;
112  DA = cree_mat(numb_a, numb_x);
113  DAT = cree_mat(numb_x, numb_a);
114  BK = cree_mat_prod(DA, DAT);
115  DB = cree_mat(numb_b, numb_x);
116  DBT = cree_mat(numb_x, numb_b);
117  C = cree_mat(numb_a, numb_b);
118  CT = cree_mat(numb_b, numb_a);
119  D = cree_mat_prod(DB, DBT);
120  DM1 = cree_mat_prod(DB, DBT);
121  CDM1 = cree_mat_prod(C, DM1);
122  CDM1CT = cree_mat_prod(CDM1, CT);
123  Z = cree_mat(numb_b, numb_x);
124  CDM1Z = cree_mat_prod(CDM1, Z);
125  YK = cree_mat(numb_a, numb_x);
126  Y = cree_mat(numb_a, numb_x);
127  B = cree_mat_prod(DA, DAT);
128  X = cree_mat_prod(DA, DAT);
129  XINV = cree_mat_prod(DA, DAT);
130  RES2 = cree_mat(numb_a, numb_x);
131  A_CROISS = cree_mat(numb_a, numb_x);
132  ZMCT = cree_mat(numb_b, numb_x);
133 
135  // First Loop on iterations //
137 
138  for (iter = 0; iter < 6; iter++) {
139  chi2tot = 0;
140 
141  //
142  // Set zeros for general matrices
143  //
144 
145  if (debug == 1) {
146  printf(" Debut de l'iteration numero %d \n", iter);
147  }
148  zero_mat(CDM1Z);
149  zero_mat(Y);
150  zero_mat(CDM1CT);
151  zero_mat(B);
152  zero_mat(X);
153  zero_mat(CDM1);
154 
155  nk = -1;
156  if (debug == 1) {
157  printf(" resultats injectes a iterations %d \n", iter);
158  printf(" parametre a1 = %f \n", a1);
159  printf(" parametre a2 = %f \n", a2);
160  printf(" chi2 du fit chi2s = %f \n", chi2s);
161 
162  printf(" value de nevtmax _______________ %d \n", nevtmax);
163  }
164 
166  // Loop on events //
168 
169  for (nevt = 0; nevt < nevtmax; nevt++) {
170  // B1 = BI[nk,1] est la normalisation du signal
171  // B2 = BI[nk,2] ewst le dephasage par rapport a une
172  // fonction centree en zero
173  // Nous choisissons ici de demarrer avec les resultats
174  // de l'ajustement parabolique mais il faudra bien
175  // entendu verifier que cela ne biaise pas le resultat !
176  // mise a zero des matrices utilisees dans la boucle
177 
178  zero_mat(Z);
179  zero_mat(YK);
180  zero_mat(BK);
181  zero_mat(C);
182  zero_mat(D);
183 
184  nk = nevt;
185  ampmax[nk] = 0.;
186  imax[nk] = 0;
187  for (k = 0; k < 10; k++) {
188  amplu[k] = adcval[nevt][k];
189  if (amplu[k] > ampmax[nk]) {
190  ampmax[nk] = amplu[k];
191  imax[nk] = k;
192  }
193  }
194 
195  if (iter == 0) {
196  // start with degree 3 polynomial ....
197  //fit3 =polfit(ns ,imax[nk] ,par3degre ,errpj ,amplu ) ;
198  // std::cout << "Poly Fit Param :"<< par3degre[0] <<" "<< par3degre[1]<< std::endl;
199 
200  // start with parabol
201  //fit3 = parab(amplu,4,12,par3degre) ;
202  /*fit3 =*/parab(amplu, 2, 9, par3degre);
203  //std::cout << "Parab Fit Param :"<< par3degre[0] <<" "<< par3degre[1]<< std::endl;
204 
205  // start with basic initial values
206  //par3degre[0]= ampmax+ampmax/10. ;
207  //par3degre[1]= (double)imax[nk]+0.1 ;
208  //bi[nk][0] = ampmax[nk] ;
209  //bi[nk][1] = (double)imax[nk] ;
210 
211  num_fit_min[nevt] = (double)imax[nk] - (double)nsmin;
212  num_fit_max[nevt] = (double)imax[nk] + (double)nsmax;
213 
214  bi[nk][0] = par3degre[0];
215  bi[nk][1] = par3degre[1];
216 
217  if (debug == 1) {
218  printf("---------> depart ampmax[%d]=%f maximum %f tim %f \n", nk, ampmax[nk], bi[nk][0], bi[nk][1]);
219  }
220 
221  } else {
222  // in other iterations :
223  // increment bi[][] parameters with bdi[][]
224  // calculated in previous
225  // iteration
226 
227  bi[nk][0] += dbi[nk][0];
228  bi[nk][1] += dbi[nk][1];
229 
230  if (debug == 1) {
231  printf("iter %d valeur de max %f et norma %f poly 3 \n", iter, bi[nk][1], bi[nk][0]);
232  }
233  }
234 
235  b1 = bi[nk][0];
236  b2 = bi[nk][1];
237 
239  // Loop on samples //
241 
242  chi2 = 0.;
243  ioktk[nk] = 0;
244  ns = nborn_max - nborn_min + 1;
245 
246  for (k = 0; k < 10; k++) {
247  //
248  // calculation of fonction used to fit
249  //
250 
251  dt = (double)k - b2;
252  t = (double)k;
253  amp = amplu[k];
254  if (debug == 1) {
255  printf(" CHECK sample %f ampli %f \n", t, amp);
256  }
257  //unsurs1 = 1./sig_err ;
258  //unsurs2 = 1./(sig_err*sig_err) ;
259  //unsurs1 = 0.1 ;
260  //unsurs2 = 0.01 ;
261 
262  unsurs1 = 1. / noise_val;
263  //unsurs2=(1./noise_val)*(1./noise_val);
264 
265  //
266  // Pulse shape function used: pulseShapepj
267  //
268 
269  nborn_min = (int)num_fit_min[nevt];
270  nborn_max = (int)num_fit_max[nevt];
271  if (k < nborn_min || k > nborn_max)
272  continue;
273  tsig[0] = (double)k;
274 
275  if (METHODE == 2) {
276  par[0] = b1;
277  par[1] = b2;
278  par[2] = a1;
279  par[3] = a2;
280  fun = pulseShapepj(tsig, par);
281  }
282  if (debug == 1) {
283  printf(" valeur ampli %f et function %f min %d max %d \n", amp, fun, nsmin, nsmax);
284  printf("min %f max %f \n", num_fit_min[nevt], num_fit_max[nevt]);
285  }
286 
287  // we need to determine a1,a2 which are global parameters
288  // and b1, b2 which are parameters for each individual signal:
289  // b1, b2 = amplitude and time event by event
290  // a1, a2 = alpha and beta global
291  // we first begin to calculate the derivatives used in the following calculation
292 
293  if (METHODE == 2) {
294  alpha = a1;
295  beta = a2;
296  albet = alpha * beta;
297  if (dt > -albet) {
298  variab = (double)1. + dt / albet;
299  dtsbeta = dt / beta;
300  db1[k] = unsurs1 * fun / b1;
301  fact2 = fun;
302  db2[k] = unsurs1 * fact2 * dtsbeta / (albet * variab);
303  da1[k] = unsurs1 * fact2 * (log(variab) - dtsbeta / (alpha * variab));
304  da2[k] = unsurs1 * fact2 * dtsbeta * dtsbeta / (albet * variab);
305  }
306  }
307  delta[k] = (amp - fun) * unsurs1;
308  if (debug == 1) {
309  printf(" ------->iter %d valeur de k %d amp %f fun %f delta %f \n", iter, k, amp, fun, delta[k]);
310  printf(" -----> valeur de k %d delta %f da1 %f da2 %f \n", k, delta[k], da1[k], da2[k]);
311  }
312 
313  chi2 = chi2 + delta[k] * delta[k];
314 
315  if (debug == 1) {
316  printf(" CHECK chi2 %f deltachi2 %f sample %d iter %d \n", chi2, delta[k] * delta[k], k, iter);
317  }
318  }
319 
321  // End Loop on samples //
323 
324  double wk1wk2;
325 
327  // Start Loop on samples //
329 
330  for (int k1 = nborn_min; k1 < nborn_max + 1; k1++) {
331  wk1wk2 = 1.;
332  int k2 = k1;
333 
334  DA.coeff[0][0] = da1[k1] * wk1wk2;
335  DA.coeff[1][0] = da2[k1] * wk1wk2;
336  DAT.coeff[0][0] = da1[k2];
337  DAT.coeff[0][1] = da2[k2];
338  DB.coeff[0][0] = db1[k1] * wk1wk2;
339  DB.coeff[1][0] = db2[k1] * wk1wk2;
340  DBT.coeff[0][0] = db1[k2];
341  DBT.coeff[0][1] = db2[k2];
342 
343  // Compute derivative matrix : matrix b[2][2]
344 
345  produit_mat_int(DA, DAT, BK);
346 
347  // Compute matrix c[2][2]
348 
349  produit_mat_int(DA, DBT, C);
350 
351  // Compute matrix d[2][2]
352 
353  produit_mat_int(DB, DBT, D);
354 
355  // Compute matrix y[3] and z[2] depending of delta (amp-fun)
356 
357  delta2 = delta[k2];
358 
359  somme_mat_int_scale(DA, YK, delta2);
360  somme_mat_int_scale(DB, Z, delta2);
361 
362  ioktk[nk]++;
363  }
364 
366  // End Loop on samples //
368 
369  // Remove events with a bad shape
370 
371  if (ioktk[nk] < 4) {
372  printf(" event rejected because npamp_used = %d \n", ioktk[nk]);
373  continue;
374  }
375  chi2s = chi2 / (2. + (double)ns + 2.);
376  chi2tot += chi2s;
377 
378  if (debug == 1) {
379  if (nevt == 198 || nevt == 199) {
380  std::cout << "adc123 pour l'evt " << nevt << " = " << adcval[nevt][nborn_min] << " = "
381  << adcval[nevt][imax[nevt]] << " = " << adcval[nevt][nborn_max] << std::endl;
382  std::cout << "chi2s pour l'evt " << nevt << " = " << chi2s << " " << chi2 << " " << ns << " " << iter
383  << std::endl;
384  std::cout << "chi2tot " << nevt << " = " << chi2tot << " " << iter << std::endl;
385  }
386  }
387 
388  // Transpose matrix C ---> CT
389 
390  transpose_mat(C, CT);
391 
392  // Calculate DM1 (inverse of D matrix 2x2)
393 
394  inverse_mat(D, DM1);
395 
396  // Set matrix product c*d in memory in order to compute variations
397  // of parameters B at the end of the iteration loop
398  // the variations of parameters b are dependant of the variations of
399  // parameters da[1],da[2]
400 
401  cti[nk][0] = CT.coeff[0][0];
402  cti[nk][1] = CT.coeff[0][1];
403  cti[nk][2] = CT.coeff[1][0];
404  cti[nk][3] = CT.coeff[1][1];
405 
406  dm1i[nk][0] = DM1.coeff[0][0];
407  dm1i[nk][1] = DM1.coeff[0][1];
408  dm1i[nk][2] = DM1.coeff[1][0];
409  dm1i[nk][3] = DM1.coeff[1][1];
410 
411  zi[nk][0] = Z.coeff[0][0];
412  zi[nk][1] = Z.coeff[1][0];
413 
414  // Sum the matrix b and y after every event
415 
416  for (k = 0; k < numb_a; k++) {
417  Y.coeff[k][0] += YK.coeff[k][0];
418  }
419  somme_mat_int(BK, B);
420 
421  // Calculate c(d-1)
422 
423  produit_mat(C, DM1, CDM1);
424 
425  // Compute c(d-1)ct
426 
427  produit_mat_int(CDM1, CT, CDM1CT);
428 
429  // Compute c(d-1)z
430 
431  produit_mat_int(CDM1, Z, CDM1Z);
432  }
434  // End Loop on events //
436 
437  // Compute b-cdm1ct
438 
439  diff_mat(B, CDM1CT, X);
440  inverse_mat(X, XINV);
441  diff_mat(Y, CDM1Z, RES2);
442 
443  // Calculation is now easy for da[0] da[1]
444 
445  produit_mat(XINV, RES2, A_CROISS);
446 
447  // A la fin, on peut iterer en mesurant l'accroissement a apporter
448  // des parametres globaux par la formule db[i] = dm1(z-ct*da[i])
449 
450  for (k = 0; k < nk + 1; k++) {
451  if (METHODE == 2) {
452  ZMCT.coeff[0][0] = zi[k][0] - (cti[k][0] * A_CROISS.coeff[0][0] + cti[k][1] * A_CROISS.coeff[1][0]);
453  ZMCT.coeff[1][0] = zi[k][1] - (cti[k][2] * A_CROISS.coeff[0][0] + cti[k][3] * A_CROISS.coeff[1][0]);
454  }
455 
456  dbi[k][0] = dm1i[k][0] * ZMCT.coeff[0][0] + dm1i[k][1] * ZMCT.coeff[1][0];
457  dbi[k][1] = dm1i[k][2] * ZMCT.coeff[0][0] + dm1i[k][3] * ZMCT.coeff[1][0];
458  if (debug == 1) {
459  if (k < 100) {
460  printf(" variations de b1= %f et b2= %f \n", dbi[k][0], dbi[k][1]);
461  }
462  }
463  db_i[k][0] = bi[k][0] + dbi[k][0];
464  db_i[k][1] = bi[k][1] + dbi[k][1];
465  }
466 
467  // dbi[0] et dbi[1] mesurent les variations a apporter aux
468  // parametres du signal
469 
470  a1 += A_CROISS.coeff[0][0];
471  a2 += A_CROISS.coeff[1][0];
472 
473  if (debug == 1) {
474  printf(" CHECK croiss coef0: %f croiss coef1: %f iter %d \n",
475  fabs(A_CROISS.coeff[0][0]),
476  fabs(A_CROISS.coeff[1][0]),
477  iter);
478  }
479  if (fabs(A_CROISS.coeff[0][0]) < 0.001 && fabs(A_CROISS.coeff[1][0]) < 0.001)
480  break;
481  }
482 
484  // End Loop on iterations //
486 
487  parout[0] = a1;
488  parout[1] = a2;
489  parout[2] = a3;
490  if (debug == 1) {
491  printf(" resultats trouves au bout de %d iterations \n", iter);
492  printf(" parametre a1 = %f \n", a1);
493  printf(" parametre a2 = %f \n", a2);
494  }
495 
496  if (debug == 1) {
497  std::cout << " Final chi2 / NDOF : " << chi2tot / nevtmax << std::endl;
498  std::cout << " Final (alpha,beta) : (" << a1 << "," << a2 << ")" << std::endl;
499  }
500 
501  return chi2tot / nevtmax;
502 }
int nsmax
Definition: TFParams.h:49
double pulseShapepj(Double_t *, Double_t *)
Definition: TFParams.cc:991
double a1ini
Definition: TFParams.h:51
float dt
Definition: AMPTWrapper.h:136
float alpha
Definition: AMPTWrapper.h:105
static std::vector< std::string > checklist log
int nsmin
Definition: TFParams.h:48
#define X(str)
Definition: MuonsGrabber.cc:38
void somme_mat_int_scale(matrice, matrice, double)
Definition: TFParams.cc:610
void zero_mat(matrice)
Definition: TFParams.cc:695
void produit_mat(matrice, matrice, matrice)
Definition: TFParams.cc:523
double a2ini
Definition: TFParams.h:52
#define nsamp
double ** coeff
Definition: TFParams.h:30
void somme_mat_int(matrice, matrice)
Definition: TFParams.cc:594
int nevtmax
Definition: TFParams.h:50
void transpose_mat(matrice, matrice)
Definition: TFParams.cc:620
double parab(double *, Int_t, Int_t, double *)
Definition: TFParams.cc:1091
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
matrice cree_mat_prod(matrice, matrice)
Definition: TFParams.cc:630
int METHODE
Definition: TFParams.h:57
static const std::string B
matrice cree_mat(int, int)
Definition: TFParams.cc:648
double a3ini
Definition: TFParams.h:53
void inverse_mat(matrice, matrice)
Definition: TFParams.cc:719
int ns
Definition: TFParams.h:47
#define debug
Definition: HDRShower.cc:19
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
void produit_mat_int(matrice, matrice, matrice)
Definition: TFParams.cc:544
tuple cout
Definition: gather_cfg.py:144
void diff_mat(matrice, matrice, matrice)
Definition: TFParams.cc:562
#define ntrack
static constexpr float b2
static constexpr float b1
double TFParams::inv3x3 ( double  a[3][3],
double  b[3][3] 
)

Definition at line 957 of file TFParams.cc.

References mps_fire::i, dqmiolumiharvest::j, and gpuVertexFinder::printf().

957  {
958  /* a[ligne][colonne] b[ligne][colonne] */
959  int i, j;
960  double deter = 0.;
961  b[0][0] = a[1][1] * a[2][2] - a[2][1] * a[1][2];
962  b[1][1] = a[0][0] * a[2][2] - a[2][0] * a[0][2];
963  b[2][2] = a[0][0] * a[1][1] - a[0][1] * a[1][0];
964  printf("a[x][x] %e %e %e %e %e %e %e \n",
965  a[0][0],
966  a[1][1],
967  a[0][1],
968  a[1][0],
969  a[0][0] * a[1][1],
970  a[0][1] * a[1][0],
971  b[2][2]);
972  b[0][1] = a[2][1] * a[0][2] - a[0][1] * a[2][2];
973  b[0][2] = a[0][1] * a[1][2] - a[1][1] * a[0][2];
974  b[1][0] = a[1][2] * a[2][0] - a[1][0] * a[2][2];
975  b[1][2] = a[1][0] * a[0][2] - a[0][0] * a[1][2];
976  b[2][0] = a[1][0] * a[2][1] - a[1][1] * a[2][0];
977  b[2][1] = a[0][1] * a[2][0] - a[0][0] * a[2][1];
978  deter = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
979  printf(" deter = %e \n", deter);
980  for (i = 0; i < 3; i++) {
981  for (j = 0; j < 3; j++) {
982  printf(" avant division a[3][3] %d %d %e \n", i, j, a[i][j]);
983  printf(" avant division b[3][3] %d %d %e %e \n", i, j, b[i][j], deter);
984  b[i][j] = b[i][j] / deter;
985  printf(" valeur de b[3][3] apres division %d %d %e %e \n", i, j, b[i][j], deter);
986  }
987  }
988  return deter;
989 }
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
double TFParams::inverpj ( int  n,
double  g[dimmat][dimmat],
double  ginv[dimmat][dimmat] 
)

Definition at line 894 of file TFParams.cc.

References cms::cuda::be, g, mps_fire::i, dqmiolumiharvest::j, findQualityFiles::jj, isotrackApplyRegressor::k, dqmiodumpmetadata::n, alignCSCRings::r, alignCSCRings::s, and mathSSE::sqrt().

894  {
895  /* */
896  /* inversion d une matrice symetrique definie positive de taille n */
897  /* J.P. Pansart Novembre 99 */
898  /* */
899  int i, j, k, jj;
900  double r, s;
901  double deter = 0;
902  double al[dimmat][dimmat], be[dimmat][dimmat];
903  /* initialisation */
904  for (i = 0; i < n; i++) {
905  for (j = 0; j < n; j++) {
906  al[i][j] = 0.;
907  be[i][j] = 0.;
908  }
909  }
910  /* decomposition en vecteurs sur une base orthonormee */
911  al[0][0] = sqrt(g[0][0]);
912  for (i = 1; i < n; i++) {
913  al[i][0] = g[0][i] / al[0][0];
914  for (j = 1; j <= i; j++) {
915  s = 0.;
916  for (k = 0; k <= j - 1; k++) {
917  s = s + al[i][k] * al[j][k];
918  }
919  r = g[i][j] - s;
920  if (j < i)
921  al[i][j] = r / al[j][j];
922  if (j == i)
923  al[i][j] = sqrt(r);
924  }
925  }
926  /* inversion de la matrice al */
927  be[0][0] = 1. / al[0][0];
928  for (i = 1; i < n; i++) {
929  be[i][i] = 1. / al[i][i];
930  for (j = 0; j < i; j++) {
931  jj = i - j - 1;
932  s = 0.;
933  for (k = jj + 1; k <= i; k++) {
934  s = s + be[i][k] * al[k][jj];
935  }
936  be[i][jj] = -s / al[jj][jj];
937  }
938  }
939  /* calcul de la matrice ginv */
940  for (i = 0; i < n; i++) {
941  for (j = 0; j < n; j++) {
942  s = 0.;
943  for (k = 0; k < n; k++) {
944  s = s + be[k][i] * be[k][j];
945  }
946  ginv[i][j] = s;
947  // if (debug==1){
948  //printf("valeur de la matrice %d %d %f \n",i,j,ginv[i][j]) ;
949  //}
950  }
951  }
952  return deter;
953 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr unsigned int dimmat
Definition: TFParams.h:40
void TFParams::inverse_mat ( matrice  A,
matrice  M 
)

Definition at line 719 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

719  {
720  /* A[ligne][colonne] B[ligne][colonne] */
721  int i, j;
722  double deter = 0.;
723  /* M est la matrice inverse de A */
724 
725  if (A.nb_lignes != A.nb_colonnes) {
726  printf(" attention matrice non inversible !!!! %d lignes %d colonnes \n", A.nb_lignes, A.nb_colonnes);
727  return;
728  }
729  zero_mat(M);
730  if (A.nb_lignes == 2) {
731  deter = A.coeff[0][0] * A.coeff[1][1] - A.coeff[0][1] * A.coeff[1][0];
732  M.coeff[0][0] = A.coeff[1][1] / deter;
733  M.coeff[0][1] = -A.coeff[0][1] / deter;
734  M.coeff[1][0] = -A.coeff[1][0] / deter;
735  M.coeff[1][1] = A.coeff[0][0] / deter;
736  } else if (A.nb_lignes == 3) {
737  M.coeff[0][0] = A.coeff[1][1] * A.coeff[2][2] - A.coeff[2][1] * A.coeff[1][2];
738  M.coeff[1][1] = A.coeff[0][0] * A.coeff[2][2] - A.coeff[2][0] * A.coeff[0][2];
739 
740  M.coeff[2][2] = A.coeff[0][0] * A.coeff[1][1] - A.coeff[0][1] * A.coeff[1][0];
741  M.coeff[0][1] = A.coeff[2][1] * A.coeff[0][2] - A.coeff[0][1] * A.coeff[2][2];
742  M.coeff[0][2] = A.coeff[0][1] * A.coeff[1][2] - A.coeff[1][1] * A.coeff[0][2];
743  M.coeff[1][0] = A.coeff[1][2] * A.coeff[2][0] - A.coeff[1][0] * A.coeff[2][2];
744  M.coeff[1][2] = A.coeff[1][0] * A.coeff[0][2] - A.coeff[0][0] * A.coeff[1][2];
745  M.coeff[2][0] = A.coeff[1][0] * A.coeff[2][1] - A.coeff[1][1] * A.coeff[2][0];
746  M.coeff[2][1] = A.coeff[0][1] * A.coeff[2][0] - A.coeff[0][0] * A.coeff[2][1];
747  deter = A.coeff[0][0] * M.coeff[0][0] + A.coeff[1][0] * M.coeff[0][1] + A.coeff[2][0] * M.coeff[0][2];
748  for (i = 0; i < 3; i++) {
749  for (j = 0; j < 3; j++)
750  M.coeff[i][j] = M.coeff[i][j] / deter;
751  }
752  } else {
753  printf(" Attention , on ne peut inverser la MATRICE %d \n", A.nb_lignes);
754  return;
755  }
756 
757  return;
758 }
void zero_mat(matrice)
Definition: TFParams.cc:695
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
double TFParams::lastShape ( Double_t *  x,
Double_t *  par 
)

Definition at line 1026 of file TFParams.cc.

References alpha, b1, b2, HLT_FULL_cff::beta, dt, funct::exp(), and HLT_FULL_cff::exponent.

1026  {
1027  Double_t fitfun;
1028  Double_t alpha, beta;
1029  Double_t dt, alphadt, exponent;
1030  Double_t b1, b2;
1031  b1 = par[0];
1032  b2 = par[1];
1033  alpha = par[2];
1034  beta = par[3];
1035  dt = x[0] - b2;
1036  alphadt = alpha * dt;
1037  exponent = -(alphadt + (exp(-alphadt) - 1.)) / beta;
1038  fitfun = b1 * exp(exponent);
1039  return fitfun;
1040 }
float dt
Definition: AMPTWrapper.h:136
float alpha
Definition: AMPTWrapper.h:105
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
static constexpr float b2
static constexpr float b1
double TFParams::lastShape2 ( Double_t *  x,
Double_t *  par 
)

Definition at line 1041 of file TFParams.cc.

References alpha, b1, b2, HLT_FULL_cff::beta, dt, funct::exp(), and HLT_FULL_cff::exponent.

1041  {
1042  Double_t fitfun;
1043  Double_t alpha, beta;
1044  Double_t dt, expo1, dt2, exponent;
1045  Double_t b1, b2;
1046  b1 = par[0];
1047  b2 = par[1];
1048  alpha = par[2];
1049  beta = par[3];
1050  dt = x[0] - b2;
1051  expo1 = exp(-beta * dt);
1052  dt2 = dt * dt;
1053  exponent = -(alpha * dt2 + (expo1 - 1.));
1054  fitfun = b1 * exp(exponent);
1055  return fitfun;
1056 }
float dt
Definition: AMPTWrapper.h:136
float alpha
Definition: AMPTWrapper.h:105
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
static constexpr float b2
static constexpr float b1
double TFParams::mixShape ( Double_t *  x,
Double_t *  par 
)

Definition at line 1128 of file TFParams.cc.

References alpha, b1, b2, HLT_FULL_cff::beta, dt, funct::exp(), HLT_FULL_cff::exponent, fact, funct::pow(), and submitPVValidationJobs::t.

1128  {
1129  Double_t fitval0, fitval;
1130  Double_t alpha, beta, fact, puiss;
1131  Double_t dt, alpha2dt, exponent;
1132  Double_t b1, b2, alpha2, t;
1133  b1 = par[0];
1134  b2 = par[1];
1135  alpha = par[2];
1136  alpha2 = par[3];
1137  beta = par[4];
1138  //
1139  t = x[0];
1140  dt = x[0] - b2;
1141  //
1142  if (t > 0.) {
1143  fact = t / b2;
1144  puiss = pow(fact, alpha);
1145  fitval0 = puiss * exp(-alpha * dt / b2);
1146  } else {
1147  fitval0 = 1.;
1148  }
1149  dt = x[0] - b2;
1150  alpha2dt = dt * alpha2;
1151  exponent = -(alpha2dt + (exp(-alpha2dt) - 1.)) / beta;
1152  fitval = b1 * fitval0 * exp(exponent);
1153  return fitval;
1154 }
float dt
Definition: AMPTWrapper.h:136
float alpha
Definition: AMPTWrapper.h:105
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
const double fact
static constexpr float b2
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
static constexpr float b1
double TFParams::parab ( double *  ,
Int_t  ,
Int_t  ,
double *   
)

Definition at line 1091 of file TFParams.cc.

References makePileupJSON::denom, dt, and isotrackApplyRegressor::k.

1091  {
1092  /* Now we calculate the parabolic adjustement in order to get */
1093  /* maximum and time max */
1094 
1095  double denom, dt, amp1, amp2, amp3;
1096  double ampmax = 0.;
1097  int imax = 0;
1098  int k;
1099  /*
1100  */
1101  for (k = nmin; k < nmax; k++) {
1102  if (ampl[k] > ampmax) {
1103  ampmax = ampl[k];
1104  imax = k;
1105  }
1106  }
1107  amp1 = ampl[imax - 1];
1108  amp2 = ampl[imax];
1109  amp3 = ampl[imax + 1];
1110  denom = 2. * amp2 - amp1 - amp3;
1111  /* */
1112  if (denom > 0.) {
1113  dt = 0.5 * (amp3 - amp1) / denom;
1114  } else {
1115  //printf("denom =%f\n",denom) ;
1116  dt = 0.5;
1117  }
1118  /* */
1119  /* ampmax correspond au maximum d'amplitude parabolique et dt */
1120  /* decalage en temps par rapport au sample maximum soit k + dt */
1121 
1122  parout[0] = amp2 + (amp3 - amp1) * dt * 0.25;
1123  parout[1] = (double)imax + dt;
1124  parout[2] = (double)imax;
1125  return denom;
1126 }
float dt
Definition: AMPTWrapper.h:136
Quality *__restrict__ uint16_t nmin
Double_t TFParams::polfit ( Int_t  ns,
Int_t  imax,
Double_t  par3d[dimout],
Double_t  errpj[dimmat][dimmat],
double *  adcpj 
)

Definition at line 759 of file TFParams.cc.

References h, mps_fire::i, and hgcalPerformanceValidation::val.

759  {
760  double val, val2, val3, adfmx[dimmat], parfp3[dimout];
761  double ius[dimmat], maskp3[dimmat];
762  double deglib, fit3, tm, h, xki2;
763  int i, nus, ilow, isup;
764  val = adcpj[imax];
765  val2 = val / 2.;
766  val3 = val / 3.;
767  ilow = 0;
768  isup = ns;
769  deglib = -4.;
770  for (i = 0; i < ns; i++) {
771  deglib = deglib + 1.;
772  ius[i] = 1.;
773  if ((adcpj[i] < val3) && (i < imax)) {
774  ilow = i;
775  }
776  if (adcpj[i] > val2) {
777  isup = i;
778  }
779  }
780  ilow = ilow + 1;
781  if (ilow == imax)
782  ilow = ilow - 1;
783  if (isup - ilow < 3)
784  isup = ilow + 3;
785  nus = 0;
786  for (i = ilow; i <= isup; i++) {
787  adfmx[nus] = adcpj[i];
788  maskp3[nus] = 0.;
789  if (ius[i] == 1) {
790  maskp3[nus] = 1.;
791  nus = nus + 1;
792  }
793  }
794  if (nus < 4)
795  return 10000.;
796  xki2 = f3deg(nus, parfp3, maskp3, adfmx, errpj);
797  tm = parfp3[4];
798  h = parfp3[5];
799  tm = tm + (double)ilow;
800  par3d[0] = h;
801  par3d[1] = tm;
802  fit3 = xki2;
803  return fit3;
804 }
static constexpr unsigned int dimout
Definition: TFParams.h:41
int ns
Definition: TFParams.h:47
double f3deg(int, double parom[dimout], double mask[dimmat], double adcpj[dimmat], double errpj[dimmat][dimmat])
Definition: TFParams.cc:805
static constexpr unsigned int dimmat
Definition: TFParams.h:40
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void TFParams::print_mat ( matrice  M)

Definition at line 681 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

681  {
682  int i, j;
683  if (M.coeff == nullptr) {
684  printf(" erreur : affichage d'une matrice vide \n");
685  return;
686  }
687  printf(" m_nli %d M_ncol %d \n", M.nb_lignes, M.nb_colonnes);
688  for (i = 0; i < M.nb_lignes; i++) {
689  for (j = 0; j < M.nb_colonnes; j++)
690  printf(" MATRICE i= %d j= %d ---> %e \n", i, j, M.coeff[i][j]);
691  }
692  //printf(" apres passage d'impression \n") ;
693  return;
694 }
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::print_mat_nk ( matrice  M,
int  nk 
)

Definition at line 709 of file TFParams.cc.

References matrice::coeff, dqmiolumiharvest::j, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

709  {
710  int j;
711  if (M.coeff == nullptr)
712  printf(" erreur : affichage d'une matrice vide \n");
713  printf(" nk = %d m_nli %d M_ncol %d \n", nk, M.nb_lignes, M.nb_colonnes);
714  for (j = 0; j < M.nb_colonnes; j++)
715  printf(" MATRICE nk= %d j= %d ---> %e \n", nk, j, M.coeff[nk][j]);
716  printf(" apres passage d'impression \n");
717  return;
718 }
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::produit_mat ( matrice  A,
matrice  B,
matrice  M 
)

Definition at line 523 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

523  {
524  int i, j, k;
525  // resultat du produit A*B = M
526  if (A.nb_colonnes != B.nb_lignes) {
527  printf(" Erreur : produit de matrices de tailles incompatibles \n ");
528  M.coeff = nullptr;
529  return;
530  }
531  M.nb_lignes = A.nb_lignes;
532  M.nb_colonnes = B.nb_colonnes;
533  zero_mat(M);
534  for (i = 0; i < M.nb_lignes; i++) {
535  for (j = 0; j < M.nb_colonnes; j++) {
536  for (k = 0; k < A.nb_colonnes; k++) {
537  M.coeff[i][j] += A.coeff[i][k] * B.coeff[k][j];
538  }
539  }
540  }
541  return;
542 }
void zero_mat(matrice)
Definition: TFParams.cc:695
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::produit_mat_int ( matrice  A,
matrice  B,
matrice  M 
)

Definition at line 544 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

544  {
545  int i, j, k;
546  if (A.nb_colonnes != B.nb_lignes) {
547  printf(" Erreur : produit de matrices de tailles incompatibles \n ");
548  M.coeff = nullptr;
549  return;
550  }
551  M.nb_lignes = A.nb_lignes;
552  M.nb_colonnes = B.nb_colonnes;
553  for (i = 0; i < M.nb_lignes; i++) {
554  for (j = 0; j < M.nb_colonnes; j++) {
555  for (k = 0; k < A.nb_colonnes; k++) {
556  M.coeff[i][j] += A.coeff[i][k] * B.coeff[k][j];
557  }
558  }
559  }
560  return;
561 }
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
double TFParams::pulseShapepj ( Double_t *  x,
Double_t *  par 
)

Definition at line 991 of file TFParams.cc.

References isotrackTrainRegressor::a1, isotrackTrainRegressor::a2, alpha, b1, b2, HLT_FULL_cff::beta, dt, funct::exp(), h, and funct::pow().

991  {
992  Double_t fitfun;
993  Double_t ped, h, tm, alpha, beta;
994  Double_t dt, dtsbeta, albet, variab, puiss;
995  Double_t b1, b2, a1, a2;
996  b1 = par[0];
997  b2 = par[1];
998  a1 = par[2];
999  a2 = par[3];
1000 
1001  ped = 0.;
1002  h = b1;
1003  tm = b2;
1004  alpha = a1;
1005  beta = a2;
1006  dt = x[0] - tm;
1007  //printf(" par %f %f %f %f dt = %f albet = %f",b1,b2,a1,a2,dt,albet) ;
1008  albet = alpha * beta;
1009  if (albet <= 0)
1010  return ((Double_t)0.);
1011 
1012  if (dt > -albet) {
1013  dtsbeta = dt / beta;
1014  variab = 1. + dt / albet;
1015  puiss = pow(variab, alpha);
1016  fitfun = h * puiss * exp(-dtsbeta) + ped;
1017  //printf(" dt = %f h = %f puiss = %f exp(-dtsbeta) %f \n",dt,h,puiss,
1018  // exp(-dtsbeta)) ;
1019  } else {
1020  fitfun = ped;
1021  }
1022 
1023  return fitfun;
1024 }
float dt
Definition: AMPTWrapper.h:136
float alpha
Definition: AMPTWrapper.h:105
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
static constexpr float b2
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
static constexpr float b1
Double_t TFParams::pulseShapepj2 ( Double_t *  x,
Double_t *  par 
)

Definition at line 1058 of file TFParams.cc.

References isotrackTrainRegressor::a1, isotrackTrainRegressor::a2, alpha, b1, HLT_FULL_cff::beta, dt, funct::exp(), h, and funct::pow().

1058  {
1059  Double_t fitfun;
1060  Double_t ped, h, /*tm,*/ alpha, beta;
1061  Double_t dt, dtsbeta, albet, variab, puiss;
1062  Double_t b1, /*b2,*/ a1, a2;
1063  b1 = par[0];
1064  //b2 = par[1] ;
1065  a1 = par[2];
1066  a2 = par[3];
1067  ped = 0.;
1068  h = b1;
1069  //tm = b2 ;
1070  alpha = a1;
1071  beta = a2;
1072  dt = x[0];
1073  albet = alpha * beta;
1074  if (albet <= 0)
1075  return ((Double_t)0.);
1076 
1077  if (dt > -albet) {
1078  dtsbeta = dt / beta;
1079  variab = 1. + dt / albet;
1080  puiss = pow(variab, alpha);
1081  fitfun = h * puiss * exp(-dtsbeta) + ped;
1082  } else {
1083  fitfun = ped;
1084  }
1085 
1086  /* printf( "fitfun %f %f %f %f, %f %f %f\n", ped, h, tm, alpha, beta, *x, fitfun ); */
1087 
1088  return fitfun;
1089 }
float dt
Definition: AMPTWrapper.h:136
float alpha
Definition: AMPTWrapper.h:105
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
static constexpr float b1
void TFParams::set_const ( int  n_samples,
int  sample_min,
int  sample_max,
double  alpha,
double  beta,
int  nevtmaximum 
)

Definition at line 509 of file TFParams.cc.

References alpha, HLT_FULL_cff::beta, and gpuVertexFinder::printf().

Referenced by TShapeAnalysis::computeShape().

509  {
510  /*------------------------------------------------------------------------*/
511  ns = n_samples;
512  nsmin = sample_min;
513  nsmax = sample_max;
514  nevtmax = nevtmaximum;
515  a1ini = alpha;
516  a2ini = 0.0;
517  a3ini = beta;
518  step_shape = .04;
519  METHODE = 2;
520  if (ns > SDIM2)
521  printf("warning: NbOfsamples exceed maximum\n");
522 }
int nsmax
Definition: TFParams.h:49
double a1ini
Definition: TFParams.h:51
float alpha
Definition: AMPTWrapper.h:105
int nsmin
Definition: TFParams.h:48
double a2ini
Definition: TFParams.h:52
int nevtmax
Definition: TFParams.h:50
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int METHODE
Definition: TFParams.h:57
double a3ini
Definition: TFParams.h:53
int ns
Definition: TFParams.h:47
double step_shape
Definition: TFParams.h:54
static constexpr int SDIM2
Definition: TFParams.h:43
void TFParams::somme_mat_int ( matrice  A,
matrice  M 
)

Definition at line 594 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, matrice::nb_lignes, and gpuVertexFinder::printf().

594  {
595  int i, j;
596  /* resultat de la somme integree M += A */
597  if (A.nb_lignes != M.nb_lignes) {
598  printf(" Erreur : somme de matrices de tailles incompatibles \n ");
599  M.coeff = nullptr;
600  return;
601  }
602  M.nb_lignes = A.nb_lignes;
603  M.nb_colonnes = A.nb_colonnes;
604  for (i = 0; i < M.nb_lignes; i++) {
605  for (j = 0; j < M.nb_colonnes; j++)
606  M.coeff[i][j] += A.coeff[i][j];
607  }
608  return;
609 }
double ** coeff
Definition: TFParams.h:30
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::somme_mat_int_scale ( matrice  A,
matrice  M,
double  delta 
)

Definition at line 610 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, and matrice::nb_lignes.

610  {
611  int i, j;
612  M.nb_lignes = A.nb_lignes;
613  M.nb_colonnes = A.nb_colonnes;
614  for (i = 0; i < M.nb_lignes; i++) {
615  for (j = 0; j < M.nb_colonnes; j++)
616  M.coeff[i][j] += A.coeff[i][j] * delta;
617  }
618  return;
619 }
double ** coeff
Definition: TFParams.h:30
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::transpose_mat ( matrice  A,
matrice  M 
)

Definition at line 620 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, and matrice::nb_lignes.

620  {
621  int i, j;
622  // resultat de la transposition = matrice M
623  for (i = 0; i < A.nb_lignes; i++) {
624  for (j = 0; j < A.nb_colonnes; j++) {
625  M.coeff[j][i] = A.coeff[i][j];
626  }
627  }
628  return;
629 }
double ** coeff
Definition: TFParams.h:30
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::zero_mat ( matrice  M)

Definition at line 695 of file TFParams.cc.

References matrice::coeff, mps_fire::i, dqmiolumiharvest::j, matrice::nb_colonnes, and matrice::nb_lignes.

695  {
696  int i, j;
697  for (i = 0; i < M.nb_lignes; i++) {
698  for (j = 0; j < M.nb_colonnes; j++)
699  M.coeff[i][j] = 0.;
700  }
701  return;
702 }
double ** coeff
Definition: TFParams.h:30
int nb_lignes
Definition: TFParams.h:28
int nb_colonnes
Definition: TFParams.h:29
void TFParams::zero_mat_nk ( matrice  M,
int  nk 
)

Definition at line 703 of file TFParams.cc.

References matrice::coeff, dqmiolumiharvest::j, and matrice::nb_colonnes.

703  {
704  int j;
705  for (j = 0; j < M.nb_colonnes; j++)
706  M.coeff[nk][j] = 0.;
707  return;
708 }
double ** coeff
Definition: TFParams.h:30
int nb_colonnes
Definition: TFParams.h:29

Member Data Documentation

double TFParams::a1ini
private

Definition at line 51 of file TFParams.h.

double TFParams::a2ini
private

Definition at line 52 of file TFParams.h.

double TFParams::a3ini
private

Definition at line 53 of file TFParams.h.

double TFParams::adclu[26]
private

Definition at line 55 of file TFParams.h.

constexpr unsigned int TFParams::dimmat = 30
static

Definition at line 40 of file TFParams.h.

constexpr unsigned int TFParams::dimout = 10
static

Definition at line 41 of file TFParams.h.

int TFParams::METHODE
private

Definition at line 57 of file TFParams.h.

char TFParams::name_mat[10]

Definition at line 76 of file TFParams.h.

constexpr unsigned int TFParams::nbmax_cell = 1000
static

Definition at line 42 of file TFParams.h.

int TFParams::nevtmax
private

Definition at line 50 of file TFParams.h.

int TFParams::ns
private

Definition at line 47 of file TFParams.h.

int TFParams::nsmax
private

Definition at line 49 of file TFParams.h.

int TFParams::nsmin
private

Definition at line 48 of file TFParams.h.

constexpr int TFParams::PLSHDIM = 650
static

Definition at line 44 of file TFParams.h.

constexpr int TFParams::SDIM2 = 10
static

Definition at line 43 of file TFParams.h.

double TFParams::step_shape
private

Definition at line 54 of file TFParams.h.

double TFParams::weight_matrix[10][10]
private

Definition at line 56 of file TFParams.h.