CMS 3D CMS Logo

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

#include <L3MuonTrajectoryBuilder.h>

Inheritance diagram for L3MuonTrajectoryBuilder:
GlobalTrajectoryBuilderBase MuonTrajectoryBuilder

Public Member Functions

 L3MuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
 Constructor with Parameter Set and MuonServiceProxy. More...
 
void setEvent (const edm::Event &) override
 Pass the Event to the algo at each event. More...
 
MuonTrajectoryBuilder::TrajectoryContainer trajectories (const TrajectorySeed &) override
 Reconstruct trajectories from standalone and tracker only Tracks. More...
 
MuonTrajectoryBuilder::CandidateContainer trajectories (const TrackCand &) override
 return a container reconstructed muons starting from a given track More...
 
 ~L3MuonTrajectoryBuilder () override
 Destructor. More...
 
- Public Member Functions inherited from GlobalTrajectoryBuilderBase
 GlobalTrajectoryBuilderBase (const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
 constructor with Parameter Set and MuonServiceProxy More...
 
MuonTrajectoryBuilder::TrajectoryContainer trajectories (const TrajectorySeed &) override
 dummy implementation, unused in this class More...
 
 ~GlobalTrajectoryBuilderBase () override
 destructor More...
 
- Public Member Functions inherited from MuonTrajectoryBuilder
 MuonTrajectoryBuilder ()
 constructor More...
 
virtual ~MuonTrajectoryBuilder ()
 destructor More...
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &descriptions)
 Add default values for fillDescriptions. More...
 

Private Member Functions

std::vector< TrackCandmakeTkCandCollection (const TrackCand &) override
 Make a TrackCand collection using tracker Track, Trajectory information. More...
 

Private Attributes

edm::Handle< reco::TrackCollectionallTrackerTracks
 
reco::BeamSpot beamSpot
 
edm::Handle< reco::BeamSpotbeamSpotHandle
 
edm::Handle< reco::VertexCollectionpvHandle
 
edm::InputTag theBeamSpotInputTag
 
double theDXYBeamSpot
 
double theMaxChi2
 
edm::InputTag theTkCollName
 
edm::EDGetTokenT< reco::TrackCollectiontheTrackToken
 
std::unique_ptr< TrajectoryCleanertheTrajectoryCleaner
 
bool theUseVertex
 
edm::InputTag theVertexCollInputTag
 
reco::Vertex vtx
 

Additional Inherited Members

- Public Types inherited from GlobalTrajectoryBuilderBase
typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
 
typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
 
typedef TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
 
typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
 
typedef TransientTrackingRecHit::RecHitContainer RecHitContainer
 
typedef TransientTrackingRecHit::RecHitPointer RecHitPointer
 
typedef std::vector< TrajectoryTC
 
typedef TC::const_iterator TI
 
- Public Types inherited from MuonTrajectoryBuilder
typedef MuonCandidate::CandidateContainer CandidateContainer
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 
typedef MuonCandidate::TrajectoryContainer TrajectoryContainer
 
- Protected Types inherited from GlobalTrajectoryBuilderBase
enum  RefitDirection { inToOut, outToIn, undetermined }
 
- Protected Member Functions inherited from GlobalTrajectoryBuilderBase
void addTraj (TrackCand &)
 if TrackCand has only a TrackRef, attempt to add Trajectory* More...
 
