CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Traj2TrackHits Class Reference

#include <Traj2TrackHits.h>

Public Types

using Chi2sFive = std::vector< unsigned char >
 
using TrajParams = std::vector< LocalTrajectoryParameters >
 

Public Member Functions

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

Static Public Member Functions

static unsigned char toChi2x5 (float chi2)
 

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, TrajParams &trajParams, Chi2sFive &chi2s) 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 =false
 
bool removeNoDet =true
 
const StripClusterParameterEstimatortheCPE = 0
 

Detailed Description

Definition at line 18 of file Traj2TrackHits.h.

Member Typedef Documentation

using Traj2TrackHits::Chi2sFive = std::vector<unsigned char>

Definition at line 25 of file Traj2TrackHits.h.

Definition at line 24 of file Traj2TrackHits.h.

Constructor & Destructor Documentation

Traj2TrackHits::Traj2TrackHits ( )
inline

Definition at line 30 of file Traj2TrackHits.h.

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

Definition at line 32 of file Traj2TrackHits.h.

32  :
33  theCPE(static_cast<TkTransientTrackingRecHitBuilder const *>(builder)->stripClusterParameterEstimator()),
34  keepOrder(ikeepOrder), removeNoDet(noNoDet) {}
const StripClusterParameterEstimator * theCPE

Member Function Documentation

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

Definition at line 113 of file Traj2TrackHits.h.

References makeMuonMisalignmentScenario::endcap, GeomDetType::isEndcap(), StripClusterParameterEstimator::localParameters(), hpstanc_transforms::max, OmniClusterRef::stripCluster(), and GeomDet::type().

Referenced by split().

114  {
115  //Use 2D SiStripRecHit in endcap
116  bool endcap = idet.type().isEndcap();
117  auto && lv = theCPE->localParameters(clus.stripCluster(),idet);
118  if (endcap) return new SiStripRecHit2D(lv.first,lv.second,idet,clus);
119  return new SiStripRecHit1D(lv.first, LocalError(lv.second.xx(),0.f,std::numeric_limits<float>::max()),idet,clus);
120  }
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters &ltp) const
const StripClusterParameterEstimator * theCPE
TrackingRecHit* Traj2TrackHits::clone ( BaseTrackerRecHit const &  hit2D) const
inlineprivate

Definition at line 101 of file Traj2TrackHits.h.

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

Referenced by split().

101  {
102  auto const & detU = *hit2D.detUnit();
103  //Use 2D SiStripRecHit in endcap
104  bool endcap = detU.type().isEndcap();
105  if (endcap) return hit2D.clone();
106  return new SiStripRecHit1D(hit2D.localPosition(),
107  LocalError(hit2D.localPositionError().xx(),0.f,std::numeric_limits<float>::max()),
108  *hit2D.det(), hit2D.firstClusterRef());
109 
110  }
template<typename HI >
void Traj2TrackHits::copy ( HI  itm,
HI  e,
TrackingRecHitCollection hits,
TrajParams trajParams,
Chi2sFive chi2s 
) const
inlineprivate

Definition at line 63 of file Traj2TrackHits.h.

References MillePedeFileConverter_cfg::e, edm::OwnVector< T, P >::push_back(), and toChi2x5().

Referenced by operator()().

63  {
64  for(;itm!=e;++itm) if( (!removeNoDet) | ((*itm).recHitR().det()!=nullptr)) {
65  hits.push_back((*itm).recHitR().cloneHit());
66  trajParams.push_back((*itm).updatedState().localParameters());
67  chi2s.push_back(toChi2x5((*itm).estimate()));
68  }
69  }
static unsigned char toChi2x5(float chi2)
void push_back(D *&d)
Definition: OwnVector.h:290
template<typename HI >
void Traj2TrackHits::copy ( HI  itm,
HI  e,
TrackingRecHitCollection hits 
) const
inlineprivate

Definition at line 72 of file Traj2TrackHits.h.

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

72  {
73  for(;itm!=e;++itm) if( (!removeNoDet) | ((*itm).recHitR().det()!=nullptr)) hits.push_back((*itm).recHitR().cloneHit());
74  }
void push_back(D *&d)
Definition: OwnVector.h:290
void Traj2TrackHits::operator() ( Trajectory const &  traj,
TrackingRecHitCollection hits,
bool  splitting 
) const
inline

Definition at line 36 of file Traj2TrackHits.h.

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

