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 85 of file Traj2TrackHits.h.

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

Referenced by split().

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

Definition at line 73 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().

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

Definition at line 46 of file Traj2TrackHits.h.

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

Referenced by operator()().

46  {
47  for(;itm!=e;++itm) if( (!removeNoDet) | ((*itm).recHitR().det()!=nullptr)) hits.push_back((*itm).recHitR().clone());
48  }
void push_back(D *&d)
Definition: OwnVector.h:290
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(), edm::OwnVector< T, P >::shrink_to_fit(), 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(splitting ? 2*meas.size() : 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  hits.shrink_to_fit();
42  }
void copy(HI itm, HI e, TrackingRecHitCollection &hits) const
void split(HI itm, HI e, TrackingRecHitCollection &hits, bool along) const
void shrink_to_fit()
Definition: OwnVector.h:128
void reserve(size_t)
Definition: OwnVector.h:284
template<typename HI >
void Traj2TrackHits::split ( HI  itm,
HI  e,
TrackingRecHitCollection hits,
bool  along 
) const
inlineprivate

Definition at line 51 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()().

51  {
52  for(;itm!=e;++itm) {
53  auto const & hit = *(*itm).recHit()->hit();
54  if( (removeNoDet) & ((*itm).recHitR().det()==nullptr)) continue;
55  if(trackerHitRTTI::isUndef(hit) | ( hit.dimension()!=2) ) {
56  hits.push_back(hit.clone());
57  continue;
58  }
59  auto const & thit = static_cast<BaseTrackerRecHit const&>(hit);
60  auto const & clus = thit.firstClusterRef();
61  if (clus.isPixel()) hits.push_back(hit.clone());
62  else if (thit.isMatched()) {
63  auto zdir = itm->updatedState().localDirection().z();
64  if (keepOrder & (!along)) zdir = -zdir;
65  split(*itm,static_cast<SiStripMatchedRecHit2D const&>(thit),hits,zdir);
66  }else if (thit.isProjected()) {
67  auto detU = static_cast<ProjectedSiStripRecHit2D const&>(thit).originalDet();
68  hits.push_back(build(*detU, clus));
69  } else hits.push_back(clone(thit));
70  }
71  }
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:290
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 94 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().

95  {
96  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (mhit.det());
97 
98  auto hitM = build (*gdet->monoDet(),
99  mhit.monoClusterRef());
100  auto hitS = build(*gdet->stereoDet(),
101  mhit.stereoClusterRef());
102 
103  // we should find a faster way
104  LocalPoint firstLocalPos =
105  itm.updatedState().surface().toLocal(gdet->monoDet()->position());
106  LocalPoint secondLocalPos =
107  itm.updatedState().surface().toLocal(gdet->stereoDet()->position());
108  LocalVector Delta = secondLocalPos - firstLocalPos;
109  float scalar = Delta.z() * zdir;
110  // hit along the direction
111  if(scalar<0) {
112  hits.push_back(hitS);
113  hits.push_back(hitM);
114  } else {
115  hits.push_back(hitM);
116  hits.push_back(hitS);
117  }
118 
119  }
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
void push_back(D *&d)
Definition: OwnVector.h:290
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:46
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().