CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, 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::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 descriptions More...
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool const m_displacedReco
 
edm::InputTag const m_L3CollectionLabel
 
edm::EDGetTokenT< reco::MuonCollection > const m_muonToken
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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::L3MuonCandidateProducerFromMuons ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 34 of file L3MuonCandidateProducerFromMuons.cc.

References category(), and LogTrace.

35  : m_L3CollectionLabel(parameterSet.getParameter<InputTag>("InputObjects")), // standAlone Collection Label
37  m_displacedReco(parameterSet.getParameter<bool>("DisplacedReconstruction")) {
38  LogTrace(category) << " constructor called";
39  produces<RecoChargedCandidateCollection>();
40 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
#define LogTrace(id)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::MuonCollection > const m_muonToken
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")

◆ ~L3MuonCandidateProducerFromMuons()

L3MuonCandidateProducerFromMuons::~L3MuonCandidateProducerFromMuons ( )
override

destructor

Definition at line 43 of file L3MuonCandidateProducerFromMuons.cc.

References category(), and LogTrace.

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

Member Function Documentation

◆ fillDescriptions()

void L3MuonCandidateProducerFromMuons::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

descriptions

Definition at line 47 of file L3MuonCandidateProducerFromMuons.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

47  {
49  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltL3Muons"));
50  desc.add<bool>("DisplacedReconstruction", false);
51  descriptions.addWithDefaultLabel(desc);
52 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

produce candidates

reconstruct muons

Implements edm::global::EDProducerBase.

Definition at line 55 of file L3MuonCandidateProducerFromMuons.cc.

References funct::abs(), HLT_2024v14_cff::candidates, category(), PixelTestBeamValidation_cfi::Charge, mps_fire::i, edm::Ref< C, T, F >::isNonnull(), edm::InputTag::label(), LogTrace, m_displacedReco, m_L3CollectionLabel, m_muonToken, eostools::move(), DiMuonV_cfg::muons, submitPVResolutionJobs::q, and L1BJetProducer_cff::vtx.

55  {
56  // Create a RecoChargedCandidate collection
57  LogTrace(category) << " Creating the RecoChargedCandidate collection";
58  auto candidates = std::make_unique<RecoChargedCandidateCollection>();
59 
60  // Take the L3 container
61  LogTrace(category) << " Taking the L3/GLB muons: " << m_L3CollectionLabel.label();
63  event.getByToken(m_muonToken, muons);
64 
65  if (not muons.isValid()) {
66  LogError(category) << muons.whyFailed()->what();
67  } else {
68  for (unsigned int i = 0; i < muons->size(); i++) {
69  // avoids crashing in case the muon is SA only.
70  TrackRef tkref;
71  if (m_displacedReco) {
72  tkref = (*muons)[i].isGlobalMuon() ? (*muons)[i].globalTrack() : (*muons)[i].muonBestTrack();
73  } else {
74  tkref = (*muons)[i].innerTrack().isNonnull() ? (*muons)[i].innerTrack() : (*muons)[i].muonBestTrack();
75  }
76  Particle::Charge q = tkref->charge();
77  Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
78  Particle::Point vtx(tkref->vx(), tkref->vy(), tkref->vz());
79 
80  int pid = 13;
81  if (abs(q) == 1)
82  pid = q < 0 ? 13 : -13;
83  else
84  LogWarning(category) << "L3MuonCandidate has charge = " << q;
85  RecoChargedCandidate cand(q, p4, vtx, pid);
86 
87  cand.setTrack(tkref);
88  candidates->push_back(cand);
89  }
90  }
91  event.put(std::move(candidates));
92 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
std::string const & label() const
Definition: InputTag.h:36
Log< level::Error, false > LogError
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
#define LogTrace(id)
edm::EDGetTokenT< reco::MuonCollection > const m_muonToken
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

◆ m_displacedReco

bool const L3MuonCandidateProducerFromMuons::m_displacedReco
private

Definition at line 42 of file L3MuonCandidateProducerFromMuons.h.

Referenced by produce().

◆ m_L3CollectionLabel

edm::InputTag const L3MuonCandidateProducerFromMuons::m_L3CollectionLabel
private

Definition at line 40 of file L3MuonCandidateProducerFromMuons.h.

Referenced by produce().

◆ m_muonToken

edm::EDGetTokenT<reco::MuonCollection> const L3MuonCandidateProducerFromMuons::m_muonToken
private

Definition at line 41 of file L3MuonCandidateProducerFromMuons.h.

Referenced by produce().