CMS 3D CMS Logo

L1GctConfigProducers.cc
Go to the documentation of this file.
3 
5 
9 
13 
14 //
15 // constants, enums and typedefs
16 //
17 
18 //
19 // static data member definitions
20 //
21 
22 //
23 // constructors and destructor
24 //
26  m_rgnEtLsb(iConfig.getParameter<double>("RctRegionEtLSB")),
27  m_htLsb(iConfig.getParameter<double>("GctHtLSB")),
28  m_CenJetSeed(iConfig.getParameter<double>("JetFinderCentralJetSeed")),
29  m_FwdJetSeed(iConfig.getParameter<double>("JetFinderForwardJetSeed")),
30  m_TauJetSeed(iConfig.getParameter<double>("JetFinderCentralJetSeed")), // no separate tau jet seed yet
31  m_tauIsoThresh(iConfig.getParameter<double>("TauIsoEtThreshold")),
32  m_htJetThresh(iConfig.getParameter<double>("HtJetEtThreshold")),
33  m_mhtJetThresh(iConfig.getParameter<double>("MHtJetEtThreshold")),
34  m_EtaBoundry(7), // not programmable!
35  m_corrFunType(0),
36  m_convertToEnergy (iConfig.getParameter<bool>("ConvertEtValuesToEnergy")),
37  m_jetCalibFunc(),
38  m_tauCalibFunc(),
39  m_metEtaMask(iConfig.getParameter<unsigned>("MEtEtaMask")),
40  m_tetEtaMask(iConfig.getParameter<unsigned>("TEtEtaMask")),
41  m_mhtEtaMask(iConfig.getParameter<unsigned>("MHtEtaMask")),
42  m_thtEtaMask(iConfig.getParameter<unsigned>("HtEtaMask"))
43 {
44 
45  //the following lines are needed to tell the framework what
46  // data is being produced
49 
50  //now do what ever other initialization is needed
51  std::string CalibStyle = iConfig.getParameter<std::string>("CalibrationStyle");
52  edm::ParameterSet calibCoeffs;
53 
54  if (CalibStyle == "PowerSeries") {
55  m_corrFunType = 1;
56  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PowerSeriesCoefficients");
57  }
58 
59  if (CalibStyle == "ORCAStyle") {
60  m_corrFunType = 2;
61  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("OrcaStyleCoefficients");
62  }
63 
64  if (CalibStyle == "Simple") {
65  m_corrFunType = 3;
66  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("SimpleCoefficients");
67  }
68 
69  if (CalibStyle == "PiecewiseCubic") {
70  m_corrFunType = 4;
71  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PiecewiseCubicCoefficients");
72  }
73 
74  if (CalibStyle == "PF") {
75  m_corrFunType = 5;
76  calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PFCoefficients");
77  }
78 
79  // check
80  if (CalibStyle != "None") {
81 
82  // Read the coefficients from file
83  // coefficients for non-tau jet corrections
84  for (unsigned i=0; i<L1GctJetFinderParams::NUMBER_ETA_VALUES; ++i) {
85  std::stringstream ss;
87  ss << "nonTauJetCalib" << i;
88  ss >> str;
89  m_jetCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
90  }
91  // coefficients for tau jet corrections
92  for (unsigned i=0; i<L1GctJetFinderParams::N_CENTRAL_ETA_VALUES; ++i) {
93  std::stringstream ss;
95  ss << "tauJetCalib" << i;
96  ss >> str;
97  m_tauCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
98  }
99 
100  } else {
101  // No corrections to be applied
102  m_corrFunType = 0; // no correction
103  // Set the vector sizes to those expected by the CalibrationFunction
106  }
107 
108  edm::LogWarning("L1GctConfig") << "Calibration Style option " << CalibStyle << std::endl;
109 
110 }
111 
112 
114 {
115 
116  // do anything here that needs to be done at desctruction time
117  // (e.g. close files, deallocate resources etc.)
118 
119 }
120 
121 // The producer methods are handled by the "Configurer" objects
122 
125 {
126  // get geometry
127  const L1CaloGeometryRecord& geomRcd = aRcd.getRecord< L1CaloGeometryRecord >() ;
129  geomRcd.get( geom ) ;
130 
131  // construct jet finder params object
132  auto pL1GctJetFinderParams = std::make_shared<L1GctJetFinderParams>(m_rgnEtLsb,
133  m_htLsb,
134  m_CenJetSeed,
135  m_FwdJetSeed,
136  m_TauJetSeed,
140  m_EtaBoundry,
145  etToEnergyConversion(geom.product()));
146 
147  return pL1GctJetFinderParams ;
148 
149 }
150 
153 
155 
156  for (unsigned ieta=0; ieta<22; ++ieta) {
157  if (((m_metEtaMask>>ieta)&0x1)==1) mask->maskMissingEt(ieta);
158  if (((m_tetEtaMask>>ieta)&0x1)==1) mask->maskTotalEt(ieta);
159  if (((m_mhtEtaMask>>ieta)&0x1)==1) mask->maskMissingHt(ieta);
160  if (((m_thtEtaMask>>ieta)&0x1)==1) mask->maskTotalHt(ieta);
161  }
162 
163  return std::shared_ptr<L1GctChannelMask>(mask);
164 
165 }
166 
167 
169 
171 std::vector<double>
173  const L1CaloGeometry* geom) const {
174  // L1CaloGeometry* geom = new L1CaloGeometry();
175  std::vector<double> result;
176  // Factors for central eta bins
177  for (unsigned ieta=0; ieta<7; ieta++) {
178  double bineta = geom->etaBinCenter(ieta, true);
179  double factor = 0.5*(exp(bineta)+exp(-bineta)); // Conversion from eta to cosec(theta)
180  result.push_back(factor);
181  }
182  // Factors for forward eta bins
183  for (unsigned ieta=0; ieta<4; ieta++) {
184  double bineta = geom->etaBinCenter(ieta, false);
185  double factor = 0.5*(exp(bineta)+exp(-bineta)); // Conversion from eta to cosec(theta)
186  result.push_back(factor);
187  }
188  return result;
189 }
190 
191 
192 //define this as a plug-in
ChanMaskReturnType produceChanMask(const L1GctChannelMaskRcd &)
std::shared_ptr< L1GctChannelMask > ChanMaskReturnType
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
static const unsigned N_CENTRAL_ETA_VALUES
Number of eta bins used in correction.
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
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::shared_ptr< L1GctJetFinderParams > JfParamsReturnType
std::vector< std::vector< double > > m_jetCalibFunc
void maskTotalHt(unsigned ieta)
mask eta range from total Ht sum
void get(HolderT &iHolder) const
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
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