CMS 3D CMS Logo

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

#include <PixelBlade.h>

Inheritance diagram for PixelBlade:
GeometricSearchDetWithGroups GeometricSearchDet

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
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...
 
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 
 PixelBlade (std::vector< const GeomDet * > &frontDets, std::vector< const GeomDet * > &backDets)
 
virtual const BoundDiskSectorspecificSurface () const
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
 ~PixelBlade ()
 
- 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
 
- 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 ()
 

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
 
int findBin (float R, int layer) const
 
GlobalPoint findPosition (int index, int diskSectorIndex) const
 
bool overlap (const GlobalPoint &gpos, const GeomDet &det, 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 * > & 
subBlade (int ind) const
 

Private Attributes

std::vector< const GeomDet * > theBackDets
 
ReferenceCountingPointer
< BoundDiskSector
theBackDiskSector
 
std::vector< const GeomDet * > theDets
 
ReferenceCountingPointer
< BoundDiskSector
theDiskSector
 
std::vector< const GeomDet * > theFrontDets
 
ReferenceCountingPointer
< BoundDiskSector
theFrontDiskSector
 

Additional Inherited Members

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

Detailed Description

A concrete implementation for PixelBlade

Definition at line 14 of file PixelBlade.h.

Constructor & Destructor Documentation

PixelBlade::PixelBlade ( std::vector< const GeomDet * > &  frontDets,
std::vector< const GeomDet * > &  backDets 
)

Definition at line 18 of file PixelBlade.cc.

References LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), theBackDets, theBackDiskSector, theDets, theDiskSector, theFrontDets, theFrontDiskSector, and PV3DBase< T, PVType, FrameType >::z().

19  :
20  theFrontDets(frontDets), theBackDets(backDets)
21 {
22  theDets.assign(theFrontDets.begin(),theFrontDets.end());
23  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
24 
28 
29 
30  //--------- DEBUG INFO --------------
31  LogDebug("TkDetLayers") << "DEBUG INFO for PixelBlade" ;
32  LogDebug("TkDetLayers") << "Blade z, perp, innerRadius, outerR: "
33  << this->position().z() << " , "
34  << this->position().perp() << " , "
35  << theDiskSector->innerRadius() << " , "
36  << theDiskSector->outerRadius() ;
37 
38  for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
39  it!=theFrontDets.end(); it++){
40  LogDebug("TkDetLayers") << "frontDet phi,z,r: "
41  << (*it)->position().phi() << " , "
42  << (*it)->position().z() << " , "
43  << (*it)->position().perp() ;;
44  }
45 
46  for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
47  it!=theBackDets.end(); it++){
48  LogDebug("TkDetLayers") << "backDet phi,z,r: "
49  << (*it)->position().phi() << " , "
50  << (*it)->position().z() << " , "
51  << (*it)->position().perp() ;
52  }
53  //-----------------------------------
54 
55 }
#define LogDebug(id)
ReferenceCountingPointer< BoundDiskSector > theFrontDiskSector
Definition: PixelBlade.h:88
T perp() const
Definition: PV3DBase.h:66
ReferenceCountingPointer< BoundDiskSector > theBackDiskSector
Definition: PixelBlade.h:89
std::vector< const GeomDet * > theFrontDets
Definition: PixelBlade.h:84
std::vector< const GeomDet * > theBackDets
Definition: PixelBlade.h:85
T z() const
Definition: PV3DBase.h:58
virtual const Surface::PositionType & position() const
Returns position of the surface.
std::vector< const GeomDet * > theDets
Definition: PixelBlade.h:83
ReferenceCountingPointer< BoundDiskSector > theDiskSector
Definition: PixelBlade.h:87
PixelBlade::~PixelBlade ( )
inline

Definition at line 20 of file PixelBlade.h.

20 {};

Member Function Documentation

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

Definition at line 156 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

