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