48 DTSegmentTags_(matchParameters.getParameter<edm::InputTag>(
"DTsegments")),
49 CSCSegmentTags_(matchParameters.getParameter<edm::InputTag>(
"CSCsegments")),
50 dtRadius_(matchParameters.getParameter<double>(
"DTradius")),
51 dtTightMatch(matchParameters.getParameter<bool>(
"TightMatchDT")),
52 cscTightMatch(matchParameters.getParameter<bool>(
"TightMatchCSC"))
71 vector<const DTRecSegment4D*> pointerTo4DSegments;
75 bool segments =
false;
79 if (!(*hit)->isValid())
continue;
80 if ( (*hit)->geographicalId().det() !=
DetId::Muon )
continue;
82 if ((*hit)->recHits().size())
83 if ((*(*hit)->recHits().begin())->recHits().size()>1) segments =
true;
92 double matchRatioPhi=0;
96 LocalPoint pointLocal = rechit->localPosition();
103 DetId idT = (*hit)->geographicalId();
104 if(!(rechit->geographicalId().rawId()==idT.
rawId()))
continue;
107 LocalPoint segLocal = (*hit)->localPosition();
108 if ((fabs(pointLocal.
x()-segLocal.
x())<ZCutParameter) &&
109 (fabs(pointLocal.
y()-segLocal.
y())<ZCutParameter))
110 pointerTo4DSegments.push_back(&(*rechit));
118 if(rechit->hasZed()) {
119 double countMuonDTHits = 0;
120 double countAgreeingHits=0;
124 nhitsZ = segmZ->
recHits().size();
132 if ( !(*hit)->isValid())
continue;
134 DetId idT = (*hit)->geographicalId();
138 LocalPoint pointLocal = (*hit)->localPosition();
140 if ((chamberSegIdT==dtDetIdHitT) && (dtDetLayerIdHitT.superlayer()==2)) countMuonDTHits++;
142 for (vector<DTRecHit1D>::const_iterator hiti=hits1d.begin(); hiti!=hits1d.end(); hiti++) {
144 if ( !hiti->isValid())
continue;
147 if(!(hiti->geographicalId().rawId()==idT.
rawId()))
continue;
153 if ((fabs(pointLocal.x()-segLocal.
x())<ZCutParameter) &&
154 (fabs(pointLocal.y()-segLocal.
y())<ZCutParameter))
159 matchRatioZ = countMuonDTHits == 0 ? 0 : countAgreeingHits/countMuonDTHits;
161 if (countAgreeingHits/nhitsZ>matchRatioZ) matchRatioZ=countAgreeingHits/nhitsZ;
164 if(rechit->hasPhi()) {
165 double countMuonDTHits = 0;
166 double countAgreeingHits=0;
170 segmPhi =
dynamic_cast<const DTRecSegment2D*
>(rechit->phiSegment());
171 nhitsPhi = segmPhi->
recHits().size();
179 if ( !(*hit)->isValid())
continue;
181 DetId idT = (*hit)->geographicalId();
185 LocalPoint pointLocal = (*hit)->localPosition();
187 if ((chamberSegIdT==dtDetIdHitT)&&((dtDetLayerIdHitT.superlayer()==1)||(dtDetLayerIdHitT.superlayer()==3)))
190 for (vector<DTRecHit1D>::const_iterator hiti=hits1d.begin(); hiti!=hits1d.end(); hiti++) {
192 if ( !hiti->isValid())
continue;
195 if(!(hiti->geographicalId().rawId()==idT.
rawId()))
continue;
202 if ((fabs(pointLocal.x()-segLocal.
x())<PhiCutParameter) &&
203 (fabs(pointLocal.y()-segLocal.
y())<PhiCutParameter))
208 matchRatioPhi = countMuonDTHits != 0 ? countAgreeingHits/countMuonDTHits : 0;
210 if (countAgreeingHits/nhitsPhi>matchRatioPhi) matchRatioPhi=countAgreeingHits/nhitsPhi;
214 if((matchRatioPhi>0.9)&&(matchRatioZ>0.9)) {
216 pointerTo4DSegments.push_back(&(*rechit));
219 if((matchRatioPhi>0.9 && nhitsPhi)||(matchRatioZ>0.9 && nhitsZ)) {
221 pointerTo4DSegments.push_back(&(*rechit));
227 return pointerTo4DSegments;
240 vector<const CSCSegment*> pointerToCSCSegments;
242 double matchRatioCSC=0;
244 double CSCXCut = 0.001;
245 double CSCYCut = 0.001;
246 double countMuonCSCHits = 0;
249 double CSCcountAgreeingHits=0;
251 if ( !segmentCSC->isValid())
continue;
254 const vector<CSCRecHit2D>& CSCRechits2D = segmentCSC->specificRecHits();
255 countMuonCSCHits = 0;
256 CSCDetId myChamber((*segmentCSC).geographicalId().rawId());
258 bool segments =
false;
261 if (!(*hitC)->isValid())
continue;
262 if ( (*hitC)->geographicalId().det() !=
DetId::Muon )
continue;
264 if (!(*hitC)->isValid())
continue;
265 if ( (*hitC)->recHits().size()>1) segments =
true;
268 DetId id = (*hitC)->geographicalId();
272 if(!(myChamber.rawId()==cscDetIdHit.
rawId()))
continue;
275 LocalPoint positionLocalCSC = (*hitC)->localPosition();
276 LocalPoint segLocalCSC = segmentCSC->localPosition();
277 if ((fabs(positionLocalCSC.
x()-segLocalCSC.
x())<CSCXCut) &&
278 (fabs(positionLocalCSC.
y()-segLocalCSC.
y())<CSCYCut))
279 pointerToCSCSegments.push_back(&(*segmentCSC));
283 if(!(cscDetIdHit.
ring()==myChamber.ring()))
continue;
284 if(!(cscDetIdHit.
station()==myChamber.station()))
continue;
285 if(!(cscDetIdHit.
endcap()==myChamber.endcap()))
continue;
286 if(!(cscDetIdHit.
chamber()==myChamber.chamber()))
continue;
290 LocalPoint positionLocalCSC = (*hitC)->localPosition();
292 for (vector<CSCRecHit2D>::const_iterator hiti=CSCRechits2D.begin(); hiti!=CSCRechits2D.end(); hiti++) {
294 if ( !hiti->isValid())
continue;
295 CSCDetId cscDetId((hiti->geographicalId()).rawId());
297 if ((*hitC)->geographicalId().rawId()!=(hiti->geographicalId()).rawId())
continue;
299 LocalPoint segLocalCSC = hiti->localPosition();
302 if((fabs(positionLocalCSC.
x()-segLocalCSC.
x())<CSCXCut) &&
303 (fabs(positionLocalCSC.
y()-segLocalCSC.
y())<CSCYCut)) {
304 CSCcountAgreeingHits++;
310 matchRatioCSC = countMuonCSCHits == 0 ? 0 : CSCcountAgreeingHits/countMuonCSCHits;
312 if ((matchRatioCSC>0.9) && ((countMuonCSCHits>1) || !
cscTightMatch)) pointerToCSCSegments.push_back(&(*segmentCSC));
316 return pointerToCSCSegments;
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< const CSCSegment * > matchCSC(const reco::Track &muon, const edm::Event &event)
const MuonServiceProxy * theService
uint32_t rawId() const
get the raw id
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
edm::EDGetTokenT< CSCSegmentCollection > allSegmentsCSCToken
MuonSegmentMatcher(const edm::ParameterSet &, MuonServiceProxy *, edm::ConsumesCollector &iC)
constructor with Parameter Set and MuonServiceProxy
edm::InputTag DTSegmentTags_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
edm::InputTag CSCSegmentTags_
virtual ~MuonSegmentMatcher()
destructor
edm::EDGetTokenT< DTRecSegment4DCollection > dtRecHitsToken
std::vector< const DTRecSegment4D * > matchDT(const reco::Track &muon, const edm::Event &event)
perform the matching
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
DetId geographicalId() const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.