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 Member Functions | Private Attributes
Traj2TrackHits Class Reference

#include <Traj2TrackHits.h>

Public Member Functions

void operator() (Trajectory const &traj, TrackingRecHitCollection &hits, bool splitting) const
 
 Traj2TrackHits (const TransientTrackingRecHitBuilder *builder, bool ikeepOrder, bool noNoDet=true)
 

Private Member Functions

BaseTrackerRecHitbuild (GeomDetUnit const &idet, OmniClusterRef const &clus) const
 
TrackingRecHitclone (BaseTrackerRecHit const &hit2D) const
 
template<typename HI >
void copy (HI itm, HI e, TrackingRecHitCollection &hits) const
 
template<typename HI >
void split (HI itm, HI e, TrackingRecHitCollection &hits, bool along) const
 
void split (TrajectoryMeasurement const &itm, SiStripMatchedRecHit2D const &mhit, TrackingRecHitCollection &hits, float zdir) const
 

Private Attributes

bool keepOrder
 
bool removeNoDet
 
const
StripClusterParameterEstimator
theCPE
 

Detailed Description

Definition at line 18 of file Traj2TrackHits.h.

Constructor & Destructor Documentation

Traj2TrackHits::Traj2TrackHits ( const TransientTrackingRecHitBuilder builder,
bool  ikeepOrder,
bool  noNoDet = true 
)
inline

Definition at line 25 of file Traj2TrackHits.h.

25  :
26  theCPE(static_cast<TkTransientTrackingRecHitBuilder const *>(builder)->stripClusterParameterEstimator()),
27  keepOrder(ikeepOrder), removeNoDet(noNoDet) {}
const StripClusterParameterEstimator * theCPE

Member Function Documentation

BaseTrackerRecHit* Traj2TrackHits::build ( GeomDetUnit const &  idet,
OmniClusterRef const &  clus 
) const
inlineprivate

Definition at line 84 of file Traj2TrackHits.h.

References Reference_intrackfit_cff::endcap, GeomDetType::isEndcap(), StripClusterParameterEstimator::localParameters(), bookConverter::max, OmniClusterRef::stripCluster(), theCPE, and GeomDetUnit::type().

Referenced by split().

85  {
86  //Use 2D SiStripRecHit in endcap
87  bool endcap = idet.type().isEndcap();
88  auto && lv = theCPE->localParameters(clus.stripCluster(),idet);
89  if (endcap) return new SiStripRecHit2D(lv.first,lv.second,idet,clus);
90  return new SiStripRecHit1D(lv.first, LocalError(lv.second.xx(),0.f,std::numeric_limits<float>::max()),idet,clus);
91  }
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
const StripClusterParameterEstimator * theCPE
TrackingRecHit* Traj2TrackHits::clone ( BaseTrackerRecHit const &  hit2D) const
inlineprivate

Definition at line 72 of file Traj2TrackHits.h.

References TrackingRecHit::clone(), TrackingRecHit::det(), TrackingRecHit::detUnit(), Reference_intrackfit_cff::endcap, BaseTrackerRecHit::firstClusterRef(), BaseTrackerRecHit::localPosition(), BaseTrackerRecHit::localPositionError(), bookConverter::max, and LocalError::xx().

Referenced by split().

72  {
73  auto const & detU = *hit2D.detUnit();
74  //Use 2D SiStripRecHit in endcap
75  bool endcap = detU.type().isEndcap();
76  if (endcap) return hit2D.clone();
77  return new SiStripRecHit1D(hit2D.localPosition(),
78  LocalError(hit2D.localPositionError().xx(),0.f,std::numeric_limits<float>::max()),
79  *hit2D.det(), hit2D.firstClusterRef());
80 
81  }
template<typename HI >
void Traj2TrackHits::copy ( HI  itm,
HI  e,
TrackingRecHitCollection hits 
) const
inlineprivate

Definition at line 45 of file Traj2TrackHits.h.

References alignCSCRings::e, edm::OwnVector< T, P >::push_back(), and removeNoDet.

Referenced by operator()().

45  {
46  for(;itm!=e;++itm) if( (!removeNoDet) | ((*itm).recHitR().det()!=nullptr)) hits.push_back((*itm).recHitR().clone());
47  }
void push_back(D *&d)
Definition: OwnVector.h:274
void Traj2TrackHits::operator() ( Trajectory const &  traj,
TrackingRecHitCollection hits,
bool  splitting 
) const
inline

Definition at line 29 of file Traj2TrackHits.h.

References alongMomentum, copy(), Trajectory::direction(), keepOrder, Trajectory::measurements(), edm::OwnVector< T, P >::reserve(), and split().

