CMS 3D CMS Logo

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

#include <GlobalMuonToMuonProducer.h>

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

Public Member Functions

 GlobalMuonToMuonProducer (const edm::ParameterSet &)
 Constructor. More...
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 reconstruct muons More...
 
 ~GlobalMuonToMuonProducer () 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 Member Functions

void printTrackRecHits (const reco::Track &track, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
 
void setAlias (std::string alias)
 

Private Attributes

std::string theAlias
 
edm::InputTag theLinksCollectionLabel
 
edm::EDGetTokenT< reco::MuonTrackLinksCollectiontrackLinkToken_
 

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

No description available.

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 23 of file GlobalMuonToMuonProducer.h.

Constructor & Destructor Documentation

GlobalMuonToMuonProducer::GlobalMuonToMuonProducer ( const edm::ParameterSet pSet)

Constructor.

Definition at line 22 of file GlobalMuonToMuonProducer.cc.

References edm::ParameterSet::getParameter(), setAlias(), AlCaHLTBitMon_QueryRunRegistry::string, theAlias, theLinksCollectionLabel, and trackLinkToken_.

22  {
23  theLinksCollectionLabel = pSet.getParameter<edm::InputTag>("InputObjects");
24 
25  setAlias(pSet.getParameter<std::string>("@module_label"));
26  produces<reco::MuonCollection>().setBranchAlias(theAlias + "s");
27  trackLinkToken_ = consumes<reco::MuonTrackLinksCollection>(theLinksCollectionLabel);
28 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonTrackLinksCollection > trackLinkToken_
void setAlias(std::string alias)
GlobalMuonToMuonProducer::~GlobalMuonToMuonProducer ( )
override

Destructor.

Definition at line 31 of file GlobalMuonToMuonProducer.cc.

31 {}

Member Function Documentation

void GlobalMuonToMuonProducer::printTrackRecHits ( const reco::Track track,
edm::ESHandle< GlobalTrackingGeometry trackingGeometry 
) const
private

Definition at line 33 of file GlobalMuonToMuonProducer.cc.

References reco::Track::found(), mps_fire::i, GlobalTrackingGeometry::idToDet(), LogTrace, reco::Track::lost(), metname, PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), alignCSCRings::r, rpcPointValidation_cfi::recHit, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDet::surface(), GeomDet::toGlobal(), and z.

Referenced by produce().

34  {
35  const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";
36 
37  LogTrace(metname) << "Valid RecHits: " << track.found() << " invalid RecHits: " << track.lost();
38 
39  int i = 0;
40  for (trackingRecHit_iterator recHit = track.recHitsBegin(); recHit != track.recHitsEnd(); ++recHit)
41  if ((*recHit)->isValid()) {
42  const GeomDet* geomDet = trackingGeometry->idToDet((*recHit)->geographicalId());
43  double r = geomDet->surface().position().perp();
44  double z = geomDet->toGlobal((*recHit)->localPosition()).z();
45  LogTrace(metname) << i++ << " r: " << r << " z: " << z << " " << geomDet->toGlobal((*recHit)->localPosition())
46  << std::endl;
47  }
48 }
unsigned short lost() const
Number of lost (=invalid) hits on track.
Definition: Track.h:145
T perp() const
Definition: PV3DBase.h:69
const std::string metname
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
#define LogTrace(id)
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:142
const GeomDet * idToDet(DetId) const override
const PositionType & position() const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
void GlobalMuonToMuonProducer::produce ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup eventSetup 
) const
override

reconstruct muons

Definition at line 51 of file GlobalMuonToMuonProducer.cc.

References HCALHighEnergyHPDFilter_cfi::energy, edm::EventSetup::get(), electronStore::links, LogTrace, metname, eostools::move(), HLT_2018_cff::muon, pdwgLeptonRecoSkim_cfi::muonCollection, p4, printTrackRecHits(), reco::LeafCandidate::setCharge(), reco::Muon::setCombined(), reco::LeafCandidate::setP4(), reco::Muon::setStandAlone(), reco::Muon::setTrack(), reco::LeafCandidate::setVertex(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and trackLinkToken_.

51  {
52  const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";
53 
54  // the muon collection, it will be loaded in the event
55  auto muonCollection = std::make_unique<reco::MuonCollection>();
56 
58  event.getByToken(trackLinkToken_, linksCollection);
59 
60  if (linksCollection->empty()) {
61  event.put(std::move(muonCollection));
62  return;
63  }
64 
65  // Global Tracking Geometry
67  eventSetup.get<GlobalTrackingGeometryRecord>().get(trackingGeometry);
68 
69  for (reco::MuonTrackLinksCollection::const_iterator links = linksCollection->begin(); links != linksCollection->end();
70  ++links) {
71  // some temporary print-out
72  LogTrace(metname) << "trackerTrack";
73  printTrackRecHits(*(links->trackerTrack()), trackingGeometry);
74  LogTrace(metname) << "standAloneTrack";
75  printTrackRecHits(*(links->standAloneTrack()), trackingGeometry);
76  LogTrace(metname) << "globalTrack";
77  printTrackRecHits(*(links->globalTrack()), trackingGeometry);
78 
79  // Fill the muon
81  muon.setStandAlone(links->standAloneTrack());
82  muon.setTrack(links->trackerTrack());
83  muon.setCombined(links->globalTrack());
84 
85  // FIXME: can this break in case combined info cannot be added to some tracks?
86  muon.setCharge(links->globalTrack()->charge());
87 
88  //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV
89  double energy = sqrt(links->globalTrack()->p() * links->globalTrack()->p() + 0.011163691);
91  links->globalTrack()->px(), links->globalTrack()->py(), links->globalTrack()->pz(), energy);
92 
93  muon.setP4(p4);
94  muon.setVertex(links->globalTrack()->vertex());
95 
96  muonCollection->push_back(muon);
97  }
98 
99  event.put(std::move(muonCollection));
100 }
edm::EDGetTokenT< reco::MuonTrackLinksCollection > trackLinkToken_
const std::string metname
void setVertex(const Point &vertex) override
set vertex
void setCharge(Charge q) final
set electric charge
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual void setStandAlone(const TrackRef &t)
virtual void setCombined(const TrackRef &t)
T sqrt(T t)
Definition: SSEVec.h:19
double p4[4]
Definition: TauolaWrapper.h:92
#define LogTrace(id)
void printTrackRecHits(const reco::Track &track, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
virtual void setTrack(const TrackRef &t)
T get() const
Definition: EventSetup.h:73
void setP4(const LorentzVector &p4) final
set 4-momentum
def move(src, dest)
Definition: eostools.py:511
void GlobalMuonToMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 38 of file GlobalMuonToMuonProducer.h.

References SiStripOfflineCRack_cfg::alias, and HLT_2018_cff::track.

Referenced by GlobalMuonToMuonProducer().

38  {
39  alias.erase(alias.size() - 1, alias.size());
40  theAlias = alias;
41  }

Member Data Documentation

std::string GlobalMuonToMuonProducer::theAlias
private

Definition at line 36 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer().

edm::InputTag GlobalMuonToMuonProducer::theLinksCollectionLabel
private

Definition at line 47 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer().

edm::EDGetTokenT<reco::MuonTrackLinksCollection> GlobalMuonToMuonProducer::trackLinkToken_
private

Definition at line 48 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and produce().