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

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

Constructor & Destructor Documentation

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

constructor with config

Definition at line 43 of file L3MuonCandidateProducer.cc.

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

43  {
44  LogTrace(category) << " constructor called";
45 
46  // StandAlone Collection Label
47  theL3CollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
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 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
static const char category[]
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
#define LogTrace(id)
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
L3MuonCandidateProducer::~L3MuonCandidateProducer ( )
override

destructor

Definition at line 78 of file L3MuonCandidateProducer.cc.

References category, and LogTrace.

78  {
79  LogTrace(category) << " L3MuonCandidateProducer destructor called";
80 }
static const char category[]
#define LogTrace(id)

Member Function Documentation

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

produce candidates

reconstruct muons

Definition at line 83 of file L3MuonCandidateProducer.cc.

References funct::abs(), HLT_2018_cff::candidates, category, 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, reco::RecoChargedCandidate::setTrack(), PDWG_EXOHSCP_cff::tracks, and badGlobalMuonTaggersAOD_cff::vtx.

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 }
#define LogDebug(id)
static const char category[]
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isNull() const
Checks for null.
Definition: Ref.h:235
#define LogTrace(id)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

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

Definition at line 52 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3CollectionLabel
private

Definition at line 49 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3LinksLabel
private

Definition at line 50 of file L3MuonCandidateProducer.h.

enum MuonTrackType L3MuonCandidateProducer::theType
private

Definition at line 54 of file L3MuonCandidateProducer.h.

bool L3MuonCandidateProducer::theUseLinks
private

Definition at line 55 of file L3MuonCandidateProducer.h.

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

Definition at line 51 of file L3MuonCandidateProducer.h.