CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TOBRod Class Referencefinal

#include <TOBRod.h>

Inheritance diagram for TOBRod:
DetRod GeometricSearchDet

Public Types

typedef PeriodicBinFinderInZ< float > BinFinderType
 
- Public Types inherited from GeometricSearchDet
typedef std::pair< const GeomDet *, TrajectoryStateOnSurfaceDetWithState
 
typedef BoundSurface::PositionType PositionType
 
typedef BoundSurface::RotationType RotationType
 
typedef TrajectoryStateOnSurface TrajectoryState
 

Public Member Functions

const std::vector< const GeomDet * > & basicComponents () const override
 
std::pair< bool, TrajectoryStateOnSurfacecompatible (const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const override __attribute__((cold))
 
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))
 
 TOBRod (std::vector< const GeomDet *> &innerDets, std::vector< const GeomDet *> &outerDets) __attribute__((cold))
 
 ~TOBRod () override __attribute__((cold))
 
- Public Member Functions inherited from DetRod
 GeometricSearchDet (bool doHaveGroups)
 
virtual const PlanespecificSurface () const final
 Return the rod surface as a Plane. More...
 
const BoundSurfacesurface () const final
 The surface of the GeometricSearchDet. More...
 
 ~DetRod () 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::PositionTypeposition () const
 Returns position of the surface. More...
 
virtual ~GeometricSearchDet ()
 

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))
 
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) 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 * > & subRod (int ind) const
 

Private Attributes

std::vector< const GeomDet * > theDets
 
BinFinderType theInnerBinFinder
 
std::vector< const GeomDet * > theInnerDets
 
ReferenceCountingPointer< PlanetheInnerPlane
 
BinFinderType theOuterBinFinder
 
std::vector< const GeomDet * > theOuterDets
 
ReferenceCountingPointer< PlanetheOuterPlane
 

Additional Inherited Members

- Protected Member Functions inherited from DetRod
void setPlane (Plane *plane)
 Set the rod's plane. More...
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
GeomDetCompatibilityChecker theCompatibilityChecker
 

Detailed Description

A concrete implementation for TOB Rod

Definition at line 14 of file TOBRod.h.

Member Typedef Documentation

◆ BinFinderType

Definition at line 16 of file TOBRod.h.

Constructor & Destructor Documentation

◆ TOBRod()

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

Definition at line 25 of file TOBRod.cc.

References mps_fire::i, LogDebug, DetRod::setPlane(), jetUpdater_cfi::sort, theDets, theInnerBinFinder, theInnerDets, theInnerPlane, theOuterBinFinder, theOuterDets, and theOuterPlane.

26  : DetRod(true), theInnerDets(innerDets), theOuterDets(outerDets) {
27  theDets.assign(theInnerDets.begin(), theInnerDets.end());
28  theDets.insert(theDets.end(), theOuterDets.begin(), theOuterDets.end());
29 
30  RodPlaneBuilderFromDet planeBuilder;
31  setPlane(planeBuilder(theDets));
32  theInnerPlane = planeBuilder(theInnerDets);
33  theOuterPlane = planeBuilder(theOuterDets);
34 
35  sort(theDets.begin(), theDets.end(), DetZLess());
36  sort(theInnerDets.begin(), theInnerDets.end(), DetZLess());
37  sort(theOuterDets.begin(), theOuterDets.end(), DetZLess());
40 
41  LogDebug("TkDetLayers") << "==== DEBUG TOBRod =====";
42  for (vector<const GeomDet*>::const_iterator i = theInnerDets.begin(); i != theInnerDets.end(); i++) {
43  LogDebug("TkDetLayers") << "inner TOBRod's Det pos z,perp,eta,phi: " << (**i).position().z() << " , "
44  << (**i).position().perp() << " , " << (**i).position().eta() << " , "
45  << (**i).position().phi();
46  }
47 
48  for (vector<const GeomDet*>::const_iterator i = theOuterDets.begin(); i != theOuterDets.end(); i++) {
49  LogDebug("TkDetLayers") << "outer TOBRod's Det pos z,perp,eta,phi: " << (**i).position().z() << " , "
50  << (**i).position().perp() << " , " << (**i).position().eta() << " , "
51  << (**i).position().phi();
52  }
53  LogDebug("TkDetLayers") << "==== end DEBUG TOBRod =====";
54 }
BinFinderType theOuterBinFinder
Definition: TOBRod.h:72
std::vector< const GeomDet * > theInnerDets
Definition: TOBRod.h:65
PeriodicBinFinderInZ< float > BinFinderType
Definition: TOBRod.h:16
std::vector< const GeomDet * > theDets
Definition: TOBRod.h:64
std::vector< const GeomDet * > theOuterDets
Definition: TOBRod.h:66
ReferenceCountingPointer< Plane > theOuterPlane
Definition: TOBRod.h:69
BinFinderType theInnerBinFinder
Definition: TOBRod.h:71
ReferenceCountingPointer< Plane > theInnerPlane
Definition: TOBRod.h:68
Definition: DetRod.h:13
void setPlane(Plane *plane)
Set the rod&#39;s plane.
Definition: DetRod.h:28
#define LogDebug(id)

