CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TIDRing Class Referencefinal

#include <TIDRing.h>

Inheritance diagram for TIDRing:
GeometricSearchDet

Public Member Functions

const std::vector< const
GeomDet * > & 
basicComponents () const override
 
std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
 
const std::vector< const
GeometricSearchDet * > & 
components () const override __attribute__((cold))
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
 
virtual const BoundDiskspecificSurface () const
 
const BoundSurfacesurface () const override
 The surface of the GeometricSearchDet. More...
 
 TIDRing (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets)
 
 ~TIDRing () override
 
- Public Member Functions inherited from GeometricSearchDet
virtual std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
virtual void compatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
 
 GeometricSearchDet (bool doHaveGroups)
 
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
bool hasGroups () const
 
virtual const
Surface::PositionType
position () const
 Returns position of the surface. More...
 
virtual ~GeometricSearchDet ()
 

Private Types

typedef PeriodicBinFinderInPhi
< float > 
BinFinderType
 

Private Member Functions

bool addClosest (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
 
SubLayerCrossings computeCrossings (const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
 
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const __attribute__((hot))
 
const std::vector< const
GeomDet * > & 
subLayer (int ind) const
 

Private Attributes

BinFinderType theBackBinFinder
 
std::vector< const GeomDet * > theBackDets
 
ReferenceCountingPointer
< BoundDisk
theBackDisk
 
std::vector< const GeomDet * > theDets
 
ReferenceCountingPointer
< BoundDisk
theDisk
 
BinFinderType theFrontBinFinder
 
std::vector< const GeomDet * > theFrontDets
 
ReferenceCountingPointer
< BoundDisk
theFrontDisk
 

Additional Inherited Members

- Public Types inherited from GeometricSearchDet
typedef std::pair< const
GeomDet
*, TrajectoryStateOnSurface
DetWithState
 
typedef BoundSurface::PositionType PositionType
 
typedef BoundSurface::RotationType RotationType
 
typedef TrajectoryStateOnSurface TrajectoryState
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
GeomDetCompatibilityChecker theCompatibilityChecker
 

Detailed Description

A concrete implementation for TID rings

Definition at line 13 of file TIDRing.h.

Member Typedef Documentation

Definition at line 68 of file TIDRing.h.

Constructor & Destructor Documentation

TIDRing::TIDRing ( std::vector< const GeomDet * > &  innerDets,
std::vector< const GeomDet * > &  outerDets 
)

Definition at line 23 of file TIDRing.cc.

References LogDebug, theBackBinFinder, theBackDets, theBackDisk, theDets, theDisk, theFrontBinFinder, theFrontDets, and theFrontDisk.

24  : GeometricSearchDet(true),
25  theFrontDets(innerDets.begin(), innerDets.end()),
26  theBackDets(outerDets.begin(), outerDets.end()) {
27  theDets.assign(theFrontDets.begin(), theFrontDets.end());
28  theDets.insert(theDets.end(), theBackDets.begin(), theBackDets.end());
29 
30  // the dets should be already phi-ordered. TO BE CHECKED
31  //sort( theFrontDets.begin(), theFrontDets.end(), DetLessPhi() );
32  //sort( theBackDets.begin(), theBackDets.end(), DetLessPhi() );
33 
35 
38 
39  theFrontBinFinder = BinFinderType(theFrontDets.front()->surface().position().phi(), theFrontDets.size());
40  theBackBinFinder = BinFinderType(theBackDets.front()->surface().position().phi(), theBackDets.size());
41 
42  LogDebug("TkDetLayers") << "DEBUG INFO for TIDRing";
43  for (vector<const GeomDet*>::const_iterator it = theFrontDets.begin(); it != theFrontDets.end(); it++) {
44  LogDebug("TkDetLayers") << "frontDet phi,z,r: " << (*it)->surface().position().phi() << " , "
45  << (*it)->surface().position().z() << " , " << (*it)->surface().position().perp();
46  }
47 
48  for (vector<const GeomDet*>::const_iterator it = theBackDets.begin(); it != theBackDets.end(); it++) {
49  LogDebug("TkDetLayers") << "backDet phi,z,r: " << (*it)->surface().position().phi() << " , "
50  << (*it)->surface().position().z() << " , " << (*it)->surface().position().perp();
51  }
52 }
PeriodicBinFinderInPhi< float > BinFinderType
Definition: TIDRing.h:68
std::vector< const GeomDet * > theDets
Definition: TIDRing.h:60
GeometricSearchDet(bool doHaveGroups)
BinFinderType theFrontBinFinder
Definition: TIDRing.h:70
std::vector< const GeomDet * > theFrontDets
Definition: TIDRing.h:61
ReferenceCountingPointer< BoundDisk > theBackDisk
Definition: TIDRing.h:66
ReferenceCountingPointer< BoundDisk > theFrontDisk
Definition: TIDRing.h:65
ReferenceCountingPointer< BoundDisk > theDisk
Definition: TIDRing.h:64
BinFinderType theBackBinFinder
Definition: TIDRing.h:71
std::vector< const GeomDet * > theBackDets
Definition: TIDRing.h:62
#define LogDebug(id)
TIDRing::~TIDRing ( )
override

Definition at line 54 of file TIDRing.cc.

54 {}

Member Function Documentation

bool TIDRing::addClosest ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubLayerCrossing crossing,
std::vector< DetGroup > &  result 
) const
private

Definition at line 131 of file TIDRing.cc.

References CompatibleDetToGroupAdder::add(), SubLayerCrossing::closestDetIndex(), subLayer(), and SubLayerCrossing::subLayerIndex().

Referenced by groupedCompatibleDetsV().

135  {
136  const vector<const GeomDet*>& sub(subLayer(crossing.subLayerIndex()));
137  const GeomDet* det(sub[crossing.closestDetIndex()]);
138  return CompatibleDetToGroupAdder::add(*det, tsos, prop, est, result);
139 }
int closestDetIndex() const
tuple result
Definition: mps_fire.py:311
int subLayerIndex() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
const std::vector< const GeomDet * > & subLayer(int ind) const
Definition: TIDRing.h:57
const std::vector<const GeomDet*>& TIDRing::basicComponents ( ) const
inlineoverridevirtual

Implements GeometricSearchDet.

Definition at line 21 of file TIDRing.h.

References theDets.

21 { return theDets; }
std::vector< const GeomDet * > theDets
Definition: TIDRing.h:60
pair< bool, TrajectoryStateOnSurface > TIDRing::compatible ( const TrajectoryStateOnSurface ts,
const Propagator ,
const MeasurementEstimator  
) const
overridevirtual

tests the geometrical compatibility of the Det with the predicted state. The FreeTrajectoryState argument is propagated to the Det surface using the Propagator argument. The resulting TrajectoryStateOnSurface is tested for compatibility with the surface bounds. If compatible, a std::pair< true, propagatedState> is returned. If the propagation fails, or if the state is not compatible, a std::pair< false, propagatedState> is returned.

Implements GeometricSearchDet.

Definition at line 60 of file TIDRing.cc.

62  {
63  edm::LogError("TkDetLayers") << "temporary dummy implementation of TIDRing::compatible()!!";
64  return pair<bool, TrajectoryStateOnSurface>();
65 }
Log< level::Error, false > LogError
const vector< const GeometricSearchDet * > & TIDRing::components ( ) const
overridevirtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 56 of file TIDRing.cc.

56  {
57  throw DetLayerException("TIDRing doesn't have GeometricSearchDet components");
58 }
Common base class.
SubLayerCrossings TIDRing::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const
private

Definition at line 94 of file TIDRing.cc.

References funct::abs(), PeriodicBinFinderInPhi< T >::binIndex(), srCondWrite_cfg::deltaPhi, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixForwardPlaneCrossing::pathLength(), HelixForwardPlaneCrossing::position(), rho, theBackBinFinder, theBackDets, theBackDisk, theFrontBinFinder, theFrontDets, theFrontDisk, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

95  {
96  HelixPlaneCrossing::PositionType startPos(startingState.globalPosition());
97  HelixPlaneCrossing::DirectionType startDir(startingState.globalMomentum());
98 
99  auto rho = startingState.transverseCurvature();
100 
101  HelixForwardPlaneCrossing crossing(startPos, startDir, rho, propDir);
102 
103  pair<bool, double> frontPath = crossing.pathLength(*theFrontDisk);
104  if (!frontPath.first)
105  return SubLayerCrossings();
106 
107  pair<bool, double> backPath = crossing.pathLength(*theBackDisk);
108  if (!backPath.first)
109  return SubLayerCrossings();
110 
111  GlobalPoint gFrontPoint(crossing.position(frontPath.second));
112  GlobalPoint gBackPoint(crossing.position(backPath.second));
113 
114  int frontIndex = theFrontBinFinder.binIndex(gFrontPoint.barePhi());
115  SubLayerCrossing frontSLC(0, frontIndex, gFrontPoint);
116 
117  int backIndex = theBackBinFinder.binIndex(gBackPoint.barePhi());
118  SubLayerCrossing backSLC(1, backIndex, gBackPoint);
119 
120  // 0ss: frontDisk has index=0, backDisk has index=1
121  float frontDist = std::abs(Geom::deltaPhi(gFrontPoint.barePhi(), theFrontDets[frontIndex]->surface().phi()));
122  float backDist = std::abs(Geom::deltaPhi(gBackPoint.barePhi(), theBackDets[backIndex]->surface().phi()));
123 
124  if (frontDist < backDist) {
125  return SubLayerCrossings(frontSLC, backSLC, 0);
126  } else {
127  return SubLayerCrossings(backSLC, frontSLC, 1);
128  }
129 }
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
BinFinderType theFrontBinFinder
Definition: TIDRing.h:70
std::vector< const GeomDet * > theFrontDets
Definition: TIDRing.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ReferenceCountingPointer< BoundDisk > theBackDisk
Definition: TIDRing.h:66
ReferenceCountingPointer< BoundDisk > theFrontDisk
Definition: TIDRing.h:65
BinFinderType theBackBinFinder
Definition: TIDRing.h:71
std::vector< const GeomDet * > theBackDets
Definition: TIDRing.h:62
void TIDRing::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
overridevirtual

Reimplemented from GeometricSearchDet.

Definition at line 67 of file TIDRing.cc.

References addClosest(), SubLayerCrossings::closest(), SubLayerCrossings::closestIndex(), computeCrossings(), tkDetUtil::computeWindowSize(), LayerCrossingSide::endcapSide(), SubLayerCrossings::isValid(), eostools::move(), DetGroupMerger::orderAndMergeTwoLevels(), SubLayerCrossings::other(), Propagator::propagationDirection(), and searchNeighbors().

Referenced by TIDLayer::groupedCompatibleDetsV().

70  {
71  SubLayerCrossings crossings;
72  crossings = computeCrossings(tsos, prop.propagationDirection());
73  if (!crossings.isValid())
74  return;
75 
76  std::vector<DetGroup> closestResult;
77  addClosest(tsos, prop, est, crossings.closest(), closestResult);
78  if (closestResult.empty())
79  return;
80 
81  DetGroupElement closestGel(closestResult.front().front());
82  float phiWindow = tkDetUtil::computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
83  searchNeighbors(tsos, prop, est, crossings.closest(), phiWindow, closestResult, false);
84 
85  vector<DetGroup> nextResult;
86  searchNeighbors(tsos, prop, est, crossings.other(), phiWindow, nextResult, true);
87 
88  int crossingSide = LayerCrossingSide().endcapSide(closestGel.trajectoryState(), prop);
90  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
91 }
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const __attribute__((hot))
Definition: TIDRing.cc:141
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
Definition: TIDRing.cc:94
int closestIndex() const
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TIDRing.cc:131
tuple result
Definition: mps_fire.py:311
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:10
def move
Definition: eostools.py:511
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
const SubLayerCrossing & other() const
const SubLayerCrossing & closest() const
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
void TIDRing::searchNeighbors ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubLayerCrossing crossing,
float  window,
std::vector< DetGroup > &  result,
bool  checkClosest 
) const
private

