CMS 3D CMS Logo

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

#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
*, TrajectoryStateOnSurface
DetWithState
 
typedef BoundSurface::PositionType PositionType
 
typedef BoundSurface::RotationType RotationType
 
typedef TrajectoryStateOnSurface TrajectoryState
 

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const __attribute__((cold))
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const __attribute__((cold))
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
 
 TOBRod (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets) __attribute__((cold))
 
 ~TOBRod () __attribute__((cold))
 
- Public Member Functions inherited from DetRod
virtual const PlanespecificSurface () const
 Return the rod surface as a Plane. More...
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
virtual ~DetRod ()
 
- 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 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 16 of file TOBRod.h.

Member Typedef Documentation

Definition at line 18 of file TOBRod.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file TOBRod.cc.

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

30  :
31  DetRod(true),
32  theInnerDets(innerDets),theOuterDets(outerDets)
33 {
34  theDets.assign(theInnerDets.begin(),theInnerDets.end());
35  theDets.insert(theDets.end(),theOuterDets.begin(),theOuterDets.end());
36 
37 
38  RodPlaneBuilderFromDet planeBuilder;
39  setPlane( planeBuilder( theDets));
40  theInnerPlane = planeBuilder( theInnerDets);
41  theOuterPlane = planeBuilder( theOuterDets);
42 
43 
44  sort(theDets.begin(),theDets.end(),DetZLess());
45  sort(theInnerDets.begin(),theInnerDets.end(),DetZLess());
46  sort(theOuterDets.begin(),theOuterDets.end(),DetZLess());
49 
50 
51 
52  LogDebug("TkDetLayers") << "==== DEBUG TOBRod =====" ;
53  for (vector<const GeomDet*>::const_iterator i=theInnerDets.begin();
54  i != theInnerDets.end(); i++){
55  LogDebug("TkDetLayers") << "inner TOBRod's Det pos z,perp,eta,phi: "
56  << (**i).position().z() << " , "
57  << (**i).position().perp() << " , "
58  << (**i).position().eta() << " , "
59  << (**i).position().phi() ;
60  }
61 
62  for (vector<const GeomDet*>::const_iterator i=theOuterDets.begin();
63  i != theOuterDets.end(); i++){
64  LogDebug("TkDetLayers") << "outer TOBRod's Det pos z,perp,eta,phi: "
65  << (**i).position().z() << " , "
66  << (**i).position().perp() << " , "
67  << (**i).position().eta() << " , "
68  << (**i).position().phi() ;
69  }
70  LogDebug("TkDetLayers") << "==== end DEBUG TOBRod =====" ;
71 
72 
73 
74 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
BinFinderType theOuterBinFinder
Definition: TOBRod.h:81
std::vector< const GeomDet * > theInnerDets
Definition: TOBRod.h:74
PeriodicBinFinderInZ< float > BinFinderType
Definition: TOBRod.h:18
std::vector< const GeomDet * > theDets
Definition: TOBRod.h:73
std::vector< const GeomDet * > theOuterDets
Definition: TOBRod.h:75
ReferenceCountingPointer< Plane > theOuterPlane
Definition: TOBRod.h:78
BinFinderType theInnerBinFinder
Definition: TOBRod.h:80
ReferenceCountingPointer< Plane > theInnerPlane
Definition: TOBRod.h:77
Definition: DetRod.h:13
void setPlane(Plane *plane)
Set the rod&#39;s plane.
Definition: DetRod.h:32
TOBRod::~TOBRod ( )

Definition at line 76 of file TOBRod.cc.

76  {
77 
78 }

Member Function Documentation

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

Definition at line 177 of file TOBRod.cc.

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

Referenced by groupedCompatibleDetsV().

182 {
183 
184  const vector<const GeomDet*>& sRod( subRod( crossing.subLayerIndex()));
185  return CompatibleDetToGroupAdder::add( *sRod[crossing.closestDetIndex()],
186  tsos, prop, est, result);
187 }
int closestDetIndex() const
const std::vector< const GeomDet * > & subRod(int ind) const
Definition: TOBRod.h:67
int subLayerIndex() const
tuple result
Definition: query.py:137
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
virtual const std::vector<const GeomDet*>& TOBRod::basicComponents ( ) const
inlinevirtual

Implements GeometricSearchDet.

Definition at line 26 of file TOBRod.h.

References theDets.

26 {return theDets;}
std::vector< const GeomDet * > theDets
Definition: TOBRod.h:73
pair< bool, TrajectoryStateOnSurface > TOBRod::compatible ( const TrajectoryStateOnSurface ts,
const Propagator ,
const MeasurementEstimator  
) const
virtual

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 87 of file TOBRod.cc.

88  {
89  edm::LogError("TkDetLayers") << "temporary dummy implementation of TOBRod::compatible()!!" ;
90  return pair<bool,TrajectoryStateOnSurface>();
91 }
const vector< const GeometricSearchDet * > & TOBRod::components ( ) const
virtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 82 of file TOBRod.cc.

82  {
83  throw DetLayerException("TOBRod doesn't have GeometricSearchDet components");
84 }
Common base class.
SubLayerCrossings TOBRod::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const
private

Definition at line 138 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().

140 {
141  GlobalPoint startPos( startingState.globalPosition());
142  GlobalVector startDir( startingState.globalMomentum());
143  double rho( startingState.transverseCurvature());
144 
145  HelixBarrelPlaneCrossingByCircle crossing( startPos, startDir, rho, propDir);
146 
147 
148  std::pair<bool,double> outerPath = crossing.pathLength( *theOuterPlane);
149  if (!outerPath.first) return SubLayerCrossings();
150  GlobalPoint gOuterPoint( crossing.position(outerPath.second));
151 
152  std::pair<bool,double> innerPath = crossing.pathLength( *theInnerPlane);
153  if (!innerPath.first) return SubLayerCrossings();
154  GlobalPoint gInnerPoint( crossing.position(innerPath.second));
155 
156 
157  int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.z());
158  float innerDist = std::abs( theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.z());
159  SubLayerCrossing innerSLC( 0, innerIndex, gInnerPoint);
160 
161  int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.z());
162  float outerDist = std::abs( theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.z());
163  SubLayerCrossing outerSLC( 1, outerIndex, gOuterPoint);
164 
165  if (innerDist < outerDist) {
166  return SubLayerCrossings( innerSLC, outerSLC, 0);
167  }
168  else {
169  return SubLayerCrossings( outerSLC, innerSLC, 1);
170  }
171 }
BinFinderType theOuterBinFinder
Definition: TOBRod.h:81
Definition: DDAxes.h:10
virtual T binPosition(int ind) const
the middle of the bin
virtual int binIndex(T z) const
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:78
BinFinderType theInnerBinFinder
Definition: TOBRod.h:80
ReferenceCountingPointer< Plane > theInnerPlane
Definition: TOBRod.h:77
float TOBRod::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 190 of file TOBRod.cc.

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