161 {
162 
163  const vector<const GeomDet*>& sBlade( subBlade( crossing.subLayerIndex()));
164  return CompatibleDetToGroupAdder().add( *sBlade[crossing.closestDetIndex()],
165  tsos, prop, est, result);
166 }
int closestDetIndex() const
const std::vector< const GeomDet * > & subBlade(int ind) const
Definition: PixelBlade.h:76
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*>& PixelBlade::basicComponents ( ) const
inlinevirtual

Implements GeometricSearchDet.

Definition at line 25 of file PixelBlade.h.

References theDets.

25 {return theDets;}
std::vector< const GeomDet * > theDets
Definition: PixelBlade.h:83
pair< bool, TrajectoryStateOnSurface > PixelBlade::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 64 of file PixelBlade.cc.

65  {
66  edm::LogError("TkDetLayers") << "temporary dummy implementation of PixelBlade::compatible()!!" ;
67  return pair<bool,TrajectoryStateOnSurface>();
68 }
const vector< const GeometricSearchDet * > & PixelBlade::components ( ) const
virtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 59 of file PixelBlade.cc.

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

Definition at line 113 of file PixelBlade.cc.

References findBin(), findPosition(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), perp(), rho, theBackDiskSector, theFrontDiskSector, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

115 {
116  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition());
117  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum());
118  double rho( startingState.transverseCurvature());
119 
120  HelixArbitraryPlaneCrossing crossing( startPos, startDir, rho, propDir);
121 
122  pair<bool,double> innerPath = crossing.pathLength( *theFrontDiskSector);
123  if (!innerPath.first) return SubLayerCrossings();
124 
125  GlobalPoint gInnerPoint( crossing.position(innerPath.second));
126  //Code for use of binfinder
127  //int innerIndex = theInnerBinFinder.binIndex(gInnerPoint.perp());
128  //float innerDist = fabs( theInnerBinFinder.binPosition(innerIndex) - gInnerPoint.z());
129  int innerIndex = findBin(gInnerPoint.perp(),0);
130  float innerDist = fabs( findPosition(innerIndex,0).perp() - gInnerPoint.perp());
131  SubLayerCrossing innerSLC( 0, innerIndex, gInnerPoint);
132 
133  pair<bool,double> outerPath = crossing.pathLength( *theBackDiskSector);
134  if (!outerPath.first) return SubLayerCrossings();
135 
136  GlobalPoint gOuterPoint( crossing.position(outerPath.second));
137  //Code for use of binfinder
138  //int outerIndex = theOuterBinFinder.binIndex(gOuterPoint.perp());
139  //float outerDist = fabs( theOuterBinFinder.binPosition(outerIndex) - gOuterPoint.perp());
140  int outerIndex = findBin(gOuterPoint.perp(),1);
141  float outerDist = fabs( findPosition(outerIndex,1).perp() - gOuterPoint.perp());
142  SubLayerCrossing outerSLC( 1, outerIndex, gOuterPoint);
143 
144  if (innerDist < outerDist) {
145  return SubLayerCrossings( innerSLC, outerSLC, 0);
146  }
147  else {
148  return SubLayerCrossings( outerSLC, innerSLC, 1);
149  }
150 }
ReferenceCountingPointer< BoundDiskSector > theFrontDiskSector
Definition: PixelBlade.h:88
ReferenceCountingPointer< BoundDiskSector > theBackDiskSector
Definition: PixelBlade.h:89
Definition: DDAxes.h:10
GlobalPoint findPosition(int index, int diskSectorIndex) const
Definition: PixelBlade.cc:264
int findBin(float R, int layer) const
Definition: PixelBlade.cc:245
T perp() const
Magnitude of transverse component.
float PixelBlade::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 169 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

172 {
173  return
174  est.maximalLocalDisplacement(tsos, det->surface()).x();
175 }
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
Definition: DDAxes.h:10
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
int PixelBlade::findBin ( float  R,
int  layer 
) const
private

Definition at line 245 of file PixelBlade.cc.

References i, theBackDets, and theFrontDets.

Referenced by computeCrossings().

