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 15 of file PixelBlade.h.

Constructor & Destructor Documentation

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

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

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

Definition at line 18 of file PixelBlade.cc.

18 {}

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 158 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

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

References theDets.

26 {return theDets;}
std::vector< const GeomDet * > theDets
Definition: PixelBlade.h:84
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 66 of file PixelBlade.cc.

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 61 of file PixelBlade.cc.

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

Definition at line 115 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

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

Definition at line 171 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

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

Definition at line 247 of file PixelBlade.cc.

References i, theBackDets, and theFrontDets.

Referenced by computeCrossings().

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

Definition at line 266 of file PixelBlade.cc.

References theBackDets, and theFrontDets.

Referenced by computeCrossings().

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

Reimplemented from GeometricSearchDet.

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

78  {
79  SubLayerCrossings crossings;
80  crossings = computeCrossings( tsos, prop.propagationDirection());
81  if(! crossings.isValid()) return;
82 
83  vector<DetGroup> closestResult;
84  addClosest( tsos, prop, est, crossings.closest(), closestResult);
85 
86  if (closestResult.empty()){
87  vector<DetGroup> nextResult;
88  addClosest( tsos, prop, est, crossings.other(), nextResult);
89  if(nextResult.empty()) return;
90 
91  DetGroupElement nextGel( nextResult.front().front());
92  int crossingSide = LayerCrossingSide().endcapSide( nextGel.trajectoryState(), prop);
93 
94  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
95  crossings.closestIndex(), crossingSide);
96  }
97  else {
98  DetGroupElement closestGel( closestResult.front().front());
99  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
100 
101  searchNeighbors( tsos, prop, est, crossings.closest(), window,
102  closestResult, false);
103 
104  vector<DetGroup> nextResult;
105  searchNeighbors( tsos, prop, est, crossings.other(), window,
106  nextResult, true);
107 
108  int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
109  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
110  crossings.closestIndex(), crossingSide);
111  }
112 }
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:171
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
Definition: PixelBlade.cc:115
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:158
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:182
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 220 of file PixelBlade.cc.

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

Referenced by searchNeighbors().

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

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

Referenced by groupedCompatibleDetsV().

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

Definition at line 41 of file PixelBlade.h.

References theDiskSector.

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

Definition at line 77 of file PixelBlade.h.

References theBackDets, and theFrontDets.

Referenced by addClosest(), and searchNeighbors().

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

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 24 of file PixelBlade.h.

References theDiskSector.

24 {return *theDiskSector;}
ReferenceCountingPointer< BoundDiskSector > theDiskSector
Definition: PixelBlade.h:88

Member Data Documentation

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

Definition at line 86 of file PixelBlade.h.

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

ReferenceCountingPointer<BoundDiskSector> PixelBlade::theBackDiskSector
private

Definition at line 90 of file PixelBlade.h.

Referenced by computeCrossings(), and PixelBlade().

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

Definition at line 84 of file PixelBlade.h.

Referenced by basicComponents(), and PixelBlade().

ReferenceCountingPointer<BoundDiskSector> PixelBlade::theDiskSector
private

Definition at line 88 of file PixelBlade.h.

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

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

Definition at line 85 of file PixelBlade.h.

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

ReferenceCountingPointer<BoundDiskSector> PixelBlade::theFrontDiskSector
private

Definition at line 89 of file PixelBlade.h.

Referenced by computeCrossings(), and PixelBlade().