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;
120 if(trackToTrackMap1->empty()) refProd = trackToTrackMap2->refProd().val;
121 std::auto_ptr<TrackToTrackMap> trackToTrackMap_output(
new TrackToTrackMap(globalMuons_cleaned, refProd));
123 size_t numGlobalMuons_cleaned = globalMuons_cleaned->size();
124 for (
size_t iGlobalMuons_cleaned = 0; iGlobalMuons_cleaned < numGlobalMuons_cleaned; ++iGlobalMuons_cleaned ) {
125 reco::TrackRef globalMuonTrack_cleaned(globalMuons_cleaned, iGlobalMuons_cleaned);
127 std::cout <<
" globalMuon(cleaned = " << globalMuonTrack_cleaned.
id() <<
":" << globalMuonTrack_cleaned.
key() <<
"):"
128 <<
" Pt = " << globalMuonTrack_cleaned->pt() <<
", eta = " << globalMuonTrack_cleaned->eta() <<
", phi = " << globalMuonTrack_cleaned->phi() << std::endl;
130 bool isMatched =
false;
132 double dRmatch = 1.e+3;
133 matchMuonTracks(globalMuonTrack_cleaned, *trackToTrackMap1, isMatched, tevMuonTrack_matched, dRmatch,
verbosity_);
134 matchMuonTracks(globalMuonTrack_cleaned, *trackToTrackMap2, isMatched, tevMuonTrack_matched, dRmatch,
verbosity_);
137 std::cout <<
"--> adding trackToTrackMap[" << globalMuonTrack_cleaned.
id() <<
":" << globalMuonTrack_cleaned.
key() <<
"]"
138 <<
" = " << tevMuonTrack_matched.
id() <<
":" << tevMuonTrack_matched.
key() << std::endl;
140 trackToTrackMap_output->insert(globalMuonTrack_cleaned, tevMuonTrack_matched);
143 <<
"Failed to find Track association for " << globalMuonTrack_cleaned.
id() <<
":" << globalMuonTrack_cleaned.
key() <<
"!!\n";
147 evt.
put(trackToTrackMap_output, todoItem->srcTrackCollection1_.instance());
std::vector< todoListEntryType > todoList_
#define DEFINE_FWK_MODULE(type)
edm::InputTag srcGlobalMuons_cleaned_
double deltaR(const T1 &t1, const T2 &t2)
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool isMatched(TrackingRecHit const &hit)
edm::AssociationMap< edm::OneToOne< reco::TrackCollection, reco::TrackCollection > > TrackToTrackMap
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
TeVMuonTrackMixer(const edm::ParameterSet &)
virtual void produceTrackExtras(edm::Event &, const edm::EventSetup &)