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 {
45 
46  //the following lines are needed to tell the framework what
47  // data is being produced
50 
51  //now do what ever other initialization is needed
52  std::string CalibStyle = iConfig.getParameter<std::string>("CalibrationStyle");
53  edm::ParameterSet calibCoeffs;
54 
55  if (CalibStyle == "PowerSeries") {
56  m_corrFunType = 1;
57  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PowerSeriesCoefficients");
58  }
59 
60  if (CalibStyle == "ORCAStyle") {
61  m_corrFunType = 2;
62  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("OrcaStyleCoefficients");
63  }
64 
65  if (CalibStyle == "Simple") {
66  m_corrFunType = 3;
67  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("SimpleCoefficients");
68  }
69 
70  if (CalibStyle == "PiecewiseCubic") {
71  m_corrFunType = 4;
72  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PiecewiseCubicCoefficients");
73  }
74 
75  if (CalibStyle == "PF") {
76  m_corrFunType = 5;
77  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PFCoefficients");
78  }
79 
80  // check
81  if (CalibStyle != "None") {
82 
83  // Read the coefficients from file
84  // coefficients for non-tau jet corrections
85  for (unsigned i=0; i<L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
86  std::stringstream ss;
88  ss << "nonTauJetCalib" << i;
89  ss >> str;
90  m_jetCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
91  }
92  // coefficients for tau jet corrections
93  for (unsigned i=0; i<L1GctJetFinderParams::N_CENTRAL_ETA_VALUES; ++i) {
94  std::stringstream ss;
96  ss << "tauJetCalib" << i;
97  ss >> str;
98  m_tauCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
99  }
100 
101  } else {
102  // No corrections to be applied
103  m_corrFunType = 0; // no correction
104  // Set the vector sizes to those expected by the CalibrationFunction
107  }
108 
109  edm::LogWarning("L1GctConfig") << "Calibration Style option " << CalibStyle << std::endl;
110 
111 }
112 
113 
115 {
116 
117  // do anything here that needs to be done at desctruction time
118  // (e.g. close files, deallocate resources etc.)
119 
120 }
121 
122 // The producer methods are handled by the "Configurer" objects
123 
126 {
127  // get geometry
128  const L1CaloGeometryRecord& geomRcd = aRcd.getRecord< L1CaloGeometryRecord >() ;
130  geomRcd.get( geom ) ;
131 
132  // construct jet finder params object
133  auto pL1GctJetFinderParams = std::make_unique<L1GctJetFinderParams>(m_rgnEtLsb,
134  m_htLsb,
135  m_CenJetSeed,
136  m_FwdJetSeed,
137  m_TauJetSeed,
141  m_EtaBoundry,
146  etToEnergyConversion(geom.product()));
147 
148  return pL1GctJetFinderParams ;
149 
150 }
151 
154 
156 
157  for (unsigned ieta=0; ieta<22; ++ieta) {
158  if (((m_metEtaMask>>ieta)&0x1)==1) mask->maskMissingEt(ieta);
159  if (((m_tetEtaMask>>ieta)&0x1)==1) mask->maskTotalEt(ieta);
160  if (((m_mhtEtaMask>>ieta)&0x1)==1) mask->maskMissingHt(ieta);
161  if (((m_thtEtaMask>>ieta)&0x1)==1) mask->maskTotalHt(ieta);
162  }
163 
164  return std::unique_ptr<L1GctChannelMask>(mask);
165 
166 }
167 
168 
170 
172 std::vector<double>
174  const L1CaloGeometry* geom) const {
175  // L1CaloGeometry* geom = new L1CaloGeometry();
176  std::vector<double> result;
177  // Factors for central eta bins
178  for (unsigned ieta=0; ieta<7; ieta++) {
179  double bineta = geom->etaBinCenter(ieta, true);
180  double factor = 0.5*(exp(bineta)+exp(-bineta)); // Conversion from eta to cosec(theta)
181  result.push_back(factor);
182  }
183  // Factors for forward eta bins
184  for (unsigned ieta=0; ieta<4; ieta++) {
185  double bineta = geom->etaBinCenter(ieta, false);
186  double factor = 0.5*(exp(bineta)+exp(-bineta)); // Conversion from eta to cosec(theta)
187  result.push_back(factor);
188  }
189  return result;
190 }
191 
192 
193 //define this as a plug-in
ChanMaskReturnType produceChanMask(const L1GctChannelMaskRcd &)
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
static const unsigned N_CENTRAL_ETA_VALUES
Number of eta bins used in correction.
std::unique_ptr< L1GctChannelMask > ChanMaskReturnType
L1GctConfigProducers(const edm::ParameterSet &)
void maskMissingEt(unsigned ieta)
mask eta range from missing Et sum
JfParamsReturnType produceJfParams(const L1GctJetFinderParamsRcd &)
double etaBinCenter(unsigned int etaIndex, bool central=true) const
std::vector< std::vector< double > > m_jetCalibFunc
void maskTotalHt(unsigned ieta)
mask eta range from total Ht sum
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
std::unique_ptr< L1GctJetFinderParams > JfParamsReturnType
std::vector< double > etToEnergyConversion(const L1CaloGeometry *geom) const
Legacy nonsense.
void maskTotalEt(unsigned ieta)
mask eta range from total Et sum
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::vector< std::vector< double > > m_tauCalibFunc
void maskMissingHt(unsigned ieta)
mask eta range from missing Ht sum
#define str(s)
bool get(HolderT &iHolder) const