CMS 3D CMS Logo

L1GctConfigProducers.cc
Go to the documentation of this file.
3 
5 
9 
13 
14 #include <cmath>
15 //
16 // constants, enums and typedefs
17 //
18 
19 //
20 // static data member definitions
21 //
22 
23 //
24 // constructors and destructor
25 //
27  : m_rgnEtLsb(iConfig.getParameter<double>("RctRegionEtLSB")),
28  m_htLsb(iConfig.getParameter<double>("GctHtLSB")),
29  m_CenJetSeed(iConfig.getParameter<double>("JetFinderCentralJetSeed")),
30  m_FwdJetSeed(iConfig.getParameter<double>("JetFinderForwardJetSeed")),
31  m_TauJetSeed(iConfig.getParameter<double>("JetFinderCentralJetSeed")), // no separate tau jet seed yet
32  m_tauIsoThresh(iConfig.getParameter<double>("TauIsoEtThreshold")),
33  m_htJetThresh(iConfig.getParameter<double>("HtJetEtThreshold")),
34  m_mhtJetThresh(iConfig.getParameter<double>("MHtJetEtThreshold")),
35  m_EtaBoundry(7), // not programmable!
36  m_corrFunType(0),
37  m_convertToEnergy(iConfig.getParameter<bool>("ConvertEtValuesToEnergy")),
38  m_jetCalibFunc(),
39  m_tauCalibFunc(),
40  m_metEtaMask(iConfig.getParameter<unsigned>("MEtEtaMask")),
41  m_tetEtaMask(iConfig.getParameter<unsigned>("TEtEtaMask")),
42  m_mhtEtaMask(iConfig.getParameter<unsigned>("MHtEtaMask")),
43  m_thtEtaMask(iConfig.getParameter<unsigned>("HtEtaMask")) {
44  //the following lines are needed to tell the framework what
45  // data is being produced
48 
49  //now do what ever other initialization is needed
50  std::string CalibStyle = iConfig.getParameter<std::string>("CalibrationStyle");
51  edm::ParameterSet calibCoeffs;
52 
53  if (CalibStyle == "PowerSeries") {
54  m_corrFunType = 1;
55  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PowerSeriesCoefficients");
56  }
57 
58  if (CalibStyle == "ORCAStyle") {
59  m_corrFunType = 2;
60  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("OrcaStyleCoefficients");
61  }
62 
63  if (CalibStyle == "Simple") {
64  m_corrFunType = 3;
65  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("SimpleCoefficients");
66  }
67 
68  if (CalibStyle == "PiecewiseCubic") {
69  m_corrFunType = 4;
70  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PiecewiseCubicCoefficients");
71  }
72 
73  if (CalibStyle == "PF") {
74  m_corrFunType = 5;
75  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PFCoefficients");
76  }
77 
78  // check
79  if (CalibStyle != "None") {
80  // Read the coefficients from file
81  // coefficients for non-tau jet corrections
82  for (unsigned i = 0; i < L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
83  std::stringstream ss;
85  ss << "nonTauJetCalib" << i;
86  ss >> str;
87  m_jetCalibFunc.push_back(calibCoeffs.getParameter<std::vector<double> >(str));
88  }
89  // coefficients for tau jet corrections
90  for (unsigned i = 0; i < L1GctJetFinderParams::N_CENTRAL_ETA_VALUES; ++i) {
91  std::stringstream ss;
93  ss << "tauJetCalib" << i;
94  ss >> str;
95  m_tauCalibFunc.push_back(calibCoeffs.getParameter<std::vector<double> >(str));
96  }
97 
98  } else {
99  // No corrections to be applied
100  m_corrFunType = 0; // no correction
101  // Set the vector sizes to those expected by the CalibrationFunction
104  }
105 
106  edm::LogWarning("L1GctConfig") << "Calibration Style option " << CalibStyle << std::endl;
107 }
108 
110  // do anything here that needs to be done at desctruction time
111  // (e.g. close files, deallocate resources etc.)
112 }
113 
114 // The producer methods are handled by the "Configurer" objects
115 
117  // get geometry
119 
120  // construct jet finder params object
121  auto pL1GctJetFinderParams = std::make_unique<L1GctJetFinderParams>(m_rgnEtLsb,
122  m_htLsb,
123  m_CenJetSeed,
124  m_FwdJetSeed,
125  m_TauJetSeed,
129  m_EtaBoundry,
134  etToEnergyConversion(geom.product()));
135 
136  return pL1GctJetFinderParams;
137 }
138 
141 
142  for (unsigned ieta = 0; ieta < 22; ++ieta) {
143  if (((m_metEtaMask >> ieta) & 0x1) == 1)
144  mask->maskMissingEt(ieta);
145  if (((m_tetEtaMask >> ieta) & 0x1) == 1)
146  mask->maskTotalEt(ieta);
147  if (((m_mhtEtaMask >> ieta) & 0x1) == 1)
148  mask->maskMissingHt(ieta);
149  if (((m_thtEtaMask >> ieta) & 0x1) == 1)
150  mask->maskTotalHt(ieta);
151  }
152 
153  return std::unique_ptr<L1GctChannelMask>(mask);
154 }
155 
157 
160  // L1CaloGeometry* geom = new L1CaloGeometry();
161  std::vector<double> result;
162  // Factors for central eta bins
163  for (unsigned ieta = 0; ieta < 7; ieta++) {
164  double bineta = geom->etaBinCenter(ieta, true);
165  double factor = 0.5 * (exp(bineta) + exp(-bineta)); // Conversion from eta to cosec(theta)
166  result.push_back(factor);
167  }
168  // Factors for forward eta bins
169  for (unsigned ieta = 0; ieta < 4; ieta++) {
170  double bineta = geom->etaBinCenter(ieta, false);
171  double factor = 0.5 * (exp(bineta) + exp(-bineta)); // Conversion from eta to cosec(theta)
172  result.push_back(factor);
173  }
174  return result;
175 }
176 
177 //define this as a plug-in
ChanMaskReturnType produceChanMask(const L1GctChannelMaskRcd &)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
static const unsigned N_CENTRAL_ETA_VALUES
Number of eta bins used in correction.
std::unique_ptr< L1GctChannelMask > ChanMaskReturnType
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1GctConfigProducers(const edm::ParameterSet &)
std::vector< std::vector< double > > m_jetCalibFunc
JfParamsReturnType produceJfParams(const L1GctJetFinderParamsRcd &)
constexpr uint32_t mask
Definition: gpuClustering.h:24
edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > m_caloGeomToken
std::vector< double > etToEnergyConversion(const L1CaloGeometry *geom) const
Legacy nonsense.
std::vector< std::vector< double > > m_tauCalibFunc
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
std::unique_ptr< L1GctJetFinderParams > JfParamsReturnType
Log< level::Warning, false > LogWarning
#define str(s)