CMS 3D CMS Logo

GlobalMuonToMuonProducer.cc
Go to the documentation of this file.
1 
8 
13 
14 // tmp
20 
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 }
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  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::StreamID
Definition: StreamID.h:30
mps_fire.i
i
Definition: mps_fire.py:355
GlobalMuonToMuonProducer.h
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
muon
Definition: MuonCocktails.h:17
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
TransientTrackingRecHit.h
HLT_2018_cff.muon
muon
Definition: HLT_2018_cff.py:10349
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackFwd.h
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
GlobalTrackingGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GlobalMuonToMuonProducer::trackLinkToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > trackLinkToken_
Definition: GlobalMuonToMuonProducer.h:48
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:36
Event.h
p4
double p4[4]
Definition: TauolaWrapper.h:92
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
GlobalMuonToMuonProducer::setAlias
void setAlias(std::string alias)
Definition: GlobalMuonToMuonProducer.h:38
pdwgLeptonRecoSkim_cfi.muonCollection
muonCollection
Definition: pdwgLeptonRecoSkim_cfi.py:7
alignCSCRings.r
r
Definition: alignCSCRings.py:93
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
GlobalMuonToMuonProducer::theLinksCollectionLabel
edm::InputTag theLinksCollectionLabel
Definition: GlobalMuonToMuonProducer.h:47
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
ParameterSet.h
GlobalMuonToMuonProducer::theAlias
std::string theAlias
Definition: GlobalMuonToMuonProducer.h:36
event
Definition: event.py:1
GlobalMuonToMuonProducer::GlobalMuonToMuonProducer
GlobalMuonToMuonProducer(const edm::ParameterSet &)
Constructor.
Definition: GlobalMuonToMuonProducer.cc:22
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:43