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 GeometricSearchDetWithGroups GeometricSearchDet 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 Types inherited from GeometricSearchDetWithGroups
typedef
GeometricSearchDet::DetWithState 
DetWithState
 

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
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 
 TOBRod (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets)
 
 ~TOBRod ()
 
- Public Member Functions inherited from DetRod
virtual const BoundPlanespecificSurface () const
 Return the rod surface as a BoundPlane. 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
 
 GeometricSearchDet ()
 
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
virtual const
Surface::PositionType
position () const
 Returns position of the surface. More...
 
virtual ~GeometricSearchDet ()
 
- Public Member Functions inherited from GeometricSearchDetWithGroups
void compatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
 
bool hasGroups () const
 

Private Member Functions

bool addClosest (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
 
SubLayerCrossings computeCrossings (const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
 
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
 
bool overlap (const GlobalPoint &gpos, const GeomDet &rod, float phiWin) const
 
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
 
const std::vector< const
GeomDet * > & 
subRod (int ind) const
 

Private Attributes

std::vector< const GeomDet * > theDets
 
BinFinderType theInnerBinFinder
 
std::vector< const GeomDet * > theInnerDets
 
ReferenceCountingPointer
< BoundPlane
theInnerPlane
 
BinFinderType theOuterBinFinder
 
std::vector< const GeomDet * > theOuterDets
 
ReferenceCountingPointer
< BoundPlane
theOuterPlane
 

Additional Inherited Members

- Protected Member Functions inherited from DetRod
void setPlane (BoundPlane *plane)
 Set the rod's plane. More...
 
- Protected Attributes inherited from GeometricSearchDet
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 28 of file TOBRod.cc.

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

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

Definition at line 74 of file TOBRod.cc.

74  {
75 
76 }

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

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

Referenced by groupedCompatibleDetsV().

178 {
179 
180  const vector<const GeomDet*>& sRod( subRod( crossing.subLayerIndex()));
181  return CompatibleDetToGroupAdder::add( *sRod[crossing.closestDetIndex()],
182  tsos, prop, est, result);
183 }
int closestDetIndex() const
const std::vector< const GeomDet * > & subRod(int ind) const
Definition: TOBRod.h:68
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)
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:74
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 85 of file TOBRod.cc.

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 80 of file TOBRod.cc.

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

Definition at line 136 of file TOBRod.cc.

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

Referenced by groupedCompatibleDetsV().

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

Definition at line 186 of file TOBRod.cc.

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

Referenced by groupedCompatibleDetsV().

189 {
190  return
191  est.maximalLocalDisplacement(tsos, det->surface()).y();
192 }
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
void TOBRod::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

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

99  {
100 
101  SubLayerCrossings crossings;
102  crossings = computeCrossings( tsos, prop.propagationDirection());
103  if(! crossings.isValid()) return;
104 
105  vector<DetGroup> closestResult;
106  addClosest( tsos, prop, est, crossings.closest(), closestResult);
107  if (closestResult.empty()){
108  vector<DetGroup> nextResult;
109  addClosest( tsos, prop, est, crossings.other(), nextResult);
110  if(nextResult.empty()) return;
111 
112  DetGroupElement nextGel( nextResult.front().front());
113  int crossingSide = LayerCrossingSide().barrelSide( nextGel.trajectoryState(), prop);
114  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
115  crossings.closestIndex(), crossingSide);
116  } else {
117 
118  DetGroupElement closestGel( closestResult.front().front());
119  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
120 
121  searchNeighbors( tsos, prop, est, crossings.closest(), window,
122  closestResult, false);
123 
124  vector<DetGroup> nextResult;
125  searchNeighbors( tsos, prop, est, crossings.other(), window,
126  nextResult, true);
127 
128  int crossingSide = LayerCrossingSide().barrelSide( closestGel.trajectoryState(), prop);
129  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
130  crossings.closestIndex(), crossingSide);
131  }
132 }
static void orderAndMergeTwoLevels(const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
def window
Definition: svgfig.py:642
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
int closestIndex() const
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
Definition: TOBRod.cc:136
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
Definition: TOBRod.cc:173
tuple result
Definition: query.py:137
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
Definition: TOBRod.cc:186
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
Definition: TOBRod.cc:197
const SubLayerCrossing & other() const
int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
returns 0 if barrel layer crossed from inside, 1 if from outside
const SubLayerCrossing & closest() const
bool TOBRod::overlap ( const GlobalPoint gpos,
const GeomDet rod,
float  phiWin 
) const
private

Definition at line 235 of file TOBRod.cc.

References BoundSurface::bounds(), Bounds::length(), GeomDet::surface(), GloballyPositioned< T >::toLocal(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by searchNeighbors().

236 {
237  // check if the z window around TSOS overlaps with the detector theDet (with a 1% margin added)
238 
239  // const float tolerance = 0.1;
240  const float relativeMargin = 1.01;
241 
242  LocalPoint localCrossPoint( det.surface().toLocal(crossPoint));
243  // if (fabs(localCrossPoint.z()) > tolerance) {
244  // edm::LogInfo(TkDetLayers) << "TOBRod::overlap calculation assumes point on surface, but it is off by "
245  // << localCrossPoint.z() ;
246  // }
247 
248  float localY = localCrossPoint.y();
249  float detHalfLength = det.surface().bounds().length()/2.;
250 
251  // edm::LogInfo(TkDetLayers) << "TOBRod::overlap: Det at " << det.position() << " hit at " << localY
252  // << " Window " << window << " halflength " << detHalfLength ;
253 
254  if ( ( fabs(localY)-window) < relativeMargin*detHalfLength ) { // FIXME: margin hard-wired!
255  return true;
256  } else {
257  return false;
258  }
259 }
def window
Definition: svgfig.py:642
T y() const
Definition: PV3DBase.h:62
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 197 of file TOBRod.cc.

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

Referenced by groupedCompatibleDetsV().

204 {
205  GlobalPoint gCrossingPos = crossing.position();
206 
207  const vector<const GeomDet*>& sRod( subRod( crossing.subLayerIndex()));
208 
209  int closestIndex = crossing.closestDetIndex();
210  int negStartIndex = closestIndex-1;
211  int posStartIndex = closestIndex+1;
212 
213  if (checkClosest) { // must decide if the closest is on the neg or pos side
214  if (gCrossingPos.z() < sRod[closestIndex]->surface().position().z()) {
215  posStartIndex = closestIndex;
216  }
217  else {
218  negStartIndex = closestIndex;
219  }
220  }
221 
222  typedef CompatibleDetToGroupAdder Adder;
223  for (int idet=negStartIndex; idet >= 0; idet--) {
224  if (!overlap( gCrossingPos, *sRod[idet], window)) break;
225  if (!Adder::add( *sRod[idet], tsos, prop, est, result)) break;
226  }
227  for (int idet=posStartIndex; idet < static_cast<int>(sRod.size()); idet++) {
228  if (!overlap( gCrossingPos, *sRod[idet], window)) break;
229  if (!Adder::add( *sRod[idet], tsos, prop, est, result)) break;
230  }
231 }
def window
Definition: svgfig.py:642
int closestDetIndex() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
const GlobalPoint & position() const
const std::vector< const GeomDet * > & subRod(int ind) const
Definition: TOBRod.h:68
int subLayerIndex() const
T z() const
Definition: PV3DBase.h:63
tuple result
Definition: query.py:137
bool overlap(const GlobalPoint &gpos, const GeomDet &rod, float phiWin) const
Definition: TOBRod.cc:235
const std::vector<const GeomDet*>& TOBRod::subRod ( int  ind) const
inlineprivate

Definition at line 68 of file TOBRod.h.

References theInnerDets, and theOuterDets.

Referenced by addClosest(), and searchNeighbors().

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

Member Data Documentation

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

Definition at line 74 of file TOBRod.h.

Referenced by basicComponents(), and TOBRod().

BinFinderType TOBRod::theInnerBinFinder
private

Definition at line 81 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

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

Definition at line 75 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

ReferenceCountingPointer<BoundPlane> TOBRod::theInnerPlane
private

Definition at line 78 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

BinFinderType TOBRod::theOuterBinFinder
private

Definition at line 82 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().

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

Definition at line 76 of file TOBRod.h.

Referenced by subRod(), and TOBRod().

ReferenceCountingPointer<BoundPlane> TOBRod::theOuterPlane
private

Definition at line 79 of file TOBRod.h.

Referenced by computeCrossings(), and TOBRod().