◆ ~TOBRod()

TOBRod::~TOBRod ( )
override

Definition at line 56 of file TOBRod.cc.

56 {}

Member Function Documentation

◆ addClosest()

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

Definition at line 138 of file TOBRod.cc.

References CompatibleDetToGroupAdder::add(), SubLayerCrossing::closestDetIndex(), mps_fire::result, SubLayerCrossing::subLayerIndex(), and subRod().

Referenced by groupedCompatibleDetsV().

142  {
143  const vector<const GeomDet*>& sRod(subRod(crossing.subLayerIndex()));
144  return CompatibleDetToGroupAdder::add(*sRod[crossing.closestDetIndex()], tsos, prop, est, result);
145 }
const std::vector< const GeomDet * > & subRod(int ind) const
Definition: TOBRod.h:61
int closestDetIndex() const
int subLayerIndex() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))

◆ basicComponents()

const std::vector<const GeomDet*>& TOBRod::basicComponents ( ) const
inlineoverridevirtual

Implements GeometricSearchDet.

Definition at line 23 of file TOBRod.h.

References theDets.

23 { return theDets; }
std::vector< const GeomDet * > theDets
Definition: TOBRod.h:64

◆ compatible()

pair< bool, TrajectoryStateOnSurface > TOBRod::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 62 of file TOBRod.cc.

64  {
65  edm::LogError("TkDetLayers") << "temporary dummy implementation of TOBRod::compatible()!!";
66  return pair<bool, TrajectoryStateOnSurface>();
67 }
Log< level::Error, false > LogError

◆ components()

const vector< const GeometricSearchDet * > & TOBRod::components ( ) const
overridevirtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 58 of file TOBRod.cc.

58  {
59  throw DetLayerException("TOBRod doesn't have GeometricSearchDet components");
60 }
Common base class.

◆ computeCrossings()

SubLayerCrossings TOBRod::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const
private

Definition at line 105 of file TOBRod.cc.

References funct::abs(), PeriodicBinFinderInZ< T >::binIndex(), PeriodicBinFinderInZ< T >::binPosition(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), rho, theInnerBinFinder, theInnerPlane, theOuterBinFinder, theOuterPlane, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

106  {
107  GlobalPoint startPos(startingState.globalPosition());
108  GlobalVector startDir(startingState.globalMomentum());
109  double rho(startingState.transverseCurvature());
110 
111  HelixBarrelPlaneCrossingByCircle crossing(startPos, startDir, rho, propDir);
112 
113  std::pair<bool, double> outerPath = crossing.pathLength(*theOuterPlane);
114  if (!outerPath.first)
115  return SubLayerCrossings();
116  GlobalPoint gOuterPoint(crossing.position(outerPath.second));
117 
118  std::pair<bool, double> innerPath = crossing.pathLength(*theInnerPlane);
119  if (!innerPath.first)
120  return SubLayerCrossings();
121  GlobalPoint gInnerPoint(crossing.position(innerPath.second));
122 
123  int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.z());
124  float innerDist = std::abs(theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.z());
125  SubLayerCrossing innerSLC(0, innerIndex, gInnerPoint);
126 
127  int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.z());
128  float outerDist = std::abs(theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.z());
129  SubLayerCrossing outerSLC(1, outerIndex, gOuterPoint);
130 
131  if (innerDist < outerDist) {
132  return SubLayerCrossings(innerSLC, outerSLC, 0);
133  } else {
134  return SubLayerCrossings(outerSLC, innerSLC, 1);
135  }
136 }
BinFinderType theOuterBinFinder
Definition: TOBRod.h:72
int binIndex(T z) const override
returns an index in the valid range for the bin that contains Z
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ReferenceCountingPointer< Plane > theOuterPlane
Definition: TOBRod.h:69
BinFinderType theInnerBinFinder
Definition: TOBRod.h:71
T binPosition(int ind) const override
the middle of the bin
ReferenceCountingPointer< Plane > theInnerPlane
Definition: TOBRod.h:68

◆ computeWindowSize()

float TOBRod::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 147 of file TOBRod.cc.

References MeasurementEstimator::maximalLocalDisplacement(), GeomDet::surface(), and y.

Referenced by groupedCompatibleDetsV().

149  {
150  return est.maximalLocalDisplacement(tsos, det->surface()).y();
151 }
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37

◆ groupedCompatibleDetsV()

void TOBRod::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
overridevirtual

Reimplemented from GeometricSearchDet.

Definition at line 69 of file TOBRod.cc.