Definition at line 141 of file TIDRing.cc.

References PVValHelper::add(), PV3DBase< T, PVType, FrameType >::barePhi(), PeriodicBinFinderInPhi< T >::binIndex(), SubLayerCrossing::closestDetIndex(), tkDetUtil::overlapInPhi(), Geom::phiLess(), SubLayerCrossing::position(), subLayer(), SubLayerCrossing::subLayerIndex(), theBackBinFinder, and theFrontBinFinder.

Referenced by groupedCompatibleDetsV().

147  {
148  const GlobalPoint& gCrossingPos = crossing.position();
149 
150  const vector<const GeomDet*>& sLayer(subLayer(crossing.subLayerIndex()));
151 
152  int closestIndex = crossing.closestDetIndex();
153  int negStartIndex = closestIndex - 1;
154  int posStartIndex = closestIndex + 1;
155 
156  if (checkClosest) { // must decide if the closest is on the neg or pos side
157  if (Geom::phiLess(gCrossingPos.barePhi(), sLayer[closestIndex]->surface().phi())) {
158  posStartIndex = closestIndex;
159  } else {
160  negStartIndex = closestIndex;
161  }
162  }
163 
164  const BinFinderType& binFinder = (crossing.subLayerIndex() == 0 ? theFrontBinFinder : theBackBinFinder);
165 
166  typedef CompatibleDetToGroupAdder Adder;
167  int half = sLayer.size() / 2; // to check if dets are called twice....
168  for (int idet = negStartIndex; idet >= negStartIndex - half; idet--) {
169  const GeomDet& neighborDet = *sLayer[binFinder.binIndex(idet)];
170  if (!tkDetUtil::overlapInPhi(gCrossingPos, neighborDet, window))
171  break;
172  if (!Adder::add(neighborDet, tsos, prop, est, result))
173  break;
174  // maybe also add shallow crossing angle test here???
175  }
176  for (int idet = posStartIndex; idet < posStartIndex + half; idet++) {
177  const GeomDet& neighborDet = *sLayer[binFinder.binIndex(idet)];
178  if (!tkDetUtil::overlapInPhi(gCrossingPos, neighborDet, window))
179  break;
180  if (!Adder::add(neighborDet, tsos, prop, est, result))
181  break;
182  // maybe also add shallow crossing angle test here???
183  }
184 }
PeriodicBinFinderInPhi< float > BinFinderType
Definition: TIDRing.h:68
def window
Definition: svgfig.py:643
int closestDetIndex() const
BinFinderType theFrontBinFinder
Definition: TIDRing.h:70
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.h:18
tuple result
Definition: mps_fire.py:311
const GlobalPoint & position() const
T barePhi() const
Definition: PV3DBase.h:65
int subLayerIndex() const
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
BinFinderType theBackBinFinder
Definition: TIDRing.h:71
const std::vector< const GeomDet * > & subLayer(int ind) const
Definition: TIDRing.h:57
virtual const BoundDisk& TIDRing::specificSurface ( ) const
inlinevirtual

