CMS 3D CMS Logo

GlobalMuonToMuonProducer.cc
Go to the documentation of this file.
1 
8 
13 
14 // tmp
19 
22  theLinksCollectionLabel = pSet.getParameter<edm::InputTag>("InputObjects");
23 
24  setAlias(pSet.getParameter<std::string>("@module_label"));
25  produces<reco::MuonCollection>().setBranchAlias(theAlias + "s");
26  trackLinkToken_ = consumes<reco::MuonTrackLinksCollection>(theLinksCollectionLabel);
27  trackingGeomToken_ = esConsumes<GlobalTrackingGeometry, GlobalTrackingGeometryRecord>();
28 }
29 
32 
34  edm::ESHandle<GlobalTrackingGeometry> trackingGeometry) const {
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 }
49 
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 
68  for (reco::MuonTrackLinksCollection::const_iterator links = linksCollection->begin(); links != linksCollection->end();
69  ++links) {
70  // some temporary print-out
71  LogTrace(metname) << "trackerTrack";
72  printTrackRecHits(*(links->trackerTrack()), trackingGeometry);
73  LogTrace(metname) << "standAloneTrack";
74  printTrackRecHits(*(links->standAloneTrack()), trackingGeometry);
75  LogTrace(metname) << "globalTrack";
76  printTrackRecHits(*(links->globalTrack()), trackingGeometry);
77 
78  // Fill the muon
80  muon.setStandAlone(links->standAloneTrack());
81  muon.setTrack(links->trackerTrack());
82  muon.setCombined(links->globalTrack());
83 
84  // FIXME: can this break in case combined info cannot be added to some tracks?
85  muon.setCharge(links->globalTrack()->charge());
86 
87  //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV
88  double energy = sqrt(links->globalTrack()->p() * links->globalTrack()->p() + 0.011163691);
90  links->globalTrack()->px(), links->globalTrack()->py(), links->globalTrack()->pz(), energy);
91 
92  muon.setP4(p4);
93  muon.setVertex(links->globalTrack()->vertex());
94 
95  muonCollection->push_back(muon);
96  }
97 
98  event.put(std::move(muonCollection));
99 }
edm::StreamID
Definition: StreamID.h:30
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
GlobalMuonToMuonProducer.h
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
muon
Definition: MuonCocktails.h:17
GlobalMuonToMuonProducer::trackingGeomToken_
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeomToken_
Definition: GlobalMuonToMuonProducer.h:51
TransientTrackingRecHit.h
edm::Handle< reco::MuonTrackLinksCollection >
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
reco::Muon
Definition: Muon.h:27
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
GlobalMuonToMuonProducer::~GlobalMuonToMuonProducer
~GlobalMuonToMuonProducer() override
Destructor.
Definition: GlobalMuonToMuonProducer.cc:31
Track.h
TrackFwd.h
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11725
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
reco::Track
Definition: Track.h:27
edm::ESHandle< GlobalTrackingGeometry >
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
GlobalMuonToMuonProducer::printTrackRecHits
void printTrackRecHits(const reco::Track &track, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
Definition: GlobalMuonToMuonProducer.cc:33
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
GlobalMuonToMuonProducer::trackLinkToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > trackLinkToken_
Definition: GlobalMuonToMuonProducer.h:50
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
GlobalMuonToMuonProducer::setAlias
void setAlias(std::string alias)
Definition: GlobalMuonToMuonProducer.h:40
pdwgLeptonRecoSkim_cfi.muonCollection
muonCollection
Definition: pdwgLeptonRecoSkim_cfi.py:7
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignCSCRings.r
r
Definition: alignCSCRings.py:93
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
GeomDet.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
electronStore.links
links
Definition: electronStore.py:149
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GlobalMuonToMuonProducer::theLinksCollectionLabel
edm::InputTag theLinksCollectionLabel
Definition: GlobalMuonToMuonProducer.h:49
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
GlobalMuonToMuonProducer::theAlias
std::string theAlias
Definition: GlobalMuonToMuonProducer.h:38
event
Definition: event.py:1
GlobalMuonToMuonProducer::GlobalMuonToMuonProducer
GlobalMuonToMuonProducer(const edm::ParameterSet &)
Constructor.
Definition: GlobalMuonToMuonProducer.cc:21
edm::Event
Definition: Event.h:73
GlobalMuonToMuonProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
reconstruct muons
Definition: GlobalMuonToMuonProducer.cc:51
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::InputTag
Definition: InputTag.h:15
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40