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::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
 
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 35 of file L3MuonTrajectoryBuilder.h.

Constructor & Destructor Documentation

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.

56  : GlobalTrajectoryBuilderBase(par, service, iC) {
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
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
TrajectoryCleaner * theTrajectoryCleaner
L3MuonTrajectoryBuilder::~L3MuonTrajectoryBuilder ( )
override

Destructor.

Definition at line 70 of file L3MuonTrajectoryBuilder.cc.

References theTrajectoryCleaner.

70  {
72  delete theTrajectoryCleaner;
73 }
TrajectoryCleaner * theTrajectoryCleaner

Member Function Documentation

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

Add default values for fillDescriptions.

Definition at line 75 of file L3MuonTrajectoryBuilder.cc.

References edm::ParameterSetDescription::add(), and MuonTrackingRegionBuilder::fillDescriptionsHLT().

75  {
78  desc.add("MuonTrackingRegionBuilder", descTRB);
79 }
static void fillDescriptionsHLT(edm::ParameterSetDescription &descriptions)
std::vector< L3MuonTrajectoryBuilder::TrackCand > L3MuonTrajectoryBuilder::makeTkCandCollection ( const TrackCand staCand)
overrideprivatevirtual

Make a TrackCand collection using tracker Track, Trajectory information.

Implements GlobalTrajectoryBuilderBase.

Definition at line 185 of file L3MuonTrajectoryBuilder.cc.

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

Referenced by trajectories().

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

Pass the Event to the algo at each event.

Reimplemented from GlobalTrajectoryBuilderBase.

Definition at line 84 of file L3MuonTrajectoryBuilder.cc.

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

84  {
85  const std::string category = "Muon|RecoMuon|L3MuonTrajectoryBuilder|setEvent";
86 
88 
89  // get tracker TrackCollection from Event
90  event.getByToken(theTrackToken, allTrackerTracks);
91  LogDebug(category) << "Found " << allTrackerTracks->size() << " tracker Tracks with label " << theTkCollName;
92 
93  if (theUseVertex) {
94  // PV
96  if (pvHandle.isValid()) {
97  vtx = pvHandle->front();
98  } else {
99  edm::LogInfo(category) << "No Primary Vertex available from EventSetup \n";
100  }
101  } else {
102  // BS
103  event.getByLabel(theBeamSpotInputTag, beamSpotHandle);
104  if (beamSpotHandle.isValid()) {
106  } else {
107  edm::LogInfo(category) << "No beam spot available from EventSetup \n";
108  }
109  }
110 }
#define LogDebug(id)
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
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::TrackCollection > theTrackToken
edm::Handle< reco::BeamSpot > beamSpotHandle
MuonCandidate::CandidateContainer L3MuonTrajectoryBuilder::trajectories ( const TrackCand )
overridevirtual

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 115 of file L3MuonTrajectoryBuilder.cc.

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

115  {
116  const std::string category = "Muon|RecoMuon|L3MuonTrajectoryBuilder|trajectories";
117 
118  // cut on muons with low momenta
119  if ((staCandIn).second->pt() < thePtCut || (staCandIn).second->innerMomentum().Rho() < thePtCut ||
120  (staCandIn).second->innerMomentum().R() < 2.5)
121  return CandidateContainer();
122 
123  // convert the STA track into a Trajectory if Trajectory not already present
124  TrackCand staCand(staCandIn);
125 
126  std::vector<TrackCand> trackerTracks;
127 
128  std::vector<TrackCand> regionalTkTracks = makeTkCandCollection(staCand);
129  LogDebug(category) << "Found " << regionalTkTracks.size() << " tracks within region of interest";
130 
131  // match tracker tracks to muon track
132  trackerTracks = trackMatcher()->match(staCand, regionalTkTracks);
133 
134  LogDebug(category) << "Found " << trackerTracks.size() << " matching tracker tracks within region of interest";
135  if (trackerTracks.empty())
136  return CandidateContainer();
137 
138  // build a combined tracker-muon MuonCandidate
139  // turn tkMatchedTracks into MuonCandidates
140  LogDebug(category) << "turn tkMatchedTracks into MuonCandidates";
141  CandidateContainer tkTrajs;
142  for (std::vector<TrackCand>::const_iterator tkt = trackerTracks.begin(); tkt != trackerTracks.end(); tkt++) {
143  if ((*tkt).first != nullptr && (*tkt).first->isValid()) {
144  MuonCandidate* muonCand =
145  new MuonCandidate(nullptr, staCand.second, (*tkt).second, new Trajectory(*(*tkt).first));
146  tkTrajs.push_back(muonCand);
147  } else {
148  MuonCandidate* muonCand = new MuonCandidate(nullptr, staCand.second, (*tkt).second, nullptr);
149  tkTrajs.push_back(muonCand);
150  }
151  }
152 
153  if (tkTrajs.empty()) {
154  LogDebug(category) << "tkTrajs empty";
155  return CandidateContainer();
156  }
157 
158  CandidateContainer result = build(staCand, tkTrajs);
159  LogDebug(category) << "Found " << result.size() << " L3Muons from one L2Cand";
160 
161  // free memory
162  if (staCandIn.first == nullptr)
163  delete staCand.first;
164 
165  for (CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); ++it) {
166  if ((*it)->trajectory())
167  delete (*it)->trajectory();
168  if ((*it)->trackerTrajectory())
169  delete (*it)->trackerTrajectory();
170  if (*it)
171  delete (*it);
172  }
173  tkTrajs.clear();
174 
175  for (std::vector<TrackCand>::const_iterator is = regionalTkTracks.begin(); is != regionalTkTracks.end(); ++is) {
176  delete (*is).first;
177  }
178 
179  return result;
180 }
#define LogDebug(id)
MuonCandidate::CandidateContainer CandidateContainer
GlobalMuonTrackMatcher * trackMatcher() const
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
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
std::vector< TrackCand > makeTkCandCollection(const TrackCand &) override
Make a TrackCand collection using tracker Track, Trajectory information.

Member Data Documentation

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

Definition at line 59 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

reco::BeamSpot L3MuonTrajectoryBuilder::beamSpot
private

Definition at line 60 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

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

Definition at line 61 of file L3MuonTrajectoryBuilder.h.

Referenced by setEvent().

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

Definition at line 64 of file L3MuonTrajectoryBuilder.h.

Referenced by setEvent().

edm::InputTag L3MuonTrajectoryBuilder::theBeamSpotInputTag
private

Definition at line 62 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

double L3MuonTrajectoryBuilder::theDXYBeamSpot
private

Definition at line 68 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and makeTkCandCollection().

double L3MuonTrajectoryBuilder::theMaxChi2
private

Definition at line 67 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and makeTkCandCollection().

edm::InputTag L3MuonTrajectoryBuilder::theTkCollName
private

Definition at line 58 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

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

Definition at line 69 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

TrajectoryCleaner* L3MuonTrajectoryBuilder::theTrajectoryCleaner
private

Definition at line 57 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and ~L3MuonTrajectoryBuilder().

bool L3MuonTrajectoryBuilder::theUseVertex
private
edm::InputTag L3MuonTrajectoryBuilder::theVertexCollInputTag
private

Definition at line 65 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder().

reco::Vertex L3MuonTrajectoryBuilder::vtx
private

Definition at line 63 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().