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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TMuonLegacyConverter (const edm::ParameterSet &)
 
 ~L1TMuonLegacyConverter () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

src/L1TMuonLegacyConverter/src/L1TMuonLegacyConverter.cc

L1Trigger/L1TCommon/interface/L1TMuonLegacyConverter.h

Description: conver L1T muons legacy format to stage2 format

Definition at line 47 of file L1TMuonLegacyConverter.h.

Constructor & Destructor Documentation

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

Definition at line 69 of file L1TMuonLegacyConverter.cc.

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

70 {
71  using namespace l1extra ;
72 
73  // moving inputTag here
74  muonSource_InputTag = iConfig.getParameter<edm::InputTag>("muonSource");
75  produceMuonParticles_ = iConfig.getUntrackedParameter<bool>("produceMuonParticles");
76  centralBxOnly_ = iConfig.getUntrackedParameter<bool>("centralBxOnly");
77 
78  produces<MuonBxCollection>("imdMuonsLegacy");
79  muonSource_InputToken = consumes<L1MuGMTReadoutCollection>(muonSource_InputTag);
80 }
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 83 of file L1TMuonLegacyConverter.cc.

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

Member Function Documentation

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

Definition at line 98 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, EnergyCorrector::pt, and edm::Event::put().

100 {
101  using namespace edm ;
102  using namespace l1extra ;
103  using namespace std ;
104 
105  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106  // ~~~~~~~~~~~~~~~~~~~~ Muons ~~~~~~~~~~~~~~~~~~~~
107  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108 
109  std::unique_ptr< MuonBxCollection > imdMuonsLegacy( new MuonBxCollection() );
110 
111  LogDebug("L1TMuonLegacyConverter")
112  << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
113  << "\nrequested in configuration, but not found in the event."
114  << std::endl;
115 
117  {
119  iSetup.get< L1MuTriggerScalesRcd >().get( muScales ) ;
120 
122  iSetup.get< L1MuTriggerPtScaleRcd >().get( muPtScale ) ;
123 
124  Handle< L1MuGMTReadoutCollection > simMuCollection ;
125  iEvent.getByToken( muonSource_InputToken, simMuCollection ) ;
126 
127  vector< L1MuGMTExtendedCand > simMuCands ;
128 
129 
130  if( !simMuCollection.isValid() )
131  {
132 
133  LogDebug("L1TMuonLegacyConverter")
134  << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
135  << "\nrequested in configuration, but not found in the event."
136  << std::endl;
137  }
138  else
139  {
140  if( centralBxOnly_ )
141  {
142  // Get GMT candidates from central bunch crossing only
143  simMuCands = simMuCollection->getRecord().getGMTCands() ;
144  }
145  else
146  {
147  // Get GMT candidates from all bunch crossings
148  vector< L1MuGMTReadoutRecord > records = simMuCollection->getRecords();
149  vector< L1MuGMTReadoutRecord >::const_iterator rItr = records.begin();
150  vector< L1MuGMTReadoutRecord >::const_iterator rEnd = records.end();
151 
152  for( ; rItr != rEnd ; ++rItr )
153  {
154  vector< L1MuGMTExtendedCand > tmpCands = rItr->getGMTCands() ;
155 
156  simMuCands.insert( simMuCands.end(),
157  tmpCands.begin(),
158  tmpCands.end() ) ;
159  }
160  }
161 
162  vector< L1MuGMTExtendedCand >::const_iterator muItr = simMuCands.begin() ;
163  vector< L1MuGMTExtendedCand >::const_iterator muEnd = simMuCands.end() ;
164  for( int i = 0 ; muItr != muEnd ; ++muItr, ++i )
165  {
166 
167  if( !muItr->empty() ){
168  // keep x and y components non-zero and protect against roundoff.
169  double pt = muPtScale->getPtScale()->getLowEdge( muItr->ptIndex() ) + 1.e-6 ;
170  std::cout << "pt from muPtScale = " << pt << std::endl;
171  double eta = muScales->getGMTEtaScale()->getCenter( muItr->etaIndex() ) ;
172  double phi = muScales->getPhiScale()->getLowEdge( muItr->phiIndex() ) ;
173 
175  eta,
176  phi,
177  muonMassGeV_ ) ;
178 
179  Muon outMu{p4, (int)0, (int)0, (int)0, (int)muItr->quality(), (int)muItr->charge(), (int)muItr->charge_valid() , (int)muItr->isol(), (int)0 , (int)0, true, (int)0, (int)0, (int)0 , (int)muItr->rank() };
180  imdMuonsLegacy->push_back( muItr->bx(), outMu ) ;
181  }
182  }
183  }
184  }
185 
186  iEvent.put( std::move(imdMuonsLegacy), "imdMuonsLegacy" );
187 
188 } // closing produce
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
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:519
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:74
BXVector< Muon > MuonBxCollection
Definition: Muon.h:10
static const double muonMassGeV_
const T & get() const
Definition: EventSetup.h:58
HLT enums.
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
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:510

Member Data Documentation

bool L1TMuonLegacyConverter::centralBxOnly_
private

Definition at line 82 of file L1TMuonLegacyConverter.h.

bool L1TMuonLegacyConverter::ignoreHtMiss_
private

Definition at line 86 of file L1TMuonLegacyConverter.h.

double const L1TMuonLegacyConverter::muonMassGeV_ = 0.105658369
staticprivate

Definition at line 80 of file L1TMuonLegacyConverter.h.

edm::InputTag L1TMuonLegacyConverter::muonSource_InputTag
private

Definition at line 63 of file L1TMuonLegacyConverter.h.

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

Definition at line 64 of file L1TMuonLegacyConverter.h.

bool L1TMuonLegacyConverter::produceMuonParticles_
private

Definition at line 62 of file L1TMuonLegacyConverter.h.