CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Phase2L1TGMTSAMuonProducer Class Reference

#include <L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTSAMuonProducer.cc>

Inheritance diagram for Phase2L1TGMTSAMuonProducer:
edm::stream::EDProducer<>

Public Member Functions

 Phase2L1TGMTSAMuonProducer (const edm::ParameterSet &)
 
 ~Phase2L1TGMTSAMuonProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (edm::StreamID) override
 
l1t::SAMuon Convertl1tMuon (const l1t::Muon &mu, const int bx_)
 
void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< BXVector< l1t::Muon > > muonToken_
 
unsigned int Ndisplaced
 
unsigned int Nprompt
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file Phase2L1TGMTSAMuonProducer.cc.

Constructor & Destructor Documentation

◆ Phase2L1TGMTSAMuonProducer()

Phase2L1TGMTSAMuonProducer::Phase2L1TGMTSAMuonProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 68 of file Phase2L1TGMTSAMuonProducer.cc.

69  : muonToken_(consumes<l1t::MuonBxCollection>(iConfig.getParameter<edm::InputTag>("muonToken"))),
70  Nprompt(iConfig.getParameter<uint>("Nprompt")),
71  Ndisplaced(iConfig.getParameter<uint>("Ndisplaced")) {
72  produces<std::vector<l1t::SAMuon> >("promptSAMuons").setBranchAlias("prompt");
73  produces<std::vector<l1t::SAMuon> >("displacedSAMuons").setBranchAlias("displaced");
74 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< BXVector< l1t::Muon > > muonToken_

◆ ~Phase2L1TGMTSAMuonProducer()

Phase2L1TGMTSAMuonProducer::~Phase2L1TGMTSAMuonProducer ( )
overridedefault

Member Function Documentation

◆ beginStream()

void Phase2L1TGMTSAMuonProducer::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 159 of file Phase2L1TGMTSAMuonProducer.cc.

159  {
160  // please remove this method if not needed
161 }

◆ Convertl1tMuon()

SAMuon Phase2L1TGMTSAMuonProducer::Convertl1tMuon ( const l1t::Muon mu,
const int  bx_ 
)
private

Definition at line 129 of file Phase2L1TGMTSAMuonProducer.cc.

References Phase2L1GMT::BITSGTETA, Phase2L1GMT::BITSGTPHI, Phase2L1GMT::BITSGTPT, Phase2L1GMT::BITSSAD0, Phase2L1GMT::BITSSAQUAL, Phase2L1GMT::BITSSAZ0, ALCARECOTkAlJpsiMuMu_cff::charge, d0, PVValHelper::eta, Phase2L1GMT::LSBeta, Phase2L1GMT::LSBphi, Phase2L1GMT::LSBpt, amptDefaultParameters_cff::mu, phi, DiDispStaMuonMonitor_cfi::pt, l1tGTMenu_lepSeeds_cff::qual, l1t::SAMuon::setWord(), and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by produce().

129  {
130  qual_sa_t qual = mu.hwQual();
131  int charge = mu.charge() > 0 ? 0 : 1;
132 
133  pt_sa_t pt = round(mu.pt() / LSBpt);
134  phi_sa_t phi = round(mu.phi() / LSBphi);
135  eta_sa_t eta = round(mu.eta() / LSBeta);
136  // FIXME: Below are not well defined in phase1 GMT
137  // Using the version from Correlator for now
138  z0_sa_t z0 = 0; // No tracks info in Phase 1
139  // Use 2 bits with LSB = 30cm for BMTF and 25cm for EMTF currently, but subjet to change
140  d0_sa_t d0 = mu.hwDXY();
141 
142  int bstart = 0;
143  wordtype word(0);
144  bstart = wordconcat<wordtype>(word, bstart, pt > 0, 1);
145  bstart = wordconcat<wordtype>(word, bstart, pt, BITSGTPT);
146  bstart = wordconcat<wordtype>(word, bstart, phi, BITSGTPHI);
147  bstart = wordconcat<wordtype>(word, bstart, eta, BITSGTETA);
148  bstart = wordconcat<wordtype>(word, bstart, z0, BITSSAZ0);
149  bstart = wordconcat<wordtype>(word, bstart, d0, BITSSAD0);
150  bstart = wordconcat<wordtype>(word, bstart, charge, 1);
151  bstart = wordconcat<wordtype>(word, bstart, qual, BITSSAQUAL);
152 
153  SAMuon samuon(mu, charge, pt.to_uint(), eta.to_int(), phi.to_int(), z0.to_int(), d0.to_int(), qual.to_uint());
154  samuon.setWord(word);
155  return samuon;
156 } // ----- end of function Phase2L1TGMTSAMuonProducer::Convertl1tMuon -----
const float LSBphi
Definition: Constants.h:92
const int BITSGTETA
Definition: Constants.h:62
ap_uint< BITSGTPT > pt_sa_t
Definition: Constants.h:113
const int BITSSAD0
Definition: Constants.h:56
const int BITSGTPHI
Definition: Constants.h:61
ap_uint< BITSSAQUAL > qual_sa_t
Definition: Constants.h:119
void setWord(uint64_t word)
Definition: SAMuon.h:53
const int BITSSAQUAL
Definition: Constants.h:57
ap_int< BITSSAD0 > d0_sa_t
Definition: Constants.h:117
ap_uint< 64 > wordtype
Definition: Constants.h:99
uint64_t word
const float LSBpt
Definition: Constants.h:91
ap_int< BITSGTETA > eta_sa_t
Definition: Constants.h:115
const int BITSGTPT
Definition: Constants.h:60
const float LSBeta
Definition: Constants.h:93
static constexpr float d0
ap_int< BITSSAZ0 > z0_sa_t
Definition: Constants.h:116
ap_int< BITSGTPHI > phi_sa_t
Definition: Constants.h:114
const int BITSSAZ0
Definition: Constants.h:55

◆ endStream()

void Phase2L1TGMTSAMuonProducer::endStream ( )
overrideprivate

Definition at line 164 of file Phase2L1TGMTSAMuonProducer.cc.

164  {
165  // please remove this method if not needed
166 }

◆ fillDescriptions()

void Phase2L1TGMTSAMuonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 169 of file Phase2L1TGMTSAMuonProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

169  {
171  desc.add<edm::InputTag>("muonToken", edm::InputTag("simGmtStage2Digis"));
172  desc.add<unsigned int>("Nprompt", 12);
173  desc.add<unsigned int>("Ndisplaced", 12);
174  descriptions.add("standaloneMuons", desc);
175 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void Phase2L1TGMTSAMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 81 of file Phase2L1TGMTSAMuonProducer.cc.

References funct::abs(), nano_mu_digi_cff::bx, Convertl1tMuon(), BPHMonitor_cff::displaced, mps_fire::i, iEvent, eostools::move(), amptDefaultParameters_cff::mu, HLT_2023v12_cff::muon, muonToken_, Ndisplaced, Nprompt, jetUpdater_cfi::sort, and parallelization::uint.

81  {
82  using namespace edm;
84  iEvent.getByToken(muonToken_, muon);
85 
86  // Output
87  std::vector<SAMuon> prompt;
88  std::vector<SAMuon> displaced;
89 
90  for (int bx = muon->getFirstBX(); bx <= muon->getLastBX(); ++bx) {
91  //TODO: We are expecting to send all BX. Using bx0 for now
92  if (bx != 0) {
93  continue;
94  }
95 
96  for (uint i = 0; i < muon->size(bx); ++i) {
97  const l1t::Muon& mu = muon->at(bx, i);
98 
99  //TODO: Still looking for a way to get displaced muon
100  if (abs(mu.hwDXY()) > 0)
101  displaced.push_back(Convertl1tMuon(mu, bx));
102  else
103  prompt.push_back(Convertl1tMuon(mu, bx));
104  }
105 
106  // Sort by hwPt
107  std::sort(prompt.begin(), prompt.end(), std::greater<>());
108  std::sort(displaced.begin(), displaced.end(), std::greater<>());
109 
110  // Store into output, allow up to 18 prompt + 18 displayed
111  if (prompt.size() > Nprompt) {
112  prompt.resize(Nprompt);
113  }
114  if (displaced.size() > Ndisplaced) {
115  displaced.resize(Ndisplaced);
116  }
117  }
118 
119  std::unique_ptr<std::vector<l1t::SAMuon> > prompt_ptr = std::make_unique<std::vector<l1t::SAMuon> >(prompt);
120  std::unique_ptr<std::vector<l1t::SAMuon> > displaced_ptr = std::make_unique<std::vector<l1t::SAMuon> >(displaced);
121  iEvent.put(std::move(prompt_ptr), "promptSAMuons");
122  iEvent.put(std::move(displaced_ptr), "displacedSAMuons");
123 }
edm::EDGetTokenT< BXVector< l1t::Muon > > muonToken_
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: Muon.h:21
HLT enums.
l1t::SAMuon Convertl1tMuon(const l1t::Muon &mu, const int bx_)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ muonToken_

edm::EDGetTokenT<BXVector<l1t::Muon> > Phase2L1TGMTSAMuonProducer::muonToken_
private

Definition at line 63 of file Phase2L1TGMTSAMuonProducer.cc.

Referenced by produce().

◆ Ndisplaced

unsigned int Phase2L1TGMTSAMuonProducer::Ndisplaced
private

Definition at line 65 of file Phase2L1TGMTSAMuonProducer.cc.

Referenced by produce().

◆ Nprompt

unsigned int Phase2L1TGMTSAMuonProducer::Nprompt
private

Definition at line 64 of file Phase2L1TGMTSAMuonProducer.cc.

Referenced by produce().