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) const
 
template<typename HI >
void copy (HI itm, HI e, TrackingRecHitCollection &hits, TrajParams &trajParams, Chi2sFive &chi2s) 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 = nullptr
 

Detailed Description

Definition at line 16 of file Traj2TrackHits.h.

Member Typedef Documentation

◆ Chi2sFive

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

Definition at line 23 of file Traj2TrackHits.h.

◆ TrajParams

Definition at line 22 of file Traj2TrackHits.h.

Constructor & Destructor Documentation

◆ Traj2TrackHits() [1/2]

Traj2TrackHits::Traj2TrackHits ( )
inline

Definition at line 31 of file Traj2TrackHits.h.

31 {}

◆ Traj2TrackHits() [2/2]

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

Definition at line 33 of file Traj2TrackHits.h.

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

Member Function Documentation

◆ build()

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

Definition at line 131 of file Traj2TrackHits.h.

131  {
132  //Use 2D SiStripRecHit in endcap
133  bool endcap = idet.type().isEndcap();
134  auto &&lv = theCPE->localParameters(clus.stripCluster(), idet);
135  if (endcap)
136  return new SiStripRecHit2D(lv.first, lv.second, idet, clus);
137  return new SiStripRecHit1D(
138  lv.first, LocalError(lv.second.xx(), 0.f, std::numeric_limits<float>::max()), idet, clus);
139  }

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

Referenced by split().

◆ clone()

TrackingRecHit* Traj2TrackHits::clone ( BaseTrackerRecHit const &  hit2D) const
inlineprivate

Definition at line 119 of file Traj2TrackHits.h.

119  {
120  auto const &detU = *hit2D.detUnit();
121  //Use 2D SiStripRecHit in endcap
122  bool endcap = detU.type().isEndcap();
123  if (endcap)
124  return hit2D.clone();
125  return new SiStripRecHit1D(hit2D.localPosition(),
126  LocalError(hit2D.localPositionError().xx(), 0.f, std::numeric_limits<float>::max()),
127  *hit2D.det(),
128  hit2D.firstClusterRef());
129  }

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

Referenced by split().

◆ copy() [1/2]

template<typename HI >
void Traj2TrackHits::copy ( HI  itm,
HI  e,
TrackingRecHitCollection hits 
) const
inlineprivate

Definition at line 84 of file Traj2TrackHits.h.

84  {
85  for (; itm != e; ++itm)
86  if ((!removeNoDet) | ((*itm).recHitR().det() != nullptr))
87  hits.push_back((*itm).recHitR().cloneHit());
88  }

References MillePedeFileConverter_cfg::e, hfClusterShapes_cfi::hits, and removeNoDet.

◆ copy() [2/2]

template<typename HI >
void Traj2TrackHits::copy ( HI  itm,
HI  e,
TrackingRecHitCollection hits,
TrajParams trajParams,
Chi2sFive chi2s 
) const
inlineprivate

Definition at line 74 of file Traj2TrackHits.h.

74  {
75  for (; itm != e; ++itm)
76  if ((!removeNoDet) | ((*itm).recHitR().det() != nullptr)) {
77  hits.push_back((*itm).recHitR().cloneHit());
78  trajParams.push_back((*itm).updatedState().localParameters());
79  chi2s.push_back(toChi2x5((*itm).estimate()));
80  }
81  }

References MillePedeFileConverter_cfg::e, hfClusterShapes_cfi::hits, removeNoDet, and toChi2x5().

Referenced by operator()().

◆ operator()() [1/2]

void Traj2TrackHits::operator() ( Trajectory const &  traj,
TrackingRecHitCollection hits,
bool  splitting 
) const
inline

Definition at line 38 of file Traj2TrackHits.h.

38  {
39  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
40  bool along = traj.direction() == alongMomentum;
41  auto const &meas = traj.measurements();
42  hits.reserve(splitting ? 2 * meas.size() : meas.size());
43  if (!splitting) {
44  if (keepOrder | along)
45  copy(meas.begin(), meas.end(), hits);
46  else
47  copy(meas.rbegin(), meas.rend(), hits);
48  return;
49  }
50  if (keepOrder | along)
51  split(meas.begin(), meas.end(), hits, along);
52  else
53  split(meas.rbegin(), meas.rend(), hits, along);
54  hits.shrink_to_fit();
55  }

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

◆ operator()() [2/2]

void Traj2TrackHits::operator() ( Trajectory const &  traj,
TrackingRecHitCollection hits,
TrajParams trajParams,
Chi2sFive chi2s 
) const
inline

Definition at line 57 of file Traj2TrackHits.h.

60  {
61  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
62  bool along = traj.direction() == alongMomentum;
63  auto const &meas = traj.measurements();
64  trajParams.reserve(meas.size());
65  chi2s.reserve(meas.size());
66  if (keepOrder | along)
67  copy(meas.begin(), meas.end(), hits, trajParams, chi2s);
68  else
69  copy(meas.rbegin(), meas.rend(), hits, trajParams, chi2s);
70  }

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

◆ split() [1/2]

template<typename HI >
void Traj2TrackHits::split ( HI  itm,
HI  e,
TrackingRecHitCollection hits,
bool  along 
) const
inlineprivate

Definition at line 91 of file Traj2TrackHits.h.

