130 std::vector<muonMomentumType> selMuonMomenta;
132 if (
verbosity_ )
std::cout <<
" muPlus: Pt = " << muPlus->
pt() <<
", eta = " << muPlus->
eta() <<
", phi = " << muPlus->
phi() << std::endl;
136 if (
verbosity_ )
std::cout <<
" muMinus: Pt = " << muMinus->
pt() <<
", eta = " << muMinus->
eta() <<
", phi = " << muMinus->
phi() << std::endl;
141 for (
typename std::vector<todoListEntryType>::const_iterator todoItem =
todoList_.begin();
142 todoItem !=
todoList_.end(); ++todoItem ) {
143 if (
verbosity_ )
std::cout <<
"processing trackCollection = " << todoItem->srcTracks_ << std::endl;
145 todoItem->trackRefMap_.clear();
153 size_t idxTrack_cleaned = 0;
155 std::vector<muonToTrackMatchInfoType> selMuonToTrackMatches;
156 for ( std::vector<muonMomentumType>::const_iterator selMuonMomentum = selMuonMomenta.begin();
157 selMuonMomentum != selMuonMomenta.end(); ++selMuonMomentum ) {
158 std::vector<muonToTrackMatchInfoType> tmpMatches;
159 for ( reco::TrackCollection::const_iterator track = tracks->begin();
160 track != tracks->end(); ++track ) {
161 double dR =
reco::deltaR(track->eta(), track->phi(), selMuonMomentum->eta_, selMuonMomentum->phi_);
162 if ( dR <
dRmatch_ ) tmpMatches.push_back(muonToTrackMatchInfoType(selMuonMomentum->pt_, &(*track), dR));
165 std::sort(tmpMatches.begin(), tmpMatches.end(), SortMuonToTrackMatchInfosDescendingMatchQuality());
166 if ( tmpMatches.size() > 0 ) selMuonToTrackMatches.push_back(tmpMatches.front());
170 for ( std::vector<muonToTrackMatchInfoType>::const_iterator tmpMatch = tmpMatches.begin();
171 tmpMatch != tmpMatches.end(); ++tmpMatch ) {
172 if ( (tmpMatch->dR_ < 1.e-3 && tmpMatch->trackPt_ > (0.33*tmpMatch->muonPt_)) ||
173 (tmpMatch->dR_ < 1.e-1 && tmpMatch->trackPt_ >
TMath::Max(0.66*tmpMatch->muonPt_, 10.)) ) selMuonToTrackMatches.push_back(*tmpMatch);
178 std::vector<reco::TrackRef> removedTracks;
179 size_t numTracks = tracks->size();
180 for (
size_t trackIdx = 0; trackIdx < numTracks; ++trackIdx ) {
183 for ( std::vector<muonToTrackMatchInfoType>::const_iterator muonMatchInfo = selMuonToTrackMatches.begin();
184 muonMatchInfo != selMuonToTrackMatches.end(); ++muonMatchInfo ) {
185 if ( muonMatchInfo->track_ == &(*track) ) isMuon =
true;
188 std::cout <<
"track: Pt = " << track->pt() <<
", eta = " << track->eta() <<
", phi = " << track->phi() <<
", isMuon = " << isMuon << std::endl;
191 removedTracks.push_back(track);
193 tracks_cleaned->push_back(*track);
194 todoItem->trackRefMap_[
reco::TrackRef(trackCollectionRefProd_cleaned, idxTrack_cleaned)] = track;
201 <<
" (" << runLumiEventNumbers_to_string(evt) <<
")" << std::endl
202 <<
" Removed " << removedTracks.size() <<
" tracks from event containing " << selMuons.size() <<
" muons !!" << std::endl;
203 if ( muPlus.
isNonnull() )
std::cout <<
" muPlus: Pt = " << muPlus->
pt() <<
", eta = " << muPlus->
eta() <<
", phi = " << muPlus->
phi() << std::endl;
204 if ( muMinus.
isNonnull() )
std::cout <<
" muMinus: Pt = " << muMinus->
pt() <<
", eta = " << muMinus->
eta() <<
", phi = " << muMinus->
phi() << std::endl;
205 std::cout <<
"Removed tracks:" << std::endl;
207 for ( std::vector<reco::TrackRef>::const_iterator removedTrack = removedTracks.begin();
208 removedTrack != removedTracks.end(); ++removedTrack ) {
210 <<
" Pt = " << (*removedTrack)->pt() <<
", eta = " << (*removedTrack)->eta() <<
", phi = " << (*removedTrack)->phi() << std::endl;
217 evt.
put(tracks_cleaned, todoItem->srcTracks_.instance());
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
bool isMuon(const Candidate &part)
virtual double pt() const =0
transverse momentum
std::vector< Track > TrackCollection
collection of Tracks
bool isNonnull() const
Checks for non-null.
double deltaR(const T1 &t1, const T2 &t2)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::InputTag srcSelectedMuons_
RefProd< PROD > getRefBeforePut()
muonMomentumType getMuonMomentum(const reco::Candidate &)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)
std::vector< todoListEntryType > todoList_
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity