test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalMuonTrajectoryBuilder.cc
Go to the documentation of this file.
1 
25 
26 //---------------
27 // C++ Headers --
28 //---------------
29 
30 #include <iostream>
31 #include <iomanip>
32 #include <algorithm>
33 
34 //-------------------------------
35 // Collaborating Class Headers --
36 //-------------------------------
37 
40 
42 
44 
48 
49 using namespace std;
50 using namespace edm;
51 
52 //----------------
53 // Constructors --
54 //----------------
55 
57  const MuonServiceProxy* service,
59  ) : GlobalTrajectoryBuilderBase(par, service, iC)
60 
61 {
62 
63  theTkTrackLabel = par.getParameter<edm::InputTag>("TrackerCollectionLabel");
65 
66 }
67 
68 
69 //--------------
70 // Destructor --
71 //--------------
72 
74 }
75 
76 //
77 // get information from event
78 //
80 
81  const std::string category = "Muon|RecoMuon|GlobalMuonTrajectoryBuilder|setEvent";
82 
84 
85  // get tracker TrackCollection from Event
86  event.getByToken(allTrackerTracksToken,allTrackerTracks);
87  LogDebug(category)
88  << " Found " << allTrackerTracks->size()
89  << " tracker Tracks with label "<< theTkTrackLabel;
90 
91 }
92 
93 //
94 // reconstruct trajectories
95 //
97 
98  const std::string category = "Muon|RecoMuon|GlobalMuonTrajectoryBuilder|trajectories";
99 
100  // cut on muons with low momenta
101  LogTrace(category) << " STA pt " << staCandIn.second->pt() << " rho " << staCandIn.second->innerMomentum().Rho() << " R " << staCandIn.second->innerMomentum().R() << " theCut " << thePtCut;
102 
103  // convert the STA track into a Trajectory if Trajectory not already present
104  TrackCand staCand(staCandIn);
105 
106  vector<TrackCand> regionalTkTracks = makeTkCandCollection(staCand);
107  LogTrace(category) << " Found " << regionalTkTracks.size() << " tracks within region of interest";
108 
109  // match tracker tracks to muon track
110  vector<TrackCand> trackerTracks = trackMatcher()->match(staCand, regionalTkTracks);
111  LogTrace(category) << " Found " << trackerTracks.size() << " matching tracker tracks within region of interest";
112 
113  if ( trackerTracks.empty() ) {
114  if ( staCandIn.first == 0) delete staCand.first;
115 
116  return CandidateContainer();
117  }
118 
119  // build a combined tracker-muon MuonCandidate
120  //
121  // turn tkMatchedTracks into MuonCandidates
122  //
123  LogTrace(category) << " Turn tkMatchedTracks into MuonCandidates";
124  CandidateContainer tkTrajs;
125  for (vector<TrackCand>::const_iterator tkt = trackerTracks.begin(); tkt != trackerTracks.end(); tkt++) {
126 
127  MuonCandidate* muonCand = new MuonCandidate( 0 ,staCand.second,(*tkt).second, 0);
128  tkTrajs.push_back(muonCand);
129  }
130 
131  if ( tkTrajs.empty() ) {
132  LogTrace(category) << " tkTrajs empty";
133  if ( staCandIn.first == 0) delete staCand.first;
134 
135  return CandidateContainer();
136  }
137 
138  CandidateContainer result = build(staCand, tkTrajs);
139  LogTrace(category) << " Found "<< result.size() << " GLBMuons from one STACand";
140 
141  // free memory
142  if ( staCandIn.first == 0) delete staCand.first;
143 
144  for( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); ++it) {
145  if ( (*it)->trajectory() ) delete (*it)->trajectory();
146  if ( (*it)->trackerTrajectory() ) delete (*it)->trackerTrajectory();
147  if ( *it ) delete (*it);
148  }
149  tkTrajs.clear();
150 
151 
152  return result;
153 
154 }
155 
156 //
157 // make a TrackCand collection using tracker Track, Trajectory information
158 //
159 vector<GlobalMuonTrajectoryBuilder::TrackCand> GlobalMuonTrajectoryBuilder::makeTkCandCollection(const TrackCand& staCand) {
160 
161  const std::string category = "Muon|RecoMuon|GlobalMuonTrajectoryBuilder|makeTkCandCollection";
162 
163  vector<TrackCand> tkCandColl;
164 
165  vector<TrackCand> tkTrackCands;
166 
167  for ( unsigned int position = 0; position != allTrackerTracks->size(); ++position ) {
169  TrackCand tkCand = TrackCand((Trajectory*)(0),tkTrackRef);
170  tkTrackCands.push_back(tkCand);
171  }
172 
173 
174  tkCandColl = chooseRegionalTrackerTracks(staCand,tkTrackCands);
175 
176  return tkCandColl;
177 
178 }
#define LogDebug(id)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< TrackCand > makeTkCandCollection(const TrackCand &)
make a TrackCand collection using tracker Track, Trajectory information
T getParameter(std::string const &) const
MuonCandidate::CandidateContainer CandidateContainer
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
GlobalMuonTrackMatcher * trackMatcher() const
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
std::pair< const Trajectory *, reco::TrackRef > TrackCand
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::vector< TrackCand > chooseRegionalTrackerTracks(const TrackCand &, const std::vector< TrackCand > &)
choose tracker tracks within region of interest
edm::EDGetTokenT< reco::TrackCollection > allTrackerTracksToken
MuonTrajectoryBuilder::CandidateContainer trajectories(const TrackCand &)
reconstruct trajectories from standalone and tracker only Tracks
tuple result
Definition: query.py:137
std::vector< MuonCandidate * > CandidateContainer
Definition: MuonCandidate.h:20
double match(const TrackCand &sta, const TrackCand &track, int matchOption=0, int surfaceOption=1) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#define LogTrace(id)
GlobalMuonTrajectoryBuilder(const edm::ParameterSet &, const MuonServiceProxy *, edm::ConsumesCollector &)
constructor with Parameter Set and MuonServiceProxy
edm::Handle< reco::TrackCollection > allTrackerTracks
MuonTrajectoryBuilder::CandidateContainer build(const TrackCand &, MuonTrajectoryBuilder::CandidateContainer &) const
build combined trajectory from sta Track and tracker RecHits
static int position[264][3]
Definition: ReadPGInfo.cc:509