49 DTSegmentTags_(matchParameters.getParameter<edm::InputTag>(
"DTsegments")),
50 CSCSegmentTags_(matchParameters.getParameter<edm::InputTag>(
"CSCsegments")),
51 dtRadius_(matchParameters.getParameter<double>(
"DTradius")),
52 dtTightMatch(matchParameters.getParameter<bool>(
"TightMatchDT")),
53 cscTightMatch(matchParameters.getParameter<bool>(
"TightMatchCSC"))
69 vector<const DTRecSegment4D*> pointerTo4DSegments;
73 bool segments =
false;
77 if ( !(*hit)->isValid())
continue;
78 if ( (*hit)->geographicalId().det() !=
DetId::Muon )
continue;
80 if (!(*hit)->isValid())
continue;
81 if ((*hit)->recHits().size()>1) segments =
true;
88 double matchRatioPhi=0;
92 if ( !rechit->isValid())
continue;
93 LocalPoint pointLocal = rechit->localPosition();
98 if ( !(*hit)->isValid())
continue;
101 DetId idT = (*hit)->geographicalId();
102 if(!(rechit->geographicalId().rawId()==idT.
rawId()))
continue;
105 LocalPoint segLocal = (*hit)->localPosition();
106 if ((fabs(pointLocal.
x()-segLocal.
x())<ZCutParameter) &&
107 (fabs(pointLocal.
y()-segLocal.
y())<ZCutParameter))
108 pointerTo4DSegments.push_back(&(*rechit));
116 if(rechit->hasZed()) {
117 double countMuonDTHits = 0;
118 double countAgreeingHits=0;
122 nhitsZ = segmZ->
recHits().size();
130 if ( !(*hit)->isValid())
continue;
132 DetId idT = (*hit)->geographicalId();
136 LocalPoint pointLocal = (*hit)->localPosition();
138 if ((chamberSegIdT==dtDetIdHitT) && (dtDetLayerIdHitT.superlayer()==2)) countMuonDTHits++;
140 for (vector<DTRecHit1D>::const_iterator hiti=hits1d.begin(); hiti!=hits1d.end(); hiti++) {
142 if ( !hiti->isValid())
continue;
145 if(!(hiti->geographicalId().rawId()==idT.
rawId()))
continue;
151 if ((fabs(pointLocal.x()-segLocal.
x())<ZCutParameter) &&
152 (fabs(pointLocal.y()-segLocal.
y())<ZCutParameter))
157 matchRatioZ = countMuonDTHits == 0 ? 0 : countAgreeingHits/countMuonDTHits;
159 if (countAgreeingHits/nhitsZ>matchRatioZ) matchRatioZ=countAgreeingHits/nhitsZ;
162 if(rechit->hasPhi()) {
163 double countMuonDTHits = 0;
164 double countAgreeingHits=0;
168 segmPhi =
dynamic_cast<const DTRecSegment2D*
>(rechit->phiSegment());
169 nhitsPhi = segmPhi->
recHits().size();
177 if ( !(*hit)->isValid())
continue;
179 DetId idT = (*hit)->geographicalId();
183 LocalPoint pointLocal = (*hit)->localPosition();
185 if ((chamberSegIdT==dtDetIdHitT)&&((dtDetLayerIdHitT.superlayer()==1)||(dtDetLayerIdHitT.superlayer()==3)))
188 for (vector<DTRecHit1D>::const_iterator hiti=hits1d.begin(); hiti!=hits1d.end(); hiti++) {
190 if ( !hiti->isValid())
continue;
193 if(!(hiti->geographicalId().rawId()==idT.
rawId()))
continue;
200 if ((fabs(pointLocal.x()-segLocal.
x())<PhiCutParameter) &&
201 (fabs(pointLocal.y()-segLocal.
y())<PhiCutParameter))
206 matchRatioPhi = countMuonDTHits != 0 ? countAgreeingHits/countMuonDTHits : 0;
208 if (countAgreeingHits/nhitsPhi>matchRatioPhi) matchRatioPhi=countAgreeingHits/nhitsPhi;
212 if((matchRatioPhi>0.9)&&(matchRatioZ>0.9)) {
214 pointerTo4DSegments.push_back(&(*rechit));
217 if((matchRatioPhi>0.9 && nhitsPhi)||(matchRatioZ>0.9 && nhitsZ)) {
219 pointerTo4DSegments.push_back(&(*rechit));
225 return pointerTo4DSegments;
238 vector<const CSCSegment*> pointerToCSCSegments;
240 double matchRatioCSC=0;
242 double CSCXCut = 0.001;
243 double CSCYCut = 0.001;
244 double countMuonCSCHits = 0;
247 double CSCcountAgreeingHits=0;
249 if ( !segmentCSC->isValid())
continue;
252 const vector<CSCRecHit2D>& CSCRechits2D = segmentCSC->specificRecHits();
253 countMuonCSCHits = 0;
254 CSCDetId myChamber((*segmentCSC).geographicalId().rawId());
256 bool segments =
false;
259 if (!(*hitC)->isValid())
continue;
260 if ( (*hitC)->geographicalId().det() !=
DetId::Muon )
continue;
262 if (!(*hitC)->isValid())
continue;
263 if ( (*hitC)->recHits().size()>1) segments =
true;
266 DetId id = (*hitC)->geographicalId();
270 if(!(myChamber.rawId()==cscDetIdHit.
rawId()))
continue;
273 LocalPoint positionLocalCSC = (*hitC)->localPosition();
274 LocalPoint segLocalCSC = segmentCSC->localPosition();
275 if ((fabs(positionLocalCSC.
x()-segLocalCSC.
x())<CSCXCut) &&
276 (fabs(positionLocalCSC.
y()-segLocalCSC.
y())<CSCYCut))
277 pointerToCSCSegments.push_back(&(*segmentCSC));
281 if(!(cscDetIdHit.
ring()==myChamber.ring()))
continue;
282 if(!(cscDetIdHit.
station()==myChamber.station()))
continue;
283 if(!(cscDetIdHit.
endcap()==myChamber.endcap()))
continue;
284 if(!(cscDetIdHit.
chamber()==myChamber.chamber()))
continue;
288 LocalPoint positionLocalCSC = (*hitC)->localPosition();
290 for (vector<CSCRecHit2D>::const_iterator hiti=CSCRechits2D.begin(); hiti!=CSCRechits2D.end(); hiti++) {
292 if ( !hiti->isValid())
continue;
293 CSCDetId cscDetId((hiti->geographicalId()).rawId());
295 if ((*hitC)->geographicalId().rawId()!=(hiti->geographicalId()).rawId())
continue;
297 LocalPoint segLocalCSC = hiti->localPosition();
300 if((fabs(positionLocalCSC.
x()-segLocalCSC.
x())<CSCXCut) &&
301 (fabs(positionLocalCSC.
y()-segLocalCSC.
y())<CSCYCut)) {
302 CSCcountAgreeingHits++;
308 matchRatioCSC = countMuonCSCHits == 0 ? 0 : CSCcountAgreeingHits/countMuonCSCHits;
310 if ((matchRatioCSC>0.9) && ((countMuonCSCHits>1) || !
cscTightMatch)) pointerToCSCSegments.push_back(&(*segmentCSC));
314 return pointerToCSCSegments;
std::vector< const CSCSegment * > matchCSC(const reco::Track &muon, const edm::Event &event)
MuonSegmentMatcher(const edm::ParameterSet &, MuonServiceProxy *)
constructor with Parameter Set and MuonServiceProxy
const MuonServiceProxy * theService
uint32_t rawId() const
get the raw id
C::const_iterator const_iterator
constant access iterator type
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
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
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.