CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TMuonLegacyConverter (const edm::ParameterSet &)
 
 ~L1TMuonLegacyConverter ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual 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<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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().

70 {
71  using namespace l1extra ;
72 
73  // moving inputTag here
74  muonSource_InputTag = iConfig.getParameter<edm::InputTag>("muonSource");
75 
76  produces<MuonBxCollection>("imdMuonsLegacy");
77  muonSource_InputToken = consumes<L1MuGMTReadoutCollection>(muonSource_InputTag);
78 }
T getParameter(std::string const &) const
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
L1TMuonLegacyConverter::~L1TMuonLegacyConverter ( )

Definition at line 81 of file L1TMuonLegacyConverter.cc.

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

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 96 of file L1TMuonLegacyConverter.cc.

References alignCSCRings::e, eta, edm::EventSetup::get(), edm::Event::getByToken(), i, edm::HandleBase::isValid(), LogDebug, p4, phi(), EnergyCorrector::pt, and edm::Event::put().

98 {
99  using namespace edm ;
100  using namespace l1extra ;
101  using namespace std ;
102 
103  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104  // ~~~~~~~~~~~~~~~~~~~~ Muons ~~~~~~~~~~~~~~~~~~~~
105  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 
107  auto_ptr< MuonBxCollection > imdMuonsLegacy( new MuonBxCollection() );
108 
110  {
112  iSetup.get< L1MuTriggerScalesRcd >().get( muScales ) ;
113 
115  iSetup.get< L1MuTriggerPtScaleRcd >().get( muPtScale ) ;
116 
117  Handle< L1MuGMTReadoutCollection > hwMuCollection ;
118  iEvent.getByToken( muonSource_InputToken, hwMuCollection ) ;
119 
120  vector< L1MuGMTExtendedCand > hwMuCands ;
121 
122  if( !hwMuCollection.isValid() )
123  {
124  LogDebug("L1TMuonLegacyConverter")
125  << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_InputTag
126  << "\nrequested in configuration, but not found in the event."
127  << std::endl;
128  }
129  else
130  {
131  if( centralBxOnly_ )
132  {
133  // Get GMT candidates from central bunch crossing only
134  hwMuCands = hwMuCollection->getRecord().getGMTCands() ;
135  }
136  else
137  {
138  // Get GMT candidates from all bunch crossings
139  vector< L1MuGMTReadoutRecord > records = hwMuCollection->getRecords();
140  vector< L1MuGMTReadoutRecord >::const_iterator rItr = records.begin();
141  vector< L1MuGMTReadoutRecord >::const_iterator rEnd = records.end();
142 
143  for( ; rItr != rEnd ; ++rItr )
144  {
145  vector< L1MuGMTExtendedCand > tmpCands = rItr->getGMTCands() ;
146 
147  hwMuCands.insert( hwMuCands.end(),
148  tmpCands.begin(),
149  tmpCands.end() ) ;
150  }
151  }
152 
153 // cout << "HW muons" << endl ;
154  vector< L1MuGMTExtendedCand >::const_iterator muItr = hwMuCands.begin() ;
155  vector< L1MuGMTExtendedCand >::const_iterator muEnd = hwMuCands.end() ;
156  for( int i = 0 ; muItr != muEnd ; ++muItr, ++i )
157  {
158 // cout << "#" << i
159 // << " name " << muItr->name()
160 // << " empty " << muItr->empty()
161 // << " pt " << muItr->ptIndex()
162 // << " eta " << muItr->etaIndex()
163 // << " phi " << muItr->phiIndex()
164 // << " iso " << muItr->isol()
165 // << " mip " << muItr->mip()
166 // << " bx " << muItr->bx()
167 // << endl ;
168 
169  if( !muItr->empty() ){
170  // keep x and y components non-zero and protect against roundoff.
171  double pt = muPtScale->getPtScale()->getLowEdge( muItr->ptIndex() ) + 1.e-6 ;
172  double eta = muScales->getGMTEtaScale()->getCenter( muItr->etaIndex() ) ;
173  double phi = muScales->getPhiScale()->getLowEdge( muItr->phiIndex() ) ;
174 
176  eta,
177  phi,
178  muonMassGeV_ ) ;
179 
180  // from L1TMuonProducer.cc - which is the stage2 muon producer:
181  // Muon outMu{vec, mu->hwPt(), mu->hwEta(), mu->hwGlobalPhi(), outMuQual, mu->hwSign(), mu->hwSignValid(), iso, mu->tfMuonIndex(), 0, true, mu->hwIsoSum(), mu->hwDPhi(), mu->hwDEta(), mu->hwRank()};
182 
183  Muon outMu{p4, (int)muItr->ptIndex(), (int)muItr->etaIndex(), (int)muItr->phiIndex(), (int)muItr->quality(), muItr->charge(), muItr->isol(), (int)muItr->etaRegionIndex(), 0, true, 0, 0, 0 , (int)muItr->rank() };
184  imdMuonsLegacy->push_back( muItr->bx(), outMu ) ;
185  }
186  }
187  }
188  }
189 
190  iEvent.put( imdMuonsLegacy, "imdMuonsLegacy" );
191 
192 } // closing produce
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< L1MuGMTReadoutCollection > muonSource_InputToken
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
double p4[4]
Definition: TauolaWrapper.h:92
bool isValid() const
Definition: HandleBase.h:75
Definition: Muon.h:16
BXVector< Muon > MuonBxCollection
Definition: Muon.h:10
static const double muonMassGeV_
const T & get() const
Definition: EventSetup.h:56

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.