CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
RecHitsSortedInPhi Class Reference

#include <RecHitsSortedInPhi.h>

Classes

struct  HitLessPhi
 
class  HitWithPhi
 

Public Types

using DoubleRange = std::array< int, 4 >
 
typedef BaseTrackerRecHit const * Hit
 
typedef std::vector< HitWithPhi >::const_iterator HitIter
 
typedef std::pair< HitIter, HitIterRange
 

Public Member Functions

Range all () const
 
DoubleRange doubleRange (float phiMin, float phiMax) const
 
bool empty () const
 
GlobalPoint gp (int i) const
 
float gv (int i) const
 
std::vector< Hithits () const
 
std::vector< Hithits (float phiMin, float phiMax) const
 
void hits (float phiMin, float phiMax, std::vector< Hit > &result) const
 
float phi (int i) const
 
 RecHitsSortedInPhi (const std::vector< Hit > &hits, GlobalPoint const &origin, DetLayer const *il)
 
float rv (int i) const
 
std::size_t size () const
 
Range unsafeRange (float phiMin, float phiMax) const
 

Static Public Member Functions

static void copyResult (const Range &range, std::vector< Hit > &result)
 

Public Attributes

std::vector< float > drphi
 
std::vector< float > du
 
std::vector< float > dv
 
bool isBarrel
 
DetLayer const * layer
 
std::vector< float > lphi
 
std::vector< HitWithPhitheHits
 
GlobalPoint theOrigin
 
std::vector< float > u
 
std::vector< float > v
 
std::vector< float > x
 
std::vector< float > y
 
std::vector< float > z
 

Detailed Description

A RecHit container sorted in phi. Provides fast access for hits in a given phi window using binary search.

Definition at line 17 of file RecHitsSortedInPhi.h.

Member Typedef Documentation

◆ DoubleRange

using RecHitsSortedInPhi::DoubleRange = std::array<int, 4>

Definition at line 41 of file RecHitsSortedInPhi.h.

◆ Hit

Definition at line 19 of file RecHitsSortedInPhi.h.

◆ HitIter

typedef std::vector<HitWithPhi>::const_iterator RecHitsSortedInPhi::HitIter

Definition at line 38 of file RecHitsSortedInPhi.h.

◆ Range

Definition at line 39 of file RecHitsSortedInPhi.h.

Constructor & Destructor Documentation

◆ RecHitsSortedInPhi()

RecHitsSortedInPhi::RecHitsSortedInPhi ( const std::vector< Hit > &  hits,
GlobalPoint const &  origin,
DetLayer const *  il 
)

Definition at line 7 of file RecHitsSortedInPhi.cc.

8  : layer(il),
9  isBarrel(il->isBarrel()),
10  x(hits.size()),
11  y(hits.size()),
12  z(hits.size()),
13  drphi(hits.size()),
14  u(hits.size()),
15  v(hits.size()),
16  du(hits.size()),
17  dv(hits.size()),
18  lphi(hits.size()) {
19  // standard region have origin as 0,0,z (not true!!!!0
20  // cosmic region never used here
21  // assert(origin.x()==0 && origin.y()==0);
22 
23  theHits.reserve(hits.size());
24  for (auto const& hp : hits)
25  theHits.emplace_back(hp);
26 
27  std::sort(theHits.begin(), theHits.end(), HitLessPhi());
28 
29  for (unsigned int i = 0; i != theHits.size(); ++i) {
30  auto const& h = *theHits[i].hit();
31  auto const& gs = static_cast<BaseTrackerRecHit const&>(h).globalState();
32  auto loc = gs.position - origin.basicVector();
33  float lr = loc.perp();
34  // float lr = gs.position.perp();
35  float lz = gs.position.z();
36  float dr = gs.errorR;
37  float dz = gs.errorZ;
38  // r[i] = gs.position.perp();
39  // phi[i] = gs.position.barePhi();
40  x[i] = gs.position.x();
41  y[i] = gs.position.y();
42  z[i] = lz;
43  drphi[i] = gs.errorRPhi;
44  u[i] = isBarrel ? lr : lz;
45  v[i] = isBarrel ? lz : lr;
46  du[i] = isBarrel ? dr : dz;
47  dv[i] = isBarrel ? dz : dr;
48  lphi[i] = loc.barePhi();
49  }
50 }

References PV3DBase< T, PVType, FrameType >::basicVector(), flavorHistoryFilter_cfi::dr, drphi, du, dv, PVValHelper::dz, hits(), trackingPlots::hp, mps_fire::i, isBarrel, lphi, Basic3DVector< T >::perp(), theHits, u, v, x, y, and z.

