CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L3MuonCandidateProducerFromMuons Class Reference

#include <L3MuonCandidateProducerFromMuons.h>

Inheritance diagram for L3MuonCandidateProducerFromMuons:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L3MuonCandidateProducerFromMuons (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 produce candidates More...
 
 ~L3MuonCandidateProducerFromMuons () override
 destructor More...
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag m_L3CollectionLabel
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

This class takes reco::Muons and creates the correspondent reco::RecoChargedCandidate.

Intermediate step in the L3 muons selection. This class takes the tracker muons (which are reco::Muons) and creates the correspondent reco::RecoChargedCandidate.

Definition at line 24 of file L3MuonCandidateProducerFromMuons.h.

Constructor & Destructor Documentation

L3MuonCandidateProducerFromMuons::L3MuonCandidateProducerFromMuons ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 33 of file L3MuonCandidateProducerFromMuons.cc.

References category(), LogTrace, m_L3CollectionLabel, and muonToken_.

34  : m_L3CollectionLabel(parameterSet.getParameter<InputTag>("InputObjects")) // standAlone Collection Label
35 {
36  muonToken_ = consumes<reco::MuonCollection>(m_L3CollectionLabel);
37  LogTrace(category) << " constructor called";
38  produces<RecoChargedCandidateCollection>();
39 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonCollection > muonToken_
#define LogTrace(id)
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
L3MuonCandidateProducerFromMuons::~L3MuonCandidateProducerFromMuons ( )
override

destructor

Definition at line 42 of file L3MuonCandidateProducerFromMuons.cc.

References category(), and LogTrace.

42  {
43  LogTrace(category) << " L3MuonCandidateProducerFromMuons destructor called";
44 }
#define LogTrace(id)
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")

Member Function Documentation

void L3MuonCandidateProducerFromMuons::produce ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup eventSetup 
) const
override

produce candidates

reconstruct muons

Definition at line 47 of file L3MuonCandidateProducerFromMuons.cc.

References funct::abs(), HLT_2018_cff::candidates, category(), mps_fire::i, edm::HandleBase::isValid(), edm::InputTag::label(), LogTrace, m_L3CollectionLabel, eostools::move(), PDWG_BPHSkim_cff::muons, muonToken_, p4, data-class-funcs::q, reco::RecoChargedCandidate::setTrack(), badGlobalMuonTaggersAOD_cff::vtx, and edm::HandleBase::whyFailed().

47  {
48  // Create a RecoChargedCandidate collection
49  LogTrace(category) << " Creating the RecoChargedCandidate collection";
50  auto candidates = std::make_unique<RecoChargedCandidateCollection>();
51 
52  // Take the L3 container
53  LogTrace(category) << " Taking the L3/GLB muons: " << m_L3CollectionLabel.label();
55  event.getByToken(muonToken_, muons);
56 
57  if (not muons.isValid()) {
58  LogError(category) << muons.whyFailed()->what();
59  } else {
60  for (unsigned int i = 0; i < muons->size(); i++) {
61  // avoids crashing in case the muon is SA only.
62  TrackRef tkref = ((*muons)[i].innerTrack().isNonnull()) ? (*muons)[i].innerTrack() : (*muons)[i].muonBestTrack();
63 
64  Particle::Charge q = tkref->charge();
65  Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
66  Particle::Point vtx(tkref->vx(), tkref->vy(), tkref->vz());
67 
68  int pid = 13;
69  if (abs(q) == 1)
70  pid = q < 0 ? 13 : -13;
71  else
72  LogWarning(category) << "L3MuonCandidate has charge = " << q;
73  RecoChargedCandidate cand(q, p4, vtx, pid);
74 
75  cand.setTrack(tkref);
76  candidates->push_back(cand);
77  }
78  }
79  event.put(std::move(candidates));
80 }
edm::EDGetTokenT< reco::MuonCollection > muonToken_
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:70
#define LogTrace(id)
std::string const & label() const
Definition: InputTag.h:36
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
std::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:91
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

edm::InputTag L3MuonCandidateProducerFromMuons::m_L3CollectionLabel
private

Definition at line 37 of file L3MuonCandidateProducerFromMuons.h.

Referenced by L3MuonCandidateProducerFromMuons(), and produce().

edm::EDGetTokenT<reco::MuonCollection> L3MuonCandidateProducerFromMuons::muonToken_
private

Definition at line 38 of file L3MuonCandidateProducerFromMuons.h.

Referenced by L3MuonCandidateProducerFromMuons(), and produce().