19 int getRegionEta(
int gtEta,
bool forward) {
23 int centralGtEta[] = {11, 12, 13, 14, 15, 16, 17, -100, 10, 9, 8, 7, 6, 5, 4};
24 int forwardGtEta[] = {18, 19, 20, 21, -100, -100, -100, -100, 3, 2, 1, 0};
31 regionEta = centralGtEta[
gtEta];
33 regionEta = forwardGtEta[
gtEta];
35 if (regionEta == -100)
36 edm::LogError(
"EtaIndexError") <<
"Bad eta index passed to L1TPhysicalEtAdder::getRegionEta, " << gtEta
43 double getPhysicalEta(
int gtEta,
bool forward =
false) {
44 int etaIndex = getRegionEta(gtEta, forward);
46 const double rgnEtaValues[11] = {0.174,
58 return -rgnEtaValues[-(etaIndex - 10)];
59 }
else if (etaIndex < 22) {
60 return rgnEtaValues[etaIndex - 11];
65 double getPhysicalPhi(
int phiIndex) {
67 return 2. *
M_PI * phiIndex / 18.;
69 return -
M_PI + 2. *
M_PI * (phiIndex - 9) / 18.;
78 produces<EGammaBxCollection>();
79 produces<TauBxCollection>(
"rlxTaus");
80 produces<TauBxCollection>(
"isoTaus");
81 produces<JetBxCollection>();
82 produces<JetBxCollection>(
"preGtJets");
83 produces<EtSumBxCollection>();
84 produces<CaloSpareBxCollection>(
"HFRingSums");
85 produces<CaloSpareBxCollection>(
"HFBitCounts");
95 emScaleToken_ = esConsumes<L1CaloEtScale, L1EmEtScaleRcd>();
96 jetScaleToken_ = esConsumes<L1CaloEtScale, L1JetEtScaleRcd>();
97 htMissScaleToken_ = esConsumes<L1CaloEtScale, L1HtMissScaleRcd>();
127 iEvent.
getByToken(preGtJetToken_, old_preGtJets);
130 iEvent.
getByToken(HfCountsToken_, old_hfcounts);
139 int firstBX = old_egammas->getFirstBX();
140 int lastBX = old_egammas->getLastBX();
142 new_egammas->setBXRange(firstBX, lastBX);
143 new_rlxtaus->setBXRange(firstBX, lastBX);
144 new_isotaus->setBXRange(firstBX, lastBX);
145 new_jets->setBXRange(firstBX, lastBX);
146 new_preGtJets->setBXRange(firstBX, lastBX);
147 new_etsums->setBXRange(firstBX, lastBX);
148 new_hfsums->setBXRange(firstBX, lastBX);
149 new_hfcounts->setBXRange(firstBX, lastBX);
151 for (
int bx = firstBX;
bx <= lastBX; ++
bx) {
155 const double et = emScale->et(itEGamma->hwPt());
156 const double eta = getPhysicalEta(itEGamma->hwEta());
157 const double phi = getPhysicalPhi(itEGamma->hwPhi());
160 EGamma eg(*&p4, itEGamma->hwPt(), itEGamma->hwEta(), itEGamma->hwPhi(), itEGamma->hwQual(), itEGamma->hwIso());
161 new_egammas->push_back(
bx, *&eg);
173 const double et = jetScale->et(itTau->hwPt());
175 const double eta = getPhysicalEta(itTau->hwEta());
176 const double phi = getPhysicalPhi(itTau->hwPhi());
179 Tau tau(*&p4, itTau->hwPt(), itTau->hwEta(), itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
180 new_rlxtaus->push_back(
bx, *&
tau);
192 const double et = jetScale->et(itTau->hwPt());
194 const double eta = getPhysicalEta(itTau->hwEta());
195 const double phi = getPhysicalPhi(itTau->hwPhi());
198 Tau tau(*&p4, itTau->hwPt(), itTau->hwEta(), itTau->hwPhi(), itTau->hwQual(), itTau->hwIso());
199 new_isotaus->push_back(
bx, *&
tau);
211 const double et = jetScale->et(itJet->hwPt());
213 const bool forward = ((itJet->hwQual() & 0x2) != 0);
214 const double eta = getPhysicalEta(itJet->hwEta(), forward);
215 const double phi = getPhysicalPhi(itJet->hwPhi());
218 Jet jet(*&p4, itJet->hwPt(), itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
219 new_jets->push_back(
bx, *&
jet);
228 const double et = itJet->hwPt() * emScale->linearLsb();
233 const bool forward = ((itJet->hwQual() & 0x2) != 0);
234 const double eta = getPhysicalEta(itJet->hwEta(), forward);
235 const double phi = getPhysicalPhi(itJet->hwPhi());
238 Jet jet(*&p4, itJet->hwPt(), itJet->hwEta(), itJet->hwPhi(), itJet->hwQual());
239 new_preGtJets->push_back(
bx, *&
jet);
243 double et = itEtSum->hwPt() * emScale->linearLsb();
248 const double eta = getPhysicalEta(itEtSum->hwEta());
249 double phi = getPhysicalPhi(itEtSum->hwPhi());
251 et = htMissScale->et(itEtSum->hwPt());
253 phi = phi + (regionPhiWidth / 2.);
258 EtSum eg(*&p4, sumType, itEtSum->hwPt(), itEtSum->hwEta(), itEtSum->hwPhi(), itEtSum->hwQual());
259 new_etsums->push_back(
bx, *&eg);
266 new_hfsums->push_back(
bx, *itCaloSpare);
270 itCaloSpare != old_hfcounts->end(
bx);
274 new_hfcounts->push_back(
bx, *itCaloSpare);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~L1TPhysicalEtAdder() override
#define DEFINE_FWK_MODULE(type)
const unsigned int gtEta(const unsigned int iEta)
Log< level::Error, false > LogError
L1TPhysicalEtAdder(const edm::ParameterSet &ps)
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
std::vector< T >::const_iterator const_iterator
void addDefault(ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
T getParameter(std::string const &) const
static const unsigned N_PHI
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)