246 {
247  vector<const GeomDet*> localDets = diskSectorIndex==0 ? theFrontDets : theBackDets;
248 
249  int theBin = 0;
250  float rDiff = fabs( R - localDets.front()->surface().position().perp());;
251  for (vector<const GeomDet*>::const_iterator i=localDets.begin(); i !=localDets.end(); i++){
252  float testDiff = fabs( R - (**i).surface().position().perp());
253  if ( testDiff < rDiff) {
254  rDiff = testDiff;
255  theBin = i - localDets.begin();
256  }
257  }
258  return theBin;
259 }
int i
Definition: DBlmapReader.cc:9
std::vector< const GeomDet * > theFrontDets
Definition: PixelBlade.h:84
std::vector< const GeomDet * > theBackDets
Definition: PixelBlade.h:85
GlobalPoint PixelBlade::findPosition ( int  index,
int  diskSectorIndex 
) const
private

Definition at line 264 of file PixelBlade.cc.

References theBackDets, and theFrontDets.

Referenced by computeCrossings().

265 {
266  vector<const GeomDet*> diskSector = diskSectorType == 0 ? theFrontDets : theBackDets;
267  return (diskSector[index])->surface().position();
268 }
std::vector< const GeomDet * > theFrontDets
Definition: PixelBlade.h:84
std::vector< const GeomDet * > theBackDets
Definition: PixelBlade.h:85
void PixelBlade::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 73 of file PixelBlade.cc.

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

76  {
77  SubLayerCrossings crossings;
78  crossings = computeCrossings( tsos, prop.propagationDirection());
79  if(! crossings.isValid()) return;
80 
81  vector<DetGroup> closestResult;
82  addClosest( tsos, prop, est, crossings.closest(), closestResult);
83 
84  if (closestResult.empty()){
85  vector<DetGroup> nextResult;
86  addClosest( tsos, prop, est, crossings.other(), nextResult);
87  if(nextResult.empty()) return;
88 
89  DetGroupElement nextGel( nextResult.front().front());
90  int crossingSide = LayerCrossingSide().endcapSide( nextGel.trajectoryState(), prop);
91 
92  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
93  crossings.closestIndex(), crossingSide);
94  }
95  else {
96  DetGroupElement closestGel( closestResult.front().front());
97  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
98 
99  searchNeighbors( tsos, prop, est, crossings.closest(), window,
100  closestResult, false);
101 
102  vector<DetGroup> nextResult;
103  searchNeighbors( tsos, prop, est, crossings.other(), window,
104  nextResult, true);
105 
106  int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
107  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
108  crossings.closestIndex(), crossingSide);
109  }
110 }
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
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
Definition: PixelBlade.cc:169
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
Definition: PixelBlade.cc:113
int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
Definition: PixelBlade.cc:156
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
Definition: PixelBlade.cc:180
tuple result
Definition: query.py:137
const SubLayerCrossing & other() const
const SubLayerCrossing & closest() const
bool PixelBlade::overlap ( const GlobalPoint gpos,
const GeomDet det,
float  phiWin 
) const
private

Definition at line 218 of file PixelBlade.cc.

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

Referenced by searchNeighbors().

219 {
220  // check if the z window around TSOS overlaps with the detector theDet (with a 1% margin added)
221 
222  // const float tolerance = 0.1;
223  const float relativeMargin = 1.01;
224 
225  LocalPoint localCrossPoint( det.surface().toLocal(crossPoint));
226  // if (fabs(localCrossPoint.z()) > tolerance) {
227  // edm::LogInfo(TkDetLayers) << "PixelBlade::overlap calculation assumes point on surface, but it is off by "
228  // << localCrossPoint.z() ;
229  // }
230 
231  float localX = localCrossPoint.x();
232  float detHalfLength = det.surface().bounds().length()/2.;
233 
234  // edm::LogInfo(TkDetLayers) << "PixelBlade::overlap: Det at " << det.position() << " hit at " << localY
235  // << " Window " << window << " halflength " << detHalfLength ;
236 
237  if ( ( fabs(localX)-window) < relativeMargin*detHalfLength ) { // FIXME: margin hard-wired!
238  return true;
239  } else {
240  return false;
241  }
242 }
def window
Definition: svgfig.py:642
virtual float length() const =0
LocalPoint toLocal(const GlobalPoint &gp) const
const Bounds & bounds() const
Definition: BoundSurface.h:89
T x() const
Definition: PV3DBase.h:56
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
void PixelBlade::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 180 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