29  {
30  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
31  bool along = traj.direction() == alongMomentum;
32  auto const & meas = traj.measurements();
33  hits.reserve(meas.size());
34  if(!splitting){
35  if (keepOrder | along) copy(meas.begin(),meas.end(),hits);
36  else copy(meas.rbegin(),meas.rend(),hits);
37  return;
38  }
39  if (keepOrder | along) split(meas.begin(),meas.end(),hits, along);
40  else split(meas.rbegin(),meas.rend(),hits,along);
41  }
void copy(HI itm, HI e, TrackingRecHitCollection &hits) const
void split(HI itm, HI e, TrackingRecHitCollection &hits, bool along) const
void reserve(size_t)
Definition: OwnVector.h:268
template<typename HI >
void Traj2TrackHits::split ( HI  itm,
HI  e,
TrackingRecHitCollection hits,
bool  along 
) const
inlineprivate

Definition at line 50 of file Traj2TrackHits.h.

References build(), clone(), compareJSON::const, alignCSCRings::e, trackerHitRTTI::isUndef(), keepOrder, edm::OwnVector< T, P >::push_back(), and removeNoDet.

Referenced by operator()().

50  {
51  for(;itm!=e;++itm) {
52  auto const & hit = *(*itm).recHit()->hit();
53  if( (removeNoDet) & ((*itm).recHitR().det()==nullptr)) continue;
54  if(trackerHitRTTI::isUndef(hit) | ( hit.dimension()!=2) ) {
55  hits.push_back(hit.clone());
56  continue;
57  }
58  auto const & thit = static_cast<BaseTrackerRecHit const&>(hit);
59  auto const & clus = thit.firstClusterRef();
60  if (clus.isPixel()) hits.push_back(hit.clone());
61  else if (thit.isMatched()) {
62  auto zdir = itm->updatedState().localDirection().z();
63  if (keepOrder & (!along)) zdir = -zdir;
64  split(*itm,static_cast<SiStripMatchedRecHit2D const&>(thit),hits,zdir);
65  }else if (thit.isProjected()) {
66  auto detU = static_cast<ProjectedSiStripRecHit2D const&>(thit).originalDet();
67  hits.push_back(build(*detU, clus));
68  } else hits.push_back(clone(thit));
69  }
70  }
void split(HI itm, HI e, TrackingRecHitCollection &hits, bool along) const
TrackingRecHit * clone(BaseTrackerRecHit const &hit2D) const
void push_back(D *&d)
Definition: OwnVector.h:274
string const
Definition: compareJSON.py:14
bool isUndef(TrackingRecHit const &hit)
BaseTrackerRecHit * build(GeomDetUnit const &idet, OmniClusterRef const &clus) const
void Traj2TrackHits::split ( TrajectoryMeasurement const &  itm,
SiStripMatchedRecHit2D const &  mhit,
TrackingRecHitCollection hits,
float  zdir 
) const
inlineprivate

Definition at line 93 of file Traj2TrackHits.h.

References build(), TrackingRecHit::det(), SiStripMatchedRecHit2D::monoClusterRef(), GluedGeomDet::monoDet(), GeomDet::position(), edm::OwnVector< T, P >::push_back(), hitfit::scalar(), SiStripMatchedRecHit2D::stereoClusterRef(), GluedGeomDet::stereoDet(), TrajectoryStateOnSurface::surface(), GloballyPositioned< T >::toLocal(), TrajectoryMeasurement::updatedState(), and PV3DBase< T, PVType, FrameType >::z().

94  {
95  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (mhit.det());
96 
97  auto hitM = build (*gdet->monoDet(),
98  mhit.monoClusterRef());
99  auto hitS = build(*gdet->stereoDet(),
100  mhit.stereoClusterRef());
101 
102  // we should find a faster way
103  LocalPoint firstLocalPos =
104  itm.updatedState().surface().toLocal(gdet->monoDet()->position());
105  LocalPoint secondLocalPos =
106  itm.updatedState().surface().toLocal(gdet->stereoDet()->position());
107  LocalVector Delta = secondLocalPos - firstLocalPos;
108  float scalar = Delta.z() * zdir;
109  // hit along the direction
110  if(scalar<0) {
111  hits.push_back(hitS);
112  hits.push_back(hitM);
113  } else {
114  hits.push_back(hitM);
115  hits.push_back(hitS);
116  }
117 
118  }
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
void push_back(D *&d)
Definition: OwnVector.h:274
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:41
T z() const
Definition: PV3DBase.h:64
BaseTrackerRecHit * build(GeomDetUnit const &idet, OmniClusterRef const &clus) const
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:183

Member Data Documentation

bool Traj2TrackHits::keepOrder
private

Definition at line 21 of file Traj2TrackHits.h.

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

bool Traj2TrackHits::removeNoDet
private

Definition at line 22 of file Traj2TrackHits.h.

Referenced by copy(), and split().

const StripClusterParameterEstimator* Traj2TrackHits::theCPE
private

Definition at line 20 of file Traj2TrackHits.h.

Referenced by build().