#include <RecoMuon/GlobalTrackFinder/interface/GlobalMuonTrajectoryBuilder.h>
Public Member Functions | |
GlobalMuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *) | |
constructor with Parameter Set and MuonServiceProxy | |
virtual void | setEvent (const edm::Event &) |
pass the Event to the algo at each event | |
MuonTrajectoryBuilder::CandidateContainer | trajectories (const TrackCand &) |
reconstruct trajectories from standalone and tracker only Tracks | |
~GlobalMuonTrajectoryBuilder () | |
destructor | |
Private Member Functions | |
std::vector< TrackCand > | makeTkCandCollection (const TrackCand &) |
make a TrackCand collection using tracker Track, Trajectory information | |
Private Attributes | |
edm::Handle < reco::TrackCollection > | allTrackerTracks |
const std::vector< Trajectory > * | allTrackerTrajs |
bool | theFirstEvent |
edm::InputTag | theTkTrackLabel |
bool | theTkTrajsAvailableFlag |
edm::Handle < TrajTrackAssociationCollection > | tkAssoMap |
Definition at line 24 of file GlobalMuonTrajectoryBuilder.h.
GlobalMuonTrajectoryBuilder::GlobalMuonTrajectoryBuilder | ( | const edm::ParameterSet & | par, | |
const MuonServiceProxy * | service | |||
) |
constructor with Parameter Set and MuonServiceProxy
Definition at line 60 of file GlobalMuonTrajectoryBuilder.cc.
References edm::ParameterSet::getParameter(), theFirstEvent, and theTkTrackLabel.
00061 : GlobalTrajectoryBuilderBase(par, service), 00062 theTkTrajsAvailableFlag(false) 00063 { 00064 00065 theFirstEvent = true; 00066 theTkTrackLabel = par.getParameter<edm::InputTag>("TrackerCollectionLabel"); 00067 }
GlobalMuonTrajectoryBuilder::~GlobalMuonTrajectoryBuilder | ( | ) |
vector< GlobalMuonTrajectoryBuilder::TrackCand > GlobalMuonTrajectoryBuilder::makeTkCandCollection | ( | const TrackCand & | staCand | ) | [private, virtual] |
make a TrackCand collection using tracker Track, Trajectory information
Implements GlobalTrajectoryBuilderBase.
Definition at line 185 of file GlobalMuonTrajectoryBuilder.cc.
References allTrackerTracks, category, GlobalTrajectoryBuilderBase::chooseRegionalTrackerTracks(), it, theTkTrajsAvailableFlag, and tkAssoMap.
Referenced by trajectories().
00185 { 00186 00187 const std::string category = "Muon|RecoMuon|GlobalMuonTrajectoryBuilder|makeTkCandCollection"; 00188 00189 vector<TrackCand> tkCandColl; 00190 00191 vector<TrackCand> tkTrackCands; 00192 00193 if ( theTkTrajsAvailableFlag ) { 00194 for(TrajTrackAssociationCollection::const_iterator it = tkAssoMap->begin(); it != tkAssoMap->end(); ++it){ 00195 const Ref<vector<Trajectory> > traj = it->key; 00196 const reco::TrackRef tk = it->val; 00197 TrackCand tkCand = TrackCand(0,tk); 00198 if( traj->isValid() ) tkCand.first = &*traj ; 00199 tkTrackCands.push_back(tkCand); 00200 } 00201 } else { 00202 for ( unsigned int position = 0; position != allTrackerTracks->size(); ++position ) { 00203 reco::TrackRef tkTrackRef(allTrackerTracks,position); 00204 TrackCand tkCand = TrackCand(0,tkTrackRef); 00205 tkTrackCands.push_back(tkCand); 00206 } 00207 } 00208 00209 tkCandColl = chooseRegionalTrackerTracks(staCand,tkTrackCands); 00210 00211 return tkCandColl; 00212 00213 }
void GlobalMuonTrajectoryBuilder::setEvent | ( | const edm::Event & | event | ) | [virtual] |
pass the Event to the algo at each event
Reimplemented from GlobalTrajectoryBuilderBase.
Definition at line 80 of file GlobalMuonTrajectoryBuilder.cc.
References allTrackerTracks, allTrackerTrajs, category, edm::Event::getByLabel(), GlobalTrajectoryBuilderBase::setEvent(), theFirstEvent, theTkTrackLabel, theTkTrajsAvailableFlag, and tkAssoMap.
00080 { 00081 00082 const std::string category = "Muon|RecoMuon|GlobalMuonTrajectoryBuilder|setEvent"; 00083 00084 GlobalTrajectoryBuilderBase::setEvent(event); 00085 00086 // get tracker TrackCollection from Event 00087 edm::Handle<std::vector<Trajectory> > handleTrackerTrajs; 00088 event.getByLabel(theTkTrackLabel,allTrackerTracks); 00089 LogInfo(category) 00090 << "Found " << allTrackerTracks->size() 00091 << " tracker Tracks with label "<< theTkTrackLabel; 00092 if (event.getByLabel(theTkTrackLabel,handleTrackerTrajs) && event.getByLabel(theTkTrackLabel,tkAssoMap)) { 00093 theTkTrajsAvailableFlag = true; 00094 allTrackerTrajs = &*handleTrackerTrajs; 00095 00096 if ( theFirstEvent ) { 00097 LogInfo(category) << "Tk Trajectories Found! "; 00098 theFirstEvent = false; 00099 } 00100 } 00101 00102 }
MuonCandidate::CandidateContainer GlobalMuonTrajectoryBuilder::trajectories | ( | const TrackCand & | staCandIn | ) |
reconstruct trajectories from standalone and tracker only Tracks
Definition at line 107 of file GlobalMuonTrajectoryBuilder.cc.
References GlobalTrajectoryBuilderBase::addTraj(), GlobalTrajectoryBuilderBase::build(), category, it, LogTrace, makeTkCandCollection(), GlobalMuonTrackMatcher::match(), HLT_VtxMuL3::result, edm::second(), GlobalTrajectoryBuilderBase::thePtCut, theTkTrajsAvailableFlag, and GlobalTrajectoryBuilderBase::trackMatcher().
00107 { 00108 00109 const std::string category = "Muon|RecoMuon|GlobalMuonTrajectoryBuilder|trajectories"; 00110 00111 // cut on muons with low momenta 00112 if ( (staCandIn).second->pt() < thePtCut || (staCandIn).second->innerMomentum().Rho() < thePtCut || (staCandIn).second->innerMomentum().R() < 2.5 ) return CandidateContainer(); 00113 00114 // convert the STA track into a Trajectory if Trajectory not already present 00115 TrackCand staCand(staCandIn); 00116 addTraj(staCand); 00117 00118 vector<TrackCand> regionalTkTracks = makeTkCandCollection(staCand); 00119 LogInfo(category) << "Found " << regionalTkTracks.size() << " tracks within region of interest"; 00120 00121 // match tracker tracks to muon track 00122 vector<TrackCand> trackerTracks = trackMatcher()->match(staCand, regionalTkTracks); 00123 LogInfo(category) << "Found " << trackerTracks.size() << " matching tracker tracks within region of interest"; 00124 if ( trackerTracks.empty() ) { 00125 if ( staCandIn.first == 0) delete staCand.first; 00126 if ( !theTkTrajsAvailableFlag ) { 00127 for ( vector<TrackCand>::const_iterator is = regionalTkTracks.begin(); is != regionalTkTracks.end(); ++is) { 00128 delete (*is).first; 00129 } 00130 } 00131 return CandidateContainer(); 00132 } 00133 00134 // build a combined tracker-muon MuonCandidate 00135 // 00136 // turn tkMatchedTracks into MuonCandidates 00137 // 00138 LogInfo(category) << "turn tkMatchedTracks into MuonCandidates"; 00139 CandidateContainer tkTrajs; 00140 for (vector<TrackCand>::const_iterator tkt = trackerTracks.begin(); tkt != trackerTracks.end(); tkt++) { 00141 if ((*tkt).first != 0 && (*tkt).first->isValid()) { 00142 MuonCandidate* muonCand = new MuonCandidate( 0 ,staCand.second,(*tkt).second, new Trajectory(*(*tkt).first)); 00143 tkTrajs.push_back(muonCand); 00144 LogTrace(category) << "tpush"; 00145 } 00146 } 00147 00148 if ( tkTrajs.empty() ) { 00149 LogTrace(category) << "tkTrajs empty"; 00150 if ( staCandIn.first == 0) delete staCand.first; 00151 if ( !theTkTrajsAvailableFlag ) { 00152 for ( vector<TrackCand>::const_iterator is = regionalTkTracks.begin(); is != regionalTkTracks.end(); ++is) { 00153 delete (*is).first; 00154 } 00155 } 00156 return CandidateContainer(); 00157 } 00158 00159 CandidateContainer result = build(staCand, tkTrajs); 00160 LogInfo(category) << "Found "<< result.size() << " GLBMuons from one STACand"; 00161 00162 // free memory 00163 if ( staCandIn.first == 0) delete staCand.first; 00164 if ( !theTkTrajsAvailableFlag ) { 00165 for ( vector<TrackCand>::const_iterator is = regionalTkTracks.begin(); is != regionalTkTracks.end(); ++is) { 00166 delete (*is).first; 00167 } 00168 } 00169 00170 for( CandidateContainer::const_iterator it = tkTrajs.begin(); it != tkTrajs.end(); ++it) { 00171 if ( (*it)->trajectory() ) delete (*it)->trajectory(); 00172 if ( (*it)->trackerTrajectory() ) delete (*it)->trackerTrajectory(); 00173 if ( *it ) delete (*it); 00174 } 00175 tkTrajs.clear(); 00176 00177 00178 return result; 00179 00180 }
Definition at line 51 of file GlobalMuonTrajectoryBuilder.h.
Referenced by makeTkCandCollection(), and setEvent().
const std::vector<Trajectory>* GlobalMuonTrajectoryBuilder::allTrackerTrajs [private] |
Definition at line 49 of file GlobalMuonTrajectoryBuilder.h.
Referenced by GlobalMuonTrajectoryBuilder(), and setEvent().
Definition at line 47 of file GlobalMuonTrajectoryBuilder.h.
Referenced by GlobalMuonTrajectoryBuilder(), and setEvent().
Reimplemented from GlobalTrajectoryBuilderBase.
Definition at line 48 of file GlobalMuonTrajectoryBuilder.h.
Referenced by makeTkCandCollection(), setEvent(), and trajectories().
Definition at line 52 of file GlobalMuonTrajectoryBuilder.h.
Referenced by makeTkCandCollection(), and setEvent().