CMS 3D CMS Logo

JetCorrectorParametersHelper.h
Go to the documentation of this file.
1 //
2 // Original Author: Fedor Ratnikov Nov 9, 2007
3 // $Id: JetCorrectorParameters.h,v 1.15 2012/03/01 18:24:52 srappocc Exp $
4 //
5 // Generic parameters for Jet corrections
6 //
7 #ifndef JetCorrectorParametersHelper_h
8 #define JetCorrectorParametersHelper_h
9 
12 
13 #include <string>
14 #include <vector>
15 #include <tuple>
16 #include <algorithm>
17 #include <functional>
18 #include <iostream>
21 
22 
23 //---------- JetCorrectorParametersHelper class ----------------
24 //-- The helper is used to find the correct Record to access ---
26 {
27  public:
28  //-------- Member functions ----------
29  unsigned size() const {return mIndexMap.size();}
30  void initTransientMaps();
31  void init(const JetCorrectorParameters::Definitions& mDefinitions,
32  const std::vector<JetCorrectorParameters::Record>& mRecords);
33  void checkMiddleBinUniformity(const std::vector<JetCorrectorParameters::Record>& mRecords) const;
34  void binIndexChecks(unsigned N, const std::vector<float>& fX) const;
35  bool binBoundChecks(unsigned dim, const float& value, const float& min, const float& max) const;
36  int binIndexN(const std::vector<float>& fX, const std::vector<JetCorrectorParameters::Record>& mRecords) const;
37 
38  using tuple_type = typename generate_tuple_type<float,JetCorrectorParameters::MAX_SIZE_DIMENSIONALITY>::type;
40  private:
41  //-------- Member variables ----------
42  // Stores the lower and upper bounds of the bins for each binned dimension
43  std::vector<std::vector<float> > mBinBoundaries;
44  // Maps a set of lower bounds for N binned dimensions to the index in mRecords
45  std::unordered_map<tuple_type, size_t> mIndexMap;
46  // Maps a set of lower bounds for the first N-1 dimensions to the range of lower bound indices mBinBoundaries for the N dimension
47  std::unordered_map<tuple_type_Nm1, std::pair<size_t,size_t> > mMap;
48  // The number of binned dimensions as given by the JetCorrectorParameters::Definitions class
49  unsigned SIZE;
50 };
51 
52 #endif
type
Definition: HCALResponse.h:21
int binIndexN(const std::vector< float > &fX, const std::vector< JetCorrectorParameters::Record > &mRecords) const
void binIndexChecks(unsigned N, const std::vector< float > &fX) const
void checkMiddleBinUniformity(const std::vector< JetCorrectorParameters::Record > &mRecords) const
std::unordered_map< tuple_type, size_t > mIndexMap
typename generate_tuple_type< float, JetCorrectorParameters::MAX_SIZE_DIMENSIONALITY >::type tuple_type
static const int MAX_SIZE_DIMENSIONALITY
Definition: value.py:1
T min(T a, T b)
Definition: MathUtil.h:58
typename generate_tuple_type< float, JetCorrectorParameters::MAX_SIZE_DIMENSIONALITY-1 >::type tuple_type_Nm1
bool binBoundChecks(unsigned dim, const float &value, const float &min, const float &max) const
#define N
Definition: blowfish.cc:9
void init(const JetCorrectorParameters::Definitions &mDefinitions, const std::vector< JetCorrectorParameters::Record > &mRecords)
std::vector< std::vector< float > > mBinBoundaries
std::unordered_map< tuple_type_Nm1, std::pair< size_t, size_t > > mMap