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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FastTrackerRecHitMatcher (const edm::ParameterSet &)
 
 ~FastTrackerRecHitMatcher ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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
 
virtual 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file FastTrackerRecHitMatcher.cc.

Member Typedef Documentation

Definition at line 45 of file FastTrackerRecHitMatcher.cc.

Constructor & Destructor Documentation

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

Definition at line 80 of file FastTrackerRecHitMatcher.cc.

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

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

Definition at line 37 of file FastTrackerRecHitMatcher.cc.

References fillDescriptions(), and produce().

37 {;}

Member Function Documentation

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

Definition at line 67 of file FastTrackerRecHitMatcher.cc.

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

Referenced by produce().

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

Definition at line 366 of file FastTrackerRecHitMatcher.cc.

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

Referenced by ~FastTrackerRecHitMatcher().

366  {
367  //The following says we do not know what parameters are allowed so do no validation
368  // Please change this to state exactly what you do use, even if it is no parameters
370  desc.setUnknown();
371  descriptions.addDefault(desc);
372 }
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 202 of file FastTrackerRecHitMatcher.cc.

References EnergyCorrector::c, alignmentValidation::c1, funct::cos(), mps_update::diff, relativeConstraints::error, Exception, TrackingRecHit::geographicalId(), StripTopology::localPitch(), StripTopology::localPosition(), BaseTrackerRecHit::localPosition(), BaseTrackerRecHit::localPositionError(), funct::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().

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

Definition at line 91 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, simHit2RecHitMapToken, trackerHits::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().

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

Definition at line 301 of file FastTrackerRecHitMatcher.cc.

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

Referenced by match().

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

Definition at line 326 of file FastTrackerRecHitMatcher.cc.

References 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().

330 {
331  LocalPoint position(originalRH->localPosition().x(), 0.,0.);
332  const BoundPlane& gluedPlane = gluedDet->surface();
333  const BoundPlane& hitPlane = monoDet->surface();
334 
335  double delta = gluedPlane.localZ( hitPlane.position());
336 
337  LocalPoint lhitPos = gluedPlane.toLocal( monoDet->surface().toGlobal(position ) );
338  LocalPoint projectedHitPos = lhitPos - ldir * delta/ldir.z();
339 
340  LocalVector hitXAxis = gluedPlane.toLocal( hitPlane.toGlobal( LocalVector(1,0,0)));
341  LocalError hitErr = originalRH->localPositionError();
342 
343  if (gluedPlane.normalVector().dot( hitPlane.normalVector()) < 0) {
344  // the two planes are inverted, and the correlation element must change sign
345  hitErr = LocalError( hitErr.xx(), -hitErr.xy(), hitErr.yy());
346  }
347  LocalError rotatedError = hitErr.rotate( hitXAxis.x(), hitXAxis.y());
348 
349 
350  const GeomDetUnit *gluedMonoDet = gluedDet->monoDet();
351  const GeomDetUnit *gluedStereoDet = gluedDet->stereoDet();
352  int isMono = 0;
353  int isStereo = 0;
354 
355  if(monoDet->geographicalId()==gluedMonoDet->geographicalId()) isMono = 1;
356  if(monoDet->geographicalId()==gluedStereoDet->geographicalId()) isStereo = 1;
357  //Added by DAO to make sure y positions are zero and correct Mono or stereo Det is filled.
358 
359  if ((isMono && isStereo)||(!isMono&&!isStereo)) throw cms::Exception("FastTrackerRecHitMatcher") << "Something wrong with DetIds.";
360  return std::make_unique<FastProjectedTrackerRecHit>(projectedHitPos, rotatedError, *gluedDet, *originalRH);
361 }
dbl * delta
Definition: mlp_gen.cc:36
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
float xx() const
Definition: LocalError.h:24
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
float xy() const
Definition: LocalError.h:25
float yy() const
Definition: LocalError.h:26
T z() const
Definition: PV3DBase.h:64
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
virtual LocalPoint localPosition() const final
static int position[264][3]
Definition: ReadPGInfo.cc:509
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:39
virtual LocalError localPositionError() const final
T x() const
Definition: PV3DBase.h:62
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21

Member Data Documentation

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

Definition at line 76 of file FastTrackerRecHitMatcher.cc.

Referenced by FastTrackerRecHitMatcher(), and produce().

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

Definition at line 75 of file FastTrackerRecHitMatcher.cc.

Referenced by FastTrackerRecHitMatcher(), and produce().