References addClosest(), LayerCrossingSide::barrelSide(), SubLayerCrossings::closest(), SubLayerCrossings::closestIndex(), computeCrossings(), computeWindowSize(), SubLayerCrossings::isValid(), eostools::move(), DetGroupMerger::orderAndMergeTwoLevels(), SubLayerCrossings::other(), Propagator::propagationDirection(), mps_fire::result, searchNeighbors(), and svgfig::window().

72  {
73  SubLayerCrossings crossings;
74  crossings = computeCrossings(tsos, prop.propagationDirection());
75  if (!crossings.isValid())
76  return;
77 
78  std::vector<DetGroup> closestResult;
79  addClosest(tsos, prop, est, crossings.closest(), closestResult);
80  if (closestResult.empty()) {
81  std::vector<DetGroup> nextResult;
82  addClosest(tsos, prop, est, crossings.other(), nextResult);
83  if (nextResult.empty())
84  return;
85 
86  DetGroupElement nextGel(nextResult.front().front());
87  int crossingSide = LayerCrossingSide().barrelSide(nextGel.trajectoryState(), prop);
89  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
90  } else {
91  DetGroupElement closestGel(closestResult.front().front());
92  float window = computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
93 
94  searchNeighbors(tsos, prop, est, crossings.closest(), window, closestResult, false);
95 
96  std::vector<DetGroup> nextResult;
97  searchNeighbors(tsos, prop, est, crossings.other(), window, nextResult, true);
98 
99  int crossingSide = LayerCrossingSide().barrelSide(closestGel.trajectoryState(), prop);
101  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
102  }
103 }
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
Definition: TOBRod.cc:147
int closestIndex() const
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
Definition: TOBRod.cc:105
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
const SubLayerCrossing & closest() const
const SubLayerCrossing & other() const
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
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: TOBRod.cc:178
def move(src, dest)
Definition: eostools.py:511
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TOBRod.cc:138

◆ searchNeighbors()

void TOBRod::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 178 of file TOBRod.cc.

References PVValHelper::add(), SubLayerCrossing::closestDetIndex(), hltL1SingleMuFiltered5_cfi::overlap, SubLayerCrossing::position(), mps_fire::result, SubLayerCrossing::subLayerIndex(), subRod(), svgfig::window(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV().

184  {
185  const GlobalPoint& gCrossingPos = crossing.position();
186 
187  const vector<const GeomDet*>& sRod(subRod(crossing.subLayerIndex()));
188 
189  int closestIndex = crossing.closestDetIndex();
190  int negStartIndex = closestIndex - 1;
191  int posStartIndex = closestIndex + 1;
192 
193  if (checkClosest) { // must decide if the closest is on the neg or pos side
194  if (gCrossingPos.z() < sRod[closestIndex]->surface().position().z()) {
195  posStartIndex = closestIndex;
196  } else {
197  negStartIndex = closestIndex;
198  }
199  }
200 
201  typedef CompatibleDetToGroupAdder Adder;
202  for (int idet = negStartIndex; idet >= 0; idet--) {
203  if (!overlap(gCrossingPos, *sRod[idet], window))
204  break;
205  if (!Adder::add(*sRod[idet], tsos, prop, est, result))
206  break;
207  }
208  for (int idet = posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
209  if (!overlap(gCrossingPos, *sRod[idet], window))
210  break;
211  if (!Adder::add(*sRod[idet], tsos, prop, est, result))
212  break;
213  }
214 }
const std::vector< const GeomDet * > & subRod(int ind) const
Definition: TOBRod.h:61
T z() const
Definition: PV3DBase.h:61
const GlobalPoint & position() const
int closestDetIndex() const
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
int subLayerIndex() const
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

◆ subRod()

const std::vector<const GeomDet*>& TOBRod::subRod ( int  ind) const
inlineprivate

Definition at line 61 of file TOBRod.h.

References theInnerDets, and theOuterDets.

Referenced by addClosest(), and searchNeighbors().

61 { return (ind == 0 ? theInnerDets : theOuterDets); }
std::vector< const GeomDet * > theInnerDets
Definition: TOBRod.h:65
std::vector< const GeomDet * > theOuterDets
Definition: TOBRod.h:66

Member Data Documentation

◆ theDets

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

Definition at line 64 of file TOBRod.h.

Referenced by basicComponents(), and TOBRod().

◆ theInnerBinFinder

BinFinderType TOBRod::theInnerBinFinder
private

Definition at line 71 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

◆ theInnerDets

std::vector<const GeomDet*> TOBRod::theInnerDets
private

Definition at line 65 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

◆ theInnerPlane

ReferenceCountingPointer<Plane> TOBRod::theInnerPlane
private

Definition at line 68 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

◆ theOuterBinFinder

BinFinderType TOBRod::theOuterBinFinder
private

Definition at line 72 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

◆ theOuterDets

std::vector<const GeomDet*> TOBRod::theOuterDets
private

Definition at line 66 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

◆ theOuterPlane

ReferenceCountingPointer<Plane> TOBRod::theOuterPlane
private

Definition at line 69 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().