Skip to content

Commit 2f4e6f6

Browse files
authored
Merge pull request #45086 from nabrandman/adding_mc_hmt_triggers_14_1_X
Adds muon shower triggers for MC data
2 parents 70e2ece + 3d4f24e commit 2f4e6f6

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

L1Trigger/L1TGlobal/plugins/GenToInputProducer.cc

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "DataFormats/L1Trigger/interface/EGamma.h"
3535
#include "DataFormats/L1Trigger/interface/Muon.h"
36+
#include "DataFormats/L1Trigger/interface/MuonShower.h"
3637
#include "DataFormats/L1Trigger/interface/Tau.h"
3738
#include "DataFormats/L1Trigger/interface/Jet.h"
3839
#include "DataFormats/L1Trigger/interface/EtSum.h"
@@ -85,12 +86,14 @@ namespace l1t {
8586
//std::shared_ptr<FirmwareVersion> m_fwv; //not const during testing.
8687

8788
TRandom3* gRandom;
89+
TRandom3* mushowerRandom;
8890

8991
// BX parameters
9092
int bxFirst_;
9193
int bxLast_;
9294

9395
int maxNumMuCands_;
96+
int maxNumMuShowerCands_;
9497
int maxNumJetCands_;
9598
int maxNumEGCands_;
9699
int maxNumTauCands_;
@@ -115,6 +118,11 @@ namespace l1t {
115118
std::vector<l1t::Muon> muonVec_bx0;
116119
std::vector<l1t::Muon> muonVec_bxp1;
117120

121+
std::vector<l1t::MuonShower> muonShowerVec_bxm2;
122+
std::vector<l1t::MuonShower> muonShowerVec_bxm1;
123+
std::vector<l1t::MuonShower> muonShowerVec_bx0;
124+
std::vector<l1t::MuonShower> muonShowerVec_bxp1;
125+
118126
std::vector<l1t::EGamma> egammaVec_bxm2;
119127
std::vector<l1t::EGamma> egammaVec_bxm1;
120128
std::vector<l1t::EGamma> egammaVec_bx0;
@@ -148,6 +156,7 @@ namespace l1t {
148156
// register what you produce
149157
produces<BXVector<l1t::EGamma>>();
150158
produces<BXVector<l1t::Muon>>();
159+
produces<BXVector<l1t::MuonShower>>();
151160
produces<BXVector<l1t::Tau>>();
152161
produces<BXVector<l1t::Jet>>();
153162
produces<BXVector<l1t::EtSum>>();
@@ -158,6 +167,7 @@ namespace l1t {
158167
bxLast_ = iConfig.getParameter<int>("bxLast");
159168

160169
maxNumMuCands_ = iConfig.getParameter<int>("maxMuCand");
170+
maxNumMuShowerCands_ = iConfig.getParameter<int>("maxMuShowerCand");
161171
maxNumJetCands_ = iConfig.getParameter<int>("maxJetCand");
162172
maxNumEGCands_ = iConfig.getParameter<int>("maxEGCand");
163173
maxNumTauCands_ = iConfig.getParameter<int>("maxTauCand");
@@ -193,6 +203,7 @@ namespace l1t {
193203

194204
// Setup vectors
195205
std::vector<l1t::Muon> muonVec;
206+
std::vector<l1t::MuonShower> muonShowerVec;
196207
std::vector<l1t::EGamma> egammaVec;
197208
std::vector<l1t::Tau> tauVec;
198209
std::vector<l1t::Jet> jetVec;
@@ -224,6 +235,7 @@ namespace l1t {
224235
//outputs
225236
std::unique_ptr<l1t::EGammaBxCollection> egammas(new l1t::EGammaBxCollection(0, bxFirst, bxLast));
226237
std::unique_ptr<l1t::MuonBxCollection> muons(new l1t::MuonBxCollection(0, bxFirst, bxLast));
238+
std::unique_ptr<l1t::MuonShowerBxCollection> muonShowers(new l1t::MuonShowerBxCollection(0, bxFirst, bxLast));
227239
std::unique_ptr<l1t::TauBxCollection> taus(new l1t::TauBxCollection(0, bxFirst, bxLast));
228240
std::unique_ptr<l1t::JetBxCollection> jets(new l1t::JetBxCollection(0, bxFirst, bxLast));
229241
std::unique_ptr<l1t::EtSumBxCollection> etsums(new l1t::EtSumBxCollection(0, bxFirst, bxLast));
@@ -259,6 +271,23 @@ namespace l1t {
259271
LogTrace("GtGenToInputProducer") << ">>> GenParticles collection not found!" << std::endl;
260272
}
261273

274+
// Muon Shower Collection
275+
276+
bool mus0 = (bool)mushowerRandom->Integer(2); // should be [0,1] = 1 bit;
277+
bool mus1 = (bool)mushowerRandom->Integer(2);
278+
bool mus2 = (bool)mushowerRandom->Integer(2);
279+
bool mus2Loose = (bool)mushowerRandom->Integer(2);
280+
bool musoot0 = (bool)mushowerRandom->Integer(2);
281+
bool musoot1 = (bool)mushowerRandom->Integer(2);
282+
bool musoot2Loose = (bool)mushowerRandom->Integer(2);
283+
//fill a vector of MuonShower objs with only one obj per BX, not one obj per muon obj
284+
cout << "GenToInputProducer MuonShower = (MUS0, MUS1, MUS2, MUSOOT0, MUSOOT1) = (" << mus0 << "," << mus1 << ","
285+
<< mus2 << "," << musoot0 << "," << musoot1 << ")" << endl;
286+
l1t::MuonShower muShower(mus0, musoot0, mus2Loose, musoot2Loose, mus1, musoot1, mus2);
287+
muShower.setMusOutOfTime0(musoot0);
288+
muShower.setMusOutOfTime1(musoot1);
289+
muonShowerVec.push_back(muShower);
290+
262291
// Muon Collection
263292
int numMuCands = int(mu_cands_index.size());
264293
Int_t idxMu[numMuCands];
@@ -635,6 +664,28 @@ namespace l1t {
635664
muonVec.clear();
636665
}
637666

667+
// Fill MuonShowers
668+
for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxm2.size()); iMuShower++) {
669+
muonShowers->push_back(-2, muonShowerVec_bxm2[iMuShower]);
670+
}
671+
for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxm1.size()); iMuShower++) {
672+
muonShowers->push_back(-1, muonShowerVec_bxm1[iMuShower]);
673+
}
674+
for (int iMuShower = 0; iMuShower < int(muonShowerVec_bx0.size()); iMuShower++) {
675+
muonShowers->push_back(0, muonShowerVec_bx0[iMuShower]);
676+
}
677+
for (int iMuShower = 0; iMuShower < int(muonShowerVec_bxp1.size()); iMuShower++) {
678+
muonShowers->push_back(1, muonShowerVec_bxp1[iMuShower]);
679+
}
680+
if (emptyBxTrailer_ <= (emptyBxEvt_ - eventCnt_)) {
681+
for (int iMuShower = 0; iMuShower < int(muonShowerVec.size()); iMuShower++) {
682+
muonShowers->push_back(2, muonShowerVec[iMuShower]);
683+
}
684+
} else {
685+
// this event is part of empty trailer...clear out data
686+
muonShowerVec.clear();
687+
}
688+
638689
// Fill Egammas
639690
for (int iEG = 0; iEG < int(egammaVec_bxm2.size()); iEG++) {
640691
egammas->push_back(-2, egammaVec_bxm2[iEG]);
@@ -737,34 +788,39 @@ namespace l1t {
737788

738789
iEvent.put(std::move(egammas));
739790
iEvent.put(std::move(muons));
791+
iEvent.put(std::move(muonShowers));
740792
iEvent.put(std::move(taus));
741793
iEvent.put(std::move(jets));
742794
iEvent.put(std::move(etsums));
743795
iEvent.put(std::move(extCond));
744796

745797
// Now shift the bx data by one to prepare for next event.
746798
muonVec_bxm2 = muonVec_bxm1;
799+
muonShowerVec_bxm2 = muonShowerVec_bxm1;
747800
egammaVec_bxm2 = egammaVec_bxm1;
748801
tauVec_bxm2 = tauVec_bxm1;
749802
jetVec_bxm2 = jetVec_bxm1;
750803
etsumVec_bxm2 = etsumVec_bxm1;
751804
extCond_bxm2 = extCond_bxm1;
752805

753806
muonVec_bxm1 = muonVec_bx0;
807+
muonShowerVec_bxm1 = muonShowerVec_bx0;
754808
egammaVec_bxm1 = egammaVec_bx0;
755809
tauVec_bxm1 = tauVec_bx0;
756810
jetVec_bxm1 = jetVec_bx0;
757811
etsumVec_bxm1 = etsumVec_bx0;
758812
extCond_bxm1 = extCond_bx0;
759813

760814
muonVec_bx0 = muonVec_bxp1;
815+
muonShowerVec_bx0 = muonShowerVec_bxp1;
761816
egammaVec_bx0 = egammaVec_bxp1;
762817
tauVec_bx0 = tauVec_bxp1;
763818
jetVec_bx0 = jetVec_bxp1;
764819
etsumVec_bx0 = etsumVec_bxp1;
765820
extCond_bx0 = extCond_bxp1;
766821

767822
muonVec_bxp1 = muonVec;
823+
muonShowerVec_bxp1 = muonShowerVec;
768824
egammaVec_bxp1 = egammaVec;
769825
tauVec_bxp1 = tauVec;
770826
jetVec_bxp1 = jetVec;
@@ -786,6 +842,7 @@ namespace l1t {
786842
srand(0);
787843

788844
gRandom = new TRandom3();
845+
mushowerRandom = new TRandom3();
789846
}
790847

791848
// ------------ method called when ending the processing of a run ------------

L1Trigger/L1TGlobal/test/runGlobalFakeInputProducer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import sys
44

55
"""
6-
IMPORTANT NOTE: currently not working for MC-based validation after the updates of the GtRecordDump!
7-
Fix needed.
8-
96
Description: script used for offline validation of the Global Trigger firmware and emulator agreement
107
(Contacts: Richard Cavanaugh, Elisa Fontanesi)
118
-----------------------------------------------------------------------------------------------------
@@ -226,6 +223,7 @@
226223
# Run the Stage 2 uGT emulator
227224
# ----------------------------
228225
process.load('L1Trigger.L1TGlobal.simGtStage2Digis_cfi')
226+
process.simGtStage2Digis.useMuonShowers = cms.bool(True)
229227
process.simGtStage2Digis.PrescaleSet = cms.uint32(1)
230228
process.simGtStage2Digis.ExtInputTag = cms.InputTag("simGtExtFakeProd")
231229
process.simGtStage2Digis.MuonInputTag = cms.InputTag("gtInput")

0 commit comments

Comments
 (0)