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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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 ( 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 getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
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 gather_cfg::cout, DEFINE_FWK_MODULE, MillePedeFileConverter_cfg::e, PVValHelper::eta, edm::EventSetup::get(), edm::Event::getByToken(), L1MuScale::getCenter(), L1MuGMTReadoutRecord::getGMTCands(), L1MuTriggerScales::getGMTEtaScale(), L1MuScale::getLowEdge(), L1MuTriggerScales::getPhiScale(), L1MuTriggerPtScale::getPtScale(), L1MuGMTReadoutCollection::getRecord(), L1MuGMTReadoutCollection::getRecords(), mps_fire::i, createfilelist::int, edm::HandleBase::isValid(), LogDebug, eostools::move(), p4, 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 
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
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< L1MuGMTExtendedCand > getGMTCands() const
get GMT candidates vector
const L1MuScale * getPtScale() const
get the Pt scale
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Muon.py:1
double p4[4]
Definition: TauolaWrapper.h:92
const L1MuScale * getPhiScale() const
get the phi scale
bool isValid() const
Definition: HandleBase.h:70
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
static const double muonMassGeV_
HLT enums.
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
T get() const
Definition: EventSetup.h:73
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
L1MuGMTReadoutRecord const & getRecord(int bx=0) const
def move(src, dest)
Definition: eostools.py:511

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.