CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TkClonerImpl Class Referencefinal

#include <TkClonerImpl.h>

Inheritance diagram for TkClonerImpl:
TkCloner

Public Member Functions

virtual
TrackingRecHit::ConstRecHitPointer 
makeShared (SiPixelRecHit const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual
TrackingRecHit::ConstRecHitPointer 
makeShared (SiStripRecHit2D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual
TrackingRecHit::ConstRecHitPointer 
makeShared (SiStripRecHit1D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual
TrackingRecHit::ConstRecHitPointer 
makeShared (SiStripMatchedRecHit2D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual
TrackingRecHit::ConstRecHitPointer 
makeShared (ProjectedSiStripRecHit2D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual SiPixelRecHitoperator() (SiPixelRecHit const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual SiStripRecHit2Doperator() (SiStripRecHit2D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual SiStripRecHit1Doperator() (SiStripRecHit1D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual SiStripMatchedRecHit2Doperator() (SiStripMatchedRecHit2D const &hit, TrajectoryStateOnSurface const &tsos) const
 
virtual ProjectedSiStripRecHit2Doperator() (ProjectedSiStripRecHit2D const &hit, TrajectoryStateOnSurface const &tsos) const
 
ProjectedSiStripRecHit2Dproject (SiStripMatchedRecHit2D const &hit, bool mono, TrajectoryStateOnSurface const &tsos) const
 
 TkClonerImpl ()
 
 TkClonerImpl (const PixelClusterParameterEstimator *ipixelCPE, const StripClusterParameterEstimator *istripCPE, const SiStripRecHitMatcher *iMatcher)
 
- Public Member Functions inherited from TkCloner
TrackingRecHit *operator()[[cms
TrackingRecHit::ConstRecHitPointer 
makeShared (TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
 

Private Attributes

const
PixelClusterParameterEstimator
pixelCPE
 
const
StripClusterParameterEstimator
stripCPE
 
const SiStripRecHitMatchertheMatcher
 

Detailed Description

Definition at line 12 of file TkClonerImpl.h.

Constructor & Destructor Documentation

TkClonerImpl::TkClonerImpl ( )
inline

Definition at line 14 of file TkClonerImpl.h.

14 {}
TkClonerImpl::TkClonerImpl ( const PixelClusterParameterEstimator ipixelCPE,
const StripClusterParameterEstimator istripCPE,
const SiStripRecHitMatcher iMatcher 
)
inline

Definition at line 15 of file TkClonerImpl.h.

18  : pixelCPE(ipixelCPE), stripCPE(istripCPE), theMatcher(iMatcher){}
const PixelClusterParameterEstimator * pixelCPE
Definition: TkClonerImpl.h:40
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
const SiStripRecHitMatcher * theMatcher
Definition: TkClonerImpl.h:42

Member Function Documentation

TrackingRecHit::ConstRecHitPointer TkClonerImpl::makeShared ( SiPixelRecHit const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

Implements TkCloner.

Definition at line 47 of file TkClonerImpl.cc.

References SiPixelRecHit::cluster(), TrackingRecHit::det(), TrackerSingleRecHit::detUnit(), PixelClusterParameterEstimator::getParameters(), and pixelCPE.

47  {
48  // std::cout << "cloning " << typeid(hit).name() << std::endl;
49  const SiPixelCluster& clust = *hit.cluster();
50  auto && params = pixelCPE->getParameters( clust, *hit.detUnit(), tsos);
51  return std::make_shared<SiPixelRecHit>(std::get<0>(params), std::get<1>(params), std::get<2>(params), *hit.det(), hit.cluster());
52 }
const PixelClusterParameterEstimator * pixelCPE
Definition: TkClonerImpl.h:40
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
Pixel cluster – collection of neighboring pixels above threshold.
TrackingRecHit::ConstRecHitPointer TkClonerImpl::makeShared ( SiStripRecHit2D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

FIXME: this only uses the first cluster and ignores the others

Implements TkCloner.

Definition at line 54 of file TkClonerImpl.cc.

References TrackingRecHit::det(), TrackerSingleRecHit::detUnit(), StripClusterParameterEstimator::localParameters(), TrackerSingleRecHit::omniCluster(), TrackerSingleRecHit::stripCluster(), and stripCPE.

54  {
55  // std::cout << "cloning " << typeid(hit).name() << std::endl;
57  const SiStripCluster& clust = hit.stripCluster();
59  stripCPE->localParameters( clust, *hit.detUnit(), tsos);
60  return std::make_shared<SiStripRecHit2D>(lv.first, lv.second, *hit.det(), hit.omniCluster());
61 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
std::pair< LocalPoint, LocalError > LocalValues
TrackingRecHit::ConstRecHitPointer TkClonerImpl::makeShared ( SiStripRecHit1D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

FIXME: this only uses the first cluster and ignores the others

Implements TkCloner.

Definition at line 63 of file TkClonerImpl.cc.

References TrackingRecHit::det(), TrackerSingleRecHit::detUnit(), asciidump::le, StripClusterParameterEstimator::localParameters(), bookConverter::max, TrackerSingleRecHit::omniCluster(), TrackerSingleRecHit::stripCluster(), and stripCPE.

63  {
64  // std::cout << "cloning " << typeid(hit).name() << std::endl;
66  const SiStripCluster& clust = hit.stripCluster();
68  stripCPE->localParameters( clust, *hit.detUnit(), tsos);
69  LocalError le(lv.second.xx(),0.,std::numeric_limits<float>::max()); //Correct??
70  return std::make_shared<SiStripRecHit1D>(lv.first, le, *hit.det(), hit.omniCluster());
71 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
std::pair< LocalPoint, LocalError > LocalValues
TrackingRecHit::ConstRecHitPointer TkClonerImpl::makeShared ( SiStripMatchedRecHit2D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

std::cout << "cloning " << typeid(hit).name() << std::endl;

Implements TkCloner.

Definition at line 132 of file TkClonerImpl.cc.

132  {
134  return TrackingRecHit::ConstRecHitPointer((*this)(hit,tsos));
135 }
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
TrackingRecHit::ConstRecHitPointer TkClonerImpl::makeShared ( ProjectedSiStripRecHit2D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

Implements TkCloner.

Definition at line 137 of file TkClonerImpl.cc.

137  {
138  // std::cout << "cloning " << typeid(hit).name() << std::endl;
139  return TrackingRecHit::ConstRecHitPointer((*this)(hit,tsos));
140 }
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
SiPixelRecHit * TkClonerImpl::operator() ( SiPixelRecHit const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

Implements TkCloner.

Definition at line 24 of file TkClonerImpl.cc.

References SiPixelRecHit::cluster(), TrackingRecHit::det(), TrackerSingleRecHit::detUnit(), PixelClusterParameterEstimator::getParameters(), and pixelCPE.

24  {
25  const SiPixelCluster& clust = *hit.cluster();
26  auto && params = pixelCPE->getParameters( clust, *hit.detUnit(), tsos);
27  return new SiPixelRecHit(std::get<0>(params), std::get<1>(params), std::get<2>(params), *hit.det(), hit.cluster());
28 }
const PixelClusterParameterEstimator * pixelCPE
Definition: TkClonerImpl.h:40
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
Pixel cluster – collection of neighboring pixels above threshold.
Our base class.
Definition: SiPixelRecHit.h:23
SiStripRecHit2D * TkClonerImpl::operator() ( SiStripRecHit2D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

FIXME: this only uses the first cluster and ignores the others

Implements TkCloner.

Definition at line 30 of file TkClonerImpl.cc.

References TrackingRecHit::det(), TrackerSingleRecHit::detUnit(), StripClusterParameterEstimator::localParameters(), TrackerSingleRecHit::omniCluster(), TrackerSingleRecHit::stripCluster(), and stripCPE.

30  {
32  const SiStripCluster& clust = hit.stripCluster();
34  stripCPE->localParameters( clust, *hit.detUnit(), tsos);
35  return new SiStripRecHit2D(lv.first, lv.second, *hit.det(), hit.omniCluster());
36 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
std::pair< LocalPoint, LocalError > LocalValues
SiStripRecHit1D * TkClonerImpl::operator() ( SiStripRecHit1D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

FIXME: this only uses the first cluster and ignores the others

Implements TkCloner.

Definition at line 38 of file TkClonerImpl.cc.

References TrackingRecHit::det(), TrackerSingleRecHit::detUnit(), asciidump::le, StripClusterParameterEstimator::localParameters(), bookConverter::max, TrackerSingleRecHit::omniCluster(), TrackerSingleRecHit::stripCluster(), and stripCPE.

38  {
40  const SiStripCluster& clust = hit.stripCluster();
42  stripCPE->localParameters( clust, *hit.detUnit(), tsos);
43  LocalError le(lv.second.xx(),0.,std::numeric_limits<float>::max()); //Correct??
44  return new SiStripRecHit1D(lv.first, le, *hit.det(), hit.omniCluster());
45 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
std::pair< LocalPoint, LocalError > LocalValues
SiStripMatchedRecHit2D * TkClonerImpl::operator() ( SiStripMatchedRecHit2D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

Implements TkCloner.

Definition at line 103 of file TkClonerImpl.cc.

References SiStripMatchedRecHit2D::clone(), TrackingRecHit::det(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), StripClusterParameterEstimator::localParameters(), SiStripRecHitMatcher::match(), SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoClusterRef(), GluedGeomDet::monoDet(), GeomDet::position(), SiStripMatchedRecHit2D::stereoCluster(), SiStripMatchedRecHit2D::stereoClusterRef(), GluedGeomDet::stereoDet(), stripCPE, GeomDet::surface(), groupFilesInBlocks::temp, theMatcher, and GloballyPositioned< T >::toLocal().

103  {
104  const GeomDet * det = hit.det();
105  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (det);
106  LocalVector tkDir = (tsos.isValid() ? tsos.localDirection() :
107  det->surface().toLocal( det->position()-GlobalPoint(0,0,0)));
108 
109  const SiStripCluster& monoclust = hit.monoCluster();
110  const SiStripCluster& stereoclust = hit.stereoCluster();
111 
113  stripCPE->localParameters( monoclust, *gdet->monoDet(), tsos);
115  stripCPE->localParameters( stereoclust, *gdet->stereoDet(), gluedToStereo(tsos, gdet));
116 
117  SiStripRecHit2D monoHit = SiStripRecHit2D( lvMono.first, lvMono.second,
118  *gdet->monoDet(),
119  hit.monoClusterRef());
120  SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
121  *gdet->stereoDet(),
122  hit.stereoClusterRef());
123 
124  // return theMatcher->match(&monoHit,&stereoHit,gdet,tkDir,true);
125  std::unique_ptr<SiStripMatchedRecHit2D> temp = theMatcher->match(&monoHit,&stereoHit,gdet,tkDir,false);
126  SiStripMatchedRecHit2D * better = temp.release();
127 
128  return better ? better : hit.clone();
129 
130 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:41
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
LocalPoint toLocal(const GlobalPoint &gp) const
const SiStripRecHitMatcher * theMatcher
Definition: TkClonerImpl.h:42
std::unique_ptr< SiStripMatchedRecHit2D > match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection, bool force=false) const
std::pair< LocalPoint, LocalError > LocalValues
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
ProjectedSiStripRecHit2D * TkClonerImpl::operator() ( ProjectedSiStripRecHit2D const &  hit,
TrajectoryStateOnSurface const &  tsos 
) const
virtual

Implements TkCloner.

Definition at line 142 of file TkClonerImpl.cc.

References TrackingRecHit::det(), f, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), StripClusterParameterEstimator::localParameters(), TrackerSingleRecHit::omniCluster(), ProjectedSiStripRecHit2D::originalDet(), GeomDet::position(), LocalError::rotate(), TrackerSingleRecHit::stripCluster(), stripCPE, GeomDet::surface(), GloballyPositioned< T >::toLocal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

142  {
143  const SiStripCluster& clust = hit.stripCluster();
144  const GeomDetUnit * gdu = reinterpret_cast<const GeomDetUnit *>(hit.originalDet());
145  //if (!gdu) std::cout<<"no luck dude"<<std::endl;
147 
148  // project...
149  const GeomDet & det = *hit.det();
150  const BoundPlane& gluedPlane = det.surface();
151  const BoundPlane& hitPlane = gdu->surface();
152  LocalVector tkDir = (tsos.isValid() ? tsos.localDirection() :
153  det.surface().toLocal( det.position()-GlobalPoint(0,0,0)));
154 
155  auto delta = gluedPlane.localZ( hitPlane.position());
156  LocalVector ldir = tkDir;
157  LocalPoint lhitPos = gluedPlane.toLocal( hitPlane.toGlobal(lv.first));
158  LocalPoint projectedHitPos = lhitPos - ldir * delta/ldir.z();
159 
160  LocalVector hitXAxis = gluedPlane.toLocal( hitPlane.toGlobal( LocalVector(1.f,0,0)));
161  LocalError hitErr = lv.second;
162  if (gluedPlane.normalVector().dot( hitPlane.normalVector()) < 0) {
163  // the two planes are inverted, and the correlation element must change sign
164  hitErr = LocalError( hitErr.xx(), -hitErr.xy(), hitErr.yy());
165  }
166  LocalError rotatedError = hitErr.rotate( hitXAxis.x(), hitXAxis.y());
167  return new ProjectedSiStripRecHit2D(projectedHitPos, rotatedError, *hit.det(), *hit.originalDet(), hit.omniCluster());
168 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
dbl * delta
Definition: mlp_gen.cc:36
float xx() const
Definition: LocalError.h:24
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
float xy() const
Definition: LocalError.h:25
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:41
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
float yy() const
Definition: LocalError.h:26
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:64
double f[11][100]
std::pair< LocalPoint, LocalError > LocalValues
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
T x() const
Definition: PV3DBase.h:62
ProjectedSiStripRecHit2D * TkClonerImpl::project ( SiStripMatchedRecHit2D const &  hit,
bool  mono,
TrajectoryStateOnSurface const &  tsos 
) const

Definition at line 171 of file TkClonerImpl.cc.

References TrackingRecHit::det(), f, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), StripClusterParameterEstimator::localParameters(), SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoClusterRef(), GluedGeomDet::monoDet(), GeomDet::position(), LocalError::rotate(), SiStripMatchedRecHit2D::stereoCluster(), SiStripMatchedRecHit2D::stereoClusterRef(), GluedGeomDet::stereoDet(), stripCPE, GeomDet::surface(), GloballyPositioned< T >::toLocal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

171  {
172  const GeomDet & det = *hit.det();
173  const GluedGeomDet & gdet = static_cast<const GluedGeomDet &> (det);
174  const GeomDetUnit * odet = mono ? gdet.monoDet() : gdet.stereoDet();
175  const BoundPlane& gluedPlane = det.surface();
176  const BoundPlane& hitPlane = odet->surface();
177 
178 
179  LocalVector tkDir = (tsos.isValid() ? tsos.localDirection() :
180  det.surface().toLocal( det.position()-GlobalPoint(0,0,0)));
181 
182  const SiStripCluster& monoclust = hit.monoCluster();
183  const SiStripCluster& stereoclust = hit.stereoCluster();
184 
186  if (tsos.isValid())
187  lv = mono ?
188  stripCPE->localParameters( monoclust, *odet, tsos) :
189  stripCPE->localParameters( stereoclust, *odet, gluedToStereo(tsos, &gdet));
190  else
191  lv = stripCPE->localParameters( mono ? monoclust : stereoclust, *odet);
192 
193 
194  auto delta = gluedPlane.localZ( hitPlane.position());
195  LocalVector ldir = tkDir;
196  LocalPoint lhitPos = gluedPlane.toLocal( hitPlane.toGlobal(lv.first));
197  LocalPoint projectedHitPos = lhitPos - ldir * delta/ldir.z();
198 
199  LocalVector hitXAxis = gluedPlane.toLocal( hitPlane.toGlobal( LocalVector(1.f,0,0)));
200  LocalError hitErr = lv.second;
201  if (gluedPlane.normalVector().dot( hitPlane.normalVector()) < 0) {
202  // the two planes are inverted, and the correlation element must change sign
203  hitErr = LocalError( hitErr.xx(), -hitErr.xy(), hitErr.yy());
204  }
205  LocalError rotatedError = hitErr.rotate( hitXAxis.x(), hitXAxis.y());
206  return new ProjectedSiStripRecHit2D(projectedHitPos, rotatedError, det, *odet,
207  mono ? hit.monoClusterRef() : hit.stereoClusterRef() );
208 }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
dbl * delta
Definition: mlp_gen.cc:36
float xx() const
Definition: LocalError.h:24
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
float xy() const
Definition: LocalError.h:25
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:41
const StripClusterParameterEstimator * stripCPE
Definition: TkClonerImpl.h:41
float yy() const
Definition: LocalError.h:26
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:64
double f[11][100]
std::pair< LocalPoint, LocalError > LocalValues
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
T x() const
Definition: PV3DBase.h:62
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21

Member Data Documentation

const PixelClusterParameterEstimator* TkClonerImpl::pixelCPE
private

Definition at line 40 of file TkClonerImpl.h.

Referenced by makeShared(), and operator()().

const StripClusterParameterEstimator* TkClonerImpl::stripCPE
private

Definition at line 41 of file TkClonerImpl.h.

Referenced by makeShared(), operator()(), and project().

const SiStripRecHitMatcher* TkClonerImpl::theMatcher
private

Definition at line 42 of file TkClonerImpl.h.

Referenced by operator()().