CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 

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 i, and j.

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 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
double weight_matrix[10][10]
Definition: TFParams.h:60
TFParams::~TFParams ( )
inline

Definition at line 66 of file TFParams.h.

66 {};

Member Function Documentation

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

Definition at line 1223 of file TFParams.cc.

References dt, testEve_cfg::level, evf::evtn::offset(), and tablePrinter::width.

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

Definition at line 626 of file TFParams.cc.

References matrice::coeff, i, j, gen::k, matrice::nb_colonnes, matrice::nb_lignes, and hitfit::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 }
int i
Definition: DBlmapReader.cc:9
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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, i, j, matrice::nb_colonnes, matrice::nb_lignes, NULL, and hitfit::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 = NULL ;
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 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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 864 of file TFParams.cc.

References delta, dimmat, f, h, i, gen::k, prof2calltree::l, alignCSCRings::s, mathSSE::sqrt(), lumiQTWidget::t, and tmp.

864  {
865 /* */
866 /* fit 3rd degree polynomial */
867 /* nmxu = nb of samples in sample data array adcpj[]
868  parom values of parameters
869  errpj inverse of the error matrix
870  fplo3dg uses only the diagonal terms of errpj[][]
871 */
872  int i , k , l /*,iworst*/ ;
873  double h , t2 , tm , delta , tmp ;
874  double xki2 , dif , difmx , deglib ;
875  double t[dimmat] , f[dimmat][4] ;
876  double cov[dimmat][dimmat] , bv[4] , invcov[dimmat][dimmat] , s /*, deter*/ ;
877 
878  deglib=(double)nmxu - 4. ;
879  for ( i=0 ; i<nmxu ; i++ ) {
880  t[i]=i ;
881  f[i][0]=1. ;
882  f[i][1]=t[i] ;
883  f[i][2]=t[i]*t[i] ;
884  f[i][3]=f[i][2]*t[i] ;
885  }
886 /* computation of covariance matrix */
887  for ( k=0 ; k<4 ; k++ ) {
888  for ( l=0 ; l<4 ; l++ ) {
889  s=0. ;
890  for (i=0 ; i<nmxu ; i++ ) {
891  s=s+f[i][k]*f[i][l]*errpj[i][i]*mask[i] ;
892  }
893  cov[k][l]=s ;
894  }
895  s=0. ;
896  for (i=0 ; i<nmxu ; i++ ) {
897  s=s+f[i][k]*adcpj[i]*errpj[i][i]*mask[i] ;
898  }
899  bv[k]=s ;
900  }
901 /* parameters */
902  /*deter =*/ inverpj ( 4 , cov , invcov );
903  for ( k=0 ; k<4 ; k++ ) {
904  s=0. ;
905  for ( l=0 ; l<4 ; l++ ) {
906  s=s+bv[l]*invcov[l][k] ;
907  }
908  parom[k]=s ;
909  }
910 
911  if( parom[3] == 0. ){
912  parom[4] = -1000.;
913  parom[5] = -1000.;
914  parom[6] = -1000.;
915  return 1000000.;
916  }
917 /* worst hit and ki2 */
918  xki2=0. ;
919  difmx=0. ;
920  for (i=0 ; i<nmxu ; i++ ){
921  t2=t[i]*t[i] ;
922  h= parom[0]+parom[1]*t[i]+parom[2]*t2+parom[3]*t2*t[i] ;
923  dif=(adcpj[i]-h)*mask[i] ;
924  if(dif > difmx) {
925  // iworst=i ;
926  difmx=dif ;
927  }
928  }
929  if(deglib > 0.5) xki2=xki2/deglib ;
930 /* amplitude and maximum position */
931  delta=parom[2]*parom[2]-3.*parom[3]*parom[1] ;
932  if(delta > 0.){
933  delta=sqrt(delta) ;
934  tm=-(delta+parom[2])/(3.*parom[3]) ;
935  tmp=(delta-parom[2])/(3.*parom[3]) ;
936  }
937  else{
938  parom[4] = -1000.;
939  parom[5] = -1000.;
940  parom[6] = -1000.;
941  return xki2 ;
942  }
943  parom[4]= tm ;
944  parom[5]= parom[0]+parom[1]*tm+parom[2]*tm*tm+parom[3]*tm*tm*tm ;
945  parom[6]= tmp ;
946  // printf("par --------> %f %f %f %f \n",parom[3],parom[2],parom[1],parom[0]);
947 
948  return xki2 ;
949 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
#define dimmat
Definition: TFParams.h:42
double inverpj(int, double g[30][30], double ginv[30][30])
Definition: TFParams.cc:952
T sqrt(T t)
Definition: SSEVec.h:46
double f[11][100]
int k[5][pyjets_maxn]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
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, beta, funct::C, matrice::coeff, gather_cfg::cout, cree_mat(), cree_mat_prod(), delta, dt, i, j, gen::k, create_public_lumi_plots::log, nevt, nsamp, ntrack, lumiQTWidget::t, X, and Gflash::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
const double Z[kNumberCalorimeter]
double pulseShapepj(Double_t *, Double_t *)
Definition: TFParams.cc:1043
double a1ini
Definition: TFParams.h:55
const double beta
dbl * delta
Definition: mlp_gen.cc:36
float dt
Definition: AMPTWrapper.h:126
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
int nsmin
Definition: TFParams.h:52
double_binary B
Definition: DDStreamer.cc:234
#define X(str)
Definition: MuonsGrabber.cc:49
void somme_mat_int_scale(matrice, matrice, double)
Definition: TFParams.cc:660
void zero_mat(matrice)
Definition: TFParams.cc:749
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:1151
int j
Definition: DBlmapReader.cc:9
matrice cree_mat_prod(matrice, matrice)
Definition: TFParams.cc:681
int METHODE
Definition: TFParams.h:61
int k[5][pyjets_maxn]
matrice cree_mat(int, int)
Definition: TFParams.cc:701
double a3ini
Definition: TFParams.h:57
void inverse_mat(matrice, matrice)
Definition: TFParams.cc:774
int ns
Definition: TFParams.h:51
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
void produit_mat_int(matrice, matrice, matrice)
Definition: TFParams.cc:588
tuple cout
Definition: gather_cfg.py:121
void diff_mat(matrice, matrice, matrice)
Definition: TFParams.cc:607
#define ntrack
#define debug
Definition: MEtoEDMFormat.h:34
double TFParams::inv3x3 ( double  a[3][3],
double  b[3][3] 
)

Definition at line 1014 of file TFParams.cc.

References i, and j.

1015 {
1016 /* a[ligne][colonne] b[ligne][colonne] */
1017 int i , j ;
1018 double deter=0. ;
1019  b[0][0]=a[1][1]*a[2][2]-a[2][1]*a[1][2] ;
1020  b[1][1]=a[0][0]*a[2][2]-a[2][0]*a[0][2] ;
1021  b[2][2]=a[0][0]*a[1][1]-a[0][1]*a[1][0] ;
1022  printf("a[x][x] %e %e %e %e %e %e %e \n",a[0][0],a[1][1],a[0][1],a[1][0],
1023  a[0][0]*a[1][1],a[0][1]*a[1][0],b[2][2]);
1024  b[0][1]=a[2][1]*a[0][2]-a[0][1]*a[2][2] ;
1025  b[0][2]=a[0][1]*a[1][2]-a[1][1]*a[0][2] ;
1026  b[1][0]=a[1][2]*a[2][0]-a[1][0]*a[2][2] ;
1027  b[1][2]=a[1][0]*a[0][2]-a[0][0]*a[1][2] ;
1028  b[2][0]=a[1][0]*a[2][1]-a[1][1]*a[2][0] ;
1029  b[2][1]=a[0][1]*a[2][0]-a[0][0]*a[2][1] ;
1030  deter=a[0][0]*b[0][0] + a[1][0]*b[0][1] + a[2][0]*b[0][2] ;
1031  printf(" deter = %e \n",deter) ;
1032  for ( i=0 ; i<3 ; i++ ) {
1033  for ( j=0 ; j<3 ; j++ ) {
1034  printf(" avant division a[3][3] %d %d %e \n",i,j,a[i][j]) ;
1035  printf(" avant division b[3][3] %d %d %e %e \n",i,j,b[i][j],deter) ;
1036  b[i][j] = b[i][j]/deter ;
1037  printf(" valeur de b[3][3] apres division %d %d %e %e \n",i,j,b[i][j],deter) ;
1038  }
1039  }
1040  return deter ;
1041 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
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 952 of file TFParams.cc.

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

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

Definition at line 774 of file TFParams.cc.

References matrice::coeff, i, j, matrice::nb_colonnes, matrice::nb_lignes, and hitfit::return.

775 {
776 /* A[ligne][colonne] B[ligne][colonne] */
777 int i , j ;
778 double deter=0. ;
779 /* M est la matrice inverse de A */
780 
781  if(A.nb_lignes != A.nb_colonnes) {
782  printf( " attention matrice non inversible !!!! %d lignes %d colonnes \n",
783  A.nb_lignes,A.nb_colonnes) ;
784  return ;
785  }
786  zero_mat(M) ;
787  if(A.nb_lignes == 2) {
788  deter = A.coeff[0][0]*A.coeff[1][1] - A.coeff[0][1]*A.coeff[1][0] ;
789  M.coeff[0][0] = A.coeff[1][1]/deter ;
790  M.coeff[0][1] = -A.coeff[0][1]/deter ;
791  M.coeff[1][0] = -A.coeff[1][0]/deter ;
792  M.coeff[1][1] = A.coeff[0][0]/deter ;
793  }
794  else if(A.nb_lignes == 3) {
795  M.coeff[0][0]=A.coeff[1][1]*A.coeff[2][2]-A.coeff[2][1]*A.coeff[1][2] ;
796  M.coeff[1][1]=A.coeff[0][0]*A.coeff[2][2]-A.coeff[2][0]*A.coeff[0][2] ;
797 
798  M.coeff[2][2]=A.coeff[0][0]*A.coeff[1][1]-A.coeff[0][1]*A.coeff[1][0] ;
799  M.coeff[0][1]=A.coeff[2][1]*A.coeff[0][2]-A.coeff[0][1]*A.coeff[2][2] ;
800  M.coeff[0][2]=A.coeff[0][1]*A.coeff[1][2]-A.coeff[1][1]*A.coeff[0][2] ;
801  M.coeff[1][0]=A.coeff[1][2]*A.coeff[2][0]-A.coeff[1][0]*A.coeff[2][2] ;
802  M.coeff[1][2]=A.coeff[1][0]*A.coeff[0][2]-A.coeff[0][0]*A.coeff[1][2] ;
803  M.coeff[2][0]=A.coeff[1][0]*A.coeff[2][1]-A.coeff[1][1]*A.coeff[2][0] ;
804  M.coeff[2][1]=A.coeff[0][1]*A.coeff[2][0]-A.coeff[0][0]*A.coeff[2][1] ;
805  deter=A.coeff[0][0]*M.coeff[0][0]+A.coeff[1][0]*M.coeff[0][1]
806  +A.coeff[2][0]*M.coeff[0][2] ;
807  for ( i=0 ; i<3 ; i++ ) {
808  for ( j=0 ; j<3 ; j++ ) M.coeff[i][j] = M.coeff[i][j]/deter ;
809  }
810  }
811  else {
812  printf(" Attention , on ne peut inverser la MATRICE %d \n",A.nb_lignes) ;
813  return ;
814  }
815 
816  return ;
817 }
int i
Definition: DBlmapReader.cc:9
void zero_mat(matrice)
Definition: TFParams.cc:749
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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 1080 of file TFParams.cc.

References alpha, beta, dt, and create_public_lumi_plots::exp.

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

Definition at line 1097 of file TFParams.cc.

References alpha, beta, dt, and create_public_lumi_plots::exp.

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

Definition at line 1190 of file TFParams.cc.

References alpha, beta, dt, create_public_lumi_plots::exp, funct::pow(), and lumiQTWidget::t.

1191 {
1192  Double_t fitval0,fitval;
1193  Double_t alpha,beta,fact,puiss;
1194  Double_t dt,alpha2dt,exponent ;
1195  Double_t b1,b2,alpha2,t ;
1196  b1 = par[0] ;
1197  b2 = par[1] ;
1198  alpha = par[2] ;
1199  alpha2 = par[3] ;
1200  beta = par[4] ;
1201 //
1202  t = x[0] ;
1203  dt= x[0]-b2 ;
1204 //
1205  if(t>0.) {
1206  fact = t/b2 ;
1207  puiss = pow(fact,alpha) ;
1208  fitval0 = puiss*exp(-alpha*dt/b2) ;
1209  }
1210  else
1211  {
1212  fitval0=1. ;
1213  }
1214  dt = x[0] - b2 ;
1215  alpha2dt = dt*alpha2 ;
1216  exponent = -(alpha2dt+(exp(-alpha2dt)-1.))/beta ;
1217  fitval = b1*fitval0*exp(exponent) ;
1218  return fitval;
1219 }
const double beta
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
x
Definition: VDTMath.h:216
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 1151 of file TFParams.cc.

References dt, and gen::k.

1152 {
1153 /* Now we calculate the parabolic adjustement in order to get */
1154 /* maximum and time max */
1155 
1156  double denom,dt,amp1,amp2,amp3 ;
1157  double ampmax = 0. ;
1158  int imax = 0 ;
1159  int k ;
1160 /*
1161  */
1162  for ( k = nmin ; k < nmax ; k++) {
1163  if (ampl[k] > ampmax ) {
1164  ampmax = ampl[k] ;
1165  imax = k ;
1166  }
1167  }
1168  amp1 = ampl[imax-1] ;
1169  amp2 = ampl[imax] ;
1170  amp3 = ampl[imax+1] ;
1171  denom=2.*amp2-amp1-amp3 ;
1172 /* */
1173  if(denom>0.){
1174  dt =0.5*(amp3-amp1)/denom ;
1175  }
1176  else {
1177  //printf("denom =%f\n",denom) ;
1178  dt=0.5 ;
1179  }
1180 /* */
1181 /* ampmax correspond au maximum d'amplitude parabolique et dt */
1182 /* decalage en temps par rapport au sample maximum soit k + dt */
1183 
1184  parout[0] =amp2+(amp3-amp1)*dt*0.25 ;
1185  parout[1] = (double)imax + dt ;
1186  parout[2] = (double)imax ;
1187 return denom ;
1188 }
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 818 of file TFParams.cc.

References dimmat, dimout, h, and i.

820  {
821  double val , val2 , val3 , adfmx[dimmat] , parfp3[dimout] ;
822  double ius[dimmat], maskp3[dimmat] ;
823  double deglib,fit3,tm,h,xki2 ;
824  int i ,nus ,ilow,isup ;
825  val=adcpj[imax] ;
826  val2=val/2. ;
827  val3=val/3. ;
828  ilow=0 ;
829  isup=ns ;
830  deglib=-4. ;
831  for (i=0 ; i<ns ; i++ ){
832  deglib=deglib+1. ;
833  ius[i] = 1. ;
834  if((adcpj[i] < val3) && (i<imax) ){
835  ilow=i ;
836  }
837  if(adcpj[i] > val2 ){
838  isup=i ;
839  }
840  }
841  ilow=ilow+1 ;
842  if(ilow == imax )ilow=ilow-1 ;
843  if(isup-ilow < 3) isup=ilow+3 ;
844  nus=0 ;
845  for(i=ilow ; i<=isup ; i++){
846 
847  adfmx[nus]=adcpj[i] ;
848  maskp3[nus] =0. ;
849  if(ius[i] == 1) {
850  maskp3[nus]=1. ;
851  nus=nus+1 ;
852  }
853  }
854  if(nus < 4) return 10000. ;
855  xki2 = f3deg ( nus , parfp3 , maskp3 , adfmx , errpj ) ;
856  tm= parfp3[4] ;
857  h=parfp3[5] ;
858  tm=tm+(double)ilow ;
859  par3d[0] = h ;
860  par3d[1] = tm ;
861  fit3 = xki2 ;
862  return fit3 ;
863 }
int i
Definition: DBlmapReader.cc:9
#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:864
int ns
Definition: TFParams.h:51
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define dimout
Definition: TFParams.h:43
void TFParams::print_mat ( matrice  M)

Definition at line 736 of file TFParams.cc.

References matrice::coeff, i, j, matrice::nb_colonnes, matrice::nb_lignes, NULL, and hitfit::return.

737 {
738  int i,j ;
739  if( M.coeff == NULL)
740  printf(" erreur : affichage d'une matrice vide \n") ;
741  printf(" m_nli %d M_ncol %d \n",M.nb_lignes,M.nb_colonnes) ;
742  for(i=0 ; i< M.nb_lignes; i++) {
743  for(j=0 ; j< M.nb_colonnes ; j++)
744  printf(" MATRICE i= %d j= %d ---> %e \n",i,j,M.coeff[i][j]) ;
745  }
746  //printf(" apres passage d'impression \n") ;
747  return ;
748 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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 763 of file TFParams.cc.

References matrice::coeff, j, matrice::nb_colonnes, matrice::nb_lignes, NULL, and hitfit::return.

764 {
765  int j ;
766  if( M.coeff == NULL)
767  printf(" erreur : affichage d'une matrice vide \n") ;
768  printf(" nk = %d m_nli %d M_ncol %d \n",nk,M.nb_lignes,M.nb_colonnes) ;
769  for(j=0 ; j< M.nb_colonnes ; j++)
770  printf(" MATRICE nk= %d j= %d ---> %e \n",nk,j,M.coeff[nk][j]) ;
771  printf(" apres passage d'impression \n") ;
772  return ;
773 }
#define NULL
Definition: scimark2.h:8
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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, i, j, gen::k, matrice::nb_colonnes, matrice::nb_lignes, NULL, and hitfit::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 = NULL ;
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 }
int i
Definition: DBlmapReader.cc:9
void zero_mat(matrice)
Definition: TFParams.cc:749
#define NULL
Definition: scimark2.h:8
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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, i, j, gen::k, matrice::nb_colonnes, matrice::nb_lignes, NULL, and hitfit::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 = NULL ;
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 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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 1043 of file TFParams.cc.

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

1044 {
1045 
1046  Double_t fitfun;
1047  Double_t ped, h, tm, alpha, beta;
1048  Double_t dt, dtsbeta, albet, variab, puiss;
1049  Double_t b1,b2,a1,a2 ;
1050  b1 = par[0] ;
1051  b2 = par[1] ;
1052  a1 = par[2] ;
1053  a2 = par[3] ;
1054 
1055  ped = 0. ;
1056  h = b1 ;
1057  tm = b2 ;
1058  alpha = a1 ;
1059  beta = a2 ;
1060  dt= x[0] - tm ;
1061  //printf(" par %f %f %f %f dt = %f albet = %f",b1,b2,a1,a2,dt,albet) ;
1062  albet = alpha*beta ;
1063  if( albet <= 0 )return( (Double_t)0. );
1064 
1065  if(dt > -albet) {
1066  dtsbeta=dt/beta ;
1067  variab=1.+dt/albet ;
1068  puiss=pow(variab,alpha);
1069  fitfun=h*puiss*exp(-dtsbeta) + ped;
1070  //printf(" dt = %f h = %f puiss = %f exp(-dtsbeta) %f \n",dt,h,puiss,
1071  // exp(-dtsbeta)) ;
1072  }
1073  else {
1074  fitfun = ped;
1075  }
1076 
1077  return fitfun;
1078 }
const double beta
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
x
Definition: VDTMath.h:216
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 1116 of file TFParams.cc.

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

1117 {
1118 
1119  Double_t fitfun;
1120  Double_t ped, h, /*tm,*/ alpha, beta;
1121  Double_t dt, dtsbeta, albet, variab, puiss;
1122  Double_t b1,/*b2,*/a1,a2 ;
1123  b1 = par[0] ;
1124  //b2 = par[1] ;
1125  a1 = par[2] ;
1126  a2 = par[3] ;
1127  ped = 0. ;
1128  h = b1 ;
1129  //tm = b2 ;
1130  alpha = a1 ;
1131  beta = a2 ;
1132  dt= x[0] ;
1133  albet = alpha*beta ;
1134  if( albet <= 0 )return( (Double_t)0. );
1135 
1136  if(dt > -albet) {
1137  dtsbeta=dt/beta ;
1138  variab=1.+dt/albet ;
1139  puiss=pow(variab,alpha);
1140  fitfun=h*puiss*exp(-dtsbeta) + ped;
1141  }
1142  else {
1143  fitfun = ped;
1144  }
1145 
1146  /* printf( "fitfun %f %f %f %f, %f %f %f\n", ped, h, tm, alpha, beta, *x, fitfun ); */
1147 
1148  return fitfun;
1149 }
const double beta
float dt
Definition: AMPTWrapper.h:126
float alpha
Definition: AMPTWrapper.h:95
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
x
Definition: VDTMath.h:216
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, 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
const double beta
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, i, j, matrice::nb_colonnes, matrice::nb_lignes, NULL, and hitfit::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 = NULL ;
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 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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, i, j, matrice::nb_colonnes, matrice::nb_lignes, and hitfit::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
int i
Definition: DBlmapReader.cc:9
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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, i, j, matrice::nb_colonnes, matrice::nb_lignes, and hitfit::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 }
int i
Definition: DBlmapReader.cc:9
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
int nb_lignes
Definition: TFParams.h:32
int nb_colonnes
Definition: TFParams.h:33
void TFParams::zero_mat ( matrice  M)

Definition at line 749 of file TFParams.cc.

References matrice::coeff, i, j, matrice::nb_colonnes, matrice::nb_lignes, and hitfit::return.

750 {
751  int i,j ;
752  for(i=0 ; i< M.nb_lignes; i++) {
753  for(j=0 ; j< M.nb_colonnes ; j++) M.coeff[i][j]=0. ;
754  }
755  return ;
756 }
int i
Definition: DBlmapReader.cc:9
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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 757 of file TFParams.cc.

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

758 {
759  int j ;
760  for(j=0 ; j< M.nb_colonnes ; j++) M.coeff[nk][j]=0. ;
761  return ;
762 }
double ** coeff
Definition: TFParams.h:34
int j
Definition: DBlmapReader.cc:9
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.