CMS 3D CMS Logo

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 ()
 
 ~TMarkov () override
 

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::TMarkov ( )

Definition at line 15 of file TMarkov.cc.

15  {
16  // TMarkov
17  // ------ calcule les distributions invariantes de la chaine de TMarkov
18  // correspondantes au spectre original et retourne la dimension de u.
19  //
20 
21  fNPeakValues = 3;
22  fNbinu = 101;
23  init();
24 }

References fNbinu, fNPeakValues, and init().

◆ ~TMarkov()

TMarkov::~TMarkov ( )
override

Definition at line 27 of file TMarkov.cc.

27 {}

Member Function Documentation

◆ computeChain()

int TMarkov::computeChain ( int *  bing)
private

Definition at line 40 of file TMarkov.cc.

40  {
41  int i;
42  int k;
43  int nuprime;
44  int offset = 0;
45  int m;
46  int pass;
47  double sumUprime, sumU;
48  double jumpToNext, jumpToPrevious;
49  double chainToNext, chainToPrevious;
50  double aConst[101], uprime[101];
51 
52  pass = 0;
53  for (m = 3, i = 1, nuprime = 1; i < 101; i++) {
54  uprime[i] = 0.;
55  for (k = 1, jumpToNext = 0., jumpToPrevious = 0.; k <= m; k++) {
56  if (i + k < 101)
57  if (bing[i] > 0 || bing[i + k] > 0)
58  jumpToNext += exp((double)(bing[i + k] - bing[i]) / sqrt((double)(bing[i + k] + bing[i])));
59  if (i - k > 0)
60  if (bing[i] > 0 || bing[i - k] > 0)
61  jumpToPrevious += exp((double)(bing[i - k] - bing[i]) / sqrt((double)(bing[i - k] + bing[i])));
62  }
63  //printf(" jump %d to %d = %f\n",i,i+1,jumpToNext);
64  //printf(" jump %d to %d = %f\n",i,i-1,jumpToPrevious);
65  if (jumpToNext > 0. && jumpToPrevious > 0.) {
66  aConst[i] = -log(jumpToNext + jumpToPrevious);
67  chainToNext = aConst[i] + log(jumpToNext);
68  chainToPrevious = aConst[i] + log(jumpToPrevious);
69  uprime[i] = chainToNext - chainToPrevious;
70  nuprime++;
71  u[nuprime] = uprime[i];
72  if (pass == 0) {
73  offset = i - 1;
74  pass = 1;
75  }
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  sumU += u[k];
84  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  binu[i + offset] = exp(u[i]);
98  //printf(" bin numero %d log(u) = %f\n",i+offset,u[i]);
99  //printf(" bin numero %d u = %f\n",i+offset,exp(u[i]));
100  }
101 
102  return nuprime + offset;
103 }

References binu, JetChargeProducer_cfi::exp, mps_fire::i, dqmdumpme::k, dqm-mbProfile::log, visualization-live-secondInstance_cfg::m, hltrates_dqm_sourceclient-live_cfg::offset, mathSSE::sqrt(), and u.

Referenced by peakFinder().

◆ getBinMax()

int TMarkov::getBinMax ( ) const
inline

Definition at line 25 of file TMarkov.h.

25 { return imax; }

References imax.

◆ getPeakValue()

double TMarkov::getPeakValue ( int  i) const
inline

Definition at line 24 of file TMarkov.h.

24 { return peak[i]; }

References mps_fire::i, and peak.

Referenced by TMatacq::findPeak(), and TMom::getPeak().

◆ init()

void TMarkov::init ( )
private

Definition at line 29 of file TMarkov.cc.

29  {
30  int i;
31  for (i = 0; i < fNPeakValues; i++)
32  peak[i] = 0.;
33  for (i = 0; i < fNbinu; i++)
34  u[i] = 0.;
35  for (i = 0; i <= fNbinu; i++)
36  binu[i] = 0.;
37  return;
38 }

References binu, fNbinu, fNPeakValues, mps_fire::i, peak, and u.

Referenced by TMarkov().

◆ peakFinder()

void TMarkov::peakFinder ( int *  bing)

Definition at line 105 of file TMarkov.cc.

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

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

Referenced by TMatacq::findPeak(), and TMom::getPeak().

Member Data Documentation

◆ binu

double TMarkov::binu[102]
private

Definition at line 11 of file TMarkov.h.

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

◆ fNbinu

int TMarkov::fNbinu
private

Definition at line 8 of file TMarkov.h.

Referenced by init(), and TMarkov().

◆ fNPeakValues

int TMarkov::fNPeakValues
private

Definition at line 8 of file TMarkov.h.

Referenced by init(), and TMarkov().

◆ imax

int TMarkov::imax
private

Definition at line 9 of file TMarkov.h.

Referenced by getBinMax(), and peakFinder().

◆ peak

double TMarkov::peak[3]
private

Definition at line 10 of file TMarkov.h.

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

◆ u

double TMarkov::u[101]
private

Definition at line 11 of file TMarkov.h.

Referenced by computeChain(), and init().

TMarkov::binu
double binu[102]
Definition: TMarkov.h:11
TMarkov::peak
double peak[3]
Definition: TMarkov.h:10
TMarkov::imax
int imax
Definition: TMarkov.h:9
mps_fire.i
i
Definition: mps_fire.py:428
TMarkov::fNPeakValues
int fNPeakValues
Definition: TMarkov.h:8
TMarkov::init
void init()
Definition: TMarkov.cc:29
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqmdumpme.k
k
Definition: dqmdumpme.py:60
TMarkov::u
double u[101]
Definition: TMarkov.h:11
TMarkov::fNbinu
int fNbinu
Definition: TMarkov.h:8
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
TMarkov::computeChain
int computeChain(int *)
Definition: TMarkov.cc:40
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82