93 |
|
// check reference muon |
94 |
|
// |
95 |
|
const reco::Muon * theMuon = theBestMuonFinder.result(ev,es); |
96 |
< |
if (!theMuon || !theBestMuonFinder.isUnique(ev,es) ) return; |
96 |
> |
if (theConfig.getParameter<bool>("onlyBestMuEvents") && (!theMuon || !theBestMuonFinder.isUnique(ev,es)) ) return; |
97 |
|
theCounter++; |
98 |
|
|
99 |
|
// |
127 |
|
// |
128 |
|
// fill muon info |
129 |
|
// |
130 |
< |
muon->setKine(theMuon->track()->pt(), theMuon->track()->eta(), theMuon->track()->phi(), theMuon->track()->charge()); |
131 |
< |
muon->setBits(theMuon->isGlobalMuon(), theMuon->isTrackerMuon(), theMuon->isStandAloneMuon(), theMuon->isCaloMuon(), theMuon->isMatchesValid()); |
132 |
< |
muon->nMatchedStations = theMuon->numberOfMatchedStations(); |
133 |
< |
if (theMuon->isGlobalMuon()) { |
134 |
< |
const reco::HitPattern& hp = (theMuon->combinedMuon())->hitPattern(); |
135 |
< |
muon->nRPCHits = hp.numberOfValidMuonRPCHits(); |
136 |
< |
muon->nDTHits = hp.numberOfValidMuonDTHits(); |
137 |
< |
muon->nCSCHits = hp.numberOfValidMuonCSCHits(); |
138 |
< |
} else muon->nRPCHits = muon->nDTHits = muon->nCSCHits = 0; |
139 |
< |
muon->nTrackerHits = theMuon->isTrackerMuon() ? (theMuon->innerTrack())->hitPattern().numberOfValidTrackerHits() : 0; |
130 |
> |
if (theMuon) { |
131 |
> |
muon->setKine(theMuon->track()->pt(), theMuon->track()->eta(), theMuon->track()->phi(), theMuon->track()->charge()); |
132 |
> |
muon->setBits(theMuon->isGlobalMuon(), theMuon->isTrackerMuon(), theMuon->isStandAloneMuon(), theMuon->isCaloMuon(), theMuon->isMatchesValid()); |
133 |
> |
muon->nMatchedStations = theMuon->numberOfMatchedStations(); |
134 |
> |
if (theMuon->isGlobalMuon()) { |
135 |
> |
const reco::HitPattern& hp = (theMuon->combinedMuon())->hitPattern(); |
136 |
> |
muon->nRPCHits = hp.numberOfValidMuonRPCHits(); |
137 |
> |
muon->nDTHits = hp.numberOfValidMuonDTHits(); |
138 |
> |
muon->nCSCHits = hp.numberOfValidMuonCSCHits(); |
139 |
> |
} else muon->nRPCHits = muon->nDTHits = muon->nCSCHits = 0; |
140 |
> |
muon->nTrackerHits = theMuon->isTrackerMuon() ? (theMuon->innerTrack())->hitPattern().numberOfValidTrackerHits() : 0; |
141 |
> |
} |
142 |
|
|
143 |
|
// |
144 |
|
// fill algoBits info |
156 |
|
// |
157 |
|
// hits and detectors compatible with muon track |
158 |
|
// |
159 |
< |
if ( muon->pt() > 10.) { |
159 |
> |
if (theMuon && muon->pt() > 10.) { |
160 |
|
detsHitsCompatibleWithMuon = theDetHitCollector.compatibleHits( theMuon, ev, es); |
161 |
|
detsCrossedByMuon = theDetHitCollector.compatibleDets( theMuon, ev, es, false); |
162 |
|
detsCrossedByMuonDeepInside = theDetHitCollector.compatibleDets( theMuon, ev, es, true); |
167 |
|
// |
168 |
|
// fill LinkSynchroAnalysis data |
169 |
|
// |
170 |
< |
theSynchroGrabber.setMuon(theMuon); |
171 |
< |
RPCRawSynchro::ProdItem rawCounts = theSynchroGrabber.counts(ev,es); |
172 |
< |
counts = ConverterRPCRawSynchroSynchroCountsObj::toSynchroObj(rawCounts); |
170 |
> |
if (theMuon) { |
171 |
> |
theSynchroGrabber.setMuon(theMuon); |
172 |
> |
RPCRawSynchro::ProdItem rawCounts = theSynchroGrabber.counts(ev,es); |
173 |
> |
counts = ConverterRPCRawSynchroSynchroCountsObj::toSynchroObj(rawCounts); |
174 |
> |
} |
175 |
|
|
176 |
|
|
177 |
|
// |
182 |
|
std::vector<bool> matching(l1Obj.size(), false); |
183 |
|
std::vector<double> deltaR(l1Obj.size(), 0.); |
184 |
|
TrackToL1ObjMatcher matcher(theConfig.getParameter<edm::ParameterSet>("matcherPSet")); |
185 |
< |
for(unsigned int i=0; i< l1Obj.size(); ++i) { |
186 |
< |
if (matcher(l1Obj[i].eta, l1Obj[i].phi, theMuon, ev,es)) matching[i]=true; |
187 |
< |
TrackToL1ObjMatcher::LastResult result = matcher.lastResult(); |
188 |
< |
deltaR[i] = sqrt( sqr(result.deltaEta) + sqr(result.deltaPhi) ); |
185 |
> |
if (theMuon){ |
186 |
> |
for(unsigned int i=0; i< l1Obj.size(); ++i) { |
187 |
> |
if (matcher(l1Obj[i].eta, l1Obj[i].phi, theMuon, ev,es)) matching[i]=true; |
188 |
> |
TrackToL1ObjMatcher::LastResult result = matcher.lastResult(); |
189 |
> |
deltaR[i] = sqrt( sqr(result.deltaEta) + sqr(result.deltaPhi) ); |
190 |
> |
} |
191 |
|
} |
192 |
|
l1ObjColl->set( matching ); |
193 |
|
l1ObjColl->set( deltaR ); |