Member Function Documentation

◆ all()

Range RecHitsSortedInPhi::all ( ) const
inline

◆ copyResult()

static void RecHitsSortedInPhi::copyResult ( const Range range,
std::vector< Hit > &  result 
)
inlinestatic

Definition at line 112 of file RecHitsSortedInPhi.h.

112  {
113  result.reserve(result.size() + (range.second - range.first));
114  for (HitIter i = range.first; i != range.second; i++)
115  result.push_back(i->hit());
116  }

References mps_fire::i, FastTimerService_cff::range, and mps_fire::result.

Referenced by hits().

◆ doubleRange()

RecHitsSortedInPhi::DoubleRange RecHitsSortedInPhi::doubleRange ( float  phiMin,
float  phiMax 
) const

Definition at line 52 of file RecHitsSortedInPhi.cc.

52  {
53  Range r1, r2;
54  if (phiMin < phiMax) {
55  if (phiMin < -Geom::fpi()) {
58  } else if (phiMax > Geom::pi()) {
61  } else {
63  r2 = Range(theHits.begin(), theHits.begin());
64  }
65  } else {
68  }
69 
70  return (DoubleRange){{int(r1.first - theHits.begin()),
71  int(r1.second - theHits.begin()),
72  int(r2.first - theHits.begin()),
73  int(r2.second - theHits.begin())}};
74 }

References Geom::fpi(), Geom::ftwoPi(), createfilelist::int, AlignmentTrackSelector_cfi::phiMax, AlignmentTrackSelector_cfi::phiMin, Geom::pi(), diffTwoXMLs::r1, diffTwoXMLs::r2, theHits, and unsafeRange().

Referenced by HitPairGeneratorFromLayerPair::doublets().

◆ empty()

bool RecHitsSortedInPhi::empty ( void  ) const
inline

◆ gp()

GlobalPoint RecHitsSortedInPhi::gp ( int  i) const
inline

Definition at line 90 of file RecHitsSortedInPhi.h.

90 { return GlobalPoint(x[i], y[i], z[i]); }

References mps_fire::i, x, y, and z.

Referenced by gv().

◆ gv()

float RecHitsSortedInPhi::gv ( int  i) const
inline

Definition at line 88 of file RecHitsSortedInPhi.h.

88 { return isBarrel ? z[i] : gp(i).perp(); } // global v

References gp(), mps_fire::i, isBarrel, PV3DBase< T, PVType, FrameType >::perp(), and z.

◆ hits() [1/3]

std::vector<Hit> RecHitsSortedInPhi::hits ( void  ) const
inline

Definition at line 76 of file RecHitsSortedInPhi.h.

76  {
77  std::vector<Hit> result;
78  result.reserve(theHits.size());
79  for (HitIter i = theHits.begin(); i != theHits.end(); i++)
80  result.push_back(i->hit());
81  return result;
82  }

References mps_fire::i, mps_fire::result, and theHits.

Referenced by hits(), and RecHitsSortedInPhi().

◆ hits() [2/3]

std::vector< RecHitsSortedInPhi::Hit > RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax 
) const

◆ hits() [3/3]

void RecHitsSortedInPhi::hits ( float  phiMin,
float  phiMax,
std::vector< Hit > &  result 
) const

◆ phi()

float RecHitsSortedInPhi::phi ( int  i) const
inline

Definition at line 87 of file RecHitsSortedInPhi.h.

87 { return theHits[i].phi(); }

References mps_fire::i, and theHits.

Referenced by Particle.Particle::__str__(), and ntupleDataFormat.Track::phiPull().

◆ rv()

float RecHitsSortedInPhi::rv ( int  i) const
inline

Definition at line 89 of file RecHitsSortedInPhi.h.

89 { return isBarrel ? u[i] : v[i]; } // dispaced r

References mps_fire::i, isBarrel, u, and v.

Referenced by HitPairGeneratorFromLayerPair::doublets().

◆ size()

std::size_t RecHitsSortedInPhi::size ( void  ) const
inline

◆ unsafeRange()

RecHitsSortedInPhi::Range RecHitsSortedInPhi::unsafeRange ( float  phiMin,
float  phiMax 
) const

Definition at line 99 of file RecHitsSortedInPhi.cc.

99  {
100  auto low = std::lower_bound(theHits.begin(), theHits.end(), HitWithPhi(phiMin), HitLessPhi());
101  return Range(low, std::upper_bound(low, theHits.end(), HitWithPhi(phiMax), HitLessPhi()));
102 }

