CMS 3D CMS Logo

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

#include <L3MuonCandidateProducer.h>

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

Public Types

enum  MuonTrackType { InnerTrack, OuterTrack, CombinedTrack }
 
- 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
 

Public Member Functions

 L3MuonCandidateProducer (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 produce candidates More...
 
 ~L3MuonCandidateProducer () 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
 
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
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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::EDGetTokenT< reco::MuonTrackLinksCollectionlinkToken_
 
edm::InputTag theL3CollectionLabel
 
edm::InputTag theL3LinksLabel
 
enum MuonTrackType theType
 
bool theUseLinks
 
edm::EDGetTokenT< reco::TrackCollectiontrackToken_
 

Additional Inherited Members

- 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
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>
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)
 
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

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

Riccardo's comment: The separation between the L3MuonProducer and this class allows the interchangeability of the L3MuonProducer and the StandAloneMuonProducer This class is supposed to be removed once the L3/STA comparison will be done, then the RecoChargedCandidate production will be put into the L3MuonProducer class.

Author
J.Alcaraz

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

Riccardo's comment: The separation between the L3MuonProducer and this class allows the interchangeability of the L3MuonProducer and the StandAloneMuonProducer This class is supposed to be removed once the L3/STA comparison will be done, then the RecoChargedCandidate production will be done into the L3MuonProducer class.

Author
J.Alcaraz

Definition at line 34 of file L3MuonCandidateProducer.h.

Member Enumeration Documentation

◆ MuonTrackType

Enumerator
InnerTrack 
OuterTrack 
CombinedTrack 

Definition at line 36 of file L3MuonCandidateProducer.h.

Constructor & Destructor Documentation

◆ L3MuonCandidateProducer()

L3MuonCandidateProducer::L3MuonCandidateProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 43 of file L3MuonCandidateProducer.cc.

43  {
44  LogTrace(category) << " constructor called";
45 
46  // StandAlone Collection Label
48  trackToken_ = consumes<reco::TrackCollection>(theL3CollectionLabel);
49 
50  // use links
51  theUseLinks = parameterSet.existsAs<InputTag>("InputLinksObjects");
52  if (theUseLinks) {
53  theL3LinksLabel = parameterSet.getParameter<InputTag>("InputLinksObjects");
54  linkToken_ = consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel);
55  if (theL3LinksLabel.label().empty() or theL3LinksLabel.label() == "unused")
56  theUseLinks = false;
57  }
58 
59  // use global, standalone or tracker pT/4-vector assignment
60  const std::string& muon_track_for_momentum = parameterSet.existsAs<std::string>("MuonPtOption")
61  ? parameterSet.getParameter<std::string>("MuonPtOption")
62  : "Global";
63  if (muon_track_for_momentum == std::string("Tracker"))
65  else if (muon_track_for_momentum == std::string("Standalone"))
67  else if (muon_track_for_momentum == std::string("Global"))
69  else {
70  LogError(category) << "invalid value for MuonPtOption, please choose among 'Tracker', 'Standalone', 'Global'";
72  }
73 
74  produces<RecoChargedCandidateCollection>();
75 }

References category, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), LogTrace, or, edm::parameterSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~L3MuonCandidateProducer()

L3MuonCandidateProducer::~L3MuonCandidateProducer ( )
override

destructor

Definition at line 78 of file L3MuonCandidateProducer.cc.

78  {
79  LogTrace(category) << " L3MuonCandidateProducer destructor called";
80 }

References category, and LogTrace.

Member Function Documentation

◆ produce()

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

produce candidates

reconstruct muons

Implements edm::global::EDProducerBase.

Definition at line 83 of file L3MuonCandidateProducer.cc.