91  {
92  for (; itm != e; ++itm) {
93  auto const &hit = *(*itm).recHit()->hit();
94  if ((removeNoDet) & ((*itm).recHitR().det() == nullptr))
95  continue;
97  hits.push_back(hit.clone());
98  continue;
99  }
100  auto const &thit = static_cast<BaseTrackerRecHit const &>(hit);
101  auto const &clus = thit.firstClusterRef();
102  if (clus.isPixel())
103  hits.push_back(hit.clone());
104  else if (clus.isPhase2())
105  hits.push_back(hit.clone());
106  else if (thit.isMatched()) {
107  auto zdir = itm->updatedState().localDirection().z();
108  if (keepOrder & (!along))
109  zdir = -zdir;
110  split(*itm, static_cast<SiStripMatchedRecHit2D const &>(thit), hits, zdir);
111  } else if (thit.isProjected()) {
112  auto detU = static_cast<ProjectedSiStripRecHit2D const &>(thit).originalDet();
113  hits.push_back(build(*detU, clus));
114  } else
115  hits.push_back(clone(thit));
116  }
117  }

References build(), clone(), MillePedeFileConverter_cfg::e, hfClusterShapes_cfi::hits, trackerHitRTTI::isNotFromCluster(), trackerHitRTTI::isUndef(), keepOrder, and removeNoDet.

Referenced by operator()().

◆ split() [2/2]

void Traj2TrackHits::split ( TrajectoryMeasurement const &  itm,
SiStripMatchedRecHit2D const &  mhit,
TrackingRecHitCollection hits,
float  zdir 
) const
inlineprivate

Definition at line 141 of file Traj2TrackHits.h.

144  {
145  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *>(mhit.det());
146 
147  auto hitM = build(*gdet->monoDet(), mhit.monoClusterRef());
148  auto hitS = build(*gdet->stereoDet(), mhit.stereoClusterRef());
149 
150  // we should find a faster way
151  LocalPoint firstLocalPos = itm.updatedState().surface().toLocal(gdet->monoDet()->position());
152  LocalPoint secondLocalPos = itm.updatedState().surface().toLocal(gdet->stereoDet()->position());
153  LocalVector Delta = secondLocalPos - firstLocalPos;
154  float scalar = Delta.z() * zdir;
155  // hit along the direction
156  if (scalar < 0) {
157  hits.push_back(hitS);
158  hits.push_back(hitM);
159  } else {
160  hits.push_back(hitM);
161  hits.push_back(hitS);
162  }
163  }

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

◆ toChi2x5()

static unsigned char Traj2TrackHits::toChi2x5 ( float  chi2)
inlinestatic

Definition at line 25 of file Traj2TrackHits.h.

25  {
26  float tc = std::round(5.f * chi2);
27  return std::min(tc, 255.f);
28  }

References hltPixelTracks_cff::chi2, f, and min().

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

Member Data Documentation

◆ keepOrder

bool Traj2TrackHits::keepOrder = false
private

Definition at line 19 of file Traj2TrackHits.h.

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

◆ removeNoDet

bool Traj2TrackHits::removeNoDet = true
private

Definition at line 20 of file Traj2TrackHits.h.

Referenced by copy(), and split().

◆ theCPE

const StripClusterParameterEstimator* Traj2TrackHits::theCPE = nullptr
private

Definition at line 18 of file Traj2TrackHits.h.

Referenced by build().

Vector3DBase< float, LocalTag >
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
Traj2TrackHits::toChi2x5
static unsigned char toChi2x5(float chi2)
Definition: Traj2TrackHits.h:25
min
T min(T a, T b)
Definition: MathUtil.h:58
GluedGeomDet::monoDet
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
trackerHitRTTI::isUndef
bool isUndef(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:24
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
trackerHitRTTI::isNotFromCluster
bool isNotFromCluster(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:25
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
Traj2TrackHits::keepOrder
bool keepOrder
Definition: Traj2TrackHits.h:19
Traj2TrackHits::clone
TrackingRecHit * clone(BaseTrackerRecHit const &hit2D) const
Definition: Traj2TrackHits.h:119
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
hitfit::scalar
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:166
Point3DBase< float, LocalTag >
GluedGeomDet
Definition: GluedGeomDet.h:7
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LocalError
Definition: LocalError.h:12
Traj2TrackHits::split
void split(HI itm, HI e, TrackingRecHitCollection &hits, bool along) const
Definition: Traj2TrackHits.h:91
Traj2TrackHits::build
BaseTrackerRecHit * build(GeomDetUnit const &idet, OmniClusterRef const &clus) const
Definition: Traj2TrackHits.h:131
StripClusterParameterEstimator::localParameters
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters &ltp) const
Definition: StripClusterParameterEstimator.h:32
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
GluedGeomDet::stereoDet
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
Traj2TrackHits::theCPE
const StripClusterParameterEstimator * theCPE
Definition: Traj2TrackHits.h:18
Traj2TrackHits::removeNoDet
bool removeNoDet
Definition: Traj2TrackHits.h:20
alongMomentum
Definition: PropagationDirection.h:4
Traj2TrackHits::copy
void copy(HI itm, HI e, TrackingRecHitCollection &hits, TrajParams &trajParams, Chi2sFive &chi2s) const
Definition: Traj2TrackHits.h:74
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37