55 bool stereLayerFirst)
const;
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");
99 auto output_recHits = std::make_unique<FastTrackerRecHitCollection>();
100 auto output_simHit2RecHitMap =
105 bool skipNext =
false;
106 for (
unsigned simHitCounter = 0; simHitCounter <
simHits->size(); ++simHitCounter) {
127 unsigned int subdet = detid.subdetId();
131 (*output_simHit2RecHitMap)[simHitCounter] = recHitRef;
139 if (!stripSubDetId.
glued()) {
140 (*output_simHit2RecHitMap)[simHitCounter] = recHitRef;
157 if (simHitCounter + 1 <
simHits->size()) {
159 const PSimHit& nextSimHit = (*simHits)[simHitCounter + 1];
170 std::unique_ptr<FastTrackerRecHit> newRecHit(
nullptr);
177 gluedLocalSimTrackDir,
184 output_recHits->push_back(
std::move(newRecHit));
185 (*output_simHit2RecHitMap)[simHitCounter] =
199 bool stereoHitFirst)
const {
217 if (trackdirection.
mag2() < FLT_MIN) {
229 LocalVector RPHIpositiononGluedendvector = projectedstripmono.second - projectedstripmono.first;
230 double c1 =
sin(RPHIpositiononGluedendvector.
phi());
231 double s1 = -
cos(RPHIpositiononGluedendvector.
phi());
234 double sigmap12 = errormonoRH.uu() * pitch * pitch;
246 StripPosition projectedstripstereo =
project(partnerstripdet, gluedDet, stripstereo, trackdirection);
252 m(0, 0) = -(projectedstripmono.second.y() - projectedstripmono.first.y());
253 m(0, 1) = (projectedstripmono.second.x() - projectedstripmono.first.x());
254 m(1, 0) = -(projectedstripstereo.second.y() - projectedstripstereo.first.y());
255 m(1, 1) = (projectedstripstereo.second.x() - projectedstripstereo.first.x());
256 c(0) =
m(0, 1) * projectedstripmono.first.y() +
m(0, 0) * projectedstripmono.first.x();
257 c(1) =
m(1, 1) * projectedstripstereo.first.y() +
m(1, 0) * projectedstripstereo.first.x();
269 LocalVector stereopositiononGluedendvector = projectedstripstereo.second - projectedstripstereo.first;
270 double c2 =
sin(stereopositiononGluedendvector.
phi());
271 double s2 = -
cos(stereopositiononGluedendvector.
phi());
275 double sigmap22 = errorstereoRH.uu() * pitch * pitch;
276 double diff = (
c1 * s2 - c2 * s1);
278 float xx = invdet2 * (sigmap12 * s2 * s2 + sigmap22 * s1 * s1);
279 float xy = -invdet2 * (sigmap12 * c2 * s2 + sigmap22 *
c1 * s1);
280 float yy = invdet2 * (sigmap12 * c2 * c2 + sigmap22 *
c1 *
c1);
285 if (det.subdetId() > 2) {
286 return std::make_unique<FastMatchedTrackerRecHit>(
position,
error, *gluedDet, *monoRH, *stereoRH, stereoHitFirst);
291 throw cms::Exception(
"FastTrackerRecHitMatcher") <<
"Matched Pixel!?";
308 float scale = -positiononGluedini.
z() / trackdirection.
z();
310 LocalPoint projpositiononGluedini = positiononGluedini +
scale * trackdirection;
311 LocalPoint projpositiononGluedend = positiononGluedend +
scale * trackdirection;
313 return StripPosition(projpositiononGluedini, projpositiononGluedend);
324 double delta = gluedPlane.localZ(hitPlane.position());
332 if (gluedPlane.normalVector().dot(hitPlane.normalVector()) < 0) {
349 if ((isMono && isStereo) || (!isMono && !isStereo))
350 throw cms::Exception(
"FastTrackerRecHitMatcher") <<
"Something wrong with DetIds.";
351 return std::make_unique<FastProjectedTrackerRecHit>(projectedHitPos, rotatedError, *gluedDet, *originalRH);
T getParameter(std::string const &) const
std::pair< LocalPoint, LocalPoint > StripPosition
Point3DBase< Scalar, LocalTag > LocalPoint
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
unsigned int stereo() const
stereo
void produce(edm::Event &, const edm::EventSetup &) override
virtual const Topology & topology() const
Geom::Phi< T > phi() const
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
unsigned int glued() const
glued
std::unique_ptr< FastTrackerRecHit > match(const FastSingleTrackerRecHit *monoRH, const FastSingleTrackerRecHit *stereoRH, const GluedGeomDet *gluedDet, LocalVector &trackdirection, bool stereLayerFirst) const
std::unique_ptr< FastTrackerRecHit > projectOnly(const FastSingleTrackerRecHit *originalRH, const GeomDet *monoDet, const GluedGeomDet *gluedDet, LocalVector &ldir) const
LocalPoint toLocal(const GlobalPoint &gp) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryESToken
edm::Ref< FastTrackerRecHitCollection > FastTrackerRecHitRef
FastTrackerRecHitMatcher(const edm::ParameterSet &)
virtual float localPitch(const LocalPoint &) const =0
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
void addDefault(ParameterSetDescription const &psetDescription)
ROOT::Math::SVector< double, 2 > AlgebraicVector2
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
#define DEFINE_FWK_MODULE(type)
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
const FastSingleTrackerRecHit * _cast2Single(const FastTrackerRecHit *recHit) const
unsigned int trackId() const
DetId geographicalId() const
The label of this GeomDet.
bool isNull() const
Checks for null.
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const GeomDetUnit * monoDet() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
LocalError localPositionError() const override
const Plane & surface() const
The nominal surface of the GeomDet.
DetId geographicalId() const
constexpr uint32_t rawId() const
get the raw id
const GeomDetUnit * stereoDet() const
LocalPoint localPosition() const override
static int position[264][3]
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepStd< double, 2, 2 > > AlgebraicMatrix22
T const * get() const
Returns C++ pointer to the item.
virtual LocalPoint localPosition(float strip) const =0
StripPosition project(const GeomDetUnit *det, const GluedGeomDet *glueddet, const StripPosition &strip, const LocalVector &trackdirection) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~FastTrackerRecHitMatcher() override