1 #ifndef Alignment_MuonAlignmentAlgorithms_MuonResidualsFitter_H
2 #define Alignment_MuonAlignmentAlgorithms_MuonResidualsFitter_H
12 #ifndef STANDALONE_FITTER
24 #include "TMatrixDSym.h"
33 #ifdef STANDALONE_FITTER
42 double width() {
return 300.;}
43 double length() {
return 300.;}
52 template<
typename T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
53 T *
make(
const A1 &a1,
const A2 &a2,
const A3 &a3,
const A4 &a4,
const A5 &a5 )
const {
T *
t =
new T(a1, a2, a3, a4, a5);
return t; }
54 template<
typename T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
typename A6,
typename A7>
55 T *
make(
const A1 &a1,
const A2 &a2,
const A3 &a3,
const A4 &a4,
const A5 &a5,
const A6 &a6,
const A7 &a7)
const {
T *
t =
new T(a1, a2, a3, a4, a5, a6, a7);
return t; }
56 template<
typename T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
typename A6,
typename A7,
typename A8>
57 T *
make(
const A1 &a1,
const A2 &a2,
const A3 &a3,
const A4 &a4,
const A5 &a5,
const A6 &a6,
const A7 &a7,
const A8 &a8)
const {
T *
t =
new T(a1, a2, a3, a4, a5, a6, a7, a8);
return t; }
76 #endif // STANDALONE_FITTER
135 throw cms::Exception(
"MuonResidualsFitter") <<
"unrecognized residualsModel";
141 delete [] (*residual);
145 virtual int type()
const = 0;
146 virtual int npar() = 0;
147 virtual int ndata() = 0;
153 void fix(
int parNum,
bool val=
true)
155 assert(0 <= parNum && parNum <
npar());
162 assert(0 <= parNum && parNum <
npar());
163 if (
m_fixed.size() == 0)
return false;
183 double value(
int parNum) { assert(0 <= parNum && parNum <
npar());
return m_value[parNum]; }
193 assert(0 <= parNum1 && parNum1 <
npar());
194 assert(0 <= parNum2 && parNum2 <
npar());
217 #ifdef STANDALONE_FITTER
220 bool fit() {
return fit(&m_ali); }
221 virtual double plot(std::string &
name) {
return plot(name, &m_dir, &m_ali); }
223 void plotweighted(std::string &
name,
int which,
int whichredchi2,
double multiplier) {
plotweighted(name, &m_dir, which, whichredchi2, multiplier); }
248 bool dofit(
void (*
fcn)(
int&,
double*,
double&,
double*,
int), std::vector<int> &parNum, std::vector<std::string> &parName, std::vector<double> &
start, std::vector<double> &
step, std::vector<double> &low, std::vector<double> &high);
249 virtual void inform(TMinuit *tMinuit) = 0;
283 #ifdef STANDALONE_FITTER
287 #ifdef STANDALONE_FITTER
306 #endif // Alignment_MuonAlignmentAlgorithms_MuonResidualsFitter_H
virtual char const * what() const
void histogramChi2GaussianFit(int which, double &fit_mean, double &fit_sigma)
double MuonResidualsFitter_logGaussPowerTails(double residual, double center, double sigma)
double MuonResidualsFitter_integrate_pureGaussian(double low, double high, double center, double sigma)
Double_t MuonResidualsFitter_powerLawTails_TF1(Double_t *xvec, Double_t *par)
virtual void inform(TMinuit *tMinuit)=0
void computeHistogramRangeAndBinning(int which, int &nbins, double &a, double &b)
void fix(int parNum, bool val=true)
void selectPeakResiduals(double nsigma, int nvar, int *vars)
double MuonResidualsFitter_logPureGaussian2D(double x, double y, double x0, double y0, double sx, double sy, double r)
void write(FILE *file, int which=0)
long numResiduals() const
double covarianceElement(int parNum1, int parNum2)
void eraseNotSelectedResiduals()
int parNum2parIdx(int parNum)
std::vector< double > m_error
void read(FILE *file, int which=0)
void MuonResidualsPositionFitter_FCN(int &npar, double *gin, double &fval, double *par, int iflag)
virtual bool fit(Alignable *ali)=0
void fill(double *residual)
MuonResidualsFitter * fitter()
int residualsModel() const
TMatrixDSym covarianceMatrix()
bool dofit(void(*fcn)(int &, double *, double &, double *, int), std::vector< int > &parNum, std::vector< std::string > &parName, std::vector< double > &start, std::vector< double > &step, std::vector< double > &low, std::vector< double > &high)
double MuonResidualsFitter_logROOTVoigt(double residual, double center, double sigma, double gamma)
double MuonResidualsFitter_compute_log_convolution(double toversigma, double gammaoversigma, double max=1000., double step=0.001, double power=4.)
TMatrixDSym correlationMatrix()
std::vector< double > m_value
std::vector< double * > m_residuals
const T & max(const T &a, const T &b)
virtual ~MuonResidualsFitter()
double MuonResidualsFitter_logPowerLawTails(double residual, double center, double sigma, double gamma)
MuonResidualsFitter(int residualsModel, int minHits, int useResiduals, bool weightAlignment=true)
std::vector< bool > m_residuals_ok
Double_t MuonResidualsFitter_GaussPowerTails_TF1(Double_t *xvec, Double_t *par)
std::map< int, int > m_parNum2parIdx
friend detail::Desired< E, detail::is_derived_or_same< Exception, E >::value >::type & operator<<(E &e, T const &stuff)
virtual void correctBField()=0
virtual double plot(std::string name, TFileDirectory *dir, Alignable *ali)=0
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Double_t MuonResidualsFitter_pureGaussian_TF1(Double_t *xvec, Double_t *par)
void plotsimple(std::string name, TFileDirectory *dir, int which, double multiplier)
void setStrategy(int strategy)
virtual double sumofweights()=0
MuonResidualsFitter * m_fitter
double errorerror(int parNum)
void fcn(int &, double *, double &, double *, int)
std::vector< double * >::const_iterator residuals_end() const
std::vector< bool > & selectedResidualsFlags()
Exception(std::string const &aCategory)
void plotweighted(std::string name, TFileDirectory *dir, int which, int whichredchi2, double multiplier)
void MuonResidualsAngleFitter_FCN(int &npar, double *gin, double &fval, double *par, int iflag)
T * make() const
make new ROOT object
void selectPeakResiduals_simple(double nsigma, int nvar, int *vars)
std::vector< bool > m_fixed
void setPrintLevel(int printLevel)
Double_t MuonResidualsFitter_ROOTVoigt_TF1(Double_t *xvec, Double_t *par)
std::vector< double * >::const_iterator residuals_begin() const
virtual int type() const =0
MuonResidualsFitterFitInfo(MuonResidualsFitter *fitter)
double MuonResidualsFitter_logPureGaussian(double residual, double center, double sigma)