55 bool stereLayerFirst)
const;
59 const StripPosition&
strip,
65 <<
"all rechits in simHit2RecHitMap must be instances of FastSingleTrackerRecHit. recHit's rtti: " 66 << recHit->
rtti() << std::endl;
83 produces<FastTrackerRecHitCollection>();
84 produces<FastTrackerRecHitRefCollection>(
"simHit2RecHitMap");
100 auto output_recHits = std::make_unique<FastTrackerRecHitCollection>();
101 auto output_simHit2RecHitMap =
102 std::make_unique<FastTrackerRecHitRefCollection>(simHit2RecHitMap->size(),
FastTrackerRecHitRef());
106 bool skipNext =
false;
107 for (
unsigned simHitCounter = 0; simHitCounter < simHits->size(); ++simHitCounter) {
128 unsigned int subdet = detid.
subdetId();
132 (*output_simHit2RecHitMap)[simHitCounter] = recHitRef;
140 if (!stripSubDetId.
glued()) {
141 (*output_simHit2RecHitMap)[simHitCounter] = recHitRef;
158 if (simHitCounter + 1 < simHits->size()) {
160 const PSimHit& nextSimHit = (*simHits)[simHitCounter + 1];
171 std::unique_ptr<FastTrackerRecHit> newRecHit(
nullptr);
176 stripSubDetId.
stereo() ? recHit : partnerRecHit,
178 gluedLocalSimTrackDir,
183 newRecHit =
projectOnly(recHit, geometry->
idToDet(detid), gluedDet, gluedLocalSimTrackDir);
185 output_recHits->push_back(
std::move(newRecHit));
186 (*output_simHit2RecHitMap)[simHitCounter] =
193 iEvent.
put(
std::move(output_simHit2RecHitMap),
"simHit2RecHitMap");
200 bool stereoHitFirst)
const {
217 if (trackdirection.
mag2() <
230 LocalVector RPHIpositiononGluedendvector = projectedstripmono.second - projectedstripmono.first;
231 double c1 =
sin(RPHIpositiononGluedendvector.
phi());
232 double s1 = -
cos(RPHIpositiononGluedendvector.
phi());
235 double sigmap12 = errormonoRH.uu() * pitch * pitch;
247 StripPosition projectedstripstereo =
project(partnerstripdet, gluedDet, stripstereo, trackdirection);
253 m(0, 0) = -(projectedstripmono.second.y() - projectedstripmono.first.y());
254 m(0, 1) = (projectedstripmono.second.x() - projectedstripmono.first.x());
255 m(1, 0) = -(projectedstripstereo.second.y() - projectedstripstereo.first.y());
256 m(1, 1) = (projectedstripstereo.second.x() - projectedstripstereo.first.x());
257 c(0) =
m(0, 1) * projectedstripmono.first.y() +
m(0, 0) * projectedstripmono.first.x();
258 c(1) =
m(1, 1) * projectedstripstereo.first.y() +
m(1, 0) * projectedstripstereo.first.x();
261 position =
LocalPoint(solution(0), solution(1));
270 LocalVector stereopositiononGluedendvector = projectedstripstereo.second - projectedstripstereo.first;
271 double c2 =
sin(stereopositiononGluedendvector.
phi());
272 double s2 = -
cos(stereopositiononGluedendvector.
phi());
276 double sigmap22 = errorstereoRH.uu() * pitch * pitch;
277 double diff = (c1 * s2 - c2 * s1);
278 double invdet2 = 1 / (diff *
diff);
279 float xx = invdet2 * (sigmap12 * s2 * s2 + sigmap22 * s1 * s1);
280 float xy = -invdet2 * (sigmap12 * c2 * s2 + sigmap22 * c1 * s1);
281 float yy = invdet2 * (sigmap12 * c2 * c2 + sigmap22 * c1 *
c1);
286 if (det.subdetId() > 2) {
287 return std::make_unique<FastMatchedTrackerRecHit>(
position,
error, *gluedDet, *monoRH, *stereoRH, stereoHitFirst);
292 throw cms::Exception(
"FastTrackerRecHitMatcher") <<
"Matched Pixel!?";
309 float scale = -positiononGluedini.
z() / trackdirection.
z();
311 LocalPoint projpositiononGluedini = positiononGluedini + scale * trackdirection;
312 LocalPoint projpositiononGluedend = positiononGluedend + scale * trackdirection;
314 return StripPosition(projpositiononGluedini, projpositiononGluedend);
325 double delta = gluedPlane.localZ(hitPlane.position());
328 LocalPoint projectedHitPos = lhitPos - ldir * delta / ldir.
z();
333 if (gluedPlane.normalVector().dot(hitPlane.normalVector()) < 0) {
350 if ((isMono && isStereo) || (!isMono && !isStereo))
351 throw cms::Exception(
"FastTrackerRecHitMatcher") <<
"Something wrong with DetIds.";
352 return std::make_unique<FastProjectedTrackerRecHit>(projectedHitPos, rotatedError, *gluedDet, *originalRH);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
std::pair< LocalPoint, LocalPoint > StripPosition
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Point3DBase< Scalar, LocalTag > LocalPoint
LocalError localPositionError() const final
const GeomDetUnit * monoDet() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual const Topology & topology() const
std::unique_ptr< FastTrackerRecHit > projectOnly(const FastSingleTrackerRecHit *originalRH, const GeomDet *monoDet, const GluedGeomDet *gluedDet, LocalVector &ldir) const
void produce(edm::Event &, const edm::EventSetup &) override
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
std::unique_ptr< FastTrackerRecHit > match(const FastSingleTrackerRecHit *monoRH, const FastSingleTrackerRecHit *stereoRH, const GluedGeomDet *gluedDet, LocalVector &trackdirection, bool stereLayerFirst) const
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
edm::Ref< FastTrackerRecHitCollection > FastTrackerRecHitRef
FastTrackerRecHitMatcher(const edm::ParameterSet &)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
unsigned int glued() const
glued
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
ROOT::Math::SVector< double, 2 > AlgebraicVector2
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
virtual LocalPoint localPosition(float strip) const =0
const GeomDet * det() const
LocalPoint toLocal(const GlobalPoint &gp) const
Cos< T >::type cos(const T &t)
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
DetId geographicalId() const
The label of this GeomDet.
T const * get() const
Returns C++ pointer to the item.
StripPosition project(const GeomDetUnit *det, const GluedGeomDet *glueddet, const StripPosition &strip, const LocalVector &trackdirection) const
bool isNull() const
Checks for null.
RefProd< PROD > getRefBeforePut()
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
unsigned int stereo() const
stereo
const FastSingleTrackerRecHit * _cast2Single(const FastTrackerRecHit *recHit) const
virtual float localPitch(const LocalPoint &) const =0
ESHandle< TrackerGeometry > geometry
static int position[264][3]
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepStd< double, 2, 2 > > AlgebraicMatrix22
const TrackerGeomDet * idToDet(DetId) const override
unsigned int trackId() const
trackerHitRTTI::RTTI rtti() const
LocalPoint localPosition() const final
DetId geographicalId() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~FastTrackerRecHitMatcher() override
const GeomDetUnit * stereoDet() const