CMS 3D CMS Logo

BSFitter.h
Go to the documentation of this file.
1 #ifndef BeamSpotProducer_BSFitter_h
2 #define BeamSpotProducer_BSFitter_h
3 
15 // CMS
19 
20 // ROOT
21 #include "TMatrixD.h"
22 #include "TMath.h"
23 #include "Minuit2/VariableMetricMinimizer.h"
24 #include "TH1F.h"
25 
26 // C++ standard
27 #include <vector>
28 #include <string>
29 
30 class BSFitter {
31 public:
32  //typedef std::vector <BSTrkParameters> BSTrkCollection;
33 
34  BSFitter();
35  BSFitter(const std::vector<BSTrkParameters> &BSvector);
36 
37  virtual ~BSFitter();
38 
40 
42 
44 
45  reco::BeamSpot Fit(double *inipar);
46 
47  // Fit Z distribution with a gaussian
48  reco::BeamSpot Fit_z(std::string type, double *inipar);
49 
50  reco::BeamSpot Fit_z_chi2(double *inipar);
51  reco::BeamSpot Fit_z_likelihood(double *inipar);
52 
53  // Fit only d0-phi distribution with a chi2
55  void SetMaximumZ(double z) { fMaxZ = z; }
56  void SetConvergence(double val) { fconvergence = val; }
57  void SetMinimumNTrks(int n) { fminNtrks = n; }
58  void Setd0Cut_d0phi(double d0cut);
59  void SetChi2Cut_d0phi(double chi2cut);
61  int GetAcceptedTrks() { return ftmprow; }
62  void d0phi_Init() {
63  ftmprow = 0;
64  ftmp.ResizeTo(4, 1);
65  ftmp.Zero();
66  fnthite = 0;
67  goodfit = true;
68  }
69  std::vector<BSTrkParameters> GetData() { return fBSvector; }
70 
72 
73  reco::BeamSpot Fit_d_likelihood(double *inipar);
74  reco::BeamSpot Fit_d_z_likelihood(double *inipar, double *error_par);
75  reco::BeamSpot Fit_dres_z_likelihood(double *inipar);
76 
77  double scanPDF(double *init_pars, int &tracksFailed, int option);
78 
79  double GetMinimum() { return ff_minimum; }
80  double GetResPar0() { return fresolution_c0; }
81  double GetResPar1() { return fresolution_c1; }
82  double GetResPar0Err() { return fres_c0_err; }
83  double GetResPar1Err() { return fres_c1_err; }
84 
86 
87  TH1F *GetVzHisto() { return h1z; }
88 
89 private:
90  ROOT::Minuit2::ModularFunctionMinimizer *theFitter;
91  //BSzFcn* theGausszFcn;
93 
97 
98  double ff_minimum;
99 
100  static const int fdim = 7;
101 
103 
104  Double_t fsqrt2pi;
105 
106  std::vector<BSTrkParameters> fBSvector;
107  std::vector<BSTrkParameters> fBSvectorBW;
108 
111  double fres_c0_err;
112  double fres_c1_err;
114  //reco::BeamSpot fBSforCuts;
115  TMatrixD ftmp;
118  double fd0cut;
119  double fchi2cut;
120  int ftmprow;
121  int fnthite;
122  bool goodfit;
123  double fMaxZ;
124  double fconvergence;
127  TH1F *h1z;
128 };
129 
130 #endif
reco::BeamSpot Fit_d_likelihood(double *inipar)
Definition: BSFitter.cc:592
BeamType
beam spot flags
Definition: BeamSpot.h:24
reco::BeamSpot::ResCovMatrix GetResMatrix()
Definition: BSFitter.h:85
reco::BeamSpot::BeamType fbeamtype
Definition: BSFitter.h:94
virtual ~BSFitter()
Definition: BSFitter.cc:95
double fchi2cut
Definition: BSFitter.h:119
TH1F * h1z
Definition: BSFitter.h:127
std::vector< BSTrkParameters > fBSvector
Definition: BSFitter.h:106
reco::BeamSpot Fit()
Definition: BSFitter.cc:102
double fMaxZ
Definition: BSFitter.h:123
int GetAcceptedTrks()
Definition: BSFitter.h:61
reco::BeamSpot Fit_z_likelihood(double *inipar)
Definition: BSFitter.cc:255
double fresolution_c1
Definition: BSFitter.h:110
void SetMaximumZ(double z)
Definition: BSFitter.h:55
double GetResPar0Err()
Definition: BSFitter.h:82
int fminNtrks
Definition: BSFitter.h:125
void SetInputBeamWidth(double val)
Definition: BSFitter.h:60
static const int fdim
Definition: BSFitter.h:100
double GetResPar1()
Definition: BSFitter.h:81
double scanPDF(double *init_pars, int &tracksFailed, int option)
Definition: BSFitter.cc:625
bool goodfit
Definition: BSFitter.h:122
BSpdfsFcn * thePDF
Definition: BSFitter.h:92
reco::BeamSpot Fit_dres_z_likelihood(double *inipar)
Definition: BSFitter.cc:809
double fresolution_c0
Definition: BSFitter.h:109
double ff_minimum
Definition: BSFitter.h:98
std::string ffit_variable
Definition: BSFitter.h:96
double fres_c0_err
Definition: BSFitter.h:111
BSFitter()
Definition: BSFitter.cc:41
bool fapplychi2cut
Definition: BSFitter.h:117
double GetMinimum()
Definition: BSFitter.h:79
reco::BeamSpot Fit_z(std::string type, double *inipar)
double GetResPar0()
Definition: BSFitter.h:80
Double_t fsqrt2pi
Definition: BSFitter.h:104
std::string ffit_type
Definition: BSFitter.h:95
void d0phi_Init()
Definition: BSFitter.h:62
int ftmprow
Definition: BSFitter.h:120
TMatrixD ftmp
Definition: BSFitter.h:115
double fconvergence
Definition: BSFitter.h:124
std::string fpar_name[fdim]
Definition: BSFitter.h:102
reco::BeamSpot Fit_ited0phi()
Definition: BSFitter.cc:360
std::vector< BSTrkParameters > GetData()
Definition: BSFitter.h:69
void SetFitVariable(std::string name)
Definition: BSFitter.h:41
void SetMinimumNTrks(int n)
Definition: BSFitter.h:57
reco::BeamSpot Fit_z_chi2(double *inipar)
Definition: BSFitter.cc:321
bool fapplyd0cut
Definition: BSFitter.h:116
double GetResPar1Err()
Definition: BSFitter.h:83
void Setd0Cut_d0phi(double d0cut)
Definition: BSFitter.cc:576
std::vector< BSTrkParameters > fBSvectorBW
Definition: BSFitter.h:107
int fnthite
Definition: BSFitter.h:121
reco::BeamSpot::ResCovMatrix fres_matrix
Definition: BSFitter.h:113
double fd0cut
Definition: BSFitter.h:118
TH1F * GetVzHisto()
Definition: BSFitter.h:87
math::Error< resdim >::type ResCovMatrix
Definition: BeamSpot.h:33
void SetChi2Cut_d0phi(double chi2cut)
Definition: BSFitter.cc:584
ROOT::Minuit2::ModularFunctionMinimizer * theFitter
Definition: BSFitter.h:90
void SetConvergence(double val)
Definition: BSFitter.h:56
reco::BeamSpot Fit_d0phi()
Definition: BSFitter.cc:410
double finputBeamWidth
Definition: BSFitter.h:126
reco::BeamSpot Fit_d_z_likelihood(double *inipar, double *error_par)
Definition: BSFitter.cc:718
double fres_c1_err
Definition: BSFitter.h:112
void SetFitType(std::string type)
Definition: BSFitter.h:39