CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuScleFitMuonProducer Class Reference
Inheritance diagram for MuScleFitMuonProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MuScleFitMuonProducer (const edm::ParameterSet &)
 
 ~MuScleFitMuonProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

template<class T >
std::unique_ptr< TapplyCorrection (const edm::Handle< T > &allMuons)
 
void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::shared_ptr< MomentumScaleCorrectorcorrector_
 
edm::ESHandle< MuScleFitDBobjectdbObject_
 
unsigned long long dbObjectCacheId_
 
std::string dbObjectLabel_
 
bool patMuons_
 
edm::InputTag theMuonLabel_
 
edm::EDGetTokenT< pat::MuonCollectionthePatMuonToken_
 
edm::EDGetTokenT< reco::MuonCollectiontheRecoMuonToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Produce a new muon collection with corrected Pt.
It is also possible to apply a smearing to the muons Pt.

Definition at line 47 of file MuScleFitMuonProducer.cc.

Constructor & Destructor Documentation

◆ MuScleFitMuonProducer()

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

Definition at line 69 of file MuScleFitMuonProducer.cc.

70  : theMuonLabel_(iConfig.getParameter<edm::InputTag>("MuonLabel")),
71  thePatMuonToken_(mayConsume<pat::MuonCollection>(theMuonLabel_)),
72  theRecoMuonToken_(mayConsume<reco::MuonCollection>(theMuonLabel_)),
73  patMuons_(iConfig.getParameter<bool>("PatMuons")),
74  dbObjectLabel_(iConfig.getUntrackedParameter<std::string>("DbObjectLabel", "")),
75  dbObjectCacheId_(0) {
76  if (patMuons_ == true) {
77  produces<pat::MuonCollection>();
78  } else {
79  produces<reco::MuonCollection>();
80  }
81 }

References patMuons_.

◆ ~MuScleFitMuonProducer()

MuScleFitMuonProducer::~MuScleFitMuonProducer ( )
override

Definition at line 83 of file MuScleFitMuonProducer.cc.

83 {}

Member Function Documentation

◆ applyCorrection()

template<class T >
std::unique_ptr< T > MuScleFitMuonProducer::applyCorrection ( const edm::Handle< T > &  allMuons)
private

Definition at line 86 of file MuScleFitMuonProducer.cc.

86  {
87  std::unique_ptr<T> pOut(new T);
88 
89  // Apply the correction and produce the new muons
90  for (typename T::const_iterator muon = allMuons->begin(); muon != allMuons->end(); ++muon) {
91  //std::cout << "Pt before correction = " << muon->pt() << std::endl;
92  double pt = (*corrector_)(*muon);
93  //std::cout << "Pt after correction = " << pt << std::endl;
94  double eta = muon->eta();
95  double phi = muon->phi();
96 
97  typename T::value_type* newMuon = muon->clone();
98  newMuon->setP4(reco::Particle::PolarLorentzVector(pt, eta, phi, muon->mass()));
99 
100  pOut->push_back(*newMuon);
101  }
102  return pOut;
103 }

References allMuons_cfi::allMuons, PVValHelper::eta, HLT_FULL_cff::muon, phi, L1TrackObjectNtupleMaker_cfg::pOut, and DiDispStaMuonMonitor_cfi::pt.

Referenced by produce().

◆ beginJob()

void MuScleFitMuonProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 154 of file MuScleFitMuonProducer.cc.

154 {}

◆ endJob()

void MuScleFitMuonProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 157 of file MuScleFitMuonProducer.cc.

157 {}

◆ produce()

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

Implements edm::EDProducer.

Definition at line 106 of file MuScleFitMuonProducer.cc.

106  {
107  unsigned long long dbObjectCacheId = iSetup.get<MuScleFitDBobjectRcd>().cacheIdentifier();
108  if (dbObjectCacheId != dbObjectCacheId_) {
109  if (!dbObjectLabel_.empty()) {
111  } else {
113  }
114  }
115 
116  //std::cout << "identifiers size from dbObject = " << dbObject_->identifiers.size() << std::endl;
117  //std::cout << "parameters size from dbObject = " << dbObject_->parameters.size() << std::endl;;
118 
119  // Create the corrector and set the parameters
121 
122  if (patMuons_ == true) {
124  iEvent.getByToken(thePatMuonToken_, allMuons);
126  } else {
128  iEvent.getByToken(theRecoMuonToken_, allMuons);
130  }
131 
132  // put into the Event
133  // iEvent.put(std::move(pOut));
134  // iEvent.put(applyCorrection(allMuons);
135 
136  /* std::unique_ptr<reco::MuonCollection> pOut(new reco::MuonCollection);
137 
138  // Apply the correction and produce the new muons
139  for( std::vector<reco::Muon>::const_iterator muon = allMuons->begin(); muon != allMuons->end(); ++muon ) {
140 
141  double pt = (*corrector_)(*muon);
142  double eta = muon->eta();
143  double phi = muon->phi();
144 
145  reco::Muon * newMuon = muon->clone();
146  newMuon->setP4( reco::Particle::PolarLorentzVector( pt, eta, phi, muon->mass() ) );
147 
148  pOut->push_back(*newMuon);
149  }
150 */
151 }

