CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TIDRing Class Referencefinal

#include <TIDRing.h>

Inheritance diagram for TIDRing:
GeometricSearchDet

Public Member Functions

const std::vector< const GeomDet * > & basicComponents () const override
 
std::pair< bool, TrajectoryStateOnSurfacecompatible (const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
 
const std::vector< const GeometricSearchDet * > & components () const override __attribute__((cold))
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
 
virtual const BoundDiskspecificSurface () const
 
const BoundSurfacesurface () const override
 The surface of the GeometricSearchDet. More...
 
 TIDRing (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets)
 
 ~TIDRing () override
 
- 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::PositionTypeposition () 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< BoundDisktheBackDisk
 
std::vector< const GeomDet * > theDets
 
ReferenceCountingPointer< BoundDisktheDisk
 
BinFinderType theFrontBinFinder
 
std::vector< const GeomDet * > theFrontDets
 
ReferenceCountingPointer< BoundDisktheFrontDisk
 

Additional Inherited Members

- Public Types inherited from GeometricSearchDet
typedef std::pair< const GeomDet *, TrajectoryStateOnSurfaceDetWithState
 
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 24 of file TIDRing.cc.

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

25  :
26  GeometricSearchDet(true),
27  theFrontDets(innerDets.begin(),innerDets.end()),
28  theBackDets(outerDets.begin(),outerDets.end())
29 {
30  theDets.assign(theFrontDets.begin(),theFrontDets.end());
31  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
32 
33 
34  // the dets should be already phi-ordered. TO BE CHECKED
35  //sort( theFrontDets.begin(), theFrontDets.end(), DetLessPhi() );
36  //sort( theBackDets.begin(), theBackDets.end(), DetLessPhi() );
37 
39 
42 
43  theFrontBinFinder = BinFinderType( theFrontDets.front()->surface().position().phi(),
44  theFrontDets.size());
45  theBackBinFinder = BinFinderType( theBackDets.front()->surface().position().phi(),
46  theBackDets.size());
47 
48 
49 
50  LogDebug("TkDetLayers") << "DEBUG INFO for TIDRing" ;
51  for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
52  it!=theFrontDets.end(); it++){
53  LogDebug("TkDetLayers") << "frontDet phi,z,r: "
54  << (*it)->surface().position().phi() << " , "
55  << (*it)->surface().position().z() << " , "
56  << (*it)->surface().position().perp() ;
57  }
58 
59  for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
60  it!=theBackDets.end(); it++){
61  LogDebug("TkDetLayers") << "backDet phi,z,r: "
62  << (*it)->surface().position().phi() << " , "
63  << (*it)->surface().position().z() << " , "
64  << (*it)->surface().position().perp() ;
65  }
66 
67 
68 }
#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 ( )
override

Definition at line 70 of file TIDRing.cc.

70  {
71 
72 }

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 162 of file TIDRing.cc.

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

Referenced by groupedCompatibleDetsV(), and specificSurface().

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

Implements GeometricSearchDet.

Definition at line 23 of file TIDRing.h.

References compatible(), components(), groupedCompatibleDetsV(), mps_fire::result, and 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
overridevirtual

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 82 of file TIDRing.cc.

Referenced by basicComponents().

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 75 of file TIDRing.cc.

Referenced by basicComponents().

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

Definition at line 120 of file TIDRing.cc.

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

Referenced by groupedCompatibleDetsV(), and specificSurface().