MuonTrajectoryBuilder::CandidateContainer build (const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
 build combined trajectory from sta Track and tracker RecHits More...
 
void checkMuonHits (const reco::Track &, ConstRecHitContainer &, ConstRecHitContainer &, std::vector< int > &) const
 check muon RecHits, calculate chamber occupancy and select hits to be used in the final fit More...
 
RefitDirection checkRecHitsOrdering (const ConstRecHitContainer &) const
 This does nothing now. More...
 
std::vector< TrackCandchooseRegionalTrackerTracks (const TrackCand &, const std::vector< TrackCand > &)
 choose tracker tracks within region of interest More...
 
const TrajectorychooseTrajectory (const std::vector< Trajectory *> &, int) const
 choose final trajectory More...
 
RectangularEtaPhiTrackingRegion defineRegionOfInterest (const reco::TrackRef &) const
 define region of interest with tracker More...
 
void fixTEC (ConstRecHitContainer &all, double scl_x, double scl_y) const
 rescale errors of outermost TEC RecHit More...
 
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits (const reco::Track &) const
 get transient RecHits of a Track More...
 
void printHits (const ConstRecHitContainer &) const
 print all RecHits of a trajectory More...
 
ConstRecHitContainer selectMuonHits (const Trajectory &, const std::vector< int > &) const
 select muon hits compatible with trajectory; check hits in chambers with showers More...
 
ConstRecHitContainer selectTrackerHits (const ConstRecHitContainer &) const
 select tracker hits; exclude some tracker hits in the global trajectory More...
 
const MuonServiceProxyservice () const
 
GlobalMuonTrackMatchertrackMatcher () const
 
double trackProbability (const Trajectory &) const
 calculate chi2 probability (-ln(P)) More...
 
- Protected Attributes inherited from GlobalTrajectoryBuilderBase
std::string theCategory
 
float thePCut
 
float thePtCut
 

Detailed Description

class to build muon trajectory

Author
N. Neumeister Purdue University
C. Liu Purdue University
A. Everett Purdue University

Definition at line 37 of file L3MuonTrajectoryBuilder.h.

Constructor & Destructor Documentation

◆ L3MuonTrajectoryBuilder()

L3MuonTrajectoryBuilder::L3MuonTrajectoryBuilder ( const edm::ParameterSet par,
const MuonServiceProxy service,
edm::ConsumesCollector iC 
)

Constructor with Parameter Set and MuonServiceProxy.

Class: L3MuonTrajectoryBuilder

Description: Reconstruct muons starting from a muon track reconstructed in the standalone muon system (with DT, CSC and RPC information). It tries to reconstruct the corresponding track in the tracker and performs matching between the reconstructed tracks in the muon system and the tracker.

Authors : N. Neumeister Purdue University C. Liu Purdue University A. Everett Purdue University with contributions from: S. Lacaprara, J. Mumford, P. Traczyk

Definition at line 53 of file L3MuonTrajectoryBuilder.cc.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), theBeamSpotInputTag, theDXYBeamSpot, theMaxChi2, theTkCollName, theTrackToken, theTrajectoryCleaner, theUseVertex, and theVertexCollInputTag.