36  {
37  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
38  bool along = traj.direction() == alongMomentum;
39  auto const & meas = traj.measurements();
40  hits.reserve(splitting ? 2*meas.size() : meas.size());
41  if(!splitting){
42  if (keepOrder | along) copy(meas.begin(),meas.end(),hits);
43  else copy(meas.rbegin(),meas.rend(),hits);
44  return;
45  }
46  if (keepOrder | along) split(meas.begin(),meas.end(),hits, along);
47  else split(meas.rbegin(),meas.rend(),hits,along);
48  hits.shrink_to_fit();
49  }
void split(HI itm, HI e, TrackingRecHitCollection &hits, bool along) const
void shrink_to_fit()
Definition: OwnVector.h:128
void copy(HI itm, HI e, TrackingRecHitCollection &hits, TrajParams &trajParams, Chi2sFive &chi2s) const
void reserve(size_t)
Definition: OwnVector.h:284
void Traj2TrackHits::operator() ( Trajectory const &  traj,
TrackingRecHitCollection hits,
TrajParams trajParams,
Chi2sFive chi2s 
) const
inline

Definition at line 51 of file Traj2TrackHits.h.

References alongMomentum, copy(), Trajectory::direction(), hfClusterShapes_cfi::hits, and Trajectory::measurements().

51  {
52  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
53  bool along = traj.direction() == alongMomentum;
54  auto const & meas = traj.measurements();
55  trajParams.reserve(meas.size());
56  chi2s.reserve(meas.size());
57  if (keepOrder | along) copy(meas.begin(),meas.end(),hits, trajParams, chi2s);
58  else copy(meas.rbegin(),meas.rend(),hits, trajParams, chi2s);
59  }
void copy(HI itm, HI e, TrackingRecHitCollection &hits, TrajParams &trajParams, Chi2sFive &chi2s) const
template<typename HI >
void Traj2TrackHits::split ( HI  itm,
HI  e,
TrackingRecHitCollection hits,
bool  along 
) const
inlineprivate

Definition at line 78 of file Traj2TrackHits.h.

References build(), clone(), MillePedeFileConverter_cfg::e, BaseTrackerRecHit::firstClusterRef(), trackerHitRTTI::isUndef(), and edm::OwnVector< T, P >::push_back().

Referenced by operator()().

78  {
79  for(;itm!=e;++itm) {
80  auto const & hit = *(*itm).recHit()->hit();
81  if( (removeNoDet) & ((*itm).recHitR().det()==nullptr)) continue;
82  if(trackerHitRTTI::isUndef(hit) | ( hit.dimension()!=2) ) {
83  hits.push_back(hit.clone());
84  continue;
85  }
86  auto const & thit = static_cast<BaseTrackerRecHit const&>(hit);
87  auto const & clus = thit.firstClusterRef();
88  if (clus.isPixel()) hits.push_back(hit.clone());
89  else if (clus.isPhase2()) hits.push_back(hit.clone());
90  else if (thit.isMatched()) {
91  auto zdir = itm->updatedState().localDirection().z();
92  if (keepOrder & (!along)) zdir = -zdir;
93  split(*itm,static_cast<SiStripMatchedRecHit2D const&>(thit),hits,zdir);
94  }else if (thit.isProjected()) {
95  auto detU = static_cast<ProjectedSiStripRecHit2D const&>(thit).originalDet();
96  hits.push_back(build(*detU, clus));
97  } else hits.push_back(clone(thit));
98  }
99  }
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
virtual OmniClusterRef const & firstClusterRef() const =0
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 122 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().

123  {
124  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (mhit.det());
125 
126  auto hitM = build (*gdet->monoDet(),
127  mhit.monoClusterRef());
128  auto hitS = build(*gdet->stereoDet(),
129  mhit.stereoClusterRef());
130 
131  // we should find a faster way
132  LocalPoint firstLocalPos =
133  itm.updatedState().surface().toLocal(gdet->monoDet()->position());
134  LocalPoint secondLocalPos =
135  itm.updatedState().surface().toLocal(gdet->stereoDet()->position());
136  LocalVector Delta = secondLocalPos - firstLocalPos;
137  float scalar = Delta.z() * zdir;
138  // hit along the direction
139  if(scalar<0) {
140  hits.push_back(hitS);
141  hits.push_back(hitM);
142  } else {
143  hits.push_back(hitM);
144  hits.push_back(hitS);
145  }
146 
147  }
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:48
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
static unsigned char Traj2TrackHits::toChi2x5 ( float  chi2)
inlinestatic

Definition at line 27 of file Traj2TrackHits.h.

References f, and min().

Referenced by copy(), and HITrackClusterRemover::process().

27 { float tc = std::round(5.f*chi2); return std::min(tc,255.f);}
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

bool Traj2TrackHits::keepOrder =false
private

Definition at line 21 of file Traj2TrackHits.h.

bool Traj2TrackHits::removeNoDet =true
private

Definition at line 22 of file Traj2TrackHits.h.

const StripClusterParameterEstimator* Traj2TrackHits::theCPE = 0
private

Definition at line 20 of file Traj2TrackHits.h.