CMS 3D CMS Logo

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

#include <L1TMuonLegacyConverter.h>

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

Public Member Functions

 L1TMuonLegacyConverter (const edm::ParameterSet &)
 
 ~L1TMuonLegacyConverter () override
 
- 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
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

bool centralBxOnly_
 
bool ignoreHtMiss_
 
edm::InputTag muonSource_InputTag
 
edm::EDGetTokenT< L1MuGMTReadoutCollectionmuonSource_InputToken
 
edm::ESGetToken< L1MuTriggerPtScale, L1MuTriggerPtScaleRcdmuPtScaleToken_
 
edm::ESGetToken< L1MuTriggerScales, L1MuTriggerScalesRcdmuScalesToken_
 
bool produceMuonParticles_
 

Static Private Attributes

static const double muonMassGeV_ = 0.105658369
 

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

src/L1TMuonLegacyConverter/src/L1TMuonLegacyConverter.cc

L1Trigger/L1TCommon/interface/L1TMuonLegacyConverter.h

Description: conver L1T muons legacy format to stage2 format

Definition at line 49 of file L1TMuonLegacyConverter.h.

Constructor & Destructor Documentation

◆ L1TMuonLegacyConverter()

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

Definition at line 65 of file L1TMuonLegacyConverter.cc.

References deDxTools::esConsumes(), edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

65  {
66  using namespace l1extra;
67 
68  // moving inputTag here
69  muonSource_InputTag = iConfig.getParameter<edm::InputTag>("muonSource");
70  produceMuonParticles_ = iConfig.getUntrackedParameter<bool>("produceMuonParticles");
71  centralBxOnly_ = iConfig.getUntrackedParameter<bool>("centralBxOnly");
72 
73  produces<MuonBxCollection>("imdMuonsLegacy");
74  muonSource_InputToken = consumes<L1MuGMTReadoutCollection>(muonSource_InputTag);
75 
79  }
80 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< L1MuTriggerPtScale, L1MuTriggerPtScaleRcd > muPtScaleToken_
edm::ESGetToken< L1MuTriggerScales, L1MuTriggerScalesRcd > muScalesToken_

◆ ~L1TMuonLegacyConverter()

L1TMuonLegacyConverter::~L1TMuonLegacyConverter ( )
override

Definition at line 82 of file L1TMuonLegacyConverter.cc.

82  {
83  // do anything here that needs to be done at desctruction time
84  // (e.g. close files, deallocate resources etc.)
85 }

Member Function Documentation

◆ produce()

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

Definition at line 92 of file L1TMuonLegacyConverter.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, PVValHelper::eta, L1MuScale::getCenter(), L1MuGMTReadoutRecord::getGMTCands(), L1MuTriggerScales::getGMTEtaScale(), edm::EventSetup::getHandle(), L1MuScale::getLowEdge(), L1MuTriggerScales::getPhiScale(), L1MuTriggerPtScale::getPtScale(), L1MuGMTReadoutCollection::getRecord(), L1MuGMTReadoutCollection::getRecords(), mps_fire::i, iEvent, createfilelist::int, edm::HandleBase::isValid(), LogDebug, eostools::move(), and DiDispStaMuonMonitor_cfi::pt.

