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 Types | Private Member Functions | Private Attributes
TIDRing Class Reference

#include <TIDRing.h>

Inheritance diagram for TIDRing:
GeometricSearchDet

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const
 
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))
 
virtual const BoundDiskspecificSurface () const
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
 TIDRing (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets)
 
 ~TIDRing ()
 
- 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 Types

typedef PeriodicBinFinderInPhi
< float > 
BinFinderType
 

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))
 
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 * > & 
subLayer (int ind) const
 

Private Attributes

BinFinderType theBackBinFinder
 
std::vector< const GeomDet * > theBackDets
 
ReferenceCountingPointer
< BoundDisk
theBackDisk
 
std::vector< const GeomDet * > theDets
 
ReferenceCountingPointer
< BoundDisk
theDisk
 
BinFinderType theFrontBinFinder
 
std::vector< const GeomDet * > theFrontDets
 
ReferenceCountingPointer
< BoundDisk
theFrontDisk
 

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 TID rings

Definition at line 14 of file TIDRing.h.

Member Typedef Documentation

Definition at line 75 of file TIDRing.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file TIDRing.cc.

References LogDebug, theBackBinFinder, theBackDets, theBackDisk, theDets, theDisk, theFrontBinFinder, theFrontDets, and theFrontDisk.

26  :
27  GeometricSearchDet(true),
28  theFrontDets(innerDets.begin(),innerDets.end()),
29  theBackDets(outerDets.begin(),outerDets.end())
30 {
31  theDets.assign(theFrontDets.begin(),theFrontDets.end());
32  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
33 
34 
35  // the dets should be already phi-ordered. TO BE CHECKED
36  //sort( theFrontDets.begin(), theFrontDets.end(), DetLessPhi() );
37  //sort( theBackDets.begin(), theBackDets.end(), DetLessPhi() );
38 
40 
43 
44  theFrontBinFinder = BinFinderType( theFrontDets.front()->surface().position().phi(),
45  theFrontDets.size());
46  theBackBinFinder = BinFinderType( theBackDets.front()->surface().position().phi(),
47  theBackDets.size());
48 
49 
50 
51  LogDebug("TkDetLayers") << "DEBUG INFO for TIDRing" ;
52  for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
53  it!=theFrontDets.end(); it++){
54  LogDebug("TkDetLayers") << "frontDet phi,z,r: "
55  << (*it)->surface().position().phi() << " , "
56  << (*it)->surface().position().z() << " , "
57  << (*it)->surface().position().perp() ;
58  }
59 
60  for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
61  it!=theBackDets.end(); it++){
62  LogDebug("TkDetLayers") << "backDet phi,z,r: "
63  << (*it)->surface().position().phi() << " , "
64  << (*it)->surface().position().z() << " , "
65  << (*it)->surface().position().perp() ;
66  }
67 
68 
69 }
#define LogDebug(id)
PeriodicBinFinderInPhi< float > BinFinderType
Definition: TIDRing.h:75
std::vector< const GeomDet * > theDets
Definition: TIDRing.h:67
GeometricSearchDet(bool doHaveGroups)
BinFinderType theFrontBinFinder
Definition: TIDRing.h:77
std::vector< const GeomDet * > theFrontDets
Definition: TIDRing.h:68
ReferenceCountingPointer< BoundDisk > theBackDisk
Definition: TIDRing.h:73
ReferenceCountingPointer< BoundDisk > theFrontDisk
Definition: TIDRing.h:72
ReferenceCountingPointer< BoundDisk > theDisk
Definition: TIDRing.h:71
BinFinderType theBackBinFinder
Definition: TIDRing.h:78
std::vector< const GeomDet * > theBackDets
Definition: TIDRing.h:69
TIDRing::~TIDRing ( )

Definition at line 71 of file TIDRing.cc.

71  {
72 
73 }

Member Function Documentation

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

Definition at line 163 of file TIDRing.cc.

References CompatibleDetToGroupAdder::add(), SubLayerCrossing::closestDetIndex(), subLayer(), and SubLayerCrossing::subLayerIndex().

Referenced by groupedCompatibleDetsV().

168 {
169  const vector<const GeomDet*>& sub( subLayer( crossing.subLayerIndex()));
170  const GeomDet* det(sub[crossing.closestDetIndex()]);
171  return CompatibleDetToGroupAdder::add( *det, tsos, prop, est, result);
172 }
int closestDetIndex() const
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))
const std::vector< const GeomDet * > & subLayer(int ind) const
Definition: TIDRing.h:61
virtual const std::vector<const GeomDet*>& TIDRing::basicComponents ( ) const
inlinevirtual

Implements GeometricSearchDet.

