CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
FastTrackerRecHitMatcher Class Reference
Inheritance diagram for FastTrackerRecHitMatcher:
edm::stream::EDProducer<>

Public Member Functions

 FastTrackerRecHitMatcher (const edm::ParameterSet &)
 
 ~FastTrackerRecHitMatcher () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::pair< LocalPoint, LocalPointStripPosition
 

Private Member Functions

const FastSingleTrackerRecHit_cast2Single (const FastTrackerRecHit *recHit) const
 
std::unique_ptr< FastTrackerRecHitmatch (const FastSingleTrackerRecHit *monoRH, const FastSingleTrackerRecHit *stereoRH, const GluedGeomDet *gluedDet, LocalVector &trackdirection, bool stereLayerFirst) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
StripPosition project (const GeomDetUnit *det, const GluedGeomDet *glueddet, const StripPosition &strip, const LocalVector &trackdirection) const
 
std::unique_ptr< FastTrackerRecHitprojectOnly (const FastSingleTrackerRecHit *originalRH, const GeomDet *monoDet, const GluedGeomDet *gluedDet, LocalVector &ldir) const
 

Private Attributes

edm::EDGetTokenT< FastTrackerRecHitRefCollectionsimHit2RecHitMapToken
 
edm::EDGetTokenT< edm::PSimHitContainersimHitsToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 30 of file FastTrackerRecHitMatcher.cc.

Member Typedef Documentation

Definition at line 40 of file FastTrackerRecHitMatcher.cc.

Constructor & Destructor Documentation

FastTrackerRecHitMatcher::FastTrackerRecHitMatcher ( const edm::ParameterSet iConfig)
explicit

Definition at line 76 of file FastTrackerRecHitMatcher.cc.

References edm::ParameterSet::getParameter(), simHit2RecHitMapToken, and simHitsToken.

78 {
79  simHitsToken = consumes<edm::PSimHitContainer>(iConfig.getParameter<edm::InputTag>("simHits"));
81  consumes<FastTrackerRecHitRefCollection>(iConfig.getParameter<edm::InputTag>("simHit2RecHitMap"));
82 
83  produces<FastTrackerRecHitCollection>();
84  produces<FastTrackerRecHitRefCollection>("simHit2RecHitMap");
85 }
T getParameter(std::string const &) const
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
FastTrackerRecHitMatcher::~FastTrackerRecHitMatcher ( )
inlineoverride

Definition at line 33 of file FastTrackerRecHitMatcher.cc.

References fillDescriptions(), and produce().

33 { ; }

Member Function Documentation

const FastSingleTrackerRecHit* FastTrackerRecHitMatcher::_cast2Single ( const FastTrackerRecHit recHit) const
inlineprivate

Definition at line 62 of file FastTrackerRecHitMatcher.cc.

References Exception, BaseTrackerRecHit::isSingle(), rpcPointValidation_cfi::recHit, and BaseTrackerRecHit::rtti().

Referenced by produce().

62  {
63  if (!recHit->isSingle()) {
64  throw cms::Exception("FastTrackerRecHitMatcher")
65  << "all rechits in simHit2RecHitMap must be instances of FastSingleTrackerRecHit. recHit's rtti: "
66  << recHit->rtti() << std::endl;
67  }
68  return dynamic_cast<const FastSingleTrackerRecHit*>(recHit);
69  }
trackerHitRTTI::RTTI rtti() const
bool isSingle() const
void FastTrackerRecHitMatcher::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 356 of file FastTrackerRecHitMatcher.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

Referenced by ~FastTrackerRecHitMatcher().

356  {
357  //The following says we do not know what parameters are allowed so do no validation
358  // Please change this to state exactly what you do use, even if it is no parameters
360  desc.setUnknown();
361  descriptions.addDefault(desc);
362 }
void addDefault(ParameterSetDescription const &psetDescription)
std::unique_ptr< FastTrackerRecHit > FastTrackerRecHitMatcher::match ( const FastSingleTrackerRecHit monoRH,
const FastSingleTrackerRecHit stereoRH,
const GluedGeomDet gluedDet,
LocalVector trackdirection,
bool  stereLayerFirst 
) const
private

Definition at line 196 of file FastTrackerRecHitMatcher.cc.

