CMS 3D CMS Logo

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

#include <TMarkov.h>

Inheritance diagram for TMarkov:

Public Member Functions

int getBinMax () const
 
double getPeakValue (int i) const
 
void peakFinder (int *)
 
 TMarkov ()
 
virtual ~TMarkov ()
 

Private Member Functions

int computeChain (int *)
 
void init ()
 

Private Attributes

double binu [102]
 
int fNbinu
 
int fNPeakValues
 
int imax
 
double peak [3]
 
double u [101]
 

Detailed Description

Definition at line 6 of file TMarkov.h.

Constructor & Destructor Documentation

TMarkov::TMarkov ( )

Definition at line 16 of file TMarkov.cc.

References fNbinu, fNPeakValues, and init().

17 {
18  // TMarkov
19  // ------ calcule les distributions invariantes de la chaine de TMarkov
20  // correspondantes au spectre original et retourne la dimension de u.
21  //
22 
23  fNPeakValues=3;
24  fNbinu=101;
25  init();
26 }
void init()
Definition: TMarkov.cc:33
int fNbinu
Definition: TMarkov.h:11
int fNPeakValues
Definition: TMarkov.h:11
TMarkov::~TMarkov ( )
virtual

Definition at line 29 of file TMarkov.cc.

30 {
31 }

Member Function Documentation

int TMarkov::computeChain ( int *  bing)
private

Definition at line 42 of file TMarkov.cc.

References binu, create_public_lumi_plots::exp, i, gen::k, create_public_lumi_plots::log, m, evf::evtn::offset(), mathSSE::sqrt(), and u.

Referenced by peakFinder().

