CMS 3D CMS Logo

ZIterativeAlgorithmWithFit.h
Go to the documentation of this file.
1 #ifndef ZITERATIVEALGORITHMWITHFIT_H
2 #define ZITERATIVEALGORITHMWITHFIT_H
3 
4 /* ******************************************
5  * ZIterativeAlgorithmWithFit.h
6  *
7  * Paolo Meridiani 06/03/2003
8  ********************************************/
9 
10 #include <TROOT.h>
11 #include <TClonesArray.h>
12 #include <vector>
13 #include <string>
14 #include <TH1.h>
15 
17 
21 
25 #define nMaxIterations 50
26 #define nMaxChannels 250
27 
29 public:
34  };
35 
38 
41  //, unsigned int events);
42 
45 
48 
49  bool resetIteration();
50 
51  bool iterate();
52 
54 
56 
58 
59  int getNumberOfChannels() const { return channels_; }
60 
61  const std::vector<float>& getOptimizedCoefficients() const { return optimizedCoefficients_; }
62 
63  const std::vector<float>& getOptimizedCoefficientsError() const { return optimizedCoefficientsError_; }
64 
65  const std::vector<float>& getOptimizedChiSquare() const { return optimizedChiSquare_; }
66 
67  const std::vector<int>& getOptimizedIterations() const { return optimizedIterations_; }
68 
69  const std::vector<float>& getWeightSum() const { return weight_sum_; }
70 
71  const std::vector<float>& getEpsilonSum() const { return calib_fac_; }
72 
73  //Helper Methods
74 
75  static inline float invMassCalc(float Energy1, float Eta1, float Phi1, float Energy2, float Eta2, float Phi2) {
76  return (sqrt(2 * Energy1 * Energy2 * (1 - cosTheta12(Eta1, Phi1, Eta2, Phi2))));
77  }
78 
79  static inline float cosTheta12(float Eta1, float Phi1, float Eta2, float Phi2) {
80  return ((cos(Phi1 - Phi2) + sinh(Eta1) * sinh(Eta2)) / (cosh(Eta1) * cosh(Eta2)));
81  }
82 
83  /*
84  static TF1* gausfit(TH1F * histoou,double* par,double* errpar) {
85  return gausfit(histoou,par,errpar,1.,2.);
86  }
87  */
88 
89  static void gausfit(
90  TH1F* histoou, double* par, double* errpar, float nsigmalow, float nsigmaup, double* mychi2, int* iterations);
91 
92 private:
93  void addWeightsCorrections(unsigned int event_id);
94 
95  void getStatWeights(const std::string& file);
96 
97  float getEventWeight(unsigned int event_id);
98 
100 
101  void recalculateMasses();
102 
104 
105  void getWeight(unsigned int evid, std::pair<calib::CalibElectron*, calib::CalibElectron*>, float);
106 
107  void getWeight(unsigned int evid, calib::CalibElectron* ele, float);
108 
109  void bookHistograms();
110 
112 
114 
115  unsigned int channels_;
116  unsigned int totalEvents_;
117  unsigned int numberOfIterations_;
118 
119  unsigned int currentEvent_;
120  unsigned int currentIteration_;
121 
122  std::vector<std::pair<calib::CalibElectron*, calib::CalibElectron*> > electrons_;
123 
124  std::vector<float> optimizedCoefficients_;
125  std::vector<float> optimizedCoefficientsError_;
126  std::vector<float> calib_fac_;
127  std::vector<float> weight_sum_;
128  std::vector<float> massReco_;
129  std::vector<float> optimizedChiSquare_;
130  std::vector<int> optimizedIterations_;
131 
133 
136 
137  std::vector<float> StatWeights_;
138  std::vector<float> Event_Weight_;
139 
140  TString calibType_;
141 
142  static const double M_Z_;
143 };
144 
145 #endif // ZIterativeAlgorithmWithFit_H
std::vector< std::pair< calib::CalibElectron *, calib::CalibElectron * > > electrons_
const std::vector< float > & getOptimizedCoefficientsError() const
ZIterativeAlgorithmWithFit()
Default constructor.
void getWeight(unsigned int evid, std::pair< calib::CalibElectron *, calib::CalibElectron *>, float)
virtual ~ZIterativeAlgorithmWithFit()
Destructor.
#define nMaxIterations
Definition: weight.py:1
bool addEvent(calib::CalibElectron *, calib::CalibElectron *, float)
std::vector< float > optimizedCoefficients_
static void gausfit(TH1F *histoou, double *par, double *errpar, float nsigmalow, float nsigmaup, double *mychi2, int *iterations)
void addWeightsCorrections(unsigned int event_id)
T sqrt(T t)
Definition: SSEVec.h:19
ZIterativeAlgorithmWithFit & operator=(const ZIterativeAlgorithmWithFit &r)
Assignment operator.
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define nMaxChannels
const ZIterativeAlgorithmWithFitPlots * getHistos() const
const std::vector< int > & getOptimizedIterations() const
const std::vector< float > & getWeightSum() const
float getEventWeight(unsigned int event_id)
const std::vector< float > & getOptimizedCoefficients() const
static float invMassCalc(float Energy1, float Eta1, float Phi1, float Energy2, float Eta2, float Phi2)
ZIterativeAlgorithmWithFitPlots * thePlots_
static float cosTheta12(float Eta1, float Phi1, float Eta2, float Phi2)
const std::vector< float > & getOptimizedChiSquare() const
void getStatWeights(const std::string &file)
std::vector< float > optimizedCoefficientsError_
const std::vector< float > & getEpsilonSum() const