Referenced by groupedCompatibleDetsV().

193 {
194  return
195  est.maximalLocalDisplacement(tsos, det->surface()).y();
196 }
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
void TOBRod::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 98 of file TOBRod.cc.

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

101  {
102 
103  SubLayerCrossings crossings;
104  crossings = computeCrossings( tsos, prop.propagationDirection());
105  if(! crossings.isValid()) return;
106 
107  std::vector<DetGroup> closestResult;
108  addClosest( tsos, prop, est, crossings.closest(), closestResult);
109  if (closestResult.empty()){
110  std::vector<DetGroup> nextResult;
111  addClosest( tsos, prop, est, crossings.other(), nextResult);
112  if(nextResult.empty()) return;
113 
114  DetGroupElement nextGel( nextResult.front().front());
115  int crossingSide = LayerCrossingSide().barrelSide( nextGel.trajectoryState(), prop);
116  DetGroupMerger::orderAndMergeTwoLevels( std::move(closestResult), std::move(nextResult), result,
117  crossings.closestIndex(), crossingSide);
118  } else {
119 
120  DetGroupElement closestGel( closestResult.front().front());
121  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
122 
123  searchNeighbors( tsos, prop, est, crossings.closest(), window,
124  closestResult, false);
125 
126  std::vector<DetGroup> nextResult;
127  searchNeighbors( tsos, prop, est, crossings.other(), window,
128  nextResult, true);
129 
130  int crossingSide = LayerCrossingSide().barrelSide( closestGel.trajectoryState(), prop);
131  DetGroupMerger::orderAndMergeTwoLevels( std::move(closestResult), std::move(nextResult), result,
132  crossings.closestIndex(), crossingSide);
133  }
134 }
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
Definition: TOBRod.cc:190
def window
Definition: svgfig.py:642
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
Definition: Propagator.h:155
int closestIndex() const
tuple result
Definition: query.py:137
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
Definition: TOBRod.cc:138
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 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:228
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TOBRod.cc:177
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 228 of file TOBRod.cc.

