51 DPRINT(
"TrackMerger") <<
std::abs(inner.
eta()) <<
" merging " << inner.
algo() <<
'/' << outer.
algo() <<
' ' << inner.
eta() <<
'/' << outer.
eta()<< std::endl;
53 std::vector<const TrackingRecHit *> hits;
55 DPRINT(
"TrackMerger") <<
"Inner track hits: " << std::endl;
57 hits.push_back(&**it);
59 DetId id(hits.back()->geographicalId());
60 PRINT <<
" subdet " <<
id.subdetId() <<
" layer " <<
theTrkTopo->layer(
id) <<
" valid " << hits.back()->
isValid() <<
" detid: " << id() << std::endl;
63 DPRINT(
"TrackMerger") <<
"Outer track hits: " << std::endl;
66 DetId lastId(hits.back()->geographicalId());
68 unsigned int lastLayer =
theTrkTopo->layer(lastId);
73 if (thisSubdet > lastSubdet || (thisSubdet == lastSubdet &&
theTrkTopo->layer(
id) > lastLayer)) {
75 PRINT <<
" adding subdet " <<
id.subdetId() <<
" layer " <<
theTrkTopo->layer(
id) <<
" valid " << hit->
isValid() <<
" detid: " << id() << std::endl;
77 PRINT <<
" skipping subdet " << thisSubdet <<
" layer " <<
theTrkTopo->layer(
id) <<
" valid " << hit->
isValid() <<
" detid: " << id() << std::endl;
81 size_t nHitsFirstTrack = hits.size();
88 PRINT <<
" subdet " <<
id.subdetId() <<
" layer " <<
theTrkTopo->layer(
id) <<
" valid " << valid <<
" detid: " << id() << std::endl;
90 for (
auto hit2 : hits) {
91 ++iHit;
if (iHit > nHitsFirstTrack)
break;
92 DetId id2 = hit2->geographicalId();
93 if (
id.subdetId() != id2.
subdetId())
continue;
96 PRINT <<
" discared as duplicate of other hit" << id() << std::endl;
99 if (hit2->isValid() && !valid) {
100 PRINT <<
" replacing old invalid hit on detid " << id2() << std::endl;
101 hit2 = hit; shared =
true;
break;
103 PRINT <<
" discared as additional hit on layer that already contains hit with detid " << id() << std::endl;
104 shared =
true;
break;
106 if (shared)
continue;
116 unsigned int nhits = hits.size();
121 for(
auto hit : hits) ownHits.
push_back(*hit);
124 std::sort(hits.begin(), hits.end(), MomentumSort(
v, &*
theGeometry));
125 for(
auto hit : hits) ownHits.
push_back(*hit);
128 std::vector<TransientTrackingRecHit::RecHitPointer> ttrh(nhits);
130 std::sort(ttrh.begin(), ttrh.end(), GlobalMomentumSort(
v));
131 for(
auto hit : ttrh) ownHits.
push_back(*hit);
edm::ESHandle< TrackerTopology > theTrkTopo
tuple ret
prodAgent to be discontinued
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
const Vector & momentum() const
track momentum vector
const math::XYZPoint & outerPosition() const
position of the outermost hit
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackAlgorithm algo() const
double eta() const
pseudorapidity of momentum vector
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Abs< T >::type abs(const T &t)
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) ...
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::ESHandle< TransientTrackingRecHitBuilder > theBuilder
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
DetId geographicalId() const
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
edm::ESHandle< MagneticField > theMagField
edm::ESHandle< TrackerGeometry > theGeometry
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.