52 : produceMuonParticles_(iConfig.getParameter<
bool>(
"produceMuonParticles")),
53 muonSource_(iConfig.getParameter<
edm::
InputTag>(
"muonSource")),
54 produceCaloParticles_(iConfig.getParameter<
bool>(
"produceCaloParticles")),
55 isoEmSource_(iConfig.getParameter<
edm::
InputTag>(
"isolatedEmSource")),
56 nonIsoEmSource_(iConfig.getParameter<
edm::
InputTag>(
"nonIsolatedEmSource")),
57 cenJetSource_(iConfig.getParameter<
edm::
InputTag>(
"centralJetSource")),
58 forJetSource_(iConfig.getParameter<
edm::
InputTag>(
"forwardJetSource")),
59 tauJetSource_(iConfig.getParameter<
edm::
InputTag>(
"tauJetSource")),
60 isoTauJetSource_(iConfig.getParameter<
edm::
InputTag>(
"isoTauJetSource")),
61 etTotSource_(iConfig.getParameter<
edm::
InputTag>(
"etTotalSource")),
62 etHadSource_(iConfig.getParameter<
edm::
InputTag>(
"etHadSource")),
63 etMissSource_(iConfig.getParameter<
edm::
InputTag>(
"etMissSource")),
64 htMissSource_(iConfig.getParameter<
edm::
InputTag>(
"htMissSource")),
65 hfRingEtSumsSource_(iConfig.getParameter<
edm::
InputTag>(
"hfRingEtSumsSource")),
66 hfRingBitCountsSource_(iConfig.getParameter<
edm::
InputTag>(
"hfRingBitCountsSource")),
67 centralBxOnly_(iConfig.getParameter<
bool>(
"centralBxOnly")),
68 ignoreHtMiss_(iConfig.getParameter<
bool>(
"ignoreHtMiss")) {
72 produces<L1EmParticleCollection>(
"Isolated");
73 produces<L1EmParticleCollection>(
"NonIsolated");
74 produces<L1JetParticleCollection>(
"Central");
75 produces<L1JetParticleCollection>(
"Forward");
76 produces<L1JetParticleCollection>(
"Tau");
77 produces<L1JetParticleCollection>(
"IsoTau");
78 produces<L1MuonParticleCollection>();
79 produces<L1EtMissParticleCollection>(
"MET");
80 produces<L1EtMissParticleCollection>(
"MHT");
81 produces<L1HFRingsCollection>();
99 muScalesToken_ = esConsumes<L1MuTriggerScales, L1MuTriggerScalesRcd>();
100 muPtScaleToken_ = esConsumes<L1MuTriggerPtScale, L1MuTriggerPtScaleRcd>();
103 caloGeomToken_ = esConsumes<L1CaloGeometry, L1CaloGeometryRecord>();
143 vector<L1MuGMTExtendedCand> hwMuCands;
145 if (!hwMuCollection.
isValid()) {
146 LogDebug(
"L1ExtraParticlesProd") <<
"\nWarning: L1MuGMTReadoutCollection with " <<
muonSource_ 147 <<
"\nrequested in configuration, but not found in the event." << std::endl;
154 vector<L1MuGMTReadoutRecord> records = hwMuCollection->
getRecords();
155 vector<L1MuGMTReadoutRecord>::const_iterator rItr = records.begin();
156 vector<L1MuGMTReadoutRecord>::const_iterator rEnd = records.end();
158 for (; rItr != rEnd; ++rItr) {
159 vector<L1MuGMTExtendedCand> tmpCands = rItr->getGMTCands();
161 hwMuCands.insert(hwMuCands.end(), tmpCands.begin(), tmpCands.end());
166 vector<L1MuGMTExtendedCand>::const_iterator muItr = hwMuCands.begin();
167 vector<L1MuGMTExtendedCand>::const_iterator muEnd = hwMuCands.end();
168 for (
int i = 0; muItr != muEnd; ++muItr, ++
i) {
180 if (!muItr->empty()) {
192 muColl->push_back(
L1MuonParticle(muItr->charge(), p4, *muItr, muItr->bx()));
238 <<
"\nrequested in configuration, but not found in the event." << std::endl;
242 L1GctEmCandCollection::const_iterator emItr = hwIsoEmCands->begin();
243 L1GctEmCandCollection::const_iterator emEnd = hwIsoEmCands->end();
244 for (
int i = 0; emItr != emEnd; ++emItr, ++
i) {
257 double et = emScale->
et(emItr->rank());
271 if (!hwNonIsoEmCands.
isValid()) {
273 <<
"\nrequested in configuration, but not found in the event." << std::endl;
276 L1GctEmCandCollection::const_iterator emItr = hwNonIsoEmCands->begin();
277 L1GctEmCandCollection::const_iterator emEnd = hwNonIsoEmCands->end();
278 for (
int i = 0; emItr != emEnd; ++emItr, ++
i) {
291 double et = emScale->
et(emItr->rank());
310 if (!hwCenJetCands.
isValid()) {
312 <<
"\nrequested in configuration, but not found in the event." << std::endl;
315 L1GctJetCandCollection::const_iterator jetItr = hwCenJetCands->begin();
316 L1GctJetCandCollection::const_iterator jetEnd = hwCenJetCands->end();
317 for (
int i = 0; jetItr != jetEnd; ++jetItr, ++
i) {
347 if (!hwForJetCands.
isValid()) {
349 <<
"\nrequested in configuration, but not found in the event." << std::endl;
352 L1GctJetCandCollection::const_iterator jetItr = hwForJetCands->begin();
353 L1GctJetCandCollection::const_iterator jetEnd = hwForJetCands->end();
354 for (
int i = 0; jetItr != jetEnd; ++jetItr, ++
i) {
385 if (!hwTauJetCands.
isValid()) {
387 <<
"\nrequested in configuration, but not found in the event." << std::endl;
389 L1GctJetCandCollection::const_iterator jetItr = hwTauJetCands->begin();
390 L1GctJetCandCollection::const_iterator jetEnd = hwTauJetCands->end();
391 for (
int i = 0; jetItr != jetEnd; ++jetItr, ++
i) {
422 if (!hwIsoTauJetCands.
isValid()) {
424 <<
"\nrequested in configuration, but not found in the event." << std::endl;
426 L1GctJetCandCollection::const_iterator jetItr = hwIsoTauJetCands->begin();
427 L1GctJetCandCollection::const_iterator jetEnd = hwIsoTauJetCands->end();
428 for (
int i = 0; jetItr != jetEnd; ++jetItr, ++
i) {
456 double etSumLSB =
jetScale->linearLsb();
466 <<
"\nrequested in configuration, but not found in the event." << std::endl;
467 }
else if (!hwEtMissColl.
isValid()) {
469 <<
"\nrequested in configuration, but not found in the event." << std::endl;
474 std::vector<bool> etMissMatched;
476 L1GctEtMissCollection::const_iterator hwEtMissItr = hwEtMissColl->begin();
477 L1GctEtMissCollection::const_iterator hwEtMissEnd = hwEtMissColl->end();
478 for (; hwEtMissItr != hwEtMissEnd; ++hwEtMissItr) {
479 etMissMatched.push_back(
false);
483 L1GctEtTotalCollection::const_iterator hwEtTotItr = hwEtTotColl->begin();
484 L1GctEtTotalCollection::const_iterator hwEtTotEnd = hwEtTotColl->end();
487 for (; hwEtTotItr != hwEtTotEnd; ++hwEtTotItr, ++iTot) {
488 int bx = hwEtTotItr->bx();
497 hwEtMissItr = hwEtMissColl->begin();
498 hwEtMissEnd = hwEtMissColl->end();
499 for (; hwEtMissItr != hwEtMissEnd; ++hwEtMissItr, ++iMiss) {
500 if (hwEtMissItr->bx() ==
bx) {
501 etMissMatched[iMiss] =
true;
512 if (hwEtMissItr != hwEtMissEnd) {
544 L1EtMissParticle::kMET,
560 hwEtMissItr = hwEtMissColl->begin();
561 hwEtMissEnd = hwEtMissColl->end();
563 for (; hwEtMissItr != hwEtMissEnd; ++hwEtMissItr, ++iMiss) {
564 if (!etMissMatched[iMiss]) {
565 int bx = hwEtMissItr->bx();
588 L1EtMissParticle::kMET,
614 std::vector<bool> htMissMatched;
620 <<
"\nrequested in configuration, but not found in the event." << std::endl;
621 }
else if (!hwHtMissColl.
isValid()) {
623 <<
"\nrequested in configuration, but not found in the event." << std::endl;
628 L1GctHtMissCollection::const_iterator hwHtMissItr = hwHtMissColl->begin();
629 L1GctHtMissCollection::const_iterator hwHtMissEnd = hwHtMissColl->end();
630 for (; hwHtMissItr != hwHtMissEnd; ++hwHtMissItr) {
631 htMissMatched.push_back(
false);
638 <<
"\nrequested in configuration, but not found in the event." << std::endl;
639 }
else if (!hwHtMissColl.
isValid()) {
641 <<
"\nrequested in configuration, but not found in the event." << std::endl;
643 L1GctEtHadCollection::const_iterator hwEtHadItr = hwEtHadColl->begin();
644 L1GctEtHadCollection::const_iterator hwEtHadEnd = hwEtHadColl->end();
647 for (; hwEtHadItr != hwEtHadEnd; ++hwEtHadItr, ++iHad) {
648 int bx = hwEtHadItr->bx();
662 L1GctHtMissCollection::const_iterator hwHtMissItr = hwHtMissColl->begin();
663 L1GctHtMissCollection::const_iterator hwHtMissEnd = hwHtMissColl->end();
666 for (; hwHtMissItr != hwHtMissEnd; ++hwHtMissItr, ++iMiss) {
667 if (hwHtMissItr->bx() ==
bx) {
668 htMissMatched[iMiss] =
true;
674 if (hwHtMissItr != hwHtMissEnd) {
677 htMissScale->
et(hwHtMissItr->overFlow() ? htMissScale->
rankScaleMax() : hwHtMissItr->et()) + 1.
e-6;
711 L1EtMissParticle::kMHT,
726 L1GctHtMissCollection::const_iterator hwHtMissItr = hwHtMissColl->begin();
727 L1GctHtMissCollection::const_iterator hwHtMissEnd = hwHtMissColl->end();
730 for (; hwHtMissItr != hwHtMissEnd; ++hwHtMissItr, ++iMiss) {
731 if (!htMissMatched[iMiss]) {
732 int bx = hwHtMissItr->bx();
736 htMissScale->
et(hwHtMissItr->overFlow() ? htMissScale->
rankScaleMax() : hwHtMissItr->et()) + 1.
e-6;
753 L1EtMissParticle::kMHT,
775 if (!hwHFEtSumsColl.
isValid()) {
777 <<
"\nrequested in configuration, but not found in the event." << std::endl;
778 }
else if (!hwHFBitCountsColl.
isValid()) {
780 <<
"\nrequested in configuration, but not found in the event." << std::endl;
782 L1GctHFRingEtSumsCollection::const_iterator hwHFEtSumsItr = hwHFEtSumsColl->begin();
783 L1GctHFRingEtSumsCollection::const_iterator hwHFEtSumsEnd = hwHFEtSumsColl->end();
786 for (; hwHFEtSumsItr != hwHFEtSumsEnd; ++hwHFEtSumsItr, ++iEtSums) {
787 int bx = hwHFEtSumsItr->bx();
790 L1GctHFBitCountsCollection::const_iterator hwHFBitCountsItr = hwHFBitCountsColl->begin();
791 L1GctHFBitCountsCollection::const_iterator hwHFBitCountsEnd = hwHFBitCountsColl->end();
794 for (; hwHFBitCountsItr != hwHFBitCountsEnd; ++hwHFBitCountsItr, ++iBitCounts) {
795 if (hwHFBitCountsItr->bx() ==
bx) {
801 if (hwHFBitCountsItr != hwHFBitCountsEnd) {
807 double etSums[L1HFRings::kNumRings];
808 etSums[L1HFRings::kRing1PosEta] = hfRingEtScale->
et(hwHFEtSumsItr->etSum(0)) + 1.
e-6;
809 etSums[L1HFRings::kRing1NegEta] = hfRingEtScale->
et(hwHFEtSumsItr->etSum(1)) + 1.
e-6;
810 etSums[L1HFRings::kRing2PosEta] = hfRingEtScale->
et(hwHFEtSumsItr->etSum(2)) + 1.
e-6;
811 etSums[L1HFRings::kRing2NegEta] = hfRingEtScale->
et(hwHFEtSumsItr->etSum(3)) + 1.
e-6;
826 int bitCounts[L1HFRings::kNumRings];
827 bitCounts[L1HFRings::kRing1PosEta] = hwHFBitCountsItr->bitCount(0);
828 bitCounts[L1HFRings::kRing1NegEta] = hwHFBitCountsItr->bitCount(1);
829 bitCounts[L1HFRings::kRing2PosEta] = hwHFBitCountsItr->bitCount(2);
830 bitCounts[L1HFRings::kRing2NegEta] = hwHFBitCountsItr->bitCount(3);
875 double etCorr =
et + 1.e-6;
884 double phi =
geom->emJetPhiBinCenter(
cand.phiIndex());
edm::InputTag muonSource_
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
edm::ESGetToken< L1CaloEtScale, L1JetEtScaleRcd > jetScaleToken_
edm::ESGetToken< L1GctJetFinderParams, L1GctJetFinderParamsRcd > jetFinderParamsToken_
math::PtEtaPhiMLorentzVector gctLorentzVector(const double &et, const L1GctCand &cand, const L1CaloGeometry *geom, bool central)
edm::ESGetToken< L1CaloEtScale, L1EmEtScaleRcd > emScaleToken_
bool produceCaloParticles_
edm::ESGetToken< L1CaloEtScale, L1HfRingEtScaleRcd > hfRingEtScaleToken_
double getHtLsbGeV() const
double htSumPhiBinCenter(unsigned int phiIndex) const
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
double etSumPhiBinCenter(unsigned int phiIndex) const
const L1MuScale * getPhiScale() const
get the phi scale
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
static const double muonMassGeV_
const L1MuScale * getPtScale() const
get the Pt scale
edm::ESGetToken< L1MuTriggerPtScale, L1MuTriggerPtScaleRcd > muPtScaleToken_
edm::InputTag etMissSource_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
double et(const uint16_t rank) const
convert from rank to physically meaningful quantity
edm::ESGetToken< L1CaloEtScale, L1HtMissScaleRcd > htMissScaleToken_
edm::InputTag htMissSource_
edm::InputTag cenJetSource_
bool produceMuonParticles_
~L1ExtraParticlesProd() override
edm::InputTag hfRingEtSumsSource_
edm::InputTag hfRingBitCountsSource_
void produce(edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > caloGeomToken_
#define DEFINE_FWK_MODULE(type)
edm::InputTag etTotSource_
edm::InputTag tauJetSource_
edm::InputTag isoEmSource_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
edm::InputTag isoTauJetSource_
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
edm::InputTag etHadSource_
edm::ESGetToken< L1MuTriggerScales, L1MuTriggerScalesRcd > muScalesToken_
unsigned rankScaleMax() const
ABC for GCT EM and jet candidates.
L1MuGMTReadoutRecord const & getRecord(int bx=0) const
L1ExtraParticlesProd(const edm::ParameterSet &)
std::vector< L1MuGMTExtendedCand > getGMTCands() const
get GMT candidates vector
edm::InputTag forJetSource_
edm::InputTag nonIsoEmSource_