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 Referencefinal

#include <TIBRing.h>

Inheritance diagram for TIBRing:
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 __attribute__((cold))
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const __attribute__((cold))
 Returns basic components, if any. More...
 
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
 
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) __attribute__((cold))
 
 ~TIBRing () __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 Types

typedef PeriodicBinFinderInPhi
< float > 
BinFinderType
 

Private Member Functions

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

Private Attributes

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

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

Definition at line 119 of file TIBRing.cc.

119  {
120 
121 }

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 79 of file TIBRing.cc.

References funct::abs(), plotBeamSpotDB::first, i, j, Geom::pi(), stat_mean(), relval_parameters_module::step, and theDets.

81 {
82  vector<double> adj_diff(last-first-1);
83  for (int i=0; i < static_cast<int>(adj_diff.size()); i++) {
84  vector<const GeomDet*>::const_iterator curent = first + i;
85  adj_diff[i] = (**(curent+1)).surface().position().phi() -
86  (**curent).surface().position().phi();
87  }
88  double step = stat_mean( adj_diff);
89  double phi_step = 2.*Geom::pi()/(last-first);
90 
91  if ( std::abs(step-phi_step)/phi_step > 0.01) {
92  int ndets = last-first;
93  edm::LogError("TkDetLayers") << "TIBRing Warning: not periodic. ndets=" << ndets ;
94  for (int j=0; j<ndets; j++) {
95  edm::LogError("TkDetLayers") << "Dets(r,phi): (" << theDets[j]->surface().position().perp()
96  << "," << theDets[j]->surface().position().phi() << ") " ;
97  }
98  throw DetLayerException( "Error: TIBRing is not periodic");
99  }
100 }
Common base class.
int i
Definition: DBlmapReader.cc:9
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
double stat_mean(const CONT &cont)
Definition: simple_stat.h:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
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 63 of file TIBRing.cc.

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

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

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 58 of file TIBRing.cc.

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

Definition at line 227 of file TIBRing.cc.

