Get the analysis.
81 if(!(*recHit)->isValid())
continue;
87 DetId idRivHit = (*recHit)->geographicalId();
94 LocalPoint posTrackRecHit = (*recHit)->localPosition();
102 range = dtSegments->get(chamberId);
105 for (segment = range.first; segment!=range.second; segment++){
107 DetId id = segment->geographicalId();
109 vector<const TrackingRecHit*> segments2D = (&(*segment))->recHits();
111 vector <const TrackingRecHit*> dtRecHits;
113 for(vector<const TrackingRecHit*>::const_iterator segm2D = segments2D.begin();
114 segm2D != segments2D.end();
117 vector <const TrackingRecHit*> rHits1D = (*segm2D)->recHits();
119 dtRecHits.push_back(rHits1D[
hit]);
125 for (
unsigned int hit = 0;
hit < dtRecHits.size();
hit++) {
127 DetId idRivHitSeg = (*dtRecHits[
hit]).geographicalId();
128 LocalPoint posDTSegment= segment->localPosition();
129 LocalPoint posSegDTRecHit = (*dtRecHits[
hit]).localPosition();
131 double rDT=
sqrt(
pow((posSegDTRecHit.
x()-posTrackRecHit.
x()),2) +
pow((posSegDTRecHit.
y()-posTrackRecHit.
y()),2) +
pow((posSegDTRecHit.
z()-posTrackRecHit.
z()),2));
133 if (idRivHit == idRivHitSeg && rDT<0.0001){
135 if (selectedDtSegments.empty()){
137 LogTrace(
metname) <<
"First selected segment (from DT). Position : "<<posDTSegment<<
" Chamber : "<<segment->chamberId();
141 for(
int segm=0; segm <
int(selectedDtSegments.size()); ++segm) {
142 double dist=
sqrt(
pow((((*(selectedDtSegments[segm])).localPosition()).
x()-posDTSegment.
x()),2) +
pow((((*(selectedDtSegments[segm])).localPosition()).
y()-posDTSegment.
y()),2) +
pow((((*(selectedDtSegments[segm])).localPosition()).
z()-posDTSegment.
z()),2));
146 if(check==
int(selectedDtSegments.size())){
148 LogTrace(
metname) <<
"New DT selected segment. Position : "<<posDTSegment<<
" Chamber : "<<segment->chamberId();
163 LocalPoint posTrackRecHit = (*recHit)->localPosition();
171 int ring = tempchamberId.ring();
172 int station = tempchamberId.station();
173 int endcap = tempchamberId.endcap();
174 int chamber = tempchamberId.chamber();
175 CSCDetId chamberId(endcap, station, ring, chamber, 0);
178 range = cscSegments->get(chamberId);
180 for(segment2 = range.first; segment2!=range.second; segment2++){
182 DetId id2 = segment2->geographicalId();
186 vector<const TrackingRecHit*> cscRecHits = (&(*segment2))->recHits();
189 for (
unsigned int hit = 0;
hit < cscRecHits.size();
hit++) {
191 DetId idRivHitSeg = (*cscRecHits[
hit]).geographicalId();
192 LocalPoint posSegCSCRecHit = (*cscRecHits[
hit]).localPosition();
193 LocalPoint posCSCSegment= segment2->localPosition();
195 double rCSC=
sqrt(
pow((posSegCSCRecHit.
x()-posTrackRecHit.
x()),2) +
pow((posSegCSCRecHit.
y()-posTrackRecHit.
y()),2) +
pow((posSegCSCRecHit.
z()-posTrackRecHit.
z()),2));
197 if (idRivHit==idRivHitSeg && rCSC < 0.0001){
199 if (selectedCscSegments.empty()){
201 LogTrace(
metname) <<
"First selected segment (from CSC). Position: "<<posCSCSegment;
205 for(
int n=0;
n<
int(selectedCscSegments.size());
n++){
206 double dist =
sqrt(
pow(((*(selectedCscSegments[
n])).localPosition().
x()-posCSCSegment.
x()),2) +
pow(((*(selectedCscSegments[n])).localPosition().
y()-posCSCSegment.
y()),2) +
pow(((*(selectedCscSegments[n])).localPosition().
z()-posCSCSegment.
z()),2));
209 if(check==
int(selectedCscSegments.size())){
211 LogTrace(
metname) <<
"New CSC segment selected. Position : "<<posCSCSegment;
231 copy(selectedDtSegments.begin(), selectedDtSegments.end(), back_inserter(selectedSegments));
232 LogTrace(
metname) <<
"N selected Dt segments:"<<selectedDtSegments.size();
233 copy(selectedCscSegments.begin(), selectedCscSegments.end(), back_inserter(selectedSegments));
234 LogTrace(
metname) <<
"N selected Csc segments:"<<selectedCscSegments.size();
237 return selectedSegments;
std::pair< const_iterator, const_iterator > range
iterator range
edm::EDGetTokenT< DTRecSegment4DCollection > dtSegmentsToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
uint32_t rawId() const
get the raw id
virtual const GeomDet * idToDet(DetId) const
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Detector det() const
get the detector field from this detid
edm::EDGetTokenT< CSCSegmentCollection > cscSegmentsToken
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
std::vector< MuonRecHitPointer > MuonRecHitContainer
Power< A, B >::type pow(const A &a, const B &b)
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.