6 #define TRACK_SORT 1 // just use all hits from inner track, then append from outer outside it 7 #define DET_SORT 0 // sort hits using global position of detector 8 #define HIT_SORT 0 // sort hits using global position of hit 15 #define DPRINT(x) std::cout << x << ": " 16 #define PRINT std::cout 18 #define DPRINT(x) LogTrace(x) 19 #define PRINT LogTrace("") 23 : useInnermostState_(iConfig.getParameter<
bool>(
"useInnermostState")),
25 theBuilderName(iConfig.getParameter<
std::
string>(
"ttrhBuilderName")),
45 <<
inner.eta() <<
'/' <<
outer.eta() << std::endl;
47 std::vector<const TrackingRecHit *>
hits;
49 DPRINT(
"TrackMerger") <<
"Inner track hits: " << std::endl;
50 for (
auto it =
inner.recHitsBegin(), ed =
inner.recHitsEnd(); it != ed; ++it) {
51 hits.push_back(&**it);
55 <<
hits.back()->isValid() <<
" detid: " <<
id() << std::endl;
58 DPRINT(
"TrackMerger") <<
"Outer track hits: " << std::endl;
62 DetId lastId(
hits.back()->geographicalId());
65 for (
auto it =
outer.recHitsBegin(), ed =
outer.recHitsEnd(); it != ed; ++it) {
68 int thisSubdet =
id.subdetId();
69 if (thisSubdet > lastSubdet || (thisSubdet == lastSubdet &&
theTrkTopo->
layer(
id) > lastLayer)) {
72 <<
hit->isValid() <<
" detid: " <<
id() << std::endl;
75 <<
hit->isValid() <<
" detid: " <<
id() << std::endl;
116 if ((
inner.outerPosition() -
inner.innerPosition()).Dot(
inner.momentum()) >= 0) {
129 if ((
outer.outerPosition() -
inner.innerPosition()).Dot(
inner.momentum()) >= 0) {
148 size_t nHitsFirstTrack =
hits.size();
149 for (
auto it =
outer.recHitsBegin(), ed =
outer.recHitsEnd(); it != ed; ++it) {
156 <<
" detid: " <<
id() << std::endl;
158 for (
auto hit2 :
hits) {
160 if (iHit > nHitsFirstTrack)
163 if (
id.subdetId() !=
id2.subdetId())
168 PRINT <<
" discared as duplicate of other hit" <<
id() << std::endl;
172 if (hit2->isValid() && !
valid) {
173 PRINT <<
" replacing old invalid hit on detid " <<
id2() << std::endl;
178 PRINT <<
" discared as additional hit on layer that already contains hit with detid " <<
id() << std::endl;
189 const std::vector<const TrackingRecHit *> &
hits,
193 std::vector<TransientTrackingRecHit::RecHitPointer> ttrh(
nhits);
194 for (
unsigned int i = 0;
i <
nhits; ++
i)
197 for (
const auto &
hit : ttrh)
211 GlobalPoint p1 = hit1->isValid() ? hit1->globalPosition() : hit1->det()->position();
212 GlobalPoint p2 = hit2->isValid() ? hit2->globalPosition() : hit2->det()->position();
edm::ESHandle< TrackerTopology > theTrkTopo
Point3DBase< Scalar, LocalTag > LocalPoint
const TrackerGeometry * geom_
ret
prodAgent to be discontinued
bool operator()(const TrackingRecHit *hit1, const TrackingRecHit *hit2) const
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > builderToken_
void init(const edm::EventSetup &iSetup)
unsigned int layer(const DetId &id) const
void addSecondTrackHits(std::vector< const TrackingRecHit *> &hits, const reco::Track &outer) const
void sortByHitPosition(const GlobalVector &v, const std::vector< const TrackingRecHit *> &hits, TrackCandidate::RecHitContainer &ownHits) const
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
bool operator()(const TransientTrackingRecHit::RecHitPointer &hit1, const TransientTrackingRecHit::RecHitPointer &hit2) const
Abs< T >::type abs(const T &t)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const TrackerGeomDet * idToDet(DetId) const override
std::shared_ptr< TrackingRecHit const > RecHitPointer
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
TrackCandidate merge(const reco::Track &inner, const reco::Track &outer, DuplicateTrackType duplicateType) const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
DetId geographicalId() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
edm::ESHandle< TransientTrackingRecHitBuilder > theBuilder
TrackMerger(const edm::ParameterSet &iConfig, edm::ConsumesCollector)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
edm::ESHandle< MagneticField > theMagField
edm::ESHandle< TrackerGeometry > theGeometry