CMS 3D CMS Logo

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

#include <TIBRing.h>

Inheritance diagram for TIBRing:
GeometricSearchDetWithGroups GeometricSearchDet

Classes

struct  SubRingCrossings
 

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual 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 &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 
virtual const BoundCylinderspecificSurface () const
 Return the ring surface as a. More...
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
 TIBRing (std::vector< const GeomDet * > &theGeomDets)
 
 ~TIBRing ()
 
- 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 Types

typedef PeriodicBinFinderInPhi
< double > 
BinFinderType
 

Private Member Functions

void checkPeriodicity (std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
 
void checkRadius (std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
 
SubRingCrossings computeCrossings (const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const
 
void computeHelicity ()
 
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
 
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubRingCrossings &crossings, float window, std::vector< DetGroup > &result) const
 

Private Attributes

BinFinderType theBinFinder
 
ReferenceCountingPointer
< BoundCylinder
theCylinder
 
std::vector< const GeomDet * > theDets
 
int theHelicity
 

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

Definition at line 13 of file TIBRing.h.

Member Typedef Documentation

Definition at line 86 of file TIBRing.h.

Constructor & Destructor Documentation

TIBRing::TIBRing ( std::vector< const GeomDet * > &  theGeomDets)

Definition at line 21 of file TIBRing.cc.

References computeHelicity(), i, LogDebug, theBinFinder, theCylinder, and theDets.

21  :
22  theDets(theGeomDets.begin(),theGeomDets.end())
23 {
24  //checkRadius( first, last);
25  //sort( theDets.begin(), theDets.end(), DetLessPhi());
26  //checkPeriodicity( theDets.begin(), theDets.end());
27 
28  theBinFinder = BinFinderType( theDets.front()->surface().position().phi(),
29  theDets.size());
30 
32 
34 
35 
36  LogDebug("TkDetLayers") << "==== DEBUG TIBRing =====" ;
37  LogDebug("TkDetLayers") << "radius, thickness, lenght: "
38  << theCylinder->radius() << " , "
39  << theCylinder->bounds().thickness() << " , "
40  << theCylinder->bounds().length() ;
41 
42  for (vector<const GeomDet*>::const_iterator i=theDets.begin();
43  i != theDets.end(); i++){
44  LogDebug("TkDetLayers") << "Ring's Det pos z,perp,eta,phi: "
45  << (**i).position().z() << " , "
46  << (**i).position().perp() << " , "
47  << (**i).position().eta() << " , "
48  << (**i).position().phi() ;
49  }
50  LogDebug("TkDetLayers") << "==== end DEBUG TIBRing =====" ;
51 
52 
53 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
BinFinderType theBinFinder
Definition: TIBRing.h:87
PeriodicBinFinderInPhi< double > BinFinderType
Definition: TIBRing.h:86
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
ReferenceCountingPointer< BoundCylinder > theCylinder
Definition: TIBRing.h:90
void computeHelicity()
Definition: TIBRing.cc:101
TIBRing::~TIBRing ( )

Definition at line 118 of file TIBRing.cc.

118  {
119 
120 }

Member Function Documentation

virtual const std::vector<const GeomDet*>& TIBRing::basicComponents ( ) const
inlinevirtual

Implements GeometricSearchDet.

Definition at line 21 of file TIBRing.h.

References theDets.

21 {return theDets;}
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
void TIBRing::checkPeriodicity ( std::vector< const GeomDet * >::const_iterator  first,
std::vector< const GeomDet * >::const_iterator  last 
)
private

Definition at line 78 of file TIBRing.cc.

References first, i, j, Geom::pi(), stat_mean(), launcher::step, and theDets.

80 {
81  vector<double> adj_diff(last-first-1);
82  for (int i=0; i < static_cast<int>(adj_diff.size()); i++) {
83  vector<const GeomDet*>::const_iterator curent = first + i;
84  adj_diff[i] = (**(curent+1)).surface().position().phi() -
85  (**curent).surface().position().phi();
86  }
87  double step = stat_mean( adj_diff);
88  double phi_step = 2.*Geom::pi()/(last-first);
89 
90  if ( fabs(step-phi_step)/phi_step > 0.01) {
91  int ndets = last-first;
92  edm::LogError("TkDetLayers") << "TIBRing Warning: not periodic. ndets=" << ndets ;
93  for (int j=0; j<ndets; j++) {
94  edm::LogError("TkDetLayers") << "Dets(r,phi): (" << theDets[j]->surface().position().perp()
95  << "," << theDets[j]->surface().position().phi() << ") " ;
96  }
97  throw DetLayerException( "Error: TIBRing is not periodic");
98  }
99 }
Common base class.
int i
Definition: DBlmapReader.cc:9
list step
Definition: launcher.py:15
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
double stat_mean(const CONT &cont)
Definition: simple_stat.h:9
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
double pi()
Definition: Pi.h:31
void TIBRing::checkRadius ( std::vector< const GeomDet * >::const_iterator  first,
std::vector< const GeomDet * >::const_iterator  last 
)
private

Definition at line 62 of file TIBRing.cc.

References i, prof2calltree::last, and alignCSCRings::r.

64 {
65  // check radius range
66  float rMin = 10000.;
67  float rMax = 0.;
68  for (vector<const GeomDet*>::const_iterator i=first; i!=last; i++) {
69  float r = (**i).surface().position().perp();
70  if (r < rMin) rMin = r;
71  if (r > rMax) rMax = r;
72  }
73  if (rMax - rMin > 0.1) throw DetLayerException(
74  "TIBRing construction failed: detectors not at constant radius");
75 }
Common base class.
int i
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
pair< bool, TrajectoryStateOnSurface > TIBRing::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 124 of file TIBRing.cc.

125  {
126  edm::LogError("TkDetLayers") << "temporary dummy implementation of TIBRing::compatible()!!" ;
127  return pair<bool,TrajectoryStateOnSurface>();
128 }
const vector< const GeometricSearchDet * > & TIBRing::components ( ) const
virtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 57 of file TIBRing.cc.

58 {
59  throw DetLayerException("TIBRing doesn't have GeometricSearchDet components");
60 }
Common base class.
TIBRing::SubRingCrossings TIBRing::computeCrossings ( const TrajectoryStateOnSurface startingState,
PropagationDirection  propDir 
) const
private

Definition at line 227 of file TIBRing.cc.

References PeriodicBinFinderInPhi< T >::binIndex(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), rho, specificSurface(), surface(), theBinFinder, theDets, TrajectoryStateOnSurface::transverseCurvature(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by groupedCompatibleDetsV().

229 {
230  typedef HelixBarrelPlaneCrossing2OrderLocal Crossing;
232 
233  GlobalPoint startPos( startingState.globalPosition());
234  GlobalVector startDir( startingState.globalMomentum());
235  double rho( startingState.transverseCurvature());
236 
237  HelixBarrelCylinderCrossing cylCrossing( startPos, startDir, rho,
238  propDir,specificSurface());
239 
240  if (!cylCrossing.hasSolution()) return SubRingCrossings();
241 
242  GlobalPoint cylPoint( cylCrossing.position());
243  GlobalVector cylDir( cylCrossing.direction());
244  int closestIndex = theBinFinder.binIndex(cylPoint.phi());
245 
246  const BoundPlane& closestPlane( theDets[closestIndex]->surface());
247 
248  LocalPoint closestPos = Crossing( cylPoint, cylDir, rho, closestPlane).position();
249  float closestDist = closestPos.x(); // use fact that local X perp to global Z
250 
251  //int next = cylPoint.phi() - closestPlane.position().phi() > 0 ? closest+1 : closest-1;
252  int nextIndex = PhiLess()( closestPlane.position().phi(), cylPoint.phi()) ?
253  closestIndex+1 : closestIndex-1;
254 
255  const BoundPlane& nextPlane( theDets[ theBinFinder.binIndex(nextIndex)]->surface());
256  LocalPoint nextPos = Crossing( cylPoint, cylDir, rho, nextPlane).position();
257  float nextDist = nextPos.x();
258 
259  if (fabs(closestDist) < fabs(nextDist)) {
260  return SubRingCrossings( closestIndex, nextIndex, nextDist);
261  }
262  else {
263  return SubRingCrossings( nextIndex, closestIndex, closestDist);
264  }
265 }
BinFinderType theBinFinder
Definition: TIBRing.h:87
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Definition: TIBRing.h:19
Definition: DDAxes.h:10
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
virtual const BoundCylinder & specificSurface() const
Return the ring surface as a.
Definition: TIBRing.h:41
GlobalVector globalMomentum() const
T x() const
Definition: PV3DBase.h:61
void TIBRing::computeHelicity ( )
private

Definition at line 101 of file TIBRing.cc.

References Vector3DBase< T, FrameTag >::dot(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), GeomDet::surface(), theDets, theHelicity, and Surface::toGlobal().

Referenced by TIBRing().

101  {
102 
103  const GeomDet& det = *theDets.front();
104  GlobalVector radial = det.surface().position() - GlobalPoint(0,0,0);
105  GlobalVector normal = det.surface().toGlobal( LocalVector(0,0,1));
106  if(normal.dot(radial)<=0)normal*=-1;
107 // edm::LogInfo(TkDetLayers) << "BarrelDetRing::computeHelicity: phi(normal) " << normal.phi()
108 // << " phi(radial) " << radial.phi() ;
109  if (PhiLess()( normal.phi(), radial.phi())) {
110  theHelicity = 1; // smaller phi angles mean "inner" group
111  }
112  else {
113  theHelicity = 0; // smaller phi angles mean "outer" group
114  }
115 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
Local3DVector LocalVector
Definition: LocalVector.h:12
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
int theHelicity
Definition: TIBRing.h:91
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
const PositionType & position() const
float TIBRing::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 267 of file TIBRing.cc.

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

Referenced by groupedCompatibleDetsV().

270 {
271  return est.maximalLocalDisplacement(tsos, det->surface()).x();
272 }
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
void TIBRing::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 132 of file TIBRing.cc.

References Clusterizer1DCommons::add(), LayerCrossingSide::barrelSide(), PeriodicBinFinderInPhi< T >::binIndex(), TIBRing::SubRingCrossings::closestIndex, computeCrossings(), computeWindowSize(), TIBRing::SubRingCrossings::isValid_, TIBRing::SubRingCrossings::nextDistance, TIBRing::SubRingCrossings::nextIndex, DetGroupMerger::orderAndMergeTwoLevels(), Propagator::propagationDirection(), query::result, searchNeighbors(), theBinFinder, theDets, theHelicity, and svgfig::window().

136 {
137  vector<DetGroup> closestResult;
138  SubRingCrossings crossings;
139  crossings = computeCrossings( tsos, prop.propagationDirection());
140  if(! crossings.isValid_) return;
141 
142  typedef CompatibleDetToGroupAdder Adder;
143  Adder::add( *theDets[theBinFinder.binIndex(crossings.closestIndex)],
144  tsos, prop, est, closestResult);
145 
146  if(closestResult.empty()){
147  Adder::add( *theDets[theBinFinder.binIndex(crossings.nextIndex)],
148  tsos, prop, est, result);
149  return;
150  }
151 
152  DetGroupElement closestGel( closestResult.front().front());
153  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
154 
155  //vector<DetGroup> result;
156  float detWidth = closestGel.det()->surface().bounds().width();
157  if (crossings.nextDistance < detWidth + window) {
158  vector<DetGroup> nextResult;
159  if (Adder::add( *theDets[theBinFinder.binIndex(crossings.nextIndex)],
160  tsos, prop, est, nextResult)) {
161  int crossingSide = LayerCrossingSide().barrelSide( tsos, prop);
162  if (crossings.closestIndex < crossings.nextIndex) {
163  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult,
164  result,
165  theHelicity, crossingSide);
166  }
167  else {
168  DetGroupMerger::orderAndMergeTwoLevels( nextResult, closestResult,
169  result,
170  theHelicity, crossingSide);
171  }
172  }
173  else {
174  result.swap(closestResult);
175  }
176  }else{
177  result.swap(closestResult);
178  }
179 
180  // only loop over neighbors (other than closest and next) if window is BIG
181  if (window > 0.5*detWidth) {
182  searchNeighbors( tsos, prop, est, crossings, window, result);
183  }
184 }
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
BinFinderType theBinFinder
Definition: TIBRing.h:87
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubRingCrossings &crossings, float window, std::vector< DetGroup > &result) const
Definition: TIBRing.cc:186
int theHelicity
Definition: TIBRing.h:91
tuple result
Definition: query.py:137
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
Definition: TIBRing.cc:267
SubRingCrossings computeCrossings(const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const
Definition: TIBRing.cc:227
int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
returns 0 if barrel layer crossed from inside, 1 if from outside
void TIBRing::searchNeighbors ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubRingCrossings crossings,
float  window,
std::vector< DetGroup > &  result 
) const
private

Definition at line 186 of file TIBRing.cc.

References Clusterizer1DCommons::add(), LayerCrossingSide::barrelSide(), PeriodicBinFinderInPhi< T >::binIndex(), TIBRing::SubRingCrossings::closestIndex, max(), min, TIBRing::SubRingCrossings::nextIndex, theBinFinder, theDets, theHelicity, and tmp.

Referenced by groupedCompatibleDetsV().

192 {
193  typedef CompatibleDetToGroupAdder Adder;
194  int crossingSide = LayerCrossingSide().barrelSide( tsos, prop);
195  typedef DetGroupMerger Merger;
196 
197  int negStart = min( crossings.closestIndex, crossings.nextIndex) - 1;
198  int posStart = max( crossings.closestIndex, crossings.nextIndex) + 1;
199 
200  int quarter = theDets.size()/4;
201  vector<DetGroup> tmp;
202  vector<DetGroup> newResult;
203  for (int idet=negStart; idet >= negStart - quarter+1; idet--) {
204  const GeomDet* neighbor = theDets[theBinFinder.binIndex(idet)];
205  // if (!overlap( gCrossingPos, *neighbor, window)) break; // mybe not needed?
206  // maybe also add shallow crossing angle test here???
207  tmp.clear();
208  newResult.clear();
209  if (!Adder::add( *neighbor, tsos, prop, est, tmp)) break;
210  Merger::orderAndMergeTwoLevels( tmp, result, newResult, theHelicity, crossingSide);
211  result.swap(newResult);
212  }
213  for (int idet=posStart; idet < posStart + quarter-1; idet++) {
214  const GeomDet* neighbor = theDets[theBinFinder.binIndex(idet)];
215  // if (!overlap( gCrossingPos, *neighbor, window)) break; // mybe not needed?
216  // maybe also add shallow crossing angle test here???
217  tmp.clear();
218  newResult.clear();
219  if (!Adder::add( *neighbor, tsos, prop, est, tmp)) break;
220  Merger::orderAndMergeTwoLevels( result, tmp, newResult, theHelicity, crossingSide);
221  result.swap(newResult);
222  }
223 }
BinFinderType theBinFinder
Definition: TIBRing.h:87
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
#define min(a, b)
Definition: mlp_lapack.h:161
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
int theHelicity
Definition: TIBRing.h:91
const T & max(const T &a, const T &b)
tuple result
Definition: query.py:137
Definition: Merger.h:30
int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
returns 0 if barrel layer crossed from inside, 1 if from outside
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
virtual const BoundCylinder& TIBRing::specificSurface ( ) const
inlinevirtual

Return the ring surface as a.

Definition at line 41 of file TIBRing.h.

References theCylinder.

Referenced by computeCrossings().

41 {return *theCylinder;}
ReferenceCountingPointer< BoundCylinder > theCylinder
Definition: TIBRing.h:90
virtual const BoundSurface& TIBRing::surface ( ) const
inlinevirtual

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 19 of file TIBRing.h.

References theCylinder.

Referenced by computeCrossings().

19 {return *theCylinder;}
ReferenceCountingPointer< BoundCylinder > theCylinder
Definition: TIBRing.h:90

Member Data Documentation

BinFinderType TIBRing::theBinFinder
private

Definition at line 87 of file TIBRing.h.

Referenced by computeCrossings(), groupedCompatibleDetsV(), searchNeighbors(), and TIBRing().

ReferenceCountingPointer<BoundCylinder> TIBRing::theCylinder
private

Definition at line 90 of file TIBRing.h.

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

std::vector<const GeomDet*> TIBRing::theDets
private
int TIBRing::theHelicity
private

Definition at line 91 of file TIBRing.h.

Referenced by computeHelicity(), groupedCompatibleDetsV(), and searchNeighbors().