CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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...
 
virtual void setEvent (const edm::Event &)
 Pass the Event to the algo at each event. More...
 
MuonTrajectoryBuilder::CandidateContainer trajectories (const TrackCand &)
 return a container reconstructed muons starting from a given track More...
 
 ~L3MuonTrajectoryBuilder ()
 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 &)
 dummy implementation, unused in this class More...
 
virtual ~GlobalTrajectoryBuilderBase ()
 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 &)
 Make a TrackCand collection using tracker Track, Trajectory information. More...
 

Private Attributes

edm::Handle
< reco::TrackCollection
allTrackerTracks
 
reco::BeamSpot beamSpot
 
edm::Handle< reco::BeamSpotbeamSpotHandle
 
edm::Handle
< reco::VertexCollection
pvHandle
 
edm::InputTag theBeamSpotInputTag
 
double theDXYBeamSpot
 
double theMaxChi2
 
edm::InputTag theTkCollName
 
edm::EDGetTokenT
< reco::TrackCollection
theTrackToken
 
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::TrackRef
TrackCand
 
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 31 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 54 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 ( )

Destructor.

Definition at line 70 of file L3MuonTrajectoryBuilder.cc.

References theTrajectoryCleaner.

70  {
72 }
TrajectoryCleaner * theTrajectoryCleaner

Member Function Documentation

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

Add default values for fillDescriptions.

Definition at line 74 of file L3MuonTrajectoryBuilder.cc.

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

74  {
77  desc.add("MuonTrackingRegionBuilder",descTRB);
78 }
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Add Fill Descriptions.
std::vector< L3MuonTrajectoryBuilder::TrackCand > L3MuonTrajectoryBuilder::makeTkCandCollection ( const TrackCand staCand)
privatevirtual

Make a TrackCand collection using tracker Track, Trajectory information.

Implements GlobalTrajectoryBuilderBase.

Definition at line 184 of file L3MuonTrajectoryBuilder.cc.

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

Referenced by trajectories().

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

Pass the Event to the algo at each event.

Reimplemented from GlobalTrajectoryBuilderBase.

Definition at line 83 of file L3MuonTrajectoryBuilder.cc.

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

83  {
84  const std::string category = "Muon|RecoMuon|L3MuonTrajectoryBuilder|setEvent";
85 
87 
88  // get tracker TrackCollection from Event
89  event.getByToken(theTrackToken,allTrackerTracks);
90  LogDebug(category)
91  << "Found " << allTrackerTracks->size()
92  << " tracker Tracks with label "<< theTkCollName;
93 
94  if( theUseVertex ) {
95  // PV
97  if ( pvHandle.isValid() ) {
98  vtx = pvHandle->front();
99  }
100  else {
101  edm::LogInfo(category) << "No Primary Vertex available from EventSetup \n";
102  }
103  }
104  else {
105  // BS
106  event.getByLabel(theBeamSpotInputTag, beamSpotHandle);
107  if( beamSpotHandle.isValid() ) {
109  }
110  else {
111  edm::LogInfo(category) << "No beam spot available from EventSetup \n";
112  }
113  }
114 }
#define LogDebug(id)
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
edm::Handle< reco::TrackCollection > allTrackerTracks
edm::Handle< reco::VertexCollection > pvHandle
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< reco::TrackCollection > theTrackToken
edm::Handle< reco::BeamSpot > beamSpotHandle
MuonCandidate::CandidateContainer L3MuonTrajectoryBuilder::trajectories ( const TrackCand )
virtual

return a container reconstructed muons starting from a given track

Implements MuonTrajectoryBuilder.

Definition at line 120 of file L3MuonTrajectoryBuilder.cc.

References GlobalTrajectoryBuilderBase::build(), python.rootplot.argparse::category, LogDebug, makeTkCandCollection(), GlobalMuonTrackMatcher::match(), query::result, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalTrajectoryBuilderBase::thePtCut, and GlobalTrajectoryBuilderBase::trackMatcher().

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

Member Data Documentation

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

Definition at line 58 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

reco::BeamSpot L3MuonTrajectoryBuilder::beamSpot
private

Definition at line 59 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().

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

Definition at line 60 of file L3MuonTrajectoryBuilder.h.

Referenced by setEvent().

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

Definition at line 63 of file L3MuonTrajectoryBuilder.h.

Referenced by setEvent().

edm::InputTag L3MuonTrajectoryBuilder::theBeamSpotInputTag
private

Definition at line 61 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

double L3MuonTrajectoryBuilder::theDXYBeamSpot
private

Definition at line 67 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and makeTkCandCollection().

double L3MuonTrajectoryBuilder::theMaxChi2
private

Definition at line 66 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and makeTkCandCollection().

edm::InputTag L3MuonTrajectoryBuilder::theTkCollName
private

Definition at line 57 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

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

Definition at line 68 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder(), and setEvent().

TrajectoryCleaner* L3MuonTrajectoryBuilder::theTrajectoryCleaner
private

Definition at line 56 of file L3MuonTrajectoryBuilder.h.

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

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

Definition at line 64 of file L3MuonTrajectoryBuilder.h.

Referenced by L3MuonTrajectoryBuilder().

reco::Vertex L3MuonTrajectoryBuilder::vtx
private

Definition at line 62 of file L3MuonTrajectoryBuilder.h.

Referenced by makeTkCandCollection(), and setEvent().