References Clusterizer1DCommons::add(), SubLayerCrossing::closestDetIndex(), muon::overlap(), SubLayerCrossing::position(), SubLayerCrossing::subLayerIndex(), subRod(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV().

235 {
236  GlobalPoint gCrossingPos = crossing.position();
237 
238  const vector<const GeomDet*>& sRod( subRod( crossing.subLayerIndex()));
239 
240  int closestIndex = crossing.closestDetIndex();
241  int negStartIndex = closestIndex-1;
242  int posStartIndex = closestIndex+1;
243 
244  if (checkClosest) { // must decide if the closest is on the neg or pos side
245  if (gCrossingPos.z() < sRod[closestIndex]->surface().position().z()) {
246  posStartIndex = closestIndex;
247  }
248  else {
249  negStartIndex = closestIndex;
250  }
251  }
252 
253  typedef CompatibleDetToGroupAdder Adder;
254  for (int idet=negStartIndex; idet >= 0; idet--) {
255  if (!overlap( gCrossingPos, *sRod[idet], window)) break;
256  if (!Adder::add( *sRod[idet], tsos, prop, est, result)) break;
257  }
258  for (int idet=posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
259  if (!overlap( gCrossingPos, *sRod[idet], window)) break;
260  if (!Adder::add( *sRod[idet], tsos, prop, est, result)) break;
261  }
262 }
def window
Definition: svgfig.py:642
int closestDetIndex() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
const GlobalPoint & position() const
const std::vector< const GeomDet * > & subRod(int ind) const
Definition: TOBRod.h:67
int subLayerIndex() const
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
const std::vector<const GeomDet*>& TOBRod::subRod ( int  ind) const
inlineprivate

Definition at line 67 of file TOBRod.h.

References theInnerDets, and theOuterDets.

Referenced by addClosest(), and searchNeighbors().

67  {
68  return (ind==0 ? theInnerDets : theOuterDets);
69  }
std::vector< const GeomDet * > theInnerDets
Definition: TOBRod.h:74
std::vector< const GeomDet * > theOuterDets
Definition: TOBRod.h:75

Member Data Documentation

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

Definition at line 73 of file TOBRod.h.

Referenced by basicComponents(), and TOBRod().

BinFinderType TOBRod::theInnerBinFinder
private

Definition at line 80 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

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

Definition at line 74 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

ReferenceCountingPointer<Plane> TOBRod::theInnerPlane
private

Definition at line 77 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

BinFinderType TOBRod::theOuterBinFinder
private

Definition at line 81 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

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

Definition at line 75 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

ReferenceCountingPointer<Plane> TOBRod::theOuterPlane
private

Definition at line 78 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().