57  theTrajectoryCleaner = std::make_unique<TrajectoryCleanerBySharedHits>();
58  theTkCollName = par.getParameter<edm::InputTag>("tkTrajLabel");
59  theBeamSpotInputTag = par.getParameter<edm::InputTag>("tkTrajBeamSpot");
60  theMaxChi2 = par.getParameter<double>("tkTrajMaxChi2");
61  theDXYBeamSpot = par.getParameter<double>("tkTrajMaxDXYBeamSpot");
62  theUseVertex = par.getParameter<bool>("tkTrajUseVertex");
63  theVertexCollInputTag = par.getParameter<edm::InputTag>("tkTrajVertex");
65 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
GlobalTrajectoryBuilderBase(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
constructor with Parameter Set and MuonServiceProxy
edm::EDGetTokenT< reco::TrackCollection > theTrackToken
std::unique_ptr< TrajectoryCleaner > theTrajectoryCleaner

◆ ~L3MuonTrajectoryBuilder()

L3MuonTrajectoryBuilder::~L3MuonTrajectoryBuilder ( )
override

Destructor.

Definition at line 70 of file L3MuonTrajectoryBuilder.cc.

70 {}

Member Function Documentation

◆ fillDescriptions()

void L3MuonTrajectoryBuilder::fillDescriptions ( edm::ParameterSetDescription descriptions)
static

Add default values for fillDescriptions.

Definition at line 72 of file L3MuonTrajectoryBuilder.cc.

References submitPVResolutionJobs::desc, and MuonTrackingRegionBuilder::fillDescriptionsHLT().

72  {
75  desc.add("MuonTrackingRegionBuilder", descTRB);
76 }
static void fillDescriptionsHLT(edm::ParameterSetDescription &descriptions)

◆ makeTkCandCollection()

std::vector< L3MuonTrajectoryBuilder::TrackCand > L3MuonTrajectoryBuilder::makeTkCandCollection ( const TrackCand staCand)
overrideprivatevirtual

Make a TrackCand collection using tracker Track, Trajectory information.

Implements GlobalTrajectoryBuilderBase.

Definition at line 169 of file L3MuonTrajectoryBuilder.cc.

References a, allTrackerTracks, beamSpot, validateAlignments::category, reco::BeamSpot::position(), reco::Vertex::position(), position, AlCaHLTBitMon_QueryRunRegistry::string, theDXYBeamSpot, theMaxChi2, theUseVertex, and vtx.

Referenced by trajectories().

169  {
170  const std::string category = "Muon|RecoMuon|L3MuonTrajectoryBuilder|makeTkCandCollection";
171  std::vector<TrackCand> tkCandColl;
172  std::vector<TrackCand> tkTrackCands;
173 
174  // for (auto&& tkTrack: allTrackerTracks){
175  // auto tkCand = TrackCand((Trajectory*)(0),tkTrack);
176  for (unsigned int position = 0; position != allTrackerTracks->size(); ++position) {
178  TrackCand tkCand = TrackCand((Trajectory*)nullptr, tkTrackRef);
179  tkCandColl.push_back(tkCand);
180  }
181 
182  //Loop over TrackCand collection made from allTrackerTracks in previous step
183  for (auto&& tkCand : tkCandColl) {
184  auto& tk = tkCand.second;
185  bool canUseL3MTS = false;
186  // check the seedRef is non-null first; and then
187  if (tk->seedRef().isNonnull()) {
188  auto a = dynamic_cast<const L3MuonTrajectorySeed*>(tk->seedRef().get());
189  canUseL3MTS = a != nullptr;
190  }
191  if (canUseL3MTS) {
193  tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >();
194  // May still need provenance here, so using trackref:
195  reco::TrackRef staTrack = l3seedRef->l2Track();
196  if (staTrack == (staCand.second)) {
197  // Apply filters (dxy, chi2 cut)
198  double tk_vtx;
199  if (theUseVertex)
200  tk_vtx = tk->dxy(vtx.position());
201  else
202  tk_vtx = tk->dxy(beamSpot.position());
203  if (fabs(tk_vtx) > theDXYBeamSpot || tk->normalizedChi2() > theMaxChi2)
204  continue;
205  tkTrackCands.push_back(tkCand);
206  }
207  } else {
208  // We will try to match all tracker tracks with the muon:
209  double tk_vtx;
210  if (theUseVertex)
211  tk_vtx = tk->dxy(vtx.position());
212  else
213  tk_vtx = tk->dxy(beamSpot.position());
214  if (fabs(tk_vtx) > theDXYBeamSpot || tk->normalizedChi2() > theMaxChi2)
215  continue;
216  tkTrackCands.push_back(tkCand);
217  }
218  }
219 
220  return tkTrackCands;
221 }
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const Point & position() const
position
Definition: BeamSpot.h:59
const Point & position() const
position
Definition: Vertex.h:127
edm::Handle< reco::TrackCollection > allTrackerTracks
double a
Definition: hdecay.h:119
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ setEvent()

void L3MuonTrajectoryBuilder::setEvent ( const edm::Event event)
overridevirtual

Pass the Event to the algo at each event.

Reimplemented from GlobalTrajectoryBuilderBase.

Definition at line 81 of file L3MuonTrajectoryBuilder.cc.

References allTrackerTracks, beamSpot, beamSpotHandle, validateAlignments::category, edm::HandleBase::isValid(), LogDebug, pvHandle, GlobalTrajectoryBuilderBase::setEvent(), AlCaHLTBitMon_QueryRunRegistry::string, theBeamSpotInputTag, theTkCollName, theTrackToken, theUseVertex, and vtx.

81  {
82  const std::string category = "Muon|RecoMuon|L3MuonTrajectoryBuilder|setEvent";
83 
85 
86  // get tracker TrackCollection from Event
87  event.getByToken(theTrackToken, allTrackerTracks);
88  LogDebug(category) << "Found " << allTrackerTracks->size() << " tracker Tracks with label " << theTkCollName;
89 
90  if (theUseVertex) {
91  // PV
93  if (pvHandle.isValid()) {
94  vtx = pvHandle->front();
95  } else {
96  edm::LogInfo(category) << "No Primary Vertex available from EventSetup \n";
97  }
98  } else {
99  // BS
100  event.getByLabel(theBeamSpotInputTag, beamSpotHandle);
101  if (beamSpotHandle.isValid()) {
103  } else {
104  edm::LogInfo(category) << "No beam spot available from EventSetup \n";
105  }
106  }
107 }
edm::Handle< reco::TrackCollection > allTrackerTracks
edm::Handle< reco::VertexCollection > pvHandle
void setEvent(const edm::Event &) override
pass the Event to the algo at each event
Log< level::Info, false > LogInfo
edm::EDGetTokenT< reco::TrackCollection > theTrackToken
bool isValid() const
Definition: HandleBase.h:70
edm::Handle< reco::BeamSpot > beamSpotHandle
Definition: event.py:1
#define LogDebug(id)

◆ trajectories() [1/2]

MuonTrajectoryBuilder::TrajectoryContainer GlobalTrajectoryBuilderBase::trajectories
inlineoverride

Reconstruct trajectories from standalone and tracker only Tracks.

Definition at line 66 of file GlobalTrajectoryBuilderBase.h.

66  {
68  }
MuonCandidate::TrajectoryContainer TrajectoryContainer

◆ trajectories() [2/2]

MuonCandidate::CandidateContainer L3MuonTrajectoryBuilder::trajectories ( const TrackCand )
overridevirtual

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 112 of file L3MuonTrajectoryBuilder.cc.

References GlobalTrajectoryBuilderBase::build(), validateAlignments::category, LogDebug, makeTkCandCollection(), GlobalMuonTrackMatcher::match(), mps_fire::result, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalTrajectoryBuilderBase::thePtCut, and GlobalTrajectoryBuilderBase::trackMatcher().

112  {
113  const std::string category = "Muon|RecoMuon|L3MuonTrajectoryBuilder|trajectories";
114 
115  // cut on muons with low momenta
116  if ((staCandIn).second->pt() < thePtCut || (staCandIn).second->innerMomentum().Rho() < thePtCut ||
117  (staCandIn).second->innerMomentum().R() < 2.5)
118  return CandidateContainer();
119 
120  // convert the STA track into a Trajectory if Trajectory not already present
121  TrackCand staCand(staCandIn);
122 
123  std::vector<TrackCand> regionalTkTracks = makeTkCandCollection(staCand);
124  LogDebug(category) << "Found " << regionalTkTracks.size() << " tracks within region of interest";
125 
126  // match tracker tracks to muon track
127  std::vector<TrackCand> trackerTracks = trackMatcher()->match(staCand, regionalTkTracks);
128 
129  LogDebug(category) << "Found " << trackerTracks.size() << " matching tracker tracks within region of interest";
130  if (trackerTracks.empty())
131  return CandidateContainer();
132 
133  // build a combined tracker-muon MuonCandidate
134  // turn tkMatchedTracks into MuonCandidates
135  LogDebug(category) << "turn tkMatchedTracks into MuonCandidates";
136  CandidateContainer tkTrajs;
137  tkTrajs.reserve(trackerTracks.size());
138  for (std::vector<TrackCand>::const_iterator tkt = trackerTracks.begin(); tkt != trackerTracks.end(); tkt++) {
139  if ((*tkt).first != nullptr && (*tkt).first->isValid()) {
140  tkTrajs.emplace_back(std::make_unique<MuonCandidate>(
141  nullptr, staCand.second, (*tkt).second, std::make_unique<Trajectory>(*(*tkt).first)));
142  } else {
143  tkTrajs.emplace_back(std::make_unique<MuonCandidate>(nullptr, staCand.second, (*tkt).second, nullptr));
144  }
145  }
146 
147  if (tkTrajs.empty()) {
148  LogDebug(category) << "tkTrajs empty";
149  return CandidateContainer();
150  }
151 
152  CandidateContainer result = build(staCand, tkTrajs);
153  LogDebug(category) << "Found " << result.size() << " L3Muons from one L2Cand";
154 
155  // free memory
156  if (staCandIn.first == nullptr)
157  delete staCand.first;
158 
159  for (std::vector<TrackCand>::const_iterator is = regionalTkTracks.begin(); is != regionalTkTracks.end(); ++is) {
160  delete (*is).first;
161  }
162 
163  return result;
164 }
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
MuonCandidate::CandidateContainer CandidateContainer
std::pair< const Trajectory *, reco::TrackRef > TrackCand
U second(std::pair< T, U > const &p)
double match(const TrackCand &sta, const TrackCand &track, int matchOption=0, int surfaceOption=1) const
std::vector< TrackCand > makeTkCandCollection(const TrackCand &) override
Make a TrackCand collection using tracker Track, Trajectory information.
GlobalMuonTrackMatcher * trackMatcher() const
#define LogDebug(id)

Member Data Documentation

◆ allTrackerTracks

edm::Handle<reco::TrackCollection> L3MuonTrajectoryBuilder::allTrackerTracks
private

Definition at line 61 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

◆ beamSpot

reco::BeamSpot L3MuonTrajectoryBuilder::beamSpot
private

Definition at line 62 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

◆ beamSpotHandle

edm::Handle<reco::BeamSpot> L3MuonTrajectoryBuilder::beamSpotHandle
private

Definition at line 63 of file L3MuonTrajectoryBuilder.h.

Referenced by setEvent().

◆ pvHandle

edm::Handle<reco::VertexCollection> L3MuonTrajectoryBuilder::pvHandle
private

Definition at line 66 of file L3MuonTrajectoryBuilder.h.

Referenced by setEvent().

◆ theBeamSpotInputTag

edm::InputTag L3MuonTrajectoryBuilder::theBeamSpotInputTag
private

Definition at line 64 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

◆ theDXYBeamSpot

double L3MuonTrajectoryBuilder::theDXYBeamSpot
private

Definition at line 70 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and makeTkCandCollection().

◆ theMaxChi2

double L3MuonTrajectoryBuilder::theMaxChi2
private

Definition at line 69 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and makeTkCandCollection().

◆ theTkCollName

edm::InputTag L3MuonTrajectoryBuilder::theTkCollName
private

Definition at line 60 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

◆ theTrackToken

edm::EDGetTokenT<reco::TrackCollection> L3MuonTrajectoryBuilder::theTrackToken
private

Definition at line 71 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

◆ theTrajectoryCleaner

std::unique_ptr<TrajectoryCleaner> L3MuonTrajectoryBuilder::theTrajectoryCleaner
private

Definition at line 59 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder().

◆ theUseVertex

bool L3MuonTrajectoryBuilder::theUseVertex
private

◆ theVertexCollInputTag

edm::InputTag L3MuonTrajectoryBuilder::theVertexCollInputTag
private

Definition at line 67 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder().

◆ vtx

reco::Vertex L3MuonTrajectoryBuilder::vtx
private

Definition at line 65 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().