53 srcGlobalMuons_cleaned_(cfg.getParameter<edm::InputTag>(
"srcGlobalMuons_cleaned"))
55 for (
typename std::vector<todoListEntryType>::const_iterator todoItem =
todoList_.begin();
56 todoItem !=
todoList_.end(); ++todoItem ) {
57 produces<TrackToTrackMap>(todoItem->srcTrackCollection1_.instance());
65 for (
typename TrackToTrackMap::const_iterator entry = trackToTrackMap.begin();
66 entry != trackToTrackMap.end(); ++entry ) {
68 double dR =
reco::deltaR(globalMuonTrack_uncleaned->eta(), globalMuonTrack_uncleaned->phi(), globalMuonTrack_cleaned->eta(), globalMuonTrack_cleaned->phi());
70 std::cout <<
"globalMuon(uncleaned = " << globalMuonTrack_uncleaned.
id() <<
":" << globalMuonTrack_uncleaned.
key() <<
"):"
71 <<
" Pt = " << globalMuonTrack_uncleaned->pt() <<
", eta = " << globalMuonTrack_uncleaned->eta() <<
", phi = " << globalMuonTrack_uncleaned->phi() <<
","
72 <<
" dR = " << dR << std::endl;
74 if ( dR < 1.
e-2 && dR < dRmatch ) {
76 tevMuonTrack_matched = entry->val;
90 for (
typename std::vector<todoListEntryType>::const_iterator todoItem =
todoList_.begin();
91 todoItem !=
todoList_.end(); ++todoItem ) {
93 evt.
getByLabel(todoItem->srcTrackCollection1_, trackCollection1);
95 evt.
getByLabel(todoItem->srcTrackCollection1_, trackToTrackMap1);
98 evt.
getByLabel(todoItem->srcTrackCollection2_, trackCollection2);
100 evt.
getByLabel(todoItem->srcTrackCollection2_, trackToTrackMap2);
103 std::cout <<
"input1 (" << todoItem->srcTrackCollection1_.label() <<
":" << todoItem->srcTrackCollection1_.instance() <<
":" << todoItem->srcTrackCollection1_.process() <<
"):" << std::endl;
104 std::cout <<
" trackCollection(productId = " << trackCollection1.
id() <<
"): #entries = " << trackCollection1->size() << std::endl;
105 std::cout <<
" trackToTrackMap(productId = " << trackToTrackMap1.
id() <<
"): #entries = " << trackToTrackMap1->size() << std::endl;
106 for (
typename TrackToTrackMap::const_iterator entry = trackToTrackMap1->begin();
107 entry != trackToTrackMap1->end(); ++entry ) {
108 std::cout <<
" trackToTrackMap[" << entry->key.id() <<
":" << entry->key.key() <<
"] = " << entry->val.id() <<
":" << entry->val.key() << std::endl;
110 std::cout <<
"input2 (" << todoItem->srcTrackCollection2_.label() <<
":" << todoItem->srcTrackCollection2_.instance() <<
":" << todoItem->srcTrackCollection2_.process() <<
"):" << std::endl;
111 std::cout <<
" trackCollection(productId = " << trackCollection2.
id() <<
"): #entries = " << trackCollection2->size() << std::endl;
112 std::cout <<
" trackToTrackMap(productId = " << trackToTrackMap2.
id() <<
"): #entries = " << trackToTrackMap2->size() << std::endl;
113 for (
typename TrackToTrackMap::const_iterator entry = trackToTrackMap2->begin();
114 entry != trackToTrackMap2->end(); ++entry ) {
115 std::cout <<
" trackToTrackMap[" << entry->key.id() <<
":" << entry->key.key() <<
"] = " << entry->val.id() <<
":" << entry->val.key() << std::endl;
119 std::auto_ptr<TrackToTrackMap> trackToTrackMap_output(
new TrackToTrackMap());
121 size_t numGlobalMuons_cleaned = globalMuons_cleaned->size();
122 for (
size_t iGlobalMuons_cleaned = 0; iGlobalMuons_cleaned < numGlobalMuons_cleaned; ++iGlobalMuons_cleaned ) {
123 reco::TrackRef globalMuonTrack_cleaned(globalMuons_cleaned, iGlobalMuons_cleaned);
125 std::cout <<
" globalMuon(cleaned = " << globalMuonTrack_cleaned.
id() <<
":" << globalMuonTrack_cleaned.
key() <<
"):"
126 <<
" Pt = " << globalMuonTrack_cleaned->pt() <<
", eta = " << globalMuonTrack_cleaned->eta() <<
", phi = " << globalMuonTrack_cleaned->phi() << std::endl;
128 bool isMatched =
false;
130 double dRmatch = 1.e+3;
131 matchMuonTracks(globalMuonTrack_cleaned, *trackToTrackMap1, isMatched, tevMuonTrack_matched, dRmatch,
verbosity_);
132 matchMuonTracks(globalMuonTrack_cleaned, *trackToTrackMap2, isMatched, tevMuonTrack_matched, dRmatch,
verbosity_);
135 std::cout <<
"--> adding trackToTrackMap[" << globalMuonTrack_cleaned.
id() <<
":" << globalMuonTrack_cleaned.
key() <<
"]"
136 <<
" = " << tevMuonTrack_matched.
id() <<
":" << tevMuonTrack_matched.
key() << std::endl;
138 trackToTrackMap_output->insert(globalMuonTrack_cleaned, tevMuonTrack_matched);
141 <<
"Failed to find Track association for " << globalMuonTrack_cleaned.
id() <<
":" << globalMuonTrack_cleaned.
key() <<
"!!\n";
145 evt.
put(trackToTrackMap_output, todoItem->srcTrackCollection1_.instance());
std::vector< todoListEntryType > todoList_
#define DEFINE_FWK_MODULE(type)
edm::InputTag srcGlobalMuons_cleaned_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
bool isMatched(TrackingRecHit const &hit)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TeVMuonTrackMixer(const edm::ParameterSet &)
edm::AssociationMap< edm::OneToOne< reco::TrackCollection, reco::TrackCollection > > TrackToTrackMap
key_type key() const
Accessor for product key.
virtual void produceTrackExtras(edm::Event &, const edm::EventSetup &)
ProductID id() const
Accessor for product ID.