CMS 3D CMS Logo

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

#include <MuonResidualsTwoBin.h>

Public Member Functions

double antisym (int parNum)
 
double errorerror (int parNum)
 
void fill (char charge, double *residual)
 
bool fit (Alignable *ali)
 
void fix (int parNum, bool value=true)
 
bool fixed (int parNum)
 
double loglikelihood ()
 
double mean (int which, double truncate)
 
double median (int which)
 
 MuonResidualsTwoBin (bool twoBin, MuonResidualsFitter *pos, MuonResidualsFitter *neg)
 
int ndata ()
 
int npar ()
 
long numResidualsNeg () const
 
long numResidualsPos () const
 
double numsegments ()
 
double plot (std::string name, TFileDirectory *dir, Alignable *ali)
 
void plotsimple (std::string name, TFileDirectory *dir, int which, double multiplier)
 
void plotweighted (std::string name, TFileDirectory *dir, int which, int whichredchi2, double multiplier)
 
void read (FILE *file, int which=0)
 
int residualsModel () const
 
std::vector< double * >
::const_iterator 
residualsNeg_begin () const
 
std::vector< double * >
::const_iterator 
residualsNeg_end () const
 
std::vector< double * >
::const_iterator 
residualsPos_begin () const
 
std::vector< double * >
::const_iterator 
residualsPos_end () const
 
void setPrintLevel (int printLevel) const
 
void setStrategy (int strategy) const
 
double stdev (int which, double truncate)
 
double sumofweights ()
 
int type () const
 
double value (int parNum)
 
double wmean (int which, int whichredchi2, double truncate)
 
void write (FILE *file, int which=0)
 
 ~MuonResidualsTwoBin ()
 

Protected Attributes

MuonResidualsFitterm_neg
 
MuonResidualsFitterm_pos
 
bool m_twoBin
 

Detailed Description

Date:
2009/10/08 02:20:59
Revision:
1.8
Author
J. Pivarski - Texas A&M University pivar.nosp@m.ski@.nosp@m.physi.nosp@m.cs.t.nosp@m.amu.e.nosp@m.du

Definition at line 15 of file MuonResidualsTwoBin.h.

Constructor & Destructor Documentation

MuonResidualsTwoBin::MuonResidualsTwoBin ( bool  twoBin,
MuonResidualsFitter pos,
MuonResidualsFitter neg 
)
inline

Definition at line 17 of file MuonResidualsTwoBin.h.

17 : m_twoBin(twoBin), m_pos(pos), m_neg(neg) {};
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
tuple twoBin
Definition: align_cfg.py:23
MuonResidualsTwoBin::~MuonResidualsTwoBin ( )
inline

Definition at line 18 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, and NULL.

18  {
19  if (m_pos != NULL) delete m_pos;
20  if (m_neg != NULL) delete m_neg;
21  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
#define NULL
Definition: scimark2.h:8

Member Function Documentation

double MuonResidualsTwoBin::antisym ( int  parNum)
inline

Definition at line 63 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, and MuonResidualsFitter::value().

63  {
64  return (m_twoBin ? ((m_pos->value(parNum) - m_neg->value(parNum)) / 2.) : 0.);
65  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
double value(int parNum)
double MuonResidualsTwoBin::errorerror ( int  parNum)
inline

Definition at line 60 of file MuonResidualsTwoBin.h.

References MuonResidualsFitter::errorerror(), m_neg, m_pos, m_twoBin, funct::pow(), and mathSSE::sqrt().

60  {
61  return (m_twoBin ? (sqrt(pow(m_pos->errorerror(parNum), 2.) + pow(m_neg->errorerror(parNum), 2.)) / 2.) : m_pos->errorerror(parNum));
62  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
T sqrt(T t)
Definition: SSEVec.h:28
double errorerror(int parNum)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void MuonResidualsTwoBin::fill ( char  charge,
double *  residual 
)
inline

Definition at line 49 of file MuonResidualsTwoBin.h.

References MuonResidualsFitter::fill(), m_neg, m_pos, and m_twoBin.

49  {
50  if (!m_twoBin || charge > 0) m_pos->fill(residual);
51  else m_neg->fill(residual);
52  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void fill(double *residual)
double charge(const std::vector< uint8_t > &Ampls)
bool MuonResidualsTwoBin::fit ( Alignable ali)
inline

Definition at line 54 of file MuonResidualsTwoBin.h.

References MuonResidualsFitter::fit(), m_neg, m_pos, and m_twoBin.

54  {
55  return (m_twoBin ? (m_pos->fit(ali) && m_neg->fit(ali)) : m_pos->fit(ali));
56  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
virtual bool fit(Alignable *ali)=0
void MuonResidualsTwoBin::fix ( int  parNum,
bool  value = true 
)
inline

Definition at line 30 of file MuonResidualsTwoBin.h.

References MuonResidualsFitter::fix(), m_neg, m_pos, and value().

30  {
31  m_pos->fix(parNum, value);
32  m_neg->fix(parNum, value);
33  };
double value(int parNum)
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void fix(int parNum, bool value=true)
bool MuonResidualsTwoBin::fixed ( int  parNum)
inline

Definition at line 35 of file MuonResidualsTwoBin.h.

References MuonResidualsFitter::fixed(), m_neg, and m_pos.

35  {
36  return m_pos->fixed(parNum) && m_neg->fixed(parNum);
37  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
bool fixed(int parNum)
double MuonResidualsTwoBin::loglikelihood ( )
inline

Definition at line 66 of file MuonResidualsTwoBin.h.

References MuonResidualsFitter::loglikelihood(), m_neg, m_pos, and m_twoBin.

66  {
68  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
double MuonResidualsTwoBin::mean ( int  which,
double  truncate 
)
inline

Definition at line 126 of file MuonResidualsTwoBin.h.

References m_twoBin, n, csvReporter::r, residualsNeg_begin(), residualsNeg_end(), residualsPos_begin(), residualsPos_end(), and value().

126  {
127  double sum = 0.;
128  double n = 0.;
129  for (std::vector<double*>::const_iterator r = residualsPos_begin(); r != residualsPos_end(); ++r) {
130  double value = (*r)[which];
131  if (fabs(value) < truncate) {
132  sum += value;
133  n += 1.;
134  }
135  }
136  if (m_twoBin) {
137  for (std::vector<double*>::const_iterator r = residualsNeg_begin(); r != residualsNeg_end(); ++r) {
138  double value = (*r)[which];
139  if (fabs(value) < truncate) {
140  sum += value;
141  n += 1.;
142  }
143  }
144  }
145  return sum/n;
146  };
double value(int parNum)
std::vector< double * >::const_iterator residualsPos_end() const
std::vector< double * >::const_iterator residualsNeg_end() const
std::vector< double * >::const_iterator residualsNeg_begin() const
std::vector< double * >::const_iterator residualsPos_begin() const
double MuonResidualsTwoBin::median ( int  which)
inline

Definition at line 111 of file MuonResidualsTwoBin.h.

References m_twoBin, csvReporter::r, residualsNeg_begin(), residualsNeg_end(), residualsPos_begin(), residualsPos_end(), and python.multivaluedict::sort().

111  {
112  std::vector<double> residuals;
113  for (std::vector<double*>::const_iterator r = residualsPos_begin(); r != residualsPos_end(); ++r) {
114  residuals.push_back((*r)[which]);
115  }
116  if (m_twoBin) {
117  for (std::vector<double*>::const_iterator r = residualsNeg_begin(); r != residualsNeg_end(); ++r) {
118  residuals.push_back((*r)[which]);
119  }
120  }
121  std::sort(residuals.begin(), residuals.end());
122  int length = residuals.size();
123  return residuals[length/2];
124  };
std::vector< double * >::const_iterator residualsPos_end() const
std::vector< double * >::const_iterator residualsNeg_end() const
std::vector< double * >::const_iterator residualsNeg_begin() const
std::vector< double * >::const_iterator residualsPos_begin() const
int MuonResidualsTwoBin::ndata ( )
inline

Definition at line 27 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, and MuonResidualsFitter::ndata().

27 { assert(m_pos->ndata() == m_neg->ndata()); return m_pos->ndata(); };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
virtual int ndata()=0
int MuonResidualsTwoBin::npar ( )
inline

Definition at line 26 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, and MuonResidualsFitter::npar().

26 { assert(m_pos->npar() == m_neg->npar()); return m_pos->npar(); };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
virtual int npar()=0
long MuonResidualsTwoBin::numResidualsNeg ( ) const
inline

Definition at line 25 of file MuonResidualsTwoBin.h.

References m_neg, and MuonResidualsFitter::numResiduals().

25 { return m_neg->numResiduals(); };
MuonResidualsFitter * m_neg
long numResiduals() const
long MuonResidualsTwoBin::numResidualsPos ( ) const
inline

Definition at line 24 of file MuonResidualsTwoBin.h.

References m_pos, and MuonResidualsFitter::numResiduals().

24 { return m_pos->numResiduals(); };
MuonResidualsFitter * m_pos
long numResiduals() const
double MuonResidualsTwoBin::numsegments ( )
inline

Definition at line 69 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, and MuonResidualsFitter::numsegments().

69  {
70  return (m_twoBin ? (m_pos->numsegments() + m_neg->numsegments()) : m_pos->numsegments());
71  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
double MuonResidualsTwoBin::plot ( std::string  name,
TFileDirectory dir,
Alignable ali 
)
inline

Definition at line 77 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, convertSQLitetoXML_cfg::output, and MuonResidualsFitter::plot().

77  {
78  if (m_twoBin) {
79  std::string namePos = name + std::string("Pos");
80  std::string nameNeg = name + std::string("Neg");
81  double output = 0.;
82  output += m_pos->plot(namePos, dir, ali);
83  output += m_neg->plot(nameNeg, dir, ali);
84  return output;
85  }
86  else {
87  return m_pos->plot(name, dir, ali);
88  }
89  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
virtual double plot(std::string name, TFileDirectory *dir, Alignable *ali)=0
void MuonResidualsTwoBin::plotsimple ( std::string  name,
TFileDirectory dir,
int  which,
double  multiplier 
)
inline

Definition at line 201 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, and MuonResidualsFitter::plotsimple().

201  {
202  if (m_twoBin) {
203  std::string namePos = name + std::string("Pos");
204  std::string nameNeg = name + std::string("Neg");
205  m_pos->plotsimple(namePos, dir, which, multiplier);
206  m_neg->plotsimple(nameNeg, dir, which, multiplier);
207  }
208  else {
209  m_pos->plotsimple(name, dir, which, multiplier);
210  }
211  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void plotsimple(std::string name, TFileDirectory *dir, int which, double multiplier)
void MuonResidualsTwoBin::plotweighted ( std::string  name,
TFileDirectory dir,
int  which,
int  whichredchi2,
double  multiplier 
)
inline

Definition at line 213 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, and MuonResidualsFitter::plotweighted().

213  {
214  if (m_twoBin) {
215  std::string namePos = name + std::string("Pos");
216  std::string nameNeg = name + std::string("Neg");
217  m_pos->plotweighted(namePos, dir, which, whichredchi2, multiplier);
218  m_neg->plotweighted(nameNeg, dir, which, whichredchi2, multiplier);
219  }
220  else {
221  m_pos->plotweighted(name, dir, which, whichredchi2, multiplier);
222  }
223  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void plotweighted(std::string name, TFileDirectory *dir, int which, int whichredchi2, double multiplier)
void MuonResidualsTwoBin::read ( FILE *  file,
int  which = 0 
)
inline
int MuonResidualsTwoBin::residualsModel ( ) const
inline

Definition at line 23 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, and MuonResidualsFitter::residualsModel().

23 { assert(m_pos->residualsModel() == m_neg->residualsModel()); return m_pos->residualsModel(); };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
std::vector<double*>::const_iterator MuonResidualsTwoBin::residualsNeg_begin ( ) const
inline

Definition at line 227 of file MuonResidualsTwoBin.h.

References m_neg, and MuonResidualsFitter::residuals_begin().

Referenced by mean(), median(), stdev(), and wmean().

227 { return m_neg->residuals_begin(); };
MuonResidualsFitter * m_neg
std::vector< double * >::const_iterator residuals_begin() const
std::vector<double*>::const_iterator MuonResidualsTwoBin::residualsNeg_end ( ) const
inline

Definition at line 228 of file MuonResidualsTwoBin.h.

References m_neg, and MuonResidualsFitter::residuals_end().

Referenced by mean(), median(), stdev(), and wmean().

228 { return m_neg->residuals_end(); };
MuonResidualsFitter * m_neg
std::vector< double * >::const_iterator residuals_end() const
std::vector<double*>::const_iterator MuonResidualsTwoBin::residualsPos_begin ( ) const
inline

Definition at line 225 of file MuonResidualsTwoBin.h.

References m_pos, and MuonResidualsFitter::residuals_begin().

Referenced by mean(), median(), stdev(), and wmean().

225 { return m_pos->residuals_begin(); };
MuonResidualsFitter * m_pos
std::vector< double * >::const_iterator residuals_begin() const
std::vector<double*>::const_iterator MuonResidualsTwoBin::residualsPos_end ( ) const
inline

Definition at line 226 of file MuonResidualsTwoBin.h.

References m_pos, and MuonResidualsFitter::residuals_end().

Referenced by mean(), median(), stdev(), and wmean().

226 { return m_pos->residuals_end(); };
MuonResidualsFitter * m_pos
std::vector< double * >::const_iterator residuals_end() const
void MuonResidualsTwoBin::setPrintLevel ( int  printLevel) const
inline

Definition at line 39 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, and MuonResidualsFitter::setPrintLevel().

39  {
40  m_pos->setPrintLevel(printLevel);
41  m_neg->setPrintLevel(printLevel);
42  }
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void setPrintLevel(int printLevel)
void MuonResidualsTwoBin::setStrategy ( int  strategy) const
inline

Definition at line 44 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, and MuonResidualsFitter::setStrategy().

44  {
45  m_pos->setStrategy(strategy);
46  m_neg->setStrategy(strategy);
47  }
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void setStrategy(int strategy)
double MuonResidualsTwoBin::stdev ( int  which,
double  truncate 
)
inline

Definition at line 176 of file MuonResidualsTwoBin.h.

References m_twoBin, n, funct::pow(), csvReporter::r, residualsNeg_begin(), residualsNeg_end(), residualsPos_begin(), residualsPos_end(), mathSSE::sqrt(), and value().

176  {
177  double sum2 = 0.;
178  double sum = 0.;
179  double n = 0.;
180  for (std::vector<double*>::const_iterator r = residualsPos_begin(); r != residualsPos_end(); ++r) {
181  double value = (*r)[which];
182  if (fabs(value) < truncate) {
183  sum2 += value*value;
184  sum += value;
185  n += 1.;
186  }
187  }
188  if (m_twoBin) {
189  for (std::vector<double*>::const_iterator r = residualsNeg_begin(); r != residualsNeg_end(); ++r) {
190  double value = (*r)[which];
191  if (fabs(value) < truncate) {
192  sum2 += value*value;
193  sum += value;
194  n += 1.;
195  }
196  }
197  }
198  return sqrt(sum2/n - pow(sum/n, 2));
199  };
double value(int parNum)
std::vector< double * >::const_iterator residualsPos_end() const
std::vector< double * >::const_iterator residualsNeg_end() const
T sqrt(T t)
Definition: SSEVec.h:28
std::vector< double * >::const_iterator residualsNeg_begin() const
std::vector< double * >::const_iterator residualsPos_begin() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double MuonResidualsTwoBin::sumofweights ( )
inline

Definition at line 72 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, and MuonResidualsFitter::sumofweights().

72  {
74  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
virtual double sumofweights()=0
int MuonResidualsTwoBin::type ( ) const
inline
double MuonResidualsTwoBin::value ( int  parNum)
inline
double MuonResidualsTwoBin::wmean ( int  which,
int  whichredchi2,
double  truncate 
)
inline

Definition at line 148 of file MuonResidualsTwoBin.h.

References m_twoBin, n, csvReporter::r, residualsNeg_begin(), residualsNeg_end(), residualsPos_begin(), residualsPos_end(), value(), and CommonMethods::weight().

148  {
149  double sum = 0.;
150  double n = 0.;
151  for (std::vector<double*>::const_iterator r = residualsPos_begin(); r != residualsPos_end(); ++r) {
152  double value = (*r)[which];
153  if (fabs(value) < truncate) {
154  double weight = 1./(*r)[whichredchi2];
155  if (TMath::Prob(1./weight*12, 12) < 0.99) {
156  sum += weight*value;
157  n += weight;
158  }
159  }
160  }
161  if (m_twoBin) {
162  for (std::vector<double*>::const_iterator r = residualsNeg_begin(); r != residualsNeg_end(); ++r) {
163  double value = (*r)[which];
164  if (fabs(value) < truncate) {
165  double weight = 1./(*r)[whichredchi2];
166  if (TMath::Prob(1./weight*12, 12) < 0.99) {
167  sum += weight*value;
168  n += weight;
169  }
170  }
171  }
172  }
173  return sum/n;
174  };
double value(int parNum)
std::vector< double * >::const_iterator residualsPos_end() const
std::vector< double * >::const_iterator residualsNeg_end() const
std::vector< double * >::const_iterator residualsNeg_begin() const
std::vector< double * >::const_iterator residualsPos_begin() const
void MuonResidualsTwoBin::write ( FILE *  file,
int  which = 0 
)
inline

Definition at line 92 of file MuonResidualsTwoBin.h.

References m_neg, m_pos, m_twoBin, and MuonResidualsFitter::write().

Referenced by MuonAlignmentFromReference::terminate().

92  {
93  if (m_twoBin) {
94  m_pos->write(file, 2*which);
95  m_neg->write(file, 2*which + 1);
96  }
97  else {
98  m_pos->write(file, which);
99  }
100  };
MuonResidualsFitter * m_neg
MuonResidualsFitter * m_pos
void write(FILE *file, int which=0)

Member Data Documentation

MuonResidualsFitter * MuonResidualsTwoBin::m_neg
protected
MuonResidualsFitter* MuonResidualsTwoBin::m_pos
protected
bool MuonResidualsTwoBin::m_twoBin
protected