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:
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 __attribute__((cold))
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const __attribute__((cold))
 Returns basic components, if any. More...
 
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
 
 PixelBlade (std::vector< const GeomDet * > &frontDets, std::vector< const GeomDet * > &backDets) __attribute__((cold))
 
virtual const BoundDiskSectorspecificSurface () const
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
 ~PixelBlade () __attribute__((cold))
 
- 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
 
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 __attribute__((hot))
 
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 GeometricSearchDet
typedef std::pair< const
GeomDet
*, TrajectoryStateOnSurface
DetWithState
 
typedef BoundSurface::PositionType PositionType
 
typedef BoundSurface::RotationType RotationType
 
typedef TrajectoryStateOnSurface TrajectoryState
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
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 BladeShapeBuilderFromDet::build(), LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), theBackDets, theBackDiskSector, theDets, theDiskSector, theFrontDets, theFrontDiskSector, and PV3DBase< T, PVType, FrameType >::z().

21  :
22  GeometricSearchDet(true),
23  theFrontDets(frontDets), theBackDets(backDets)
24 {
25  theDets.assign(theFrontDets.begin(),theFrontDets.end());
26  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
27 
31 
32 
33  //--------- DEBUG INFO --------------
34  LogDebug("TkDetLayers") << "DEBUG INFO for PixelBlade" ;
35  LogDebug("TkDetLayers") << "Blade z, perp, innerRadius, outerR: "
36  << this->position().z() << " , "
37  << this->position().perp() << " , "
38  << theDiskSector->innerRadius() << " , "
39  << theDiskSector->outerRadius() ;
40 
41  for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
42  it!=theFrontDets.end(); it++){
43  LogDebug("TkDetLayers") << "frontDet phi,z,r: "
44  << (*it)->position().phi() << " , "
45  << (*it)->position().z() << " , "
46  << (*it)->position().perp() ;;
47  }
48 
49  for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
50  it!=theBackDets.end(); it++){
51  LogDebug("TkDetLayers") << "backDet phi,z,r: "
52  << (*it)->position().phi() << " , "
53  << (*it)->position().z() << " , "
54  << (*it)->position().perp() ;
55  }
56  //-----------------------------------
57 
58 }
#define LogDebug(id)
ReferenceCountingPointer< BoundDiskSector > theFrontDiskSector
Definition: PixelBlade.h:89
T perp() const
Definition: PV3DBase.h:72
ReferenceCountingPointer< BoundDiskSector > theBackDiskSector
Definition: PixelBlade.h:90
GeometricSearchDet(bool doHaveGroups)
std::vector< const GeomDet * > theFrontDets
Definition: PixelBlade.h:85
std::vector< const GeomDet * > theBackDets
Definition: PixelBlade.h:86
T z() const
Definition: PV3DBase.h:64
static BoundDiskSector * build(const std::vector< const GeomDet * > &dets) __attribute__((cold))
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 159 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

164 {
165 
166  const vector<const GeomDet*>& sBlade( subBlade( crossing.subLayerIndex()));
167  return CompatibleDetToGroupAdder().add( *sBlade[crossing.closestDetIndex()],
168  tsos, prop, est, result);
169 }
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) __attribute__((hot))
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 67 of file PixelBlade.cc.

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 62 of file PixelBlade.cc.

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

Definition at line 116 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

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

Definition at line 172 of file PixelBlade.cc.

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

Referenced by groupedCompatibleDetsV().

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

Definition at line 248 of file PixelBlade.cc.

References funct::abs(), i, theBackDets, and theFrontDets.

Referenced by computeCrossings().

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

Definition at line 267 of file PixelBlade.cc.

References theBackDets, and theFrontDets.

Referenced by computeCrossings().

268 {
269  vector<const GeomDet*> diskSector = diskSectorType == 0 ? theFrontDets : theBackDets;
270  return (diskSector[index])->surface().position();
271 }
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 76 of file PixelBlade.cc.

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

79  {
80  SubLayerCrossings crossings;
81  crossings = computeCrossings( tsos, prop.propagationDirection());
82  if(! crossings.isValid()) return;
83 
84  vector<DetGroup> closestResult;
85  addClosest( tsos, prop, est, crossings.closest(), closestResult);
86 
87  if (closestResult.empty()){
88  vector<DetGroup> nextResult;
89  addClosest( tsos, prop, est, crossings.other(), nextResult);
90  if(nextResult.empty()) return;
91 
92  DetGroupElement nextGel( nextResult.front().front());
93  int crossingSide = LayerCrossingSide().endcapSide( nextGel.trajectoryState(), prop);
94 
96  crossings.closestIndex(), crossingSide);
97  }
98  else {
99  DetGroupElement closestGel( closestResult.front().front());
100  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
101 
102  searchNeighbors( tsos, prop, est, crossings.closest(), window,
103  closestResult, false);
104 
105  vector<DetGroup> nextResult;
106  searchNeighbors( tsos, prop, est, crossings.other(), window,
107  nextResult, true);
108 
109  int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
111  crossings.closestIndex(), crossingSide);
112  }
113 }
def window
Definition: svgfig.py:642
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:155
int closestIndex() const
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: PixelBlade.cc:159
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
Definition: PixelBlade.cc:172
tuple result
Definition: query.py:137
def move
Definition: eostools.py:510
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
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)
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
Definition: PixelBlade.cc:116
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: PixelBlade.cc:183
bool PixelBlade::overlap ( const GlobalPoint gpos,
const GeomDet det,
float  phiWin 
) const
private

Definition at line 221 of file PixelBlade.cc.

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

Referenced by searchNeighbors().

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

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

Referenced by groupedCompatibleDetsV().

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