CMS 3D CMS Logo

List of all members | Public Member Functions | 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[10], double mask[30], double adcpj[30], double errpj[30][30])
 
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[30][30], double ginv[30][30])
 
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[10], Double_t errpj[30][30], 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=10, int size_sh=650)
 
void transpose_mat (matrice, matrice)
 
void zero_mat (matrice)
 
void zero_mat_nk (matrice, int)
 
 ~TFParams () override
 

Public Attributes

char name_mat [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 47 of file TFParams.h.

Constructor & Destructor Documentation

TFParams::TFParams ( int  size = 10,
int  size_sh = 650 
)

Definition at line 25 of file TFParams.cc.

References mps_fire::i.

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

Definition at line 66 of file TFParams.h.

References debug.

66 {};

Member Function Documentation

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

Definition at line 1226 of file TFParams.cc.

References CustomPhysics_cfi::amplitude, dt, hcalDigis_cfi::level, PFRecoTauDiscriminationByIsolation_cfi::offset, and ApeEstimator_cff::width.

1226  {
1227 
1228 // level of amplitude where we calculate the width ( level = 0.5 if at 50 % )
1229 // (level = 0.3 if at 30 % )
1230  double level = 0.30 ;
1231 // fixed parameters
1232  double amplitude = 1.00 ;
1233  double offset = 7.00;
1234  double amp_max = amplitude;
1235 
1236 // steps in time
1237  double t_min = offset-4.50;
1238  double t_max = offset+12.50;
1239 
1240  int t_step_max = 3000;
1241  double delta_t = (double)((t_max-t_min)/t_step_max);
1242 
1243 // Loop over time ( Loop 2 --> get width )
1244  int t_amp_half_flag = 0;
1245  double t_amp_half_min = 999.;
1246  double t_amp_half_max = -999.;
1247 
1248  for (int t_step=0; t_step<t_step_max; t_step++){
1249 
1250  double t_val = t_min + (double)t_step*delta_t;
1251  double albet = alpha_here*beta_here ;
1252  double dt = t_val-offset ;
1253  double amp =0;
1254 
1255  if( methode == 2 ) { // electronic function
1256  if( (t_val-offset) > -albet) {
1257 
1258  amp = amplitude*TMath::Power( ( 1 + ( dt / (alpha_here*beta_here) ) ) , alpha_here ) * TMath::Exp(-1.0*(dt/beta_here));
1259  } else {
1260 
1261  amp = 1. ;
1262  }
1263  }
1264 
1265  if( amp > (amp_max*level) && t_amp_half_flag == 0) {
1266  t_amp_half_flag = 1;
1267  t_amp_half_min = t_val;
1268  }
1269 
1270  if( amp < (amp_max*level) && t_amp_half_flag == 1) {
1271  t_amp_half_flag = 2;
1272  t_amp_half_max = t_val;
1273  }
1274 
1275  }
1276 
1277 // Compute Width
1278  double width = (t_amp_half_max - t_amp_half_min);
1279 
1280  return width;
1281 }
float dt
Definition: AMPTWrapper.h:126
void TFParams::copie_colonne_mat ( matrice  A,
matrice  M,
int  nk 
)

Definition at line 626 of file TFParams.cc.

References matrice::coeff, mps_fire::i, gen::k, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

627 {
628  int i,j ;
629  int k ;
630  /* resultat de la copie de A dans un vecteur colonne M */
631  k = 0 ;
632  for(i=0 ; i< A.nb_lignes; i++) {
633  for(j=0 ; j < A.nb_colonnes ; j++) {
634  M.coeff[nk][k] = A.coeff[i][j] ;
635  printf(" copie nk %d i %d j %d k %d A %e M %e \n ",nk,i,j,k,A.coeff[i][j],
636  M.coeff[nk][k]);
637  k++ ;
638  }
639  }
640  return ;
641 }
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int k[5][pyjets_maxn]
int nb_colonnes
Definition: TFParams.h:33
void TFParams::diff_mat ( matrice  A,
matrice  B,
matrice  M 
)

Definition at line 607 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, nullptr, and mathSSE::return().

608 {
609  int i,j ;
610 //resultat de la difference A-B = M
611  if(A.nb_lignes != B.nb_lignes) {
612  printf( " Erreur : difference de matrices de tailles incompatibles \n ");
613  M.coeff = nullptr ;
614  return ;
615  }
616  M.nb_lignes = A.nb_lignes ;
617  M.nb_colonnes = A.nb_colonnes ;
618  for(i=0 ; i< M.nb_lignes; i++) {
619  for(j=0 ; j < M.nb_colonnes ; j++) {
620  M.coeff[i][j] = A.coeff[i][j] - B.coeff[i][j] ;
621  }
622  }
623  return ;
624 
625 }
#define nullptr
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
double TFParams::f3deg ( int  nmxu,
double  parom[10],
double  mask[30],
double  adcpj[30],
double  errpj[30][30] 
)

Definition at line 867 of file TFParams.cc.

References delta, dimmat, f, h, mps_fire::i, gen::k, checklumidiff::l, RecoTauDiscriminantConfiguration::mask, alignCSCRings::s, mathSSE::sqrt(), protons_cff::t, and tmp.

867  {
868 /* */
869 /* fit 3rd degree polynomial */
870 /* nmxu = nb of samples in sample data array adcpj[]
871  parom values of parameters
872  errpj inverse of the error matrix
873  fplo3dg uses only the diagonal terms of errpj[][]
874 */
875  int i , k , l /*,iworst*/ ;
876  double h , t2 , tm , delta , tmp ;
877  double xki2 , dif , difmx , deglib ;
878  double t[dimmat] , f[dimmat][4] ;
879  double cov[dimmat][dimmat] , bv[4] , invcov[dimmat][dimmat] , s /*, deter*/ ;
880 
881  deglib=(double)nmxu - 4. ;
882  for ( i=0 ; i<nmxu ; i++ ) {
883  t[i]=i ;
884  f[i][0]=1. ;
885  f[i][1]=t[i] ;
886  f[i][2]=t[i]*t[i] ;
887  f[i][3]=f[i][2]*t[i] ;
888  }
889 /* computation of covariance matrix */
890  for ( k=0 ; k<4 ; k++ ) {
891  for ( l=0 ; l<4 ; l++ ) {
892  s=0. ;
893  for (i=0 ; i<nmxu ; i++ ) {
894  s=s+f[i][k]*f[i][l]*errpj[i][i]*mask[i] ;
895  }
896  cov[k][l]=s ;
897  }
898  s=0. ;
899  for (i=0 ; i<nmxu ; i++ ) {
900  s=s+f[i][k]*adcpj[i]*errpj[i][i]*mask[i] ;
901  }
902  bv[k]=s ;
903  }
904 /* parameters */
905  /*deter =*/ inverpj ( 4 , cov , invcov );
906  for ( k=0 ; k<4 ; k++ ) {
907  s=0. ;
908  for ( l=0 ; l<4 ; l++ ) {
909  s=s+bv[l]*invcov[l][k] ;
910  }
911  parom[k]=s ;
912  }
913 
914  if( parom[3] == 0. ){
915  parom[4] = -1000.;
916  parom[5] = -1000.;
917  parom[6] = -1000.;
918  return 1000000.;
919  }
920 /* worst hit and ki2 */
921  xki2=0. ;
922  difmx=0. ;
923  for (i=0 ; i<nmxu ; i++ ){
924  t2=t[i]*t[i] ;
925  h= parom[0]+parom[1]*t[i]+parom[2]*t2+parom[3]*t2*t[i] ;
926  dif=(adcpj[i]-h)*mask[i] ;
927  if(dif > difmx) {
928  // iworst=i ;
929  difmx=dif ;
930  }
931  }
932  if(deglib > 0.5) xki2=xki2/deglib ;
933 /* amplitude and maximum position */
934  delta=parom[2]*parom[2]-3.*parom[3]*parom[1] ;
935  if(delta > 0.){
936  delta=sqrt(delta) ;
937  tm=-(delta+parom[2])/(3.*parom[3]) ;
938  tmp=(delta-parom[2])/(3.*parom[3]) ;
939  }
940  else{
941  parom[4] = -1000.;
942  parom[5] = -1000.;
943  parom[6] = -1000.;
944  return xki2 ;
945  }
946  parom[4]= tm ;
947  parom[5]= parom[0]+parom[1]*tm+parom[2]*tm*tm+parom[3]*tm*tm*tm ;
948  parom[6]= tmp ;
949  // printf("par --------> %f %f %f %f \n",parom[3],parom[2],parom[1],parom[0]);
950 
951  return xki2 ;
952 }
dbl * delta
Definition: mlp_gen.cc:36
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
#define dimmat
Definition: TFParams.h:42
double inverpj(int, double g[30][30], double ginv[30][30])
Definition: TFParams.cc:955
T sqrt(T t)
Definition: SSEVec.h:18
double f[11][100]
int k[5][pyjets_maxn]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double TFParams::fitpj ( double **  adcval,
double *  parout,
double **  db_i,
double  noise_val,
int  debug 
)

Definition at line 38 of file TFParams.cc.

References alpha, TtFullHadDaughter::B, pfBoostedDoubleSVAK8TagInfos_cfi::beta, patCaloMETCorrections_cff::C, vertices_cff::chi2, matrice::coeff, gather_cfg::cout, cree_mat(), cree_mat_prod(), delta, dt, mps_fire::i, createfilelist::int, gen::k, cmsBatch::log, nevt, nsamp, ntrack, protons_cff::t, X, DOFs::Y, and DOFs::Z.

Referenced by TShapeAnalysis::computeShape().

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

Definition at line 1017 of file TFParams.cc.

References mps_fire::i.

1018 {
1019 /* a[ligne][colonne] b[ligne][colonne] */
1020 int i , j ;
1021 double deter=0. ;
1022  b[0][0]=a[1][1]*a[2][2]-a[2][1]*a[1][2] ;
1023  b[1][1]=a[0][0]*a[2][2]-a[2][0]*a[0][2] ;
1024  b[2][2]=a[0][0]*a[1][1]-a[0][1]*a[1][0] ;
1025  printf("a[x][x] %e %e %e %e %e %e %e \n",a[0][0],a[1][1],a[0][1],a[1][0],
1026  a[0][0]*a[1][1],a[0][1]*a[1][0],b[2][2]);
1027  b[0][1]=a[2][1]*a[0][2]-a[0][1]*a[2][2] ;
1028  b[0][2]=a[0][1]*a[1][2]-a[1][1]*a[0][2] ;
1029  b[1][0]=a[1][2]*a[2][0]-a[1][0]*a[2][2] ;
1030  b[1][2]=a[1][0]*a[0][2]-a[0][0]*a[1][2] ;
1031  b[2][0]=a[1][0]*a[2][1]-a[1][1]*a[2][0] ;
1032  b[2][1]=a[0][1]*a[2][0]-a[0][0]*a[2][1] ;
1033  deter=a[0][0]*b[0][0] + a[1][0]*b[0][1] + a[2][0]*b[0][2] ;
1034  printf(" deter = %e \n",deter) ;
1035  for ( i=0 ; i<3 ; i++ ) {
1036  for ( j=0 ; j<3 ; j++ ) {
1037  printf(" avant division a[3][3] %d %d %e \n",i,j,a[i][j]) ;
1038  printf(" avant division b[3][3] %d %d %e %e \n",i,j,b[i][j],deter) ;
1039  b[i][j] = b[i][j]/deter ;
1040  printf(" valeur de b[3][3] apres division %d %d %e %e \n",i,j,b[i][j],deter) ;
1041  }
1042  }
1043  return deter ;
1044 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
double TFParams::inverpj ( int  n,
double  g[30][30],
double  ginv[30][30] 
)

Definition at line 955 of file TFParams.cc.

References dimmat, g, mps_fire::i, findQualityFiles::jj, gen::k, gen::n, alignCSCRings::r, alignCSCRings::s, and mathSSE::sqrt().

956 {
957 /* */
958 /* inversion d une matrice symetrique definie positive de taille n */
959 /* J.P. Pansart Novembre 99 */
960 /* */
961 int i , j , k , jj ;
962 double r , s ;
963 double deter=0 ;
964 double al[dimmat][dimmat] , be[dimmat][dimmat] ;
965 /* initialisation */
966  for( i=0 ; i<n ; i++ ) {
967  for ( j=0 ; j<n ; j++ ) {
968  al[i][j] = 0. ;
969  be[i][j] = 0. ;
970  }
971  }
972 /* decomposition en vecteurs sur une base orthonormee */
973  al[0][0] = sqrt( g[0][0] ) ;
974  for ( i=1 ; i<n ; i++ ) {
975  al[i][0] = g[0][i] / al[0][0] ;
976  for ( j=1 ; j<=i ; j++ ) {
977  s=0. ;
978  for ( k=0 ; k<=j-1 ; k++ ) {
979  s=s+ al[i][k] * al[j][k] ;
980  }
981  r= g[i][j] - s ;
982  if( j < i ) al[i][j] = r/al[j][j] ;
983  if( j == i ) al[i][j] = sqrt ( r) ;
984  }
985  }
986 /* inversion de la matrice al */
987  be[0][0] = 1./al[0][0] ;
988  for ( i=1 ; i<n ; i++ ) {
989  be[i][i] = 1. / al[i][i] ;
990  for ( j=0 ; j<i ; j++ ) {
991  jj=i-j-1 ;
992  s=0. ;
993  for ( k=jj+1 ; k<=i ; k++ ) {
994  s=s+ be[i][k] * al[k][jj] ;
995  }
996  be[i][jj]=-s/al[jj][jj] ;
997  }
998  }
999 /* calcul de la matrice ginv */
1000  for ( i=0 ; i<n ; i++ ) {
1001  for ( j=0 ; j<n ; j++ ) {
1002  s=0. ;
1003  for ( k=0 ; k<n ; k++ ) {
1004  s=s+ be[k][i] * be[k][j] ;
1005  }
1006  ginv[i][j]=s ;
1007  // if (debug==1){
1008  //printf("valeur de la matrice %d %d %f \n",i,j,ginv[i][j]) ;
1009  //}
1010  }
1011  }
1012  return deter ;
1013 }
#define dimmat
Definition: TFParams.h:42
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:18
int k[5][pyjets_maxn]
void TFParams::inverse_mat ( matrice  A,
matrice  M 
)

Definition at line 777 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

778 {
779 /* A[ligne][colonne] B[ligne][colonne] */
780 int i , j ;
781 double deter=0. ;
782 /* M est la matrice inverse de A */
783 
784  if(A.nb_lignes != A.nb_colonnes) {
785  printf( " attention matrice non inversible !!!! %d lignes %d colonnes \n",
786  A.nb_lignes,A.nb_colonnes) ;
787  return ;
788  }
789  zero_mat(M) ;
790  if(A.nb_lignes == 2) {
791  deter = A.coeff[0][0]*A.coeff[1][1] - A.coeff[0][1]*A.coeff[1][0] ;
792  M.coeff[0][0] = A.coeff[1][1]/deter ;
793  M.coeff[0][1] = -A.coeff[0][1]/deter ;
794  M.coeff[1][0] = -A.coeff[1][0]/deter ;
795  M.coeff[1][1] = A.coeff[0][0]/deter ;
796  }
797  else if(A.nb_lignes == 3) {
798  M.coeff[0][0]=A.coeff[1][1]*A.coeff[2][2]-A.coeff[2][1]*A.coeff[1][2] ;
799  M.coeff[1][1]=A.coeff[0][0]*A.coeff[2][2]-A.coeff[2][0]*A.coeff[0][2] ;
800 
801  M.coeff[2][2]=A.coeff[0][0]*A.coeff[1][1]-A.coeff[0][1]*A.coeff[1][0] ;
802  M.coeff[0][1]=A.coeff[2][1]*A.coeff[0][2]-A.coeff[0][1]*A.coeff[2][2] ;
803  M.coeff[0][2]=A.coeff[0][1]*A.coeff[1][2]-A.coeff[1][1]*A.coeff[0][2] ;
804  M.coeff[1][0]=A.coeff[1][2]*A.coeff[2][0]-A.coeff[1][0]*A.coeff[2][2] ;
805  M.coeff[1][2]=A.coeff[1][0]*A.coeff[0][2]-A.coeff[0][0]*A.coeff[1][2] ;
806  M.coeff[2][0]=A.coeff[1][0]*A.coeff[2][1]-A.coeff[1][1]*A.coeff[2][0] ;
807  M.coeff[2][1]=A.coeff[0][1]*A.coeff[2][0]-A.coeff[0][0]*A.coeff[2][1] ;
808  deter=A.coeff[0][0]*M.coeff[0][0]+A.coeff[1][0]*M.coeff[0][1]
809  +A.coeff[2][0]*M.coeff[0][2] ;
810  for ( i=0 ; i<3 ; i++ ) {
811  for ( j=0 ; j<3 ; j++ ) M.coeff[i][j] = M.coeff[i][j]/deter ;
812  }
813  }
814  else {
815  printf(" Attention , on ne peut inverser la MATRICE %d \n",A.nb_lignes) ;
816  return ;
817  }
818 
819  return ;
820 }
void zero_mat(matrice)
Definition: TFParams.cc:752
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
double TFParams::lastShape ( Double_t *  x,
Double_t *  par 
)

Definition at line 1083 of file TFParams.cc.

References alpha, pfBoostedDoubleSVAK8TagInfos_cfi::beta, dt, JetChargeProducer_cfi::exp, and dedxEstimators_cff::exponent.

1084 {
1085 
1086  Double_t fitfun;
1087  Double_t alpha, beta;
1088  Double_t dt,alphadt,exponent ;
1089  Double_t b1,b2 ;
1090  b1 = par[0] ;
1091  b2 = par[1] ;
1092  alpha = par[2] ;
1093  beta = par[3] ;
1094  dt= x[0] - b2 ;
1095  alphadt = alpha*dt ;
1096  exponent = -(alphadt+(exp(-alphadt)-1.))/beta ;
1097  fitfun = b1*exp(exponent) ;
1098  return fitfun;
1099 }
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
double TFParams::lastShape2 ( Double_t *  x,
Double_t *  par 
)

Definition at line 1100 of file TFParams.cc.

References alpha, pfBoostedDoubleSVAK8TagInfos_cfi::beta, dt, JetChargeProducer_cfi::exp, and dedxEstimators_cff::exponent.

1101 {
1102 
1103  Double_t fitfun;
1104  Double_t alpha, beta;
1105  Double_t dt,expo1,dt2,exponent ;
1106  Double_t b1,b2 ;
1107  b1 = par[0] ;
1108  b2 = par[1] ;
1109  alpha = par[2] ;
1110  beta = par[3] ;
1111  dt= x[0] - b2 ;
1112  expo1 = exp(-beta*dt) ;
1113  dt2 = dt*dt ;
1114  exponent = -(alpha*dt2+(expo1-1.)) ;
1115  fitfun = b1*exp(exponent) ;
1116  return fitfun;
1117 }
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
double TFParams::mixShape ( Double_t *  x,
Double_t *  par 
)

Definition at line 1193 of file TFParams.cc.

References alpha, pfBoostedDoubleSVAK8TagInfos_cfi::beta, dt, JetChargeProducer_cfi::exp, dedxEstimators_cff::exponent, fact, funct::pow(), and protons_cff::t.

1194 {
1195  Double_t fitval0,fitval;
1196  Double_t alpha,beta,fact,puiss;
1197  Double_t dt,alpha2dt,exponent ;
1198  Double_t b1,b2,alpha2,t ;
1199  b1 = par[0] ;
1200  b2 = par[1] ;
1201  alpha = par[2] ;
1202  alpha2 = par[3] ;
1203  beta = par[4] ;
1204 //
1205  t = x[0] ;
1206  dt= x[0]-b2 ;
1207 //
1208  if(t>0.) {
1209  fact = t/b2 ;
1210  puiss = pow(fact,alpha) ;
1211  fitval0 = puiss*exp(-alpha*dt/b2) ;
1212  }
1213  else
1214  {
1215  fitval0=1. ;
1216  }
1217  dt = x[0] - b2 ;
1218  alpha2dt = dt*alpha2 ;
1219  exponent = -(alpha2dt+(exp(-alpha2dt)-1.))/beta ;
1220  fitval = b1*fitval0*exp(exponent) ;
1221  return fitval;
1222 }
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
const double fact
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double TFParams::parab ( double *  ,
Int_t  ,
Int_t  ,
double *   
)

Definition at line 1154 of file TFParams.cc.

References dt, and gen::k.

1155 {
1156 /* Now we calculate the parabolic adjustement in order to get */
1157 /* maximum and time max */
1158 
1159  double denom,dt,amp1,amp2,amp3 ;
1160  double ampmax = 0. ;
1161  int imax = 0 ;
1162  int k ;
1163 /*
1164  */
1165  for ( k = nmin ; k < nmax ; k++) {
1166  if (ampl[k] > ampmax ) {
1167  ampmax = ampl[k] ;
1168  imax = k ;
1169  }
1170  }
1171  amp1 = ampl[imax-1] ;
1172  amp2 = ampl[imax] ;
1173  amp3 = ampl[imax+1] ;
1174  denom=2.*amp2-amp1-amp3 ;
1175 /* */
1176  if(denom>0.){
1177  dt =0.5*(amp3-amp1)/denom ;
1178  }
1179  else {
1180  //printf("denom =%f\n",denom) ;
1181  dt=0.5 ;
1182  }
1183 /* */
1184 /* ampmax correspond au maximum d'amplitude parabolique et dt */
1185 /* decalage en temps par rapport au sample maximum soit k + dt */
1186 
1187  parout[0] =amp2+(amp3-amp1)*dt*0.25 ;
1188  parout[1] = (double)imax + dt ;
1189  parout[2] = (double)imax ;
1190 return denom ;
1191 }
float dt
Definition: AMPTWrapper.h:126
int k[5][pyjets_maxn]
Double_t TFParams::polfit ( Int_t  ns,
Int_t  imax,
Double_t  par3d[10],
Double_t  errpj[30][30],
double *  adcpj 
)

Definition at line 821 of file TFParams.cc.

References dimmat, dimout, h, mps_fire::i, and heppy_batch::val.

823  {
824  double val , val2 , val3 , adfmx[dimmat] , parfp3[dimout] ;
825  double ius[dimmat], maskp3[dimmat] ;
826  double deglib,fit3,tm,h,xki2 ;
827  int i ,nus ,ilow,isup ;
828  val=adcpj[imax] ;
829  val2=val/2. ;
830  val3=val/3. ;
831  ilow=0 ;
832  isup=ns ;
833  deglib=-4. ;
834  for (i=0 ; i<ns ; i++ ){
835  deglib=deglib+1. ;
836  ius[i] = 1. ;
837  if((adcpj[i] < val3) && (i<imax) ){
838  ilow=i ;
839  }
840  if(adcpj[i] > val2 ){
841  isup=i ;
842  }
843  }
844  ilow=ilow+1 ;
845  if(ilow == imax )ilow=ilow-1 ;
846  if(isup-ilow < 3) isup=ilow+3 ;
847  nus=0 ;
848  for(i=ilow ; i<=isup ; i++){
849 
850  adfmx[nus]=adcpj[i] ;
851  maskp3[nus] =0. ;
852  if(ius[i] == 1) {
853  maskp3[nus]=1. ;
854  nus=nus+1 ;
855  }
856  }
857  if(nus < 4) return 10000. ;
858  xki2 = f3deg ( nus , parfp3 , maskp3 , adfmx , errpj ) ;
859  tm= parfp3[4] ;
860  h=parfp3[5] ;
861  tm=tm+(double)ilow ;
862  par3d[0] = h ;
863  par3d[1] = tm ;
864  fit3 = xki2 ;
865  return fit3 ;
866 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
#define dimmat
Definition: TFParams.h:42
double f3deg(int, double parom[10], double mask[30], double adcpj[30], double errpj[30][30])
Definition: TFParams.cc:867
int ns
Definition: TFParams.h:51
#define dimout
Definition: TFParams.h:43
void TFParams::print_mat ( matrice  M)

Definition at line 736 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

737 {
738  int i,j ;
739  if( M.coeff == nullptr)
740  {
741  printf(" erreur : affichage d'une matrice vide \n") ;
742  return;
743  }
744  printf(" m_nli %d M_ncol %d \n",M.nb_lignes,M.nb_colonnes) ;
745  for(i=0 ; i< M.nb_lignes; i++) {
746  for(j=0 ; j< M.nb_colonnes ; j++)
747  printf(" MATRICE i= %d j= %d ---> %e \n",i,j,M.coeff[i][j]) ;
748  }
749  //printf(" apres passage d'impression \n") ;
750  return ;
751 }
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::print_mat_nk ( matrice  M,
int  nk 
)

Definition at line 766 of file TFParams.cc.

References matrice::coeff, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

767 {
768  int j ;
769  if( M.coeff == nullptr)
770  printf(" erreur : affichage d'une matrice vide \n") ;
771  printf(" nk = %d m_nli %d M_ncol %d \n",nk,M.nb_lignes,M.nb_colonnes) ;
772  for(j=0 ; j< M.nb_colonnes ; j++)
773  printf(" MATRICE nk= %d j= %d ---> %e \n",nk,j,M.coeff[nk][j]) ;
774  printf(" apres passage d'impression \n") ;
775  return ;
776 }
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::produit_mat ( matrice  A,
matrice  B,
matrice  M 
)

Definition at line 566 of file TFParams.cc.

References matrice::coeff, mps_fire::i, gen::k, matrice::nb_colonnes, matrice::nb_lignes, nullptr, and mathSSE::return().

567 {
568  int i,j,k ;
569 // resultat du produit A*B = M
570  if(A.nb_colonnes != B.nb_lignes) {
571  printf( " Erreur : produit de matrices de tailles incompatibles \n ");
572  M.coeff = nullptr ;
573  return ;
574  }
575  M.nb_lignes = A.nb_lignes ;
576  M.nb_colonnes = B.nb_colonnes ;
577  zero_mat(M) ;
578  for(i=0 ; i< M.nb_lignes; i++) {
579  for(j=0 ; j< M.nb_colonnes ; j++) {
580  for(k=0 ; k< A.nb_colonnes; k++){
581  M.coeff[i][j] += A.coeff[i][k]*B.coeff[k][j] ;
582  }
583  }
584  }
585  return ;
586 }
#define nullptr
void zero_mat(matrice)
Definition: TFParams.cc:752
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int k[5][pyjets_maxn]
int nb_colonnes
Definition: TFParams.h:33
void TFParams::produit_mat_int ( matrice  A,
matrice  B,
matrice  M 
)

Definition at line 588 of file TFParams.cc.

References matrice::coeff, mps_fire::i, gen::k, matrice::nb_colonnes, matrice::nb_lignes, nullptr, and mathSSE::return().

589 {
590  int i,j,k ;
591  if(A.nb_colonnes != B.nb_lignes) {
592  printf( " Erreur : produit de matrices de tailles incompatibles \n ");
593  M.coeff = nullptr ;
594  return ;
595  }
596  M.nb_lignes = A.nb_lignes ;
597  M.nb_colonnes = B.nb_colonnes ;
598  for(i=0 ; i< M.nb_lignes; i++) {
599  for(j=0 ; j< M.nb_colonnes ; j++) {
600  for(k=0 ; k< A.nb_colonnes; k++){
601  M.coeff[i][j] += A.coeff[i][k]*B.coeff[k][j] ;
602  }
603  }
604  }
605  return ;
606 }
#define nullptr
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int k[5][pyjets_maxn]
int nb_colonnes
Definition: TFParams.h:33
double TFParams::pulseShapepj ( Double_t *  x,
Double_t *  par 
)

Definition at line 1046 of file TFParams.cc.

References alpha, pfBoostedDoubleSVAK8TagInfos_cfi::beta, dt, JetChargeProducer_cfi::exp, h, and funct::pow().

1047 {
1048 
1049  Double_t fitfun;
1050  Double_t ped, h, tm, alpha, beta;
1051  Double_t dt, dtsbeta, albet, variab, puiss;
1052  Double_t b1,b2,a1,a2 ;
1053  b1 = par[0] ;
1054  b2 = par[1] ;
1055  a1 = par[2] ;
1056  a2 = par[3] ;
1057 
1058  ped = 0. ;
1059  h = b1 ;
1060  tm = b2 ;
1061  alpha = a1 ;
1062  beta = a2 ;
1063  dt= x[0] - tm ;
1064  //printf(" par %f %f %f %f dt = %f albet = %f",b1,b2,a1,a2,dt,albet) ;
1065  albet = alpha*beta ;
1066  if( albet <= 0 )return( (Double_t)0. );
1067 
1068  if(dt > -albet) {
1069  dtsbeta=dt/beta ;
1070  variab=1.+dt/albet ;
1071  puiss=pow(variab,alpha);
1072  fitfun=h*puiss*exp(-dtsbeta) + ped;
1073  //printf(" dt = %f h = %f puiss = %f exp(-dtsbeta) %f \n",dt,h,puiss,
1074  // exp(-dtsbeta)) ;
1075  }
1076  else {
1077  fitfun = ped;
1078  }
1079 
1080  return fitfun;
1081 }
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Double_t TFParams::pulseShapepj2 ( Double_t *  x,
Double_t *  par 
)

Definition at line 1119 of file TFParams.cc.

References alpha, pfBoostedDoubleSVAK8TagInfos_cfi::beta, dt, JetChargeProducer_cfi::exp, h, and funct::pow().

1120 {
1121 
1122  Double_t fitfun;
1123  Double_t ped, h, /*tm,*/ alpha, beta;
1124  Double_t dt, dtsbeta, albet, variab, puiss;
1125  Double_t b1,/*b2,*/a1,a2 ;
1126  b1 = par[0] ;
1127  //b2 = par[1] ;
1128  a1 = par[2] ;
1129  a2 = par[3] ;
1130  ped = 0. ;
1131  h = b1 ;
1132  //tm = b2 ;
1133  alpha = a1 ;
1134  beta = a2 ;
1135  dt= x[0] ;
1136  albet = alpha*beta ;
1137  if( albet <= 0 )return( (Double_t)0. );
1138 
1139  if(dt > -albet) {
1140  dtsbeta=dt/beta ;
1141  variab=1.+dt/albet ;
1142  puiss=pow(variab,alpha);
1143  fitfun=h*puiss*exp(-dtsbeta) + ped;
1144  }
1145  else {
1146  fitfun = ped;
1147  }
1148 
1149  /* printf( "fitfun %f %f %f %f, %f %f %f\n", ped, h, tm, alpha, beta, *x, fitfun ); */
1150 
1151  return fitfun;
1152 }
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void TFParams::set_const ( int  n_samples,
int  sample_min,
int  sample_max,
double  alpha,
double  beta,
int  nevtmaximum 
)

Definition at line 552 of file TFParams.cc.

References alpha, pfBoostedDoubleSVAK8TagInfos_cfi::beta, and SDIM2.

Referenced by TShapeAnalysis::computeShape().

553  {
554 /*------------------------------------------------------------------------*/
555  ns = n_samples;
556  nsmin = sample_min ;
557  nsmax = sample_max ;
558  nevtmax = nevtmaximum ;
559  a1ini = alpha ;
560  a2ini = 0.0 ;
561  a3ini = beta ;
562  step_shape = .04;
563  METHODE = 2;
564  if(ns > SDIM2) printf("warning: NbOfsamples exceed maximum\n");
565 }
int nsmax
Definition: TFParams.h:53
double a1ini
Definition: TFParams.h:55
float alpha
Definition: AMPTWrapper.h:95
int nsmin
Definition: TFParams.h:52
double a2ini
Definition: TFParams.h:56
int nevtmax
Definition: TFParams.h:54
#define SDIM2
Definition: TFParams.h:26
int METHODE
Definition: TFParams.h:61
double a3ini
Definition: TFParams.h:57
int ns
Definition: TFParams.h:51
double step_shape
Definition: TFParams.h:58
void TFParams::somme_mat_int ( matrice  A,
matrice  M 
)

Definition at line 643 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, nullptr, and mathSSE::return().

644 {
645  int i,j;
646  /* resultat de la somme integree M += A */
647  if(A.nb_lignes != M.nb_lignes) {
648  printf( " Erreur : somme de matrices de tailles incompatibles \n ");
649  M.coeff = nullptr ;
650  return ;
651  }
652  M.nb_lignes = A.nb_lignes ;
653  M.nb_colonnes = A.nb_colonnes ;
654  for(i=0 ; i< M.nb_lignes; i++) {
655  for(j=0 ; j< M.nb_colonnes ; j++)
656  M.coeff[i][j] += A.coeff[i][j] ;
657  }
658  return ;
659 }
#define nullptr
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::somme_mat_int_scale ( matrice  A,
matrice  M,
double  delta 
)

Definition at line 660 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

661 {
662  int i,j ;
663  M.nb_lignes = A.nb_lignes ;
664  M.nb_colonnes = A.nb_colonnes ;
665  for(i=0 ; i< M.nb_lignes; i++) {
666  for(j=0 ; j< M.nb_colonnes ; j++) M.coeff[i][j] += A.coeff[i][j]*delta ;
667  }
668  return ;
669 }
dbl * delta
Definition: mlp_gen.cc:36
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::transpose_mat ( matrice  A,
matrice  M 
)

Definition at line 670 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

671 {
672  int i,j;
673 // resultat de la transposition = matrice M
674  for(i=0 ; i< A.nb_lignes; i++) {
675  for(j=0 ; j< A.nb_colonnes ; j++) {
676  M.coeff[j][i] = A.coeff[i][j] ;
677  }
678  }
679  return ;
680 }
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::zero_mat ( matrice  M)

Definition at line 752 of file TFParams.cc.

References matrice::coeff, mps_fire::i, matrice::nb_colonnes, matrice::nb_lignes, and mathSSE::return().

753 {
754  int i,j ;
755  for(i=0 ; i< M.nb_lignes; i++) {
756  for(j=0 ; j< M.nb_colonnes ; j++) M.coeff[i][j]=0. ;
757  }
758  return ;
759 }
double ** coeff
Definition: TFParams.h:34
return((rh^lh)&mask)
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::zero_mat_nk ( matrice  M,
int  nk 
)

Definition at line 760 of file TFParams.cc.

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

761 {
762  int j ;
763  for(j=0 ; j< M.nb_colonnes ; j++) M.coeff[nk][j]=0. ;
764  return ;
765 }
double ** coeff
Definition: TFParams.h:34
int nb_colonnes
Definition: TFParams.h:33

Member Data Documentation

double TFParams::a1ini
private

Definition at line 55 of file TFParams.h.

double TFParams::a2ini
private

Definition at line 56 of file TFParams.h.

double TFParams::a3ini
private

Definition at line 57 of file TFParams.h.

double TFParams::adclu[26]
private

Definition at line 59 of file TFParams.h.

int TFParams::METHODE
private

Definition at line 61 of file TFParams.h.

char TFParams::name_mat[10]

Definition at line 79 of file TFParams.h.

int TFParams::nevtmax
private

Definition at line 54 of file TFParams.h.

int TFParams::ns
private

Definition at line 51 of file TFParams.h.

int TFParams::nsmax
private

Definition at line 53 of file TFParams.h.

int TFParams::nsmin
private

Definition at line 52 of file TFParams.h.

double TFParams::step_shape
private

Definition at line 58 of file TFParams.h.

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

Definition at line 60 of file TFParams.h.