43 {
44  int i;int k;int nuprime;int offset=0;int m;int pass;
45  double sumUprime,sumU;
46  double jumpToNext,jumpToPrevious;
47  double chainToNext,chainToPrevious;
48  double aConst[101],uprime[101];
49 
50  pass=0;
51  for(m=3,i=1,nuprime=1;i<101;i++)
52  {
53  uprime[i]=0.;
54  for(k=1,jumpToNext=0.,jumpToPrevious=0.;k<=m;k++)
55  {
56  if(i+k < 101)
57  if(bing[i] > 0 || bing[i+k] > 0)
58  jumpToNext += exp( (double)(bing[i+k]-bing[i])
59  /sqrt((double)(bing[i+k]+bing[i])));
60  if(i-k > 0)
61  if(bing[i] > 0 || bing[i-k] > 0)
62  jumpToPrevious += exp( (double)(bing[i-k]-bing[i])
63  /sqrt((double)(bing[i-k]+bing[i])));
64  }
65  //printf(" jump %d to %d = %f\n",i,i+1,jumpToNext);
66  //printf(" jump %d to %d = %f\n",i,i-1,jumpToPrevious);
67  if(jumpToNext > 0. && jumpToPrevious > 0.)
68  {
69  aConst[i] = -log(jumpToNext+jumpToPrevious);
70  chainToNext = aConst[i]+log(jumpToNext);
71  chainToPrevious = aConst[i]+log(jumpToPrevious);
72  uprime[i]=chainToNext - chainToPrevious;
73  nuprime++; u[nuprime] = uprime[i];
74  if(pass == 0)
75  { offset=i-1; pass=1;}
76  }
77  }
78 
79  //for(i=1;i<101;i++)
80  //printf(" bin numero %d uprime = %f\n",i,uprime[i]);
81 
82  for(k=3,sumUprime=u[2],sumU=u[2];k<nuprime+1;k++)
83  {
84  sumU += u[k]; u[k] = sumU;
85  sumUprime += log(1.+exp(u[k]-u[k-1]));
86  }
87 
88  u[1] = -sumUprime;
89 
90  for(k=2;k<nuprime+1;k++)
91  u[k] += u[1];
92 
93  for(i=1;i<offset+1;i++)
94  binu[i]=0.;
95 
96  for(i=1;i<nuprime+1;i++)
97  {
98  binu[i+offset] = exp(u[i]);
99  //printf(" bin numero %d log(u) = %f\n",i+offset,u[i]);
100  //printf(" bin numero %d u = %f\n",i+offset,exp(u[i]));
101 
102  }
103 
104  return nuprime+offset;
105 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:48
double binu[102]
Definition: TMarkov.h:14
unsigned int offset(bool)
int k[5][pyjets_maxn]
double u[101]
Definition: TMarkov.h:14
int TMarkov::getBinMax ( ) const
inline

Definition at line 28 of file TMarkov.h.

References imax.

28 { return imax; }
int imax
Definition: TMarkov.h:12
double TMarkov::getPeakValue ( int  i) const
inline

Definition at line 27 of file TMarkov.h.

References i, and peak.

27 { return peak[i]; }
int i
Definition: DBlmapReader.cc:9
double peak[3]
Definition: TMarkov.h:13
void TMarkov::init ( )
private

Definition at line 33 of file TMarkov.cc.

References binu, fNbinu, fNPeakValues, i, peak, reco::return(), and u.

Referenced by TMarkov().

34 {
35  int i;
36  for(i=0;i<fNPeakValues;i++) peak[i]=0.;
37  for(i=0;i<fNbinu;i++) u[i]=0.;
38  for(i=0;i<=fNbinu;i++) binu[i]=0.;
39  return ;
40 }
int i
Definition: DBlmapReader.cc:9
int fNbinu
Definition: TMarkov.h:11
double binu[102]
Definition: TMarkov.h:14
double u[101]
Definition: TMarkov.h:14
double peak[3]
Definition: TMarkov.h:13
return(e1-e2)*(e1-e2)+dp *dp
int fNPeakValues
Definition: TMarkov.h:11
void TMarkov::peakFinder ( int *  bing)

Definition at line 107 of file TMarkov.cc.

References binu, computeChain(), i, imax, and peak.

108 {
109  int firstBin=0;int lastBin=0;
110  double barycentre=0.;
111  double sum=0.;
112  double maximum=0.;
113 
114  int nu= computeChain(&bing[0]);
115 
116  for(int i=1;i<nu+1;i++)
117  {
118  sum += binu[i];
119  barycentre += (double)i * binu[i];
120  if(binu[i] > maximum)
121  { maximum=binu[i]; imax=i; }
122  }
123 
124  maximum *= 0.75;
125  for(int i=1,pass=0;i<nu+1;i++) {
126  if(binu[i] > maximum) {
127  if(pass == 0) {
128  firstBin=i;
129  lastBin=i;
130  pass=1;
131  } else {
132  lastBin=i;
133  }
134  }
135  }
136 
137  peak[0] = (barycentre/sum);
138  peak[1]= (double)(lastBin-firstBin+1);
139  peak[2]= sum;
140 }
int i
Definition: DBlmapReader.cc:9
int imax
Definition: TMarkov.h:12
int computeChain(int *)
Definition: TMarkov.cc:42
double binu[102]
Definition: TMarkov.h:14
double peak[3]
Definition: TMarkov.h:13

Member Data Documentation

double TMarkov::binu[102]
private

Definition at line 14 of file TMarkov.h.

Referenced by computeChain(), init(), and peakFinder().

int TMarkov::fNbinu
private

Definition at line 11 of file TMarkov.h.

Referenced by init(), and TMarkov().

int TMarkov::fNPeakValues
private

Definition at line 11 of file TMarkov.h.

Referenced by init(), and TMarkov().

int TMarkov::imax
private

Definition at line 12 of file TMarkov.h.

Referenced by getBinMax(), and peakFinder().

double TMarkov::peak[3]
private

Definition at line 13 of file TMarkov.h.

Referenced by getPeakValue(), init(), and peakFinder().

double TMarkov::u[101]
private

Definition at line 14 of file TMarkov.h.

Referenced by computeChain(), and init().