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
 
- 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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::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 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 30 of file L3MuonCandidateProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 44 of file L3MuonCandidateProducer.cc.

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

44  {
45  LogTrace(category)<<" constructor called";
46 
47  // StandAlone Collection Label
48  theL3CollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
49  trackToken_ = consumes<reco::TrackCollection>(theL3CollectionLabel);
50 
51  // use links
52  theUseLinks = parameterSet.existsAs<InputTag>("InputLinksObjects");
53  if (theUseLinks) {
54  theL3LinksLabel = parameterSet.getParameter<InputTag>("InputLinksObjects");
55  linkToken_ = consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel);
56  if (theL3LinksLabel.label() == "" or theL3LinksLabel.label() == "unused")
57  theUseLinks = false;
58  }
59 
60  // use global, standalone or tracker pT/4-vector assignment
61  const std::string & muon_track_for_momentum = parameterSet.existsAs<std::string>("MuonPtOption") ? parameterSet.getParameter<std::string>("MuonPtOption") : "Global";
62  if (muon_track_for_momentum == std::string("Tracker"))
64  else if (muon_track_for_momentum == std::string("Standalone"))
66  else if (muon_track_for_momentum == std::string("Global"))
68  else {
69  LogError(category)<<"invalid value for MuonPtOption, please choose among 'Tracker', 'Standalone', 'Global'";
71  }
72 
73  produces<RecoChargedCandidateCollection>();
74 }
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:186
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 77 of file L3MuonCandidateProducer.cc.

References category, and LogTrace.

77  {
78  LogTrace(category)<<" L3MuonCandidateProducer destructor called";
79 }
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(), objects.IsoTrackAnalyzer::candidates, category, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, mps_fire::i, edm::Ref< C, T, F >::isNull(), LogDebug, LogTrace, eostools::move(), p4, sysUtil::pid, lumiQueryAPI::q, reco::RecoChargedCandidate::setTrack(), l1t::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();
103  link != links->end(); ++link){ LogDebug(category) << " i = " << i;
104 
105  if (not link->trackerTrack().isNull()) LogTrace(category) << " link tk pt " << link->trackerTrack()->pt();
106  if (not link->standAloneTrack().isNull()) LogTrace(category) << " sta pt " << link->standAloneTrack()->pt();
107  if (not link->globalTrack().isNull()) LogTrace(category) << " global pt " << link->globalTrack()->pt();
108  if (not inRef.isNull()) LogTrace(category) << " inRef pt " << inRef->pt();
109 
110  if (link->globalTrack().isNull()) {
111  edm::LogError(category) << "null reference to the global track";
112  // skip this candidate
113  continue;
114  }
115 
116  float dR = deltaR(inRef->eta(),inRef->phi(),link->globalTrack()->eta(),link->globalTrack()->phi());
117  float dPt = abs(inRef->pt() - link->globalTrack()->pt())/inRef->pt();
118  if (dR < 0.02 and dPt < 0.001) {
119  LogTrace(category) << " *** pt matches *** ";
120  switch(theType) {
121  case InnerTrack: tkRef = link->trackerTrack(); break;
122  case OuterTrack: tkRef = link->standAloneTrack(); break;
123  case CombinedTrack: tkRef = link->globalTrack(); break;
124  default: tkRef = link->globalTrack(); break;
125  }
126  }
127  }
128  if (tkRef.isNull()) {
129  edm::LogWarning(category) << "null reference to the linked track, reverting to old behaviour";
130  tkRef = inRef;
131  }
132  } else {
133  // theUseLinks is false
134  tkRef = inRef;
135  }
136  LogDebug(category) << "tkRef Used For Momentum pt " << tkRef->pt() << " inRef from the input collection pt " << inRef->pt();
137 
138  Particle::Charge q = tkRef->charge();
139  Particle::LorentzVector p4(tkRef->px(), tkRef->py(), tkRef->pz(), tkRef->p());
140  Particle::Point vtx(tkRef->vx(),tkRef->vy(), tkRef->vz());
141 
142  int pid = 13;
143  if(abs(q)==1) pid = q < 0 ? 13 : -13;
144  else LogWarning(category) << "L3MuonCandidate has charge = "<<q;
145  RecoChargedCandidate cand(q, p4, vtx, pid);
146 
147  //set the inRef as the RecoChargedCandidate ref so that the isolation maps
148  //work in downstream filters
149  cand.setTrack(inRef);
150  candidates->push_back(cand);
151  }
152 
153  event.put(std::move(candidates));
154 
155  LogTrace(category)<<" Event loaded"
156  <<"================================";
157 }
#define LogDebug(id)
static const char category[]
std::pair< double, double > Point
Definition: CaloEllipse.h:18
double p4[4]
Definition: TauolaWrapper.h:92
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isNull() const
Checks for null.
Definition: Ref.h:250
#define LogTrace(id)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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:510
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

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

Definition at line 49 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3CollectionLabel
private

Definition at line 46 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3LinksLabel
private

Definition at line 47 of file L3MuonCandidateProducer.h.

enum MuonTrackType L3MuonCandidateProducer::theType
private

Definition at line 51 of file L3MuonCandidateProducer.h.

bool L3MuonCandidateProducer::theUseLinks
private

Definition at line 52 of file L3MuonCandidateProducer.h.

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

Definition at line 48 of file L3MuonCandidateProducer.h.