92  {
93  using namespace edm;
94  using namespace l1extra;
95  using namespace std;
96 
97  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98  // ~~~~~~~~~~~~~~~~~~~~ Muons ~~~~~~~~~~~~~~~~~~~~
99  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100 
101  std::unique_ptr<MuonBxCollection> imdMuonsLegacy(new MuonBxCollection());
102 
103  LogDebug("L1TMuonLegacyConverter") << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
104  << "\nrequested in configuration, but not found in the event." << std::endl;
105 
106  if (produceMuonParticles_) {
108 
110 
111  Handle<L1MuGMTReadoutCollection> simMuCollection;
112  iEvent.getByToken(muonSource_InputToken, simMuCollection);
113 
114  vector<L1MuGMTExtendedCand> simMuCands;
115 
116  if (!simMuCollection.isValid()) {
117  LogDebug("L1TMuonLegacyConverter") << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
118  << "\nrequested in configuration, but not found in the event." << std::endl;
119  } else {
120  if (centralBxOnly_) {
121  // Get GMT candidates from central bunch crossing only
122  simMuCands = simMuCollection->getRecord().getGMTCands();
123  } else {
124  // Get GMT candidates from all bunch crossings
125  vector<L1MuGMTReadoutRecord> records = simMuCollection->getRecords();
126  vector<L1MuGMTReadoutRecord>::const_iterator rItr = records.begin();
127  vector<L1MuGMTReadoutRecord>::const_iterator rEnd = records.end();
128 
129  for (; rItr != rEnd; ++rItr) {
130  vector<L1MuGMTExtendedCand> tmpCands = rItr->getGMTCands();
131 
132  simMuCands.insert(simMuCands.end(), tmpCands.begin(), tmpCands.end());
133  }
134  }
135 
136  vector<L1MuGMTExtendedCand>::const_iterator muItr = simMuCands.begin();
137  vector<L1MuGMTExtendedCand>::const_iterator muEnd = simMuCands.end();
138  for (int i = 0; muItr != muEnd; ++muItr, ++i) {
139  if (!muItr->empty()) {
140  // keep x and y components non-zero and protect against roundoff.
141  double pt = muPtScale->getPtScale()->getLowEdge(muItr->ptIndex()) + 1.e-6;
142  std::cout << "pt from muPtScale = " << pt << std::endl;
143  double eta = muScales->getGMTEtaScale()->getCenter(muItr->etaIndex());
144  double phi = muScales->getPhiScale()->getLowEdge(muItr->phiIndex());
145 
147 
148  Muon outMu{p4,
149  (int)0,
150  (int)0,
151  (int)0,
152  (int)muItr->quality(),
153  (int)muItr->charge(),
154  (int)muItr->charge_valid(),
155  (int)muItr->isol(),
156  (int)0,
157  (int)0,
158  true,
159  (int)0,
160  (int)0,
161  (int)0,
162  (int)muItr->rank()};
163  imdMuonsLegacy->push_back(muItr->bx(), outMu);
164  }
165  }
166  }
167  }
168 
169  iEvent.put(std::move(imdMuonsLegacy), "imdMuonsLegacy");
170 
171 } // closing produce
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
const L1MuScale * getPhiScale() const
get the phi scale
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
const L1MuScale * getPtScale() const
get the Pt scale
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int iEvent
Definition: GenABIO.cc:224
Definition: Muon.py:1
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
static const double muonMassGeV_
bool isValid() const
Definition: HandleBase.h:70
edm::ESGetToken< L1MuTriggerPtScale, L1MuTriggerPtScaleRcd > muPtScaleToken_
HLT enums.
L1MuGMTReadoutRecord const & getRecord(int bx=0) const
std::vector< L1MuGMTExtendedCand > getGMTCands() const
get GMT candidates vector
edm::ESGetToken< L1MuTriggerScales, L1MuTriggerScalesRcd > muScalesToken_
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ centralBxOnly_

bool L1TMuonLegacyConverter::centralBxOnly_
private

Definition at line 86 of file L1TMuonLegacyConverter.h.

◆ ignoreHtMiss_

bool L1TMuonLegacyConverter::ignoreHtMiss_
private

Definition at line 90 of file L1TMuonLegacyConverter.h.

◆ muonMassGeV_

double const L1TMuonLegacyConverter::muonMassGeV_ = 0.105658369
staticprivate

Definition at line 84 of file L1TMuonLegacyConverter.h.

◆ muonSource_InputTag

edm::InputTag L1TMuonLegacyConverter::muonSource_InputTag
private

Definition at line 65 of file L1TMuonLegacyConverter.h.

◆ muonSource_InputToken

edm::EDGetTokenT<L1MuGMTReadoutCollection> L1TMuonLegacyConverter::muonSource_InputToken
private

Definition at line 66 of file L1TMuonLegacyConverter.h.

◆ muPtScaleToken_

edm::ESGetToken<L1MuTriggerPtScale, L1MuTriggerPtScaleRcd> L1TMuonLegacyConverter::muPtScaleToken_
private

Definition at line 69 of file L1TMuonLegacyConverter.h.

◆ muScalesToken_

edm::ESGetToken<L1MuTriggerScales, L1MuTriggerScalesRcd> L1TMuonLegacyConverter::muScalesToken_
private

Definition at line 68 of file L1TMuonLegacyConverter.h.

◆ produceMuonParticles_

bool L1TMuonLegacyConverter::produceMuonParticles_
private

Definition at line 64 of file L1TMuonLegacyConverter.h.