83  {
84  // Take the L3 container
85  LogTrace(category) << " Taking the L3/GLB muons: " << theL3CollectionLabel.label();
87  event.getByToken(trackToken_, tracks);
88 
90  if (theUseLinks)
91  event.getByToken(linkToken_, links);
92 
93  // Create a RecoChargedCandidate collection
94  LogTrace(category) << " Creating the RecoChargedCandidate collection";
95  auto candidates = std::make_unique<RecoChargedCandidateCollection>();
96  LogDebug(category) << " size = " << tracks->size();
97  for (unsigned int i = 0; i < tracks->size(); i++) {
98  TrackRef inRef(tracks, i);
99  TrackRef tkRef = TrackRef();
100 
101  if (theUseLinks) {
102  for (reco::MuonTrackLinksCollection::const_iterator link = links->begin(); link != links->end(); ++link) {
103  LogDebug(category) << " i = " << i;
104 
105  if (not link->trackerTrack().isNull())
106  LogTrace(category) << " link tk pt " << link->trackerTrack()->pt();
107  if (not link->standAloneTrack().isNull())
108  LogTrace(category) << " sta pt " << link->standAloneTrack()->pt();
109  if (not link->globalTrack().isNull())
110  LogTrace(category) << " global pt " << link->globalTrack()->pt();
111  if (not inRef.isNull())
112  LogTrace(category) << " inRef pt " << inRef->pt();
113 
114  if (link->globalTrack().isNull()) {
115  edm::LogError(category) << "null reference to the global track";
116  // skip this candidate
117  continue;
118  }
119 
120  float dR = deltaR(inRef->eta(), inRef->phi(), link->globalTrack()->eta(), link->globalTrack()->phi());
121  float dPt = abs(inRef->pt() - link->globalTrack()->pt()) / inRef->pt();
122  if (dR < 0.02 and dPt < 0.001) {
123  LogTrace(category) << " *** pt matches *** ";
124  switch (theType) {
125  case InnerTrack:
126  tkRef = link->trackerTrack();
127  break;
128  case OuterTrack:
129  tkRef = link->standAloneTrack();
130  break;
131  case CombinedTrack:
132  tkRef = link->globalTrack();
133  break;
134  default:
135  tkRef = link->globalTrack();
136  break;
137  }
138  }
139  }
140  if (tkRef.isNull()) {
141  edm::LogWarning(category) << "null reference to the linked track, reverting to old behaviour";
142  tkRef = inRef;
143  }
144  } else {
145  // theUseLinks is false
146  tkRef = inRef;
147  }
148  LogDebug(category) << "tkRef Used For Momentum pt " << tkRef->pt() << " inRef from the input collection pt "
149  << inRef->pt();
150 
151  Particle::Charge q = tkRef->charge();
152  Particle::LorentzVector p4(tkRef->px(), tkRef->py(), tkRef->pz(), tkRef->p());
153  Particle::Point vtx(tkRef->vx(), tkRef->vy(), tkRef->vz());
154 
155  int pid = 13;
156  if (abs(q) == 1)
157  pid = q < 0 ? 13 : -13;
158  else
159  LogWarning(category) << "L3MuonCandidate has charge = " << q;
160  RecoChargedCandidate cand(q, p4, vtx, pid);
161 
162  //set the inRef as the RecoChargedCandidate ref so that the isolation maps
163  //work in downstream filters
164  cand.setTrack(inRef);
165  candidates->push_back(cand);
166  }
167 
168  event.put(std::move(candidates));
169 
170  LogTrace(category) << " Event loaded"
171  << "================================";
172 }

References funct::abs(), HLT_2018_cff::candidates, category, PixelTestBeamValidation_cfi::Charge, PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, mps_fire::i, edm::Ref< C, T, F >::isNull(), MainPageGenerator::link, electronStore::links, LogDebug, LogTrace, eostools::move(), p4, data-class-funcs::q, PDWG_EXOHSCP_cff::tracks, and badGlobalMuonTaggersAOD_cff::vtx.

Member Data Documentation

◆ linkToken_

edm::EDGetTokenT<reco::MuonTrackLinksCollection> L3MuonCandidateProducer::linkToken_
private

Definition at line 52 of file L3MuonCandidateProducer.h.

◆ theL3CollectionLabel

edm::InputTag L3MuonCandidateProducer::theL3CollectionLabel
private

Definition at line 49 of file L3MuonCandidateProducer.h.

◆ theL3LinksLabel

edm::InputTag L3MuonCandidateProducer::theL3LinksLabel
private

Definition at line 50 of file L3MuonCandidateProducer.h.

◆ theType

enum MuonTrackType L3MuonCandidateProducer::theType
private

Definition at line 54 of file L3MuonCandidateProducer.h.

◆ theUseLinks

bool L3MuonCandidateProducer::theUseLinks
private

Definition at line 55 of file L3MuonCandidateProducer.h.

◆ trackToken_

edm::EDGetTokenT<reco::TrackCollection> L3MuonCandidateProducer::trackToken_
private

Definition at line 51 of file L3MuonCandidateProducer.h.

L3MuonCandidateProducer::theL3LinksLabel
edm::InputTag theL3LinksLabel
Definition: L3MuonCandidateProducer.h:50
L3MuonCandidateProducer::linkToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
Definition: L3MuonCandidateProducer.h:52
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
L3MuonCandidateProducer::theL3CollectionLabel
edm::InputTag theL3CollectionLabel
Definition: L3MuonCandidateProducer.h:49
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
L3MuonCandidateProducer::theUseLinks
bool theUseLinks
Definition: L3MuonCandidateProducer.h:55
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
data-class-funcs.q
q
Definition: data-class-funcs.py:169
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< TrackCollection >
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
Point
math::XYZPoint Point
Definition: TrackerDpgAnalysis.cc:107
category
static const char category[]
Definition: L3MuonCandidateProducer.cc:40
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
cand
Definition: decayParser.h:34
p4
double p4[4]
Definition: TauolaWrapper.h:92
L3MuonCandidateProducer::OuterTrack
Definition: L3MuonCandidateProducer.h:36
L3MuonCandidateProducer::trackToken_
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Definition: L3MuonCandidateProducer.h:51
reco::RecoChargedCandidate
Definition: RecoChargedCandidate.h:15
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition: JetExtendedAssociation.h:25
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLT_2018_cff.candidates
candidates
Definition: HLT_2018_cff.py:53513
electronStore.links
links
Definition: electronStore.py:149
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:78
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
L3MuonCandidateProducer::CombinedTrack
Definition: L3MuonCandidateProducer.h:36
edm::InputTag
Definition: InputTag.h:15
L3MuonCandidateProducer::theType
enum MuonTrackType theType
Definition: L3MuonCandidateProducer.h:54
L3MuonCandidateProducer::InnerTrack
Definition: L3MuonCandidateProducer.h:36