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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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
 
bool produceMuonParticles_
 

Static Private Attributes

static const double muonMassGeV_ = 0.105658369
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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::L1TMuonLegacyConverter ( const edm::ParameterSet iConfig)
explicit

Definition at line 65 of file L1TMuonLegacyConverter.cc.

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 }

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

◆ ~L1TMuonLegacyConverter()

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

◆ produce()

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

Definition at line 87 of file L1TMuonLegacyConverter.cc.

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 
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

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

Member Data Documentation

◆ centralBxOnly_

bool L1TMuonLegacyConverter::centralBxOnly_
private

Definition at line 80 of file L1TMuonLegacyConverter.h.

◆ ignoreHtMiss_

bool L1TMuonLegacyConverter::ignoreHtMiss_
private

Definition at line 84 of file L1TMuonLegacyConverter.h.

◆ muonMassGeV_

const double L1TMuonLegacyConverter::muonMassGeV_ = 0.105658369
staticprivate

Definition at line 78 of file L1TMuonLegacyConverter.h.

◆ muonSource_InputTag

edm::InputTag L1TMuonLegacyConverter::muonSource_InputTag
private

Definition at line 61 of file L1TMuonLegacyConverter.h.

◆ muonSource_InputToken

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

Definition at line 62 of file L1TMuonLegacyConverter.h.

◆ produceMuonParticles_

bool L1TMuonLegacyConverter::produceMuonParticles_
private

Definition at line 60 of file L1TMuonLegacyConverter.h.

mps_fire.i
i
Definition: mps_fire.py:428
L1MuTriggerScales::getGMTEtaScale
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
Definition: L1MuTriggerScales.h:169
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm
HLT enums.
Definition: AlignableModifier.h:19
L1TMuonLegacyConverter::muonSource_InputTag
edm::InputTag muonSource_InputTag
Definition: L1TMuonLegacyConverter.h:61
l1t::MuonBxCollection
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
Muon
Definition: Muon.py:1
L1MuTriggerScales::getPhiScale
const L1MuScale * getPhiScale() const
get the phi scale
Definition: L1MuTriggerScales.h:175
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
PVValHelper::eta
Definition: PVValidationHelpers.h:69
edm::ESHandle
Definition: DTSurvey.h:22
L1MuScale::getLowEdge
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
L1MuGMTReadoutCollection::getRecords
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
Definition: L1MuGMTReadoutCollection.h:52
L1MuTriggerPtScale::getPtScale
const L1MuScale * getPtScale() const
get the Pt scale
Definition: L1MuTriggerPtScale.h:59
L1MuGMTReadoutCollection::getRecord
L1MuGMTReadoutRecord const & getRecord(int bx=0) const
Definition: L1MuGMTReadoutCollection.h:55
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
L1MuGMTReadoutRecord::getGMTCands
std::vector< L1MuGMTExtendedCand > getGMTCands() const
get GMT candidates vector
Definition: L1MuGMTReadoutRecord.cc:93
L1MuTriggerPtScaleRcd
Definition: L1MuTriggerPtScaleRcd.h:12
get
#define get
L1MuTriggerScalesRcd
Definition: L1MuTriggerScalesRcd.h:12
L1TMuonLegacyConverter::muonMassGeV_
static const double muonMassGeV_
Definition: L1TMuonLegacyConverter.h:78
DDAxes::phi
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1TMuonLegacyConverter::produceMuonParticles_
bool produceMuonParticles_
Definition: L1TMuonLegacyConverter.h:60
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
l1extra
Definition: L1EmParticle.h:26
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
L1TMuonLegacyConverter::muonSource_InputToken
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
Definition: L1TMuonLegacyConverter.h:62
L1TMuonLegacyConverter::centralBxOnly_
bool centralBxOnly_
Definition: L1TMuonLegacyConverter.h:80
L1MuScale::getCenter
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37