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