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) {
56 <<
hits.back()->isValid() <<
" detid: " <<
id() << std::endl;
59 DPRINT(
"TrackMerger") <<
"Outer track hits: " << std::endl;
63 DetId lastId(
hits.back()->geographicalId());
66 for (
auto it =
outer.recHitsBegin(), ed =
outer.recHitsEnd();
it != ed; ++
it) {
69 int thisSubdet =
id.subdetId();
70 if (thisSubdet > lastSubdet || (thisSubdet == lastSubdet &&
theTrkTopo->
layer(
id) > lastLayer)) {
73 <<
hit->isValid() <<
" detid: " <<
id() << std::endl;
76 <<
hit->isValid() <<
" detid: " <<
id() << std::endl;
117 if ((
inner.outerPosition() -
inner.innerPosition()).Dot(
inner.momentum()) >= 0) {
130 if ((
outer.outerPosition() -
inner.innerPosition()).Dot(
inner.momentum()) >= 0) {
149 size_t nHitsFirstTrack =
hits.size();
150 for (
auto it =
outer.recHitsBegin(), ed =
outer.recHitsEnd();
it != ed; ++
it) {
157 <<
" detid: " <<
id() << std::endl;
159 for (
auto hit2 :
hits) {
161 if (iHit > nHitsFirstTrack)
164 if (
id.subdetId() !=
id2.subdetId())
169 PRINT <<
" discared as duplicate of other hit" <<
id() << std::endl;
173 if (hit2->isValid() && !
valid) {
174 PRINT <<
" replacing old invalid hit on detid " <<
id2() << std::endl;
179 PRINT <<
" discared as additional hit on layer that already contains hit with detid " <<
id() << std::endl;
190 const std::vector<const TrackingRecHit *> &
hits,
194 std::vector<TransientTrackingRecHit::RecHitPointer> ttrh(
nhits);
195 for (
unsigned int i = 0;
i <
nhits; ++
i)
198 for (
const auto &
hit : ttrh)
212 GlobalPoint p1 = hit1->isValid() ? hit1->globalPosition() : hit1->det()->position();
213 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
uint32_t cc[maxCellsPerHit]
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