CMS 3D CMS Logo

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