Definition at line 35 of file TIDRing.h.

References theDisk.

35 { return *theDisk; }
ReferenceCountingPointer< BoundDisk > theDisk
Definition: TIDRing.h:64
const std::vector<const GeomDet*>& TIDRing::subLayer ( int  ind) const
inlineprivate

Definition at line 57 of file TIDRing.h.

References theBackDets, and theFrontDets.

Referenced by addClosest(), and searchNeighbors().

57 { return (ind == 0 ? theFrontDets : theBackDets); }
std::vector< const GeomDet * > theFrontDets
Definition: TIDRing.h:61
std::vector< const GeomDet * > theBackDets
Definition: TIDRing.h:62
const BoundSurface& TIDRing::surface ( ) const
inlineoverridevirtual

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 19 of file TIDRing.h.

References theDisk.

Referenced by TIDLayer::ringIndicesByCrossingProximity().

19 { return *theDisk; }
ReferenceCountingPointer< BoundDisk > theDisk
Definition: TIDRing.h:64

Member Data Documentation

BinFinderType TIDRing::theBackBinFinder
private

Definition at line 71 of file TIDRing.h.

Referenced by computeCrossings(), searchNeighbors(), and TIDRing().

std::vector<const GeomDet*> TIDRing::theBackDets
private

Definition at line 62 of file TIDRing.h.

Referenced by computeCrossings(), subLayer(), and TIDRing().

ReferenceCountingPointer<BoundDisk> TIDRing::theBackDisk
private

Definition at line 66 of file TIDRing.h.

Referenced by computeCrossings(), and TIDRing().

std::vector<const GeomDet*> TIDRing::theDets
private

Definition at line 60 of file TIDRing.h.

Referenced by basicComponents(), and TIDRing().

ReferenceCountingPointer<BoundDisk> TIDRing::theDisk
private

Definition at line 64 of file TIDRing.h.

Referenced by specificSurface(), surface(), and TIDRing().

BinFinderType TIDRing::theFrontBinFinder
private

Definition at line 70 of file TIDRing.h.

Referenced by computeCrossings(), searchNeighbors(), and TIDRing().

std::vector<const GeomDet*> TIDRing::theFrontDets
private

Definition at line 61 of file TIDRing.h.

Referenced by computeCrossings(), subLayer(), and TIDRing().

ReferenceCountingPointer<BoundDisk> TIDRing::theFrontDisk
private

Definition at line 65 of file TIDRing.h.

Referenced by computeCrossings(), and TIDRing().