References funct::abs(), PV3DBase< T, PVType, FrameType >::barePhi(), HelixBarrelCylinderCrossing::bestSol, PeriodicBinFinderInPhi< T >::binIndex(), HelixBarrelCylinderCrossing::direction(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixBarrelCylinderCrossing::hasSolution(), GloballyPositioned< T >::position(), HelixBarrelCylinderCrossing::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  auto rho = startingState.transverseCurvature();
236 
237  HelixBarrelCylinderCrossing cylCrossing( startPos, startDir, rho,
238  propDir,specificSurface(),
240 
241  if (!cylCrossing.hasSolution()) return SubRingCrossings();
242 
243  GlobalPoint cylPoint( cylCrossing.position());
244  GlobalVector cylDir( cylCrossing.direction());
245  int closestIndex = theBinFinder.binIndex(cylPoint.barePhi());
246 
247  const Plane& closestPlane( theDets[closestIndex]->surface());
248 
249  LocalPoint closestPos = Crossing::positionOnly( cylPoint, cylDir, rho, closestPlane);
250  float closestDist = closestPos.x(); // use fact that local X perp to global Z
251 
252  //int next = cylPoint.phi() - closestPlane.position().phi() > 0 ? closest+1 : closest-1;
253  int nextIndex = PhiLess()( closestPlane.position().barePhi(), cylPoint.barePhi()) ?
254  closestIndex+1 : closestIndex-1;
255 
256  const Plane& nextPlane( theDets[ theBinFinder.binIndex(nextIndex)]->surface());
257  LocalPoint nextPos = Crossing::positionOnly( cylPoint, cylDir, rho, nextPlane);
258  float nextDist = nextPos.x();
259 
260  if (std::abs(closestDist) < std::abs(nextDist)) {
261  return SubRingCrossings( closestIndex, nextIndex, nextDist);
262  }
263  else {
264  return SubRingCrossings( nextIndex, closestIndex, closestDist);
265  }
266 }
BinFinderType theBinFinder
Definition: TIBRing.h:87
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Definition: TIBRing.h:19
std::vector< const GeomDet * > theDets
Definition: TIBRing.h:89
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
Definition: Plane.h:17
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const BoundCylinder & specificSurface() const
Return the ring surface as a.
Definition: TIBRing.h:41
GlobalVector globalMomentum() const
T x() const
Definition: PV3DBase.h:62
void TIBRing::computeHelicity ( )
private

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

102  {
103 
104  const GeomDet& det = *theDets.front();
105  GlobalVector radial = det.surface().position() - GlobalPoint(0,0,0);
106  GlobalVector normal = det.surface().toGlobal( LocalVector(0,0,1));
107  if(normal.dot(radial)<=0)normal*=-1;
108 // edm::LogInfo(TkDetLayers) << "BarrelDetRing::computeHelicity: phi(normal) " << normal.phi()
109 // << " phi(radial) " << radial.phi() ;
110  if (PhiLess()( normal.phi(), radial.phi())) {
111  theHelicity = 1; // smaller phi angles mean "inner" group
112  }
113  else {
114  theHelicity = 0; // smaller phi angles mean "outer" group
115  }
116 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
Local3DVector LocalVector
Definition: LocalVector.h:12
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
int theHelicity
Definition: TIBRing.h:91
const PositionType & position() const
float TIBRing::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 268 of file TIBRing.cc.

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

Referenced by groupedCompatibleDetsV().

271 {
272  return est.maximalLocalDisplacement(tsos, det->surface()).x();
273 }
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
void TIBRing::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 133 of file TIBRing.cc.

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

137 {
138  vector<DetGroup> closestResult;
139  SubRingCrossings crossings;
140  crossings = computeCrossings( tsos, prop.propagationDirection());
141  if(! crossings.isValid_) return;
142 
143  typedef CompatibleDetToGroupAdder Adder;
144  Adder::add( *theDets[theBinFinder.binIndex(crossings.closestIndex)],
145  tsos, prop, est, closestResult);
146 
147  if(closestResult.empty()){
148  Adder::add( *theDets[theBinFinder.binIndex(crossings.nextIndex)],
149  tsos, prop, est, result);
150  return;
151  }
152 
153  DetGroupElement closestGel( closestResult.front().front());
154  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
155 
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( std::move(closestResult), std::move(nextResult),
164  result,
165  theHelicity, crossingSide);
166  }
167  else {
168  DetGroupMerger::orderAndMergeTwoLevels( std::move(nextResult), std::move(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.5f*detWidth) {
182  searchNeighbors( tsos, prop, est, crossings, window, result);
183  }
184 }
def window
Definition: svgfig.py:642
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
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)
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:151
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
tuple result
Definition: mps_fire.py:83
int theHelicity
Definition: TIBRing.h:91
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
Definition: TIBRing.cc:268
def move
Definition: eostools.py:510
double f[11][100]
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubRingCrossings &crossings, float window, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TIBRing.cc:186
SubRingCrossings computeCrossings(const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
Definition: TIBRing.cc:227
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
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, bookConverter::max, HLT_25ns10e33_v2_cff::Merger, min(), eostools::move(), neighbor(), TIBRing::SubRingCrossings::nextIndex, theBinFinder, theDets, and theHelicity.

Referenced by groupedCompatibleDetsV().

192 {
193  typedef CompatibleDetToGroupAdder Adder;
194  int crossingSide = LayerCrossingSide::barrelSide( tsos, prop);
195  typedef DetGroupMerger Merger;
196 
197  int negStart = std::min( crossings.closestIndex, crossings.nextIndex) - 1;
198  int posStart = std::max( crossings.closestIndex, crossings.nextIndex) + 1;
199 
200  int quarter = theDets.size()/4;
201  for (int idet=negStart; idet >= negStart - quarter+1; idet--) {
202  const GeomDet* neighbor = theDets[theBinFinder.binIndex(idet)];
203  // if (!overlap( gCrossingPos, *neighbor, window)) break; // mybe not needed?
204  // maybe also add shallow crossing angle test here???
205  vector<DetGroup> tmp1;
206  if (!Adder::add( *neighbor, tsos, prop, est, tmp1)) break;
207  vector<DetGroup> tmp2; tmp2.swap(result);
208  vector<DetGroup> newResult;
209  Merger::orderAndMergeTwoLevels(std::move(tmp1), std::move(tmp2), newResult, theHelicity, crossingSide);
210  result.swap(newResult);
211  }
212  for (int idet=posStart; idet < posStart + quarter-1; idet++) {
213  const GeomDet* neighbor = theDets[theBinFinder.binIndex(idet)];
214  // if (!overlap( gCrossingPos, *neighbor, window)) break; // mybe not needed?
215  // maybe also add shallow crossing angle test here???
216  vector<DetGroup> tmp1;
217  if (!Adder::add( *neighbor, tsos, prop, est, tmp1)) break;
218  vector<DetGroup> tmp2; tmp2.swap(result);
219  vector<DetGroup> newResult;
220  Merger::orderAndMergeTwoLevels(std::move(tmp2), std::move(tmp1), newResult, theHelicity, crossingSide);
221  result.swap(newResult);
222  }
223 }
static int barrelSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
returns 0 if barrel layer crossed from inside, 1 if from outside
BinFinderType theBinFinder
Definition: TIBRing.h:87
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
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
tuple result
Definition: mps_fire.py:83
int theHelicity
Definition: TIBRing.h:91
def move
Definition: eostools.py:510
T min(T a, T b)
Definition: MathUtil.h:58
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().