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 =
101 std::make_unique<FastTrackerRecHitRefCollection>(simHit2RecHitMap->size(),
FastTrackerRecHitRef());
105 bool skipNext =
false;
106 for (
unsigned simHitCounter = 0; simHitCounter < simHits->size(); ++simHitCounter) {
115 const PSimHit& simHit = (*simHits)[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);
174 newRecHit =
match(stripSubDetId.
stereo() ? partnerRecHit : recHit,
175 stripSubDetId.
stereo() ? recHit : partnerRecHit,
177 gluedLocalSimTrackDir,
184 output_recHits->push_back(
std::move(newRecHit));
185 (*output_simHit2RecHitMap)[simHitCounter] =
192 iEvent.
put(
std::move(output_simHit2RecHitMap),
"simHit2RecHitMap");
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();
260 position =
LocalPoint(solution(0), solution(1));
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);
277 double invdet2 = 1 / (diff *
diff);
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());
327 LocalPoint projectedHitPos = lhitPos - ldir * delta / ldir.
z();
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);
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
std::pair< LocalPoint, LocalPoint > StripPosition
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::EventSetup & c
Point3DBase< Scalar, LocalTag > LocalPoint
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
#define DEFINE_FWK_MODULE(type)
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
const Plane & surface() const
The nominal surface of the GeomDet.
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryESToken
edm::Ref< FastTrackerRecHitCollection > FastTrackerRecHitRef
FastTrackerRecHitMatcher(const edm::ParameterSet &)
bool getData(T &iHolder) const
virtual float localPitch(const LocalPoint &) const =0
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
unsigned int glued() const
glued
void addDefault(ParameterSetDescription const &psetDescription)
ROOT::Math::SVector< double, 2 > AlgebraicVector2
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
const GeomDet * det() const
LocalPoint toLocal(const GlobalPoint &gp) const
Cos< T >::type cos(const T &t)
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.
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
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 toLocal(const reco::Track::Vector &v, const Surface &s)
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
LocalError localPositionError() const override
Basic2DVector< T > xy() const
unsigned int stereo() const
stereo
T getParameter(std::string const &) const
const FastSingleTrackerRecHit * _cast2Single(const FastTrackerRecHit *recHit) const
LocalPoint localPosition() const override
static int position[264][3]
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepStd< double, 2, 2 > > AlgebraicMatrix22
unsigned int trackId() const
virtual LocalPoint localPosition(float strip) const =0
trackerHitRTTI::RTTI rtti() const
DetId geographicalId() const
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