References LaserClient_cfi::low, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlignmentTrackSelector_cfi::phiMax, AlignmentTrackSelector_cfi::phiMin, theHits, and pfDeepBoostedJetPreprocessParams_cfi::upper_bound.

Referenced by doubleRange(), and hits().

Member Data Documentation

◆ drphi

std::vector<float> RecHitsSortedInPhi::drphi

◆ du

std::vector<float> RecHitsSortedInPhi::du

◆ dv

std::vector<float> RecHitsSortedInPhi::dv

◆ isBarrel

bool RecHitsSortedInPhi::isBarrel

◆ layer

DetLayer const* RecHitsSortedInPhi::layer

◆ lphi

std::vector<float> RecHitsSortedInPhi::lphi

Definition at line 110 of file RecHitsSortedInPhi.h.

Referenced by RecHitsSortedInPhi().

◆ theHits

std::vector<HitWithPhi> RecHitsSortedInPhi::theHits

◆ theOrigin

GlobalPoint RecHitsSortedInPhi::theOrigin

Definition at line 93 of file RecHitsSortedInPhi.h.

◆ u

std::vector<float> RecHitsSortedInPhi::u

Definition at line 106 of file RecHitsSortedInPhi.h.

Referenced by RecHitsSortedInPhi(), and rv().

◆ v

std::vector<float> RecHitsSortedInPhi::v

◆ x

std::vector<float> RecHitsSortedInPhi::x

◆ y

std::vector<float> RecHitsSortedInPhi::y

◆ z

std::vector<float> RecHitsSortedInPhi::z
pfDeepBoostedJetPreprocessParams_cfi.upper_bound
upper_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:16
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
RecHitsSortedInPhi::u
std::vector< float > u
Definition: RecHitsSortedInPhi.h:106
RecHitsSortedInPhi::hits
std::vector< Hit > hits() const
Definition: RecHitsSortedInPhi.h:76
RecHitsSortedInPhi::DoubleRange
std::array< int, 4 > DoubleRange
Definition: RecHitsSortedInPhi.h:41
RecHitsSortedInPhi::copyResult
static void copyResult(const Range &range, std::vector< Hit > &result)
Definition: RecHitsSortedInPhi.h:112
gs
Definition: AbsArchive.cc:45
RecHitsSortedInPhi::z
std::vector< float > z
Definition: RecHitsSortedInPhi.h:102
trackingPlots.hp
hp
Definition: trackingPlots.py:1248
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
Geom::pi
constexpr double pi()
Definition: Pi.h:31
h
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
RecHitsSortedInPhi::lphi
std::vector< float > lphi
Definition: RecHitsSortedInPhi.h:110
RecHitsSortedInPhi::x
std::vector< float > x
Definition: RecHitsSortedInPhi.h:100
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
RecHitsSortedInPhi::theHits
std::vector< HitWithPhi > theHits
Definition: RecHitsSortedInPhi.h:95
RecHitsSortedInPhi::dv
std::vector< float > dv
Definition: RecHitsSortedInPhi.h:109
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
createfilelist.int
int
Definition: createfilelist.py:10
RecHitsSortedInPhi::drphi
std::vector< float > drphi
Definition: RecHitsSortedInPhi.h:103
RecHitsSortedInPhi::isBarrel
bool isBarrel
Definition: RecHitsSortedInPhi.h:98
RecHitsSortedInPhi::du
std::vector< float > du
Definition: RecHitsSortedInPhi.h:108
PVValHelper::dz
Definition: PVValidationHelpers.h:50
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
Geom::ftwoPi
constexpr float ftwoPi()
Definition: Pi.h:36
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
RecHitsSortedInPhi::unsafeRange
Range unsafeRange(float phiMin, float phiMax) const
Definition: RecHitsSortedInPhi.cc:99
RecHitsSortedInPhi::gp
GlobalPoint gp(int i) const
Definition: RecHitsSortedInPhi.h:90
mps_fire.result
result
Definition: mps_fire.py:311
RecHitsSortedInPhi::HitIter
std::vector< HitWithPhi >::const_iterator HitIter
Definition: RecHitsSortedInPhi.h:38
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
Geom::fpi
constexpr float fpi()
Definition: Pi.h:35
RecHitsSortedInPhi::y
std::vector< float > y
Definition: RecHitsSortedInPhi.h:101
RecHitsSortedInPhi::Range
std::pair< HitIter, HitIter > Range
Definition: RecHitsSortedInPhi.h:39
RecHitsSortedInPhi::v
std::vector< float > v
Definition: RecHitsSortedInPhi.h:107
RecHitsSortedInPhi::layer
DetLayer const * layer
Definition: RecHitsSortedInPhi.h:97