187 {
188  GlobalPoint gCrossingPos = crossing.position();
189 
190  const vector<const GeomDet*>& sBlade( subBlade( crossing.subLayerIndex()));
191 
192  int closestIndex = crossing.closestDetIndex();
193  int negStartIndex = closestIndex-1;
194  int posStartIndex = closestIndex+1;
195 
196  if (checkClosest) { // must decide if the closest is on the neg or pos side
197  if (gCrossingPos.perp() < sBlade[closestIndex]->surface().position().perp()) {
198  posStartIndex = closestIndex;
199  }
200  else {
201  negStartIndex = closestIndex;
202  }
203  }
204 
205  typedef CompatibleDetToGroupAdder Adder;
206  for (int idet=negStartIndex; idet >= 0; idet--) {
207  if (!overlap( gCrossingPos, *sBlade[idet], window)) break;
208  if (!Adder::add( *sBlade[idet], tsos, prop, est, result)) break;
209  }
210  for (int idet=posStartIndex; idet < static_cast<int>(sBlade.size()); idet++) {
211  if (!overlap( gCrossingPos, *sBlade[idet], window)) break;
212  if (!Adder::add( *sBlade[idet], tsos, prop, est, result)) break;
213  }
214 }
def window
Definition: svgfig.py:642
T perp() const
Definition: PV3DBase.h:66
int closestDetIndex() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
const std::vector< const GeomDet * > & subBlade(int ind) const
Definition: PixelBlade.h:76
const GlobalPoint & position() const
bool overlap(const GlobalPoint &gpos, const GeomDet &det, float phiWin) const
Definition: PixelBlade.cc:218
int subLayerIndex() const
tuple result
Definition: query.py:137
virtual const BoundDiskSector& PixelBlade::specificSurface ( ) const
inlinevirtual

Definition at line 40 of file PixelBlade.h.

References theDiskSector.

40 {return *theDiskSector;}
ReferenceCountingPointer< BoundDiskSector > theDiskSector
Definition: PixelBlade.h:87
const std::vector<const GeomDet*>& PixelBlade::subBlade ( int  ind) const
inlineprivate

Definition at line 76 of file PixelBlade.h.

References theBackDets, and theFrontDets.

Referenced by addClosest(), and searchNeighbors().

76  {
77  return (ind==0 ? theFrontDets : theBackDets);
78  }
std::vector< const GeomDet * > theFrontDets
Definition: PixelBlade.h:84
std::vector< const GeomDet * > theBackDets
Definition: PixelBlade.h:85
virtual const BoundSurface& PixelBlade::surface ( ) const
inlinevirtual

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 23 of file PixelBlade.h.

References theDiskSector.

23 {return *theDiskSector;}
ReferenceCountingPointer< BoundDiskSector > theDiskSector
Definition: PixelBlade.h:87

Member Data Documentation

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

Definition at line 85 of file PixelBlade.h.

Referenced by findBin(), findPosition(), PixelBlade(), and subBlade().

ReferenceCountingPointer<BoundDiskSector> PixelBlade::theBackDiskSector
private

Definition at line 89 of file PixelBlade.h.

Referenced by computeCrossings(), and PixelBlade().

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

Definition at line 83 of file PixelBlade.h.

Referenced by basicComponents(), and PixelBlade().

ReferenceCountingPointer<BoundDiskSector> PixelBlade::theDiskSector
private

Definition at line 87 of file PixelBlade.h.

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

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

Definition at line 84 of file PixelBlade.h.

Referenced by findBin(), findPosition(), PixelBlade(), and subBlade().

ReferenceCountingPointer<BoundDiskSector> PixelBlade::theFrontDiskSector
private

Definition at line 88 of file PixelBlade.h.

Referenced by computeCrossings(), and PixelBlade().