File indexing completed on 2024-04-06 12:02:17
0001
0002
0003
0004
0005
0006
0007 #ifndef JetCorrectorParametersHelper_h
0008 #define JetCorrectorParametersHelper_h
0009
0010 #include "CondFormats/JetMETObjects/interface/JetCorrectorParameters.h"
0011 #include "CondFormats/JetMETObjects/interface/Utilities.h"
0012
0013 #include <string>
0014 #include <vector>
0015 #include <tuple>
0016 #include <algorithm>
0017 #include <functional>
0018 #include <iostream>
0019 #include "FWCore/Utilities/interface/Exception.h"
0020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0021
0022
0023
0024 class JetCorrectorParametersHelper {
0025 public:
0026
0027 unsigned size() const { return mIndexMap.size(); }
0028 void initTransientMaps();
0029 void init(const JetCorrectorParameters::Definitions& mDefinitions,
0030 const std::vector<JetCorrectorParameters::Record>& mRecords);
0031 void checkMiddleBinUniformity(const std::vector<JetCorrectorParameters::Record>& mRecords) const;
0032 void binIndexChecks(unsigned N, const std::vector<float>& fX) const;
0033 bool binBoundChecks(unsigned dim, const float& value, const float& min, const float& max) const;
0034 int binIndexN(const std::vector<float>& fX, const std::vector<JetCorrectorParameters::Record>& mRecords) const;
0035
0036 using tuple_type = typename generate_tuple_type<float, JetCorrectorParameters::MAX_SIZE_DIMENSIONALITY>::type;
0037 using tuple_type_Nm1 = typename generate_tuple_type<float, JetCorrectorParameters::MAX_SIZE_DIMENSIONALITY - 1>::type;
0038
0039 private:
0040
0041
0042 std::vector<std::vector<float> > mBinBoundaries;
0043
0044 std::unordered_map<tuple_type, size_t> mIndexMap;
0045
0046 std::unordered_map<tuple_type_Nm1, std::pair<size_t, size_t> > mMap;
0047
0048 unsigned SIZE;
0049 };
0050
0051 #endif