References HltBtagPostValidation_cff::c, alignmentValidation::c1, funct::cos(), change_name::diff, relativeConstraints::error, Exception, TrackingRecHit::geographicalId(), StripTopology::localPitch(), StripTopology::localPosition(), BaseTrackerRecHit::localPosition(), BaseTrackerRecHit::localPositionError(), visualization-live-secondInstance_cfg::m, PV3DBase< T, PVType, FrameType >::mag2(), Topology::measurementError(), Topology::measurementPosition(), GluedGeomDet::monoDet(), PV3DBase< T, PVType, FrameType >::phi(), position, project(), indexGen::s2, funct::sin(), GluedGeomDet::stereoDet(), GeomDet::surface(), toLocal(), GeomDet::topology(), PV2DBase< T, PVType, FrameType >::x(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, and geometryCSVtoXML::yy.

Referenced by produce().

200  {
201  // stripdet = mono
202  // partnerstripdet = stereo
203  const GeomDetUnit* stripdet = gluedDet->monoDet();
204  const GeomDetUnit* partnerstripdet = gluedDet->stereoDet();
205  const StripTopology& topol = (const StripTopology&)stripdet->topology();
206 
208 
209  // position of the initial and final point of the strip (RPHI cluster) in local strip coordinates
210  MeasurementPoint RPHIpoint = topol.measurementPosition(monoRH->localPosition());
211  MeasurementPoint RPHIpointini = MeasurementPoint(RPHIpoint.x(), -0.5);
212  MeasurementPoint RPHIpointend = MeasurementPoint(RPHIpoint.x(), 0.5);
213 
214  // position of the initial and final point of the strip in local coordinates (mono det)
215  StripPosition stripmono = StripPosition(topol.localPosition(RPHIpointini), topol.localPosition(RPHIpointend));
216 
217  if (trackdirection.mag2() <
218  FLT_MIN) { // in case of no track hypothesis assume a track from the origin through the center of the strip
219  LocalPoint lcenterofstrip = monoRH->localPosition();
220  GlobalPoint gcenterofstrip = (stripdet->surface()).toGlobal(lcenterofstrip);
221  GlobalVector gtrackdirection = gcenterofstrip - GlobalPoint(0, 0, 0);
222  trackdirection = (gluedDet->surface()).toLocal(gtrackdirection);
223  }
224 
225  //project mono hit on glued det
226  StripPosition projectedstripmono = project(stripdet, gluedDet, stripmono, trackdirection);
227  const StripTopology& partnertopol = (const StripTopology&)partnerstripdet->topology();
228 
229  //error calculation (the part that depends on mono RH only)
230  LocalVector RPHIpositiononGluedendvector = projectedstripmono.second - projectedstripmono.first;
231  double c1 = sin(RPHIpositiononGluedendvector.phi());
232  double s1 = -cos(RPHIpositiononGluedendvector.phi());
233  MeasurementError errormonoRH = topol.measurementError(monoRH->localPosition(), monoRH->localPositionError());
234  double pitch = topol.localPitch(monoRH->localPosition());
235  double sigmap12 = errormonoRH.uu() * pitch * pitch;
236 
237  // position of the initial and final point of the strip (STEREO cluster)
238  MeasurementPoint STEREOpoint = partnertopol.measurementPosition(stereoRH->localPosition());
239 
240  MeasurementPoint STEREOpointini = MeasurementPoint(STEREOpoint.x(), -0.5);
241  MeasurementPoint STEREOpointend = MeasurementPoint(STEREOpoint.x(), 0.5);
242 
243  // position of the initial and final point of the strip in local coordinates (stereo det)
244  StripPosition stripstereo(partnertopol.localPosition(STEREOpointini), partnertopol.localPosition(STEREOpointend));
245 
246  //project stereo hit on glued det
247  StripPosition projectedstripstereo = project(partnerstripdet, gluedDet, stripstereo, trackdirection);
248 
249  //perform the matching
250  //(x2-x1)(y-y1)=(y2-y1)(x-x1)
252  AlgebraicVector2 c, solution;
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();
259  m.Invert();
260  solution = m * c;
261  position = LocalPoint(solution(0), solution(1));
262 
263  //
264  // temporary fix by tommaso
265  //
266 
267  LocalError tempError(100, 0, 100);
268 
269  // calculate the error
270  LocalVector stereopositiononGluedendvector = projectedstripstereo.second - projectedstripstereo.first;
271  double c2 = sin(stereopositiononGluedendvector.phi());
272  double s2 = -cos(stereopositiononGluedendvector.phi());
273  MeasurementError errorstereoRH =
274  partnertopol.measurementError(stereoRH->localPosition(), stereoRH->localPositionError());
275  pitch = partnertopol.localPitch(stereoRH->localPosition());
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);
282  LocalError error = LocalError(xx, xy, yy);
283 
284  //Added by DAO to make sure y positions are zero.
285  DetId det(monoRH->geographicalId());
286  if (det.subdetId() > 2) {
287  return std::make_unique<FastMatchedTrackerRecHit>(position, error, *gluedDet, *monoRH, *stereoRH, stereoHitFirst);
288 
289  }
290 
291  else {
292  throw cms::Exception("FastTrackerRecHitMatcher") << "Matched Pixel!?";
293  }
294 }
T mag2() const
Definition: PV3DBase.h:63
std::pair< LocalPoint, LocalPoint > StripPosition
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
LocalError localPositionError() const final
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
virtual const Topology & topology() const
Definition: GeomDet.cc:67
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
ROOT::Math::SVector< double, 2 > AlgebraicVector2
virtual LocalPoint localPosition(float strip) const =0
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
StripPosition project(const GeomDetUnit *det, const GluedGeomDet *glueddet, const StripPosition &strip, const LocalVector &trackdirection) const
Definition: DetId.h:17
virtual float localPitch(const LocalPoint &) const =0
static int position[264][3]
Definition: ReadPGInfo.cc:289
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepStd< double, 2, 2 > > AlgebraicMatrix22
LocalPoint localPosition() const final
DetId geographicalId() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
T x() const
Definition: PV2DBase.h:43
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
void FastTrackerRecHitMatcher::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 87 of file FastTrackerRecHitMatcher.cc.