References allMuons_cfi::allMuons, applyCorrection(), corrector_, dbObject_, dbObjectCacheId_, dbObjectLabel_, edm::EventSetup::get(), get, iEvent, patMuons_, edm::ESHandle< T >::product(), thePatMuonToken_, and theRecoMuonToken_.

Member Data Documentation

◆ corrector_

std::shared_ptr<MomentumScaleCorrector> MuScleFitMuonProducer::corrector_
private

Definition at line 66 of file MuScleFitMuonProducer.cc.

Referenced by produce().

◆ dbObject_

edm::ESHandle<MuScleFitDBobject> MuScleFitMuonProducer::dbObject_
private

Definition at line 63 of file MuScleFitMuonProducer.cc.

Referenced by produce().

◆ dbObjectCacheId_

unsigned long long MuScleFitMuonProducer::dbObjectCacheId_
private

Definition at line 65 of file MuScleFitMuonProducer.cc.

Referenced by produce().

◆ dbObjectLabel_

std::string MuScleFitMuonProducer::dbObjectLabel_
private

Definition at line 64 of file MuScleFitMuonProducer.cc.

Referenced by produce().

◆ patMuons_

bool MuScleFitMuonProducer::patMuons_
private

Definition at line 62 of file MuScleFitMuonProducer.cc.

Referenced by MuScleFitMuonProducer(), and produce().

◆ theMuonLabel_

edm::InputTag MuScleFitMuonProducer::theMuonLabel_
private

Definition at line 59 of file MuScleFitMuonProducer.cc.

◆ thePatMuonToken_

edm::EDGetTokenT<pat::MuonCollection> MuScleFitMuonProducer::thePatMuonToken_
private

Definition at line 60 of file MuScleFitMuonProducer.cc.

Referenced by produce().

◆ theRecoMuonToken_

edm::EDGetTokenT<reco::MuonCollection> MuScleFitMuonProducer::theRecoMuonToken_
private

Definition at line 61 of file MuScleFitMuonProducer.cc.

Referenced by produce().

MuScleFitMuonProducer::dbObjectCacheId_
unsigned long long dbObjectCacheId_
Definition: MuScleFitMuonProducer.cc:65
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
MomentumScaleCorrector
Definition: MomentumScaleCorrector.h:25
muon
Definition: MuonCocktails.h:17
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
MuScleFitDBobjectRcd
Definition: MuScleFitDBobjectRcd.h:6
L1TrackObjectNtupleMaker_cfg.pOut
pOut
Definition: L1TrackObjectNtupleMaker_cfg.py:172
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
MuScleFitMuonProducer::dbObjectLabel_
std::string dbObjectLabel_
Definition: MuScleFitMuonProducer.cc:64
MuScleFitMuonProducer::patMuons_
bool patMuons_
Definition: MuScleFitMuonProducer.cc:62
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11725
PVValHelper::eta
Definition: PVValidationHelpers.h:70
MuScleFitMuonProducer::theMuonLabel_
edm::InputTag theMuonLabel_
Definition: MuScleFitMuonProducer.cc:59
MuScleFitMuonProducer::corrector_
std::shared_ptr< MomentumScaleCorrector > corrector_
Definition: MuScleFitMuonProducer.cc:66
reco::Particle::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
allMuons_cfi.allMuons
allMuons
Definition: allMuons_cfi.py:3
MuScleFitMuonProducer::dbObject_
edm::ESHandle< MuScleFitDBobject > dbObject_
Definition: MuScleFitMuonProducer.cc:63
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuScleFitMuonProducer::applyCorrection
std::unique_ptr< T > applyCorrection(const edm::Handle< T > &allMuons)
Definition: MuScleFitMuonProducer.cc:86
DDAxes::phi
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MuScleFitMuonProducer::theRecoMuonToken_
edm::EDGetTokenT< reco::MuonCollection > theRecoMuonToken_
Definition: MuScleFitMuonProducer.cc:61
MuScleFitMuonProducer::thePatMuonToken_
edm::EDGetTokenT< pat::MuonCollection > thePatMuonToken_
Definition: MuScleFitMuonProducer.cc:60
edm::InputTag
Definition: InputTag.h:15