Definition at line 23 of file TIDRing.h.

References theDets.

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

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 76 of file TIDRing.cc.

77 {
78  throw DetLayerException("TIDRing doesn't have GeometricSearchDet components");
79 }
Common base class.
SubLayerCrossings TIDRing::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const
private

Definition at line 121 of file TIDRing.cc.

References funct::abs(), PeriodicBinFinderInPhi< T >::binIndex(), SiPixelRawToDigiRegional_cfi::deltaPhi, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixForwardPlaneCrossing::pathLength(), HelixForwardPlaneCrossing::position(), rho, theBackBinFinder, theBackDets, theBackDisk, theFrontBinFinder, theFrontDets, theFrontDisk, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

123 {
124 
125  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition() );
126  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum() );
127 
128  auto rho = startingState.transverseCurvature();
129 
130  HelixForwardPlaneCrossing crossing(startPos,startDir,rho,propDir);
131 
132  pair<bool,double> frontPath = crossing.pathLength( *theFrontDisk);
133  if (!frontPath.first) return SubLayerCrossings();
134 
135  pair<bool,double> backPath = crossing.pathLength( *theBackDisk);
136  if (!backPath.first) return SubLayerCrossings();
137 
138  GlobalPoint gFrontPoint(crossing.position(frontPath.second));
139  GlobalPoint gBackPoint( crossing.position(backPath.second));
140 
141  int frontIndex = theFrontBinFinder.binIndex(gFrontPoint.barePhi());
142  SubLayerCrossing frontSLC( 0, frontIndex, gFrontPoint);
143 
144  int backIndex = theBackBinFinder.binIndex(gBackPoint.barePhi());
145  SubLayerCrossing backSLC( 1, backIndex, gBackPoint);
146 
147 
148  // 0ss: frontDisk has index=0, backDisk has index=1
149  float frontDist = std::abs(Geom::deltaPhi( gFrontPoint.barePhi(),
150  theFrontDets[frontIndex]->surface().phi()));
151  float backDist = std::abs(Geom::deltaPhi( gBackPoint.barePhi(),
152  theBackDets[backIndex]->surface().phi()));
153 
154 
155  if (frontDist < backDist) {
156  return SubLayerCrossings( frontSLC, backSLC, 0);
157  }
158  else {
159  return SubLayerCrossings( backSLC, frontSLC, 1);
160  }
161 }
BinFinderType theFrontBinFinder
Definition: TIDRing.h:77
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
std::vector< const GeomDet * > theFrontDets
Definition: TIDRing.h:68
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ReferenceCountingPointer< BoundDisk > theBackDisk
Definition: TIDRing.h:73
ReferenceCountingPointer< BoundDisk > theFrontDisk
Definition: TIDRing.h:72
BinFinderType theBackBinFinder
Definition: TIDRing.h:78
std::vector< const GeomDet * > theBackDets
Definition: TIDRing.h:69
void TIDRing::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 92 of file TIDRing.cc.

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

Referenced by TIDLayer::groupedCompatibleDetsV().

96 {
97  SubLayerCrossings crossings;
98  crossings = computeCrossings( tsos, prop.propagationDirection());
99  if(! crossings.isValid()) return;
100 
101  std::vector<DetGroup> closestResult;
102  addClosest( tsos, prop, est, crossings.closest(), closestResult);
103  if (closestResult.empty()) return;
104 
105  DetGroupElement closestGel( closestResult.front().front());
106  float phiWindow = tkDetUtil::computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
107  searchNeighbors( tsos, prop, est, crossings.closest(), phiWindow,
108  closestResult, false);
109 
110  vector<DetGroup> nextResult;
111  searchNeighbors( tsos, prop, est, crossings.other(), phiWindow,
112  nextResult, true);
113 
114  int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
115  DetGroupMerger::orderAndMergeTwoLevels( std::move(closestResult), std::move(nextResult), result,
116  crossings.closestIndex(), crossingSide);
117 }
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: TIDRing.cc:176
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
Definition: TIDRing.cc:121
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: TIDRing.cc:163
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:10
tuple result
Definition: query.py:137
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)
void TIDRing::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 176 of file TIDRing.cc.

References Clusterizer1DCommons::add(), PV3DBase< T, PVType, FrameType >::barePhi(), PeriodicBinFinderInPhi< T >::binIndex(), SubLayerCrossing::closestDetIndex(), tkDetUtil::overlapInPhi(), Geom::phiLess(), SubLayerCrossing::position(), subLayer(), SubLayerCrossing::subLayerIndex(), theBackBinFinder, and theFrontBinFinder.

Referenced by groupedCompatibleDetsV().