122 {
123 
124  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition() );
125  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum() );
126 
127  auto rho = startingState.transverseCurvature();
128 
129  HelixForwardPlaneCrossing crossing(startPos,startDir,rho,propDir);
130 
131  pair<bool,double> frontPath = crossing.pathLength( *theFrontDisk);
132  if (!frontPath.first) return SubLayerCrossings();
133 
134  pair<bool,double> backPath = crossing.pathLength( *theBackDisk);
135  if (!backPath.first) return SubLayerCrossings();
136 
137  GlobalPoint gFrontPoint(crossing.position(frontPath.second));
138  GlobalPoint gBackPoint( crossing.position(backPath.second));
139 
140  int frontIndex = theFrontBinFinder.binIndex(gFrontPoint.barePhi());
141  SubLayerCrossing frontSLC( 0, frontIndex, gFrontPoint);
142 
143  int backIndex = theBackBinFinder.binIndex(gBackPoint.barePhi());
144  SubLayerCrossing backSLC( 1, backIndex, gBackPoint);
145 
146 
147  // 0ss: frontDisk has index=0, backDisk has index=1
148  float frontDist = std::abs(Geom::deltaPhi( gFrontPoint.barePhi(),
149  theFrontDets[frontIndex]->surface().phi()));
150  float backDist = std::abs(Geom::deltaPhi( gBackPoint.barePhi(),
151  theBackDets[backIndex]->surface().phi()));
152 
153 
154  if (frontDist < backDist) {
155  return SubLayerCrossings( frontSLC, backSLC, 0);
156  }
157  else {
158  return SubLayerCrossings( backSLC, frontSLC, 1);
159  }
160 }
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
BinFinderType theFrontBinFinder
Definition: TIDRing.h:77
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
overridevirtual

Reimplemented from GeometricSearchDet.

Definition at line 91 of file TIDRing.cc.

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

Referenced by basicComponents(), and TIDLayer::groupedCompatibleDetsV().

95 {
96  SubLayerCrossings crossings;
97  crossings = computeCrossings( tsos, prop.propagationDirection());
98  if(! crossings.isValid()) return;
99 
100  std::vector<DetGroup> closestResult;
101  addClosest( tsos, prop, est, crossings.closest(), closestResult);
102  if (closestResult.empty()) return;
103 
104  DetGroupElement closestGel( closestResult.front().front());
105  float phiWindow = tkDetUtil::computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
106  searchNeighbors( tsos, prop, est, crossings.closest(), phiWindow,
107  closestResult, false);
108 
109  vector<DetGroup> nextResult;
110  searchNeighbors( tsos, prop, est, crossings.other(), phiWindow,
111  nextResult, true);
112 
113  int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
115  crossings.closestIndex(), crossingSide);
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: TIDRing.cc:175
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
Definition: TIDRing.cc:120
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:162
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:10
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:151
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)
def move(src, dest)
Definition: eostools.py:511
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 175 of file TIDRing.cc.

References PVValHelper::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(), and specificSurface().

182 {
183  const GlobalPoint& gCrossingPos = crossing.position();
184 
185  const vector<const GeomDet*>& sLayer( subLayer( crossing.subLayerIndex()));
186 
187  int closestIndex = crossing.closestDetIndex();
188  int negStartIndex = closestIndex-1;
189  int posStartIndex = closestIndex+1;
190 
191  if (checkClosest) { // must decide if the closest is on the neg or pos side
192  if ( Geom::phiLess( gCrossingPos.barePhi(), sLayer[closestIndex]->surface().phi())) {
193  posStartIndex = closestIndex;
194  }
195  else {
196  negStartIndex = closestIndex;
197  }
198  }
199 
200  const BinFinderType& binFinder = (crossing.subLayerIndex()==0 ? theFrontBinFinder : theBackBinFinder);
201 
202  typedef CompatibleDetToGroupAdder Adder;
203  int half = sLayer.size()/2; // to check if dets are called twice....
204  for (int idet=negStartIndex; idet >= negStartIndex - half; idet--) {
205  const GeomDet & neighborDet = *sLayer[binFinder.binIndex(idet)];
206  if (!tkDetUtil::overlapInPhi( gCrossingPos, neighborDet, window)) break;
207  if (!Adder::add( neighborDet, tsos, prop, est, result)) break;
208  // maybe also add shallow crossing angle test here???
209  }
210  for (int idet=posStartIndex; idet < posStartIndex + half; idet++) {
211  const GeomDet & neighborDet = *sLayer[binFinder.binIndex(idet)];
212  if (!tkDetUtil::overlapInPhi( gCrossingPos, neighborDet, window)) break;
213  if (!Adder::add( neighborDet, tsos, prop, est, result)) break;
214  // maybe also add shallow crossing angle test here???
215  }
216 }
PeriodicBinFinderInPhi< float > BinFinderType
Definition: TIDRing.h:75
int closestDetIndex() const
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
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:642
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:23
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
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 addClosest(), computeCrossings(), searchNeighbors(), theDisk, and svgfig::window().

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
const BoundSurface& TIDRing::surface ( ) const
inlineoverridevirtual

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().