References _cast2Single(), TrackingRecHit::det(), TrackingRecHit::geographicalId(), geometry, edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), StripSubdetector::glued(), TrackerGeometry::idToDet(), edm::Ref< C, T, F >::isNull(), PSimHit::localDirection(), match(), eostools::move(), projectOnly(), edm::Event::put(), DetId::rawId(), rpcPointValidation_cfi::recHit, rpcPointValidation_cfi::simHit, Reconstruction_BefMix_cff::simHit2RecHitMap, simHit2RecHitMapToken, FastTrackerRecHitCombiner_cfi::simHits, simHitsToken, StripSubdetector::stereo(), DetId::subdetId(), GeomDet::surface(), Surface::toGlobal(), GloballyPositioned< T >::toLocal(), and PSimHit::trackId().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), HTMLExport.HTMLExportStatic::export(), and ~FastTrackerRecHitMatcher().

87  {
88  // services
90  iSetup.get<TrackerDigiGeometryRecord>().get(geometry);
91 
92  // input
94  iEvent.getByToken(simHitsToken, simHits);
95 
97  iEvent.getByToken(simHit2RecHitMapToken, simHit2RecHitMap);
98 
99  // output
100  auto output_recHits = std::make_unique<FastTrackerRecHitCollection>();
101  auto output_simHit2RecHitMap =
102  std::make_unique<FastTrackerRecHitRefCollection>(simHit2RecHitMap->size(), FastTrackerRecHitRef());
103  edm::RefProd<FastTrackerRecHitCollection> output_recHits_refProd =
105 
106  bool skipNext = false;
107  for (unsigned simHitCounter = 0; simHitCounter < simHits->size(); ++simHitCounter) {
108  // skip hit in case it was matched to previous one
109  if (skipNext) {
110  skipNext = false;
111  continue;
112  }
113  skipNext = false;
114 
115  // get simHit and associated recHit
116  const PSimHit& simHit = (*simHits)[simHitCounter];
117  const FastTrackerRecHitRef& recHitRef = (*simHit2RecHitMap)[simHitCounter];
118 
119  // skip simHits w/o associated recHit
120  if (recHitRef.isNull())
121  continue;
122 
123  // cast
124  const FastSingleTrackerRecHit* recHit = _cast2Single(recHitRef.get());
125 
126  // get subdetector id
127  DetId detid = recHit->geographicalId();
128  unsigned int subdet = detid.subdetId();
129 
130  // treat pixel hits
131  if (subdet <= 2) {
132  (*output_simHit2RecHitMap)[simHitCounter] = recHitRef;
133  }
134 
135  // treat strip hits
136  else {
137  StripSubdetector stripSubDetId(detid);
138 
139  // treat regular regular strip hits
140  if (!stripSubDetId.glued()) {
141  (*output_simHit2RecHitMap)[simHitCounter] = recHitRef;
142  }
143 
144  // treat strip hits on glued layers
145  else {
146  // Obtain direction of simtrack at simhit in local coordinates of glued module
147  // - direction of simtrack at simhit, in coordindates of the single module
148  LocalVector localSimTrackDir = simHit.localDirection();
149  // - transform to global coordinates
150  GlobalVector globalSimTrackDir = recHit->det()->surface().toGlobal(localSimTrackDir);
151  // - transform to local coordinates of glued module
152  const GluedGeomDet* gluedDet = (const GluedGeomDet*)geometry->idToDet(DetId(stripSubDetId.glued()));
153  LocalVector gluedLocalSimTrackDir = gluedDet->surface().toLocal(globalSimTrackDir);
154 
155  // check whether next hit is partner
156  const FastSingleTrackerRecHit* partnerRecHit = nullptr;
157  // - there must be a next hit
158  if (simHitCounter + 1 < simHits->size()) {
159  const FastTrackerRecHitRef& nextRecHitRef = (*simHit2RecHitMap)[simHitCounter + 1];
160  const PSimHit& nextSimHit = (*simHits)[simHitCounter + 1];
161  // - partner hit must not be null
162  // - simHit and partner simHit must belong to same simTrack
163  // - partner hit must be on the module glued to the module of the hit
164  if ((!nextRecHitRef.isNull()) && simHit.trackId() == nextSimHit.trackId() &&
165  StripSubdetector(nextRecHitRef->geographicalId()).partnerDetId() == detid.rawId()) {
166  partnerRecHit = _cast2Single(nextRecHitRef.get());
167  skipNext = true;
168  }
169  }
170 
171  std::unique_ptr<FastTrackerRecHit> newRecHit(nullptr);
172 
173  // if partner found: create a matched hit
174  if (partnerRecHit) {
175  newRecHit = match(stripSubDetId.stereo() ? partnerRecHit : recHit,
176  stripSubDetId.stereo() ? recHit : partnerRecHit,
177  gluedDet,
178  gluedLocalSimTrackDir,
179  stripSubDetId.stereo());
180  }
181  // else: create projected hit
182  else {
183  newRecHit = projectOnly(recHit, geometry->idToDet(detid), gluedDet, gluedLocalSimTrackDir);
184  }
185  output_recHits->push_back(std::move(newRecHit));
186  (*output_simHit2RecHitMap)[simHitCounter] =
187  FastTrackerRecHitRef(output_recHits_refProd, output_recHits->size() - 1);
188  }
189  }
190  }
191 
192  iEvent.put(std::move(output_recHits));
193  iEvent.put(std::move(output_simHit2RecHitMap), "simHit2RecHitMap");
194 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::unique_ptr< FastTrackerRecHit > projectOnly(const FastSingleTrackerRecHit *originalRH, const GeomDet *monoDet, const GluedGeomDet *gluedDet, LocalVector &ldir) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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.
Definition: GeomDet.h:37
edm::Ref< FastTrackerRecHitCollection > FastTrackerRecHitRef
edm::EDGetTokenT< FastTrackerRecHitRefCollection > simHit2RecHitMapToken
const GeomDet * det() const
LocalPoint toLocal(const GlobalPoint &gp) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
edm::EDGetTokenT< edm::PSimHitContainer > simHitsToken
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
bool isNull() const
Checks for null.
Definition: Ref.h:235
RefProd< PROD > getRefBeforePut()
Definition: Event.h:156
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:58
Definition: DetId.h:17
const FastSingleTrackerRecHit * _cast2Single(const FastTrackerRecHit *recHit) const
ESHandle< TrackerGeometry > geometry
T get() const
Definition: EventSetup.h:73
const TrackerGeomDet * idToDet(DetId) const override
unsigned int trackId() const
Definition: PSimHit.h:106
DetId geographicalId() const
def move(src, dest)
Definition: eostools.py:511
FastTrackerRecHitMatcher::StripPosition FastTrackerRecHitMatcher::project ( const GeomDetUnit det,
const GluedGeomDet glueddet,
const StripPosition strip,
const LocalVector trackdirection 
) const
private

Definition at line 296 of file FastTrackerRecHitMatcher.cc.

References Scenarios_cff::scale, GeomDet::surface(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by match().

299  {
300  GlobalPoint globalpointini = (det->surface()).toGlobal(strip.first);
301  GlobalPoint globalpointend = (det->surface()).toGlobal(strip.second);
302 
303  // position of the initial and final point of the strip in glued local coordinates
304  LocalPoint positiononGluedini = (glueddet->surface()).toLocal(globalpointini);
305  LocalPoint positiononGluedend = (glueddet->surface()).toLocal(globalpointend);
306 
307  //correct the position with the track direction
308 
309  float scale = -positiononGluedini.z() / trackdirection.z();
310 
311  LocalPoint projpositiononGluedini = positiononGluedini + scale * trackdirection;
312  LocalPoint projpositiononGluedend = positiononGluedend + scale * trackdirection;
313 
314  return StripPosition(projpositiononGluedini, projpositiononGluedend);
315 }
std::pair< LocalPoint, LocalPoint > StripPosition
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
T z() const
Definition: PV3DBase.h:61
std::unique_ptr< FastTrackerRecHit > FastTrackerRecHitMatcher::projectOnly ( const FastSingleTrackerRecHit originalRH,
const GeomDet monoDet,
const GluedGeomDet gluedDet,
LocalVector ldir 
) const
private

Definition at line 317 of file FastTrackerRecHitMatcher.cc.

References dumpMFGeometry_cfg::delta, Exception, GeomDet::geographicalId(), BaseTrackerRecHit::localPosition(), BaseTrackerRecHit::localPositionError(), GluedGeomDet::monoDet(), position, LocalError::rotate(), GluedGeomDet::stereoDet(), GeomDet::surface(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

320  {
321  LocalPoint position(originalRH->localPosition().x(), 0., 0.);
322  const BoundPlane& gluedPlane = gluedDet->surface();
323  const BoundPlane& hitPlane = monoDet->surface();
324 
325  double delta = gluedPlane.localZ(hitPlane.position());
326 
327  LocalPoint lhitPos = gluedPlane.toLocal(monoDet->surface().toGlobal(position));
328  LocalPoint projectedHitPos = lhitPos - ldir * delta / ldir.z();
329 
330  LocalVector hitXAxis = gluedPlane.toLocal(hitPlane.toGlobal(LocalVector(1, 0, 0)));
331  LocalError hitErr = originalRH->localPositionError();
332 
333  if (gluedPlane.normalVector().dot(hitPlane.normalVector()) < 0) {
334  // the two planes are inverted, and the correlation element must change sign
335  hitErr = LocalError(hitErr.xx(), -hitErr.xy(), hitErr.yy());
336  }
337  LocalError rotatedError = hitErr.rotate(hitXAxis.x(), hitXAxis.y());
338 
339  const GeomDetUnit* gluedMonoDet = gluedDet->monoDet();
340  const GeomDetUnit* gluedStereoDet = gluedDet->stereoDet();
341  int isMono = 0;
342  int isStereo = 0;
343 
344  if (monoDet->geographicalId() == gluedMonoDet->geographicalId())
345  isMono = 1;
346  if (monoDet->geographicalId() == gluedStereoDet->geographicalId())
347  isStereo = 1;
348  //Added by DAO to make sure y positions are zero and correct Mono or stereo Det is filled.
349 
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);
353 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
float xx() const
Definition: LocalError.h:22
LocalError localPositionError() const final
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
T y() const
Definition: PV3DBase.h:60
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
float xy() const
Definition: LocalError.h:23
float yy() const
Definition: LocalError.h:24
T z() const
Definition: PV3DBase.h:61
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
static int position[264][3]
Definition: ReadPGInfo.cc:289
LocalPoint localPosition() const final
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:37
T x() const
Definition: PV3DBase.h:59
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20

Member Data Documentation

edm::EDGetTokenT<FastTrackerRecHitRefCollection> FastTrackerRecHitMatcher::simHit2RecHitMapToken
private

Definition at line 73 of file FastTrackerRecHitMatcher.cc.

Referenced by FastTrackerRecHitMatcher(), and produce().

edm::EDGetTokenT<edm::PSimHitContainer> FastTrackerRecHitMatcher::simHitsToken
private

Definition at line 72 of file FastTrackerRecHitMatcher.cc.

Referenced by FastTrackerRecHitMatcher(), and produce().