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
ZIterativeAlgorithmWithFit::totalEvents_
unsigned int totalEvents_
Definition: ZIterativeAlgorithmWithFit.h:116
ZIterativeAlgorithmWithFit::optimizedIterations_
std::vector< int > optimizedIterations_
Definition: ZIterativeAlgorithmWithFit.h:130
ZIterativeAlgorithmWithFit::calib_fac_
std::vector< float > calib_fac_
Definition: ZIterativeAlgorithmWithFit.h:126
ZIterativeAlgorithmWithFit::addEvent
bool addEvent(calib::CalibElectron *, calib::CalibElectron *, float)
Definition: ZIterativeAlgorithmWithFit.cc:250
calib::CalibElectron
Definition: CalibElectron.h:13
ZIterativeAlgorithmWithFit::getStatWeights
void getStatWeights(const std::string &file)
Definition: ZIterativeAlgorithmWithFit.cc:154
ZIterativeAlgorithmWithFit::currentEvent_
unsigned int currentEvent_
Definition: ZIterativeAlgorithmWithFit.h:119
ZIterativeAlgorithmWithFit::~ZIterativeAlgorithmWithFit
virtual ~ZIterativeAlgorithmWithFit()
Destructor.
Definition: ZIterativeAlgorithmWithFit.cc:353
ZIterativeAlgorithmWithFit::thePlots_
ZIterativeAlgorithmWithFitPlots * thePlots_
Definition: ZIterativeAlgorithmWithFit.h:111
ZIterativeAlgorithmWithFit::getOptimizedChiSquare
const std::vector< float > & getOptimizedChiSquare() const
Definition: ZIterativeAlgorithmWithFit.h:65
nMaxIterations
#define nMaxIterations
Definition: ZIterativeAlgorithmWithFit.h:25
ZIterativeAlgorithmWithFit::ZIterativeAlgorithmWithFitPlots
Definition: ZIterativeAlgorithmWithFit.h:30
ZIterativeAlgorithmWithFit::getNumberOfIterations
int getNumberOfIterations() const
Definition: ZIterativeAlgorithmWithFit.h:57
ZIterativeAlgorithmWithFit::optimizedChiSquare_
std::vector< float > optimizedChiSquare_
Definition: ZIterativeAlgorithmWithFit.h:129
ZIterativeAlgorithmWithFit::currentIteration_
unsigned int currentIteration_
Definition: ZIterativeAlgorithmWithFit.h:120
ZIterativeAlgorithmWithFit::Event_Weight_
std::vector< float > Event_Weight_
Definition: ZIterativeAlgorithmWithFit.h:138
ZIterativeAlgorithmWithFit::massMethod
std::string massMethod
Definition: ZIterativeAlgorithmWithFit.h:132
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ZIterativeAlgorithmWithFit::numberOfIterations_
unsigned int numberOfIterations_
Definition: ZIterativeAlgorithmWithFit.h:117
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ZIterativeAlgorithmWithFit::massReco_
std::vector< float > massReco_
Definition: ZIterativeAlgorithmWithFit.h:128
CalibElectron.h
ZIterativeAlgorithmWithFit::M_Z_
static const double M_Z_
Definition: ZIterativeAlgorithmWithFit.h:142
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ZIterativeAlgorithmWithFit::addWeightsCorrections
void addWeightsCorrections(unsigned int event_id)
ZIterativeAlgorithmWithFit::UseStatWeights_
bool UseStatWeights_
Definition: ZIterativeAlgorithmWithFit.h:134
ZIterativeAlgorithmWithFit::nCrystalCut_
int nCrystalCut_
Definition: ZIterativeAlgorithmWithFit.h:113
ZIterativeAlgorithmWithFit::operator=
ZIterativeAlgorithmWithFit & operator=(const ZIterativeAlgorithmWithFit &r)
Assignment operator.
Definition: ZIterativeAlgorithmWithFit.h:44
edm::ParameterSet
Definition: ParameterSet.h:36
ZIterativeAlgorithmWithFit::optimizedCoefficients_
std::vector< float > optimizedCoefficients_
Definition: ZIterativeAlgorithmWithFit.h:124
nMaxChannels
#define nMaxChannels
Definition: ZIterativeAlgorithmWithFit.h:26
ZIterativeAlgorithmWithFit
Definition: ZIterativeAlgorithmWithFit.h:28
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
ZIterativeAlgorithmWithFit::getWeight
void getWeight(unsigned int evid, std::pair< calib::CalibElectron *, calib::CalibElectron * >, float)
Definition: ZIterativeAlgorithmWithFit.cc:297
ZIterativeAlgorithmWithFit::recalculateWeightsEnergies
void recalculateWeightsEnergies()
ZIterativeAlgorithmWithFit::channels_
unsigned int channels_
Definition: ZIterativeAlgorithmWithFit.h:115
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
ZIterativeAlgorithmWithFit::ZIterativeAlgorithmWithFitPlots::weightedRescaleFactor
TH1 * weightedRescaleFactor[50][250]
Definition: ZIterativeAlgorithmWithFit.h:31
ZIterativeAlgorithmWithFit::gausfit
static void gausfit(TH1F *histoou, double *par, double *errpar, float nsigmalow, float nsigmaup, double *mychi2, int *iterations)
Definition: ZIterativeAlgorithmWithFit.cc:355
ZIterativeAlgorithmWithFit::getOptimizedCoefficients
const std::vector< float > & getOptimizedCoefficients() const
Definition: ZIterativeAlgorithmWithFit.h:61
alignCSCRings.r
r
Definition: alignCSCRings.py:93
ZIterativeAlgorithmWithFit::cosTheta12
static float cosTheta12(float Eta1, float Phi1, float Eta2, float Phi2)
Definition: ZIterativeAlgorithmWithFit.h:79
ZIterativeAlgorithmWithFit::WeightFileName_
std::string WeightFileName_
Definition: ZIterativeAlgorithmWithFit.h:135
ZIterativeAlgorithmWithFit::StatWeights_
std::vector< float > StatWeights_
Definition: ZIterativeAlgorithmWithFit.h:137
ZIterativeAlgorithmWithFit::iterate
bool iterate()
Definition: ZIterativeAlgorithmWithFit.cc:182
ZIterativeAlgorithmWithFit::recalculateMasses
void recalculateMasses()
ZIterativeAlgorithmWithFit::getEpsilonSum
const std::vector< float > & getEpsilonSum() const
Definition: ZIterativeAlgorithmWithFit.h:71
ZIterativeAlgorithmWithFit::getWeightSum
const std::vector< float > & getWeightSum() const
Definition: ZIterativeAlgorithmWithFit.h:69
ZIterativeAlgorithmWithFit::getHistos
const ZIterativeAlgorithmWithFitPlots * getHistos() const
Definition: ZIterativeAlgorithmWithFit.h:55
ZIterativeAlgorithmWithFit::invMassCalc
static float invMassCalc(float Energy1, float Eta1, float Phi1, float Energy2, float Eta2, float Phi2)
Definition: ZIterativeAlgorithmWithFit.h:75
ZIterativeAlgorithmWithFit::resetIteration
bool resetIteration()
Definition: ZIterativeAlgorithmWithFit.cc:168
ZIterativeAlgorithmWithFit::bookHistograms
void bookHistograms()
Definition: ZIterativeAlgorithmWithFit.cc:111
ZIterativeAlgorithmWithFit::electrons_
std::vector< std::pair< calib::CalibElectron *, calib::CalibElectron * > > electrons_
Definition: ZIterativeAlgorithmWithFit.h:122
ZIterativeAlgorithmWithFit::calibType_
TString calibType_
Definition: ZIterativeAlgorithmWithFit.h:140
ZIterativeAlgorithmWithFit::getOptimizedIterations
const std::vector< int > & getOptimizedIterations() const
Definition: ZIterativeAlgorithmWithFit.h:67
ParameterSet.h
ZIterativeAlgorithmWithFit::ZIterativeAlgorithmWithFitPlots::unweightedRescaleFactor
TH1 * unweightedRescaleFactor[50][250]
Definition: ZIterativeAlgorithmWithFit.h:32
ZIterativeAlgorithmWithFit::getEventWeight
float getEventWeight(unsigned int event_id)
Definition: ZIterativeAlgorithmWithFit.cc:304
ZIterativeAlgorithmWithFit::optimizedCoefficientsError_
std::vector< float > optimizedCoefficientsError_
Definition: ZIterativeAlgorithmWithFit.h:125
weight
Definition: weight.py:1
ZIterativeAlgorithmWithFit::ZIterativeAlgorithmWithFit
ZIterativeAlgorithmWithFit()
Default constructor.
Definition: ZIterativeAlgorithmWithFit.cc:46
ZIterativeAlgorithmWithFit::getNumberOfChannels
int getNumberOfChannels() const
Definition: ZIterativeAlgorithmWithFit.h:59
ZIterativeAlgorithmWithFit::getOptimizedCoefficientsError
const std::vector< float > & getOptimizedCoefficientsError() const
Definition: ZIterativeAlgorithmWithFit.h:63
ZIterativeAlgorithmWithFit::weight_sum_
std::vector< float > weight_sum_
Definition: ZIterativeAlgorithmWithFit.h:127