183 {
184  GlobalPoint gCrossingPos = crossing.position();
185 
186  const vector<const GeomDet*>& sLayer( subLayer( crossing.subLayerIndex()));
187 
188  int closestIndex = crossing.closestDetIndex();
189  int negStartIndex = closestIndex-1;
190  int posStartIndex = closestIndex+1;
191 
192  if (checkClosest) { // must decide if the closest is on the neg or pos side
193  if ( Geom::phiLess( gCrossingPos.barePhi(), sLayer[closestIndex]->surface().phi())) {
194  posStartIndex = closestIndex;
195  }
196  else {
197  negStartIndex = closestIndex;
198  }
199  }
200 
201  const BinFinderType& binFinder = (crossing.subLayerIndex()==0 ? theFrontBinFinder : theBackBinFinder);
202 
203  typedef CompatibleDetToGroupAdder Adder;
204  int half = sLayer.size()/2; // to check if dets are called twice....
205  for (int idet=negStartIndex; idet >= negStartIndex - half; idet--) {
206  const GeomDet & neighborDet = *sLayer[binFinder.binIndex(idet)];
207  if (!tkDetUtil::overlapInPhi( gCrossingPos, neighborDet, window)) break;
208  if (!Adder::add( neighborDet, tsos, prop, est, result)) break;
209  // maybe also add shallow crossing angle test here???
210  }
211  for (int idet=posStartIndex; idet < posStartIndex + half; idet++) {
212  const GeomDet & neighborDet = *sLayer[binFinder.binIndex(idet)];
213  if (!tkDetUtil::overlapInPhi( gCrossingPos, neighborDet, window)) break;
214  if (!Adder::add( neighborDet, tsos, prop, est, result)) break;
215  // maybe also add shallow crossing angle test here???
216  }
217 }
PeriodicBinFinderInPhi< float > BinFinderType
Definition: TIDRing.h:75
def window
Definition: svgfig.py:642
int closestDetIndex() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
BinFinderType theFrontBinFinder
Definition: TIDRing.h:77
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.h:19
const GlobalPoint & position() const
T barePhi() const
Definition: PV3DBase.h:68
int subLayerIndex() const
tuple result
Definition: query.py:137
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
BinFinderType theBackBinFinder
Definition: TIDRing.h:78
const std::vector< const GeomDet * > & subLayer(int ind) const
Definition: TIDRing.h:61
virtual const BoundDisk& TIDRing::specificSurface ( ) const
inlinevirtual

Definition at line 38 of file TIDRing.h.

References theDisk.

38 {return *theDisk;}
ReferenceCountingPointer< BoundDisk > theDisk
Definition: TIDRing.h:71
const std::vector<const GeomDet*>& TIDRing::subLayer ( int  ind) const
inlineprivate

Definition at line 61 of file TIDRing.h.

References theBackDets, and theFrontDets.

Referenced by addClosest(), and searchNeighbors().

61  {
62  return (ind==0 ? theFrontDets : theBackDets);
63  }
std::vector< const GeomDet * > theFrontDets
Definition: TIDRing.h:68
std::vector< const GeomDet * > theBackDets
Definition: TIDRing.h:69
virtual const BoundSurface& TIDRing::surface ( ) const
inlinevirtual

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 21 of file TIDRing.h.

References theDisk.

Referenced by TIDLayer::ringIndicesByCrossingProximity().

21 {return *theDisk;}
ReferenceCountingPointer< BoundDisk > theDisk
Definition: TIDRing.h:71

Member Data Documentation

BinFinderType TIDRing::theBackBinFinder
private

Definition at line 78 of file TIDRing.h.

Referenced by computeCrossings(), searchNeighbors(), and TIDRing().

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

Definition at line 69 of file TIDRing.h.

Referenced by computeCrossings(), subLayer(), and TIDRing().

ReferenceCountingPointer<BoundDisk> TIDRing::theBackDisk
private

Definition at line 73 of file TIDRing.h.

Referenced by computeCrossings(), and TIDRing().

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

Definition at line 67 of file TIDRing.h.

Referenced by basicComponents(), and TIDRing().

ReferenceCountingPointer<BoundDisk> TIDRing::theDisk
private

Definition at line 71 of file TIDRing.h.

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

BinFinderType TIDRing::theFrontBinFinder
private

Definition at line 77 of file TIDRing.h.

Referenced by computeCrossings(), searchNeighbors(), and TIDRing().

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

Definition at line 68 of file TIDRing.h.

Referenced by computeCrossings(), subLayer(), and TIDRing().

ReferenceCountingPointer<BoundDisk> TIDRing::theFrontDisk
private

Definition at line 72 of file TIDRing.h.

Referenced by computeCrossings(), and TIDRing().