CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< L1MuGMTReadoutCollection
muonSource_InputToken
 
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 45 of file L1TMuonLegacyConverter.h.

Constructor & Destructor Documentation

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

Definition at line 65 of file L1TMuonLegacyConverter.cc.

References 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 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1TMuonLegacyConverter::~L1TMuonLegacyConverter ( )
override

Definition at line 77 of file L1TMuonLegacyConverter.cc.

77  {
78  // do anything here that needs to be done at desctruction time
79  // (e.g. close files, deallocate resources etc.)
80 }

Member Function Documentation

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

Definition at line 87 of file L1TMuonLegacyConverter.cc.

References reco::LeafCandidate::charge(), gather_cfg::cout, alignCSCRings::e, PVValHelper::eta, edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, edm::HandleBase::isValid(), LogDebug, eostools::move(), DiDispStaMuonMonitor_cfi::pt, and edm::Event::put().

87  {
88  using namespace edm;
89  using namespace l1extra;
90  using namespace std;
91 
92  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93  // ~~~~~~~~~~~~~~~~~~~~ Muons ~~~~~~~~~~~~~~~~~~~~
94  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95 
96  std::unique_ptr<MuonBxCollection> imdMuonsLegacy(new MuonBxCollection());
97 
98  LogDebug("L1TMuonLegacyConverter") << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
99  << "\nrequested in configuration, but not found in the event." << std::endl;
100 
101  if (produceMuonParticles_) {
103  iSetup.get<L1MuTriggerScalesRcd>().get(muScales);
104 
106  iSetup.get<L1MuTriggerPtScaleRcd>().get(muPtScale);
107 
108  Handle<L1MuGMTReadoutCollection> simMuCollection;
109  iEvent.getByToken(muonSource_InputToken, simMuCollection);
110 
111  vector<L1MuGMTExtendedCand> simMuCands;
112 
113  if (!simMuCollection.isValid()) {
114  LogDebug("L1TMuonLegacyConverter") << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
115  << "\nrequested in configuration, but not found in the event." << std::endl;
116  } else {
117  if (centralBxOnly_) {
118  // Get GMT candidates from central bunch crossing only
119  simMuCands = simMuCollection->getRecord().getGMTCands();
120  } else {
121  // Get GMT candidates from all bunch crossings
122  vector<L1MuGMTReadoutRecord> records = simMuCollection->getRecords();
123  vector<L1MuGMTReadoutRecord>::const_iterator rItr = records.begin();
124  vector<L1MuGMTReadoutRecord>::const_iterator rEnd = records.end();
125 
126  for (; rItr != rEnd; ++rItr) {
127  vector<L1MuGMTExtendedCand> tmpCands = rItr->getGMTCands();
128 
129  simMuCands.insert(simMuCands.end(), tmpCands.begin(), tmpCands.end());
130  }
131  }
132 
133  vector<L1MuGMTExtendedCand>::const_iterator muItr = simMuCands.begin();
134  vector<L1MuGMTExtendedCand>::const_iterator muEnd = simMuCands.end();
135  for (int i = 0; muItr != muEnd; ++muItr, ++i) {
136  if (!muItr->empty()) {
137  // keep x and y components non-zero and protect against roundoff.
138  double pt = muPtScale->getPtScale()->getLowEdge(muItr->ptIndex()) + 1.e-6;
139  std::cout << "pt from muPtScale = " << pt << std::endl;
140  double eta = muScales->getGMTEtaScale()->getCenter(muItr->etaIndex());
141  double phi = muScales->getPhiScale()->getLowEdge(muItr->phiIndex());
142 
143  math::PtEtaPhiMLorentzVector p4(pt, eta, phi, muonMassGeV_);
144 
145  Muon outMu{p4,
146  (int)0,
147  (int)0,
148  (int)0,
149  (int)muItr->quality(),
150  (int)muItr->charge(),
151  (int)muItr->charge_valid(),
152  (int)muItr->isol(),
153  (int)0,
154  (int)0,
155  true,
156  (int)0,
157  (int)0,
158  (int)0,
159  (int)muItr->rank()};
160  imdMuonsLegacy->push_back(muItr->bx(), outMu);
161  }
162  }
163  }
164  }
165 
166  iEvent.put(std::move(imdMuonsLegacy), "imdMuonsLegacy");
167 
168 } // closing produce
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
def move
Definition: eostools.py:511
bool isValid() const
Definition: HandleBase.h:70
Definition: Muon.h:21
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
static const double muonMassGeV_
T get() const
Definition: EventSetup.h:88
tuple cout
Definition: gather_cfg.py:144
int charge() const final
electric charge
#define LogDebug(id)

Member Data Documentation

bool L1TMuonLegacyConverter::centralBxOnly_
private

Definition at line 80 of file L1TMuonLegacyConverter.h.

bool L1TMuonLegacyConverter::ignoreHtMiss_
private

Definition at line 84 of file L1TMuonLegacyConverter.h.

double const L1TMuonLegacyConverter::muonMassGeV_ = 0.105658369
staticprivate

Definition at line 78 of file L1TMuonLegacyConverter.h.

edm::InputTag L1TMuonLegacyConverter::muonSource_InputTag
private

Definition at line 61 of file L1TMuonLegacyConverter.h.

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

Definition at line 62 of file L1TMuonLegacyConverter.h.

bool L1TMuonLegacyConverter::produceMuonParticles_
private

Definition at line 60 of file L1TMuonLegacyConverter.h.