CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MTDDetRing Class Reference

#include <MTDDetRing.h>

Inheritance diagram for MTDDetRing:
ForwardDetRingOneZ ForwardDetRing GeometricSearchDet

Public Member Functions

std::pair< bool, TrajectoryStateOnSurfacecompatible (const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est) const override
 
std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
 
const std::vector< const GeometricSearchDet * > & components () const override
 Returns basic components, if any. More...
 
std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
 
 MTDDetRing (std::vector< const GeomDet *>::const_iterator first, std::vector< const GeomDet *>::const_iterator last)
 Construct from iterators on GeomDet*. More...
 
 MTDDetRing (const std::vector< const GeomDet *> &dets)
 Construct from a vector of GeomDet*. More...
 
 ~MTDDetRing () override
 
- Public Member Functions inherited from ForwardDetRingOneZ
const std::vector< const GeomDet * > & basicComponents () const override
 
 ForwardDetRingOneZ (std::vector< const GeomDet *>::const_iterator first, std::vector< const GeomDet *>::const_iterator last)
 Construct from iterators on Det*. More...
 
 ForwardDetRingOneZ (const std::vector< const GeomDet *> &dets)
 
 ~ForwardDetRingOneZ () override
 
- Public Member Functions inherited from ForwardDetRing
void compatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const override
 
 GeometricSearchDet (bool doHaveGroups)
 
const BoundDiskspecificSurface () const
 Return the ring surface as a BoundDisk. More...
 
const BoundSurfacesurface () const final
 The surface of the GeometricSearchDet. More...
 
 ~ForwardDetRing () override
 
- Public Member Functions inherited from GeometricSearchDet
 GeometricSearchDet (bool doHaveGroups)
 
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) 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

void init ()
 

Private Attributes

BinFinderType theBinFinder
 

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 Member Functions inherited from ForwardDetRingOneZ
bool add (int idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
 
- Protected Member Functions inherited from ForwardDetRing
void setDisk (BoundDisk *disk)
 Set the rod's disk. More...
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
GeomDetCompatibilityChecker theCompatibilityChecker
 

Detailed Description

A ring of periodic, possibly overlapping vertical detectors. Designed for the endcap timing layer.

Author
L. Gray - FNAL

Definition at line 16 of file MTDDetRing.h.

Member Typedef Documentation

◆ BinFinderType

Definition at line 43 of file MTDDetRing.h.

Constructor & Destructor Documentation

◆ MTDDetRing() [1/2]

MTDDetRing::MTDDetRing ( std::vector< const GeomDet *>::const_iterator  first,
std::vector< const GeomDet *>::const_iterator  last 
)

Construct from iterators on GeomDet*.

Definition at line 19 of file MTDDetRing.cc.

References init().

21  init();
22 }
void init()
Definition: MTDDetRing.cc:26
ForwardDetRingOneZ(std::vector< const GeomDet *>::const_iterator first, std::vector< const GeomDet *>::const_iterator last)
Construct from iterators on Det*.

◆ MTDDetRing() [2/2]

MTDDetRing::MTDDetRing ( const std::vector< const GeomDet *> &  dets)

Construct from a vector of GeomDet*.

Definition at line 24 of file MTDDetRing.cc.

References init().

24 : ForwardDetRingOneZ(vdets) { init(); }
void init()
Definition: MTDDetRing.cc:26
ForwardDetRingOneZ(std::vector< const GeomDet *>::const_iterator first, std::vector< const GeomDet *>::const_iterator last)
Construct from iterators on Det*.

◆ ~MTDDetRing()

MTDDetRing::~MTDDetRing ( )
override

Definition at line 30 of file MTDDetRing.cc.

30 {}

Member Function Documentation

◆ compatible()

pair< bool, TrajectoryStateOnSurface > MTDDetRing::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 39 of file MTDDetRing.cc.

References MeasurementEstimator::estimate(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localPosition(), LogTrace, PV3DBase< T, PVType, FrameType >::perp(), Propagator::propagate(), ForwardDetRing::specificSurface(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by compatibleDets().

41  {
42  TrajectoryStateOnSurface ms = prop.propagate(ts, specificSurface());
43 
44 #ifdef EDM_ML_DEBUG
45  LogTrace("MTDDetLayers") << "MTDDetRing::compatible, Surface at Z: " << specificSurface().position().z()
46  << " R1: " << specificSurface().innerRadius() << " R2: " << specificSurface().outerRadius()
47  << " TS at Z,R: " << ts.globalPosition().z() << "," << ts.globalPosition().perp();
48  if (ms.isValid()) {
49  LogTrace("MTDDetLayers") << " DEST at Z,R: " << ms.globalPosition().z() << "," << ms.globalPosition().perp()
50  << " local Z: " << ms.localPosition().z();
51  } else {
52  LogTrace("MTDDetLayers") << " DEST: not valid";
53  }
54 #endif
55 
56  return make_pair(ms.isValid() and est.estimate(ms, specificSurface()) != 0, ms);
57 }
T perp() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:61
const BoundDisk & specificSurface() const
Return the ring surface as a BoundDisk.
#define LogTrace(id)
GlobalPoint globalPosition() const

◆ compatibleDets()

vector< GeometricSearchDet::DetWithState > MTDDetRing::compatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
overridevirtual

Returns all Dets compatible with a trajectory state according to the estimator est. The startingState should be propagated to the surface of each compatible Det using the Propagator passed as an argument. The default implementation should be overridden in dets with specific surface types to avoid propagation to a generic Surface

Reimplemented from GeometricSearchDet.

Definition at line 59 of file MTDDetRing.cc.

References ForwardDetRingOneZ::add(), ForwardDetRingOneZ::basicComponents(), PeriodicBinFinderInPhi< T >::binIndex(), compatible(), TrajectoryStateOnSurface::globalPosition(), createfilelist::int, LogTrace, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeometricSearchDet::position(), GloballyPositioned< T >::position(), mps_fire::result, ForwardDetRing::specificSurface(), mathSSE::sqrt(), ForwardDetRing::surface(), theBinFinder, and PV3DBase< T, PVType, FrameType >::z().

61  {
62  LogTrace("MTDDetLayers") << "MTDDetRing::compatibleDets, Surface at Z: " << surface().position().z()
63  << " R1: " << specificSurface().innerRadius() << " R2: " << specificSurface().outerRadius()
64  << " TS at Z,R: " << startingState.globalPosition().z() << ","
65  << startingState.globalPosition().perp() << " DetRing pos." << position();
66 
67  vector<DetWithState> result;
68 
69  // Propagate and check that the result is within bounds
70  pair<bool, TrajectoryStateOnSurface> compat = compatible(startingState, prop, est);
71  if (!compat.first) {
72  LogTrace("MTDDetLayers") << " MTDDetRing::compatibleDets: not compatible"
73  << " (should not have been selected!)";
74  return result;
75  }
76 
77  // Find the most probable destination component
78  TrajectoryStateOnSurface& tsos = compat.second;
79  GlobalPoint startPos = tsos.globalPosition();
80  int closest = theBinFinder.binIndex(startPos.phi());
81  const vector<const GeomDet*> dets = basicComponents();
82  LogTrace("MTDDetLayers") << " MTDDetRing::compatibleDets, closest det: " << closest
83  << " Phi: " << dets[closest]->surface().position().phi() << " impactPhi " << startPos.phi();
84 
85  // Add this detector, if it is compatible
86  // NOTE: add performs a null propagation
87  add(closest, result, tsos, prop, est);
88 
89 #ifdef EDM_ML_DEBUG
90  int nclosest = result.size();
91  int nnextdet = 0; // MDEBUG counters
92 
93  // Try the neighbors on each side until no more compatible.
94  float dphi = 0;
95  if (!result.empty()) { // If closest is not compatible the next cannot be either
96  float nSigmas = 3.;
97  if (result.back().second.hasError()) {
98  dphi = nSigmas * atan(sqrt(result.back().second.localError().positionError().xx()) /
99  result.back().second.globalPosition().perp());
100  }
101  } else {
102  LogTrace("MTDDetLayers") << " MTDDetRing::compatibleDets, closest not compatible!";
103  //FIXME: if closest is not compatible the next cannot be either
104  }
105 #endif
106 
107  for (int idet = closest + 1; idet < closest + int(dets.size()) / 4 + 1; idet++) {
108  // FIXME: should use dphi to decide if det must be queried.
109  // Right now query until not compatible.
110  int idetp = theBinFinder.binIndex(idet);
111  {
112 #ifdef EDM_ML_DEBUG
113  LogTrace("MTDDetLayers") << " next det:" << idetp << " at Z: " << dets[idetp]->position().z()
114  << " phi: " << dets[idetp]->position().phi() << " FTS phi " << startPos.phi()
115  << " max dphi " << dphi;
116  nnextdet++;
117 #endif
118  if (!add(idetp, result, tsos, prop, est))
119  break;
120  }
121  }
122 
123  for (int idet = closest - 1; idet > closest - int(dets.size()) / 4 - 1; idet--) {
124  // FIXME: should use dphi to decide if det must be queried.
125  // Right now query until not compatible.
126  int idetp = theBinFinder.binIndex(idet);
127  {
128 #ifdef EDM_ML_DEBUG
129  LogTrace("MTDDetLayers") << " previous det:" << idetp << " " << idet << " " << closest - dets.size() / 4 - 1
130  << " at Z: " << dets[idetp]->position().z() << " phi: " << dets[idetp]->position().phi()
131  << " FTS phi " << startPos.phi() << " max dphi" << dphi;
132  nnextdet++;
133 #endif
134  if (!add(idetp, result, tsos, prop, est))
135  break;
136  }
137  }
138 
139 #ifdef EDM_ML_DEBUG
140  LogTrace("MTDDetLayers") << " MTDDetRing::compatibleDets, size: " << result.size() << " on closest: " << nclosest
141  << " # checked dets: " << nnextdet + 1;
142 
143  if (result.empty()) {
144  LogTrace("MTDDetLayers") << " ***Ring not compatible,should have been discarded before!!!";
145  }
146 #endif
147 
148  return result;
149 }
BinFinderType theBinFinder
Definition: MTDDetRing.h:44
virtual const Surface::PositionType & position() const
Returns position of the surface.
T perp() const
Definition: PV3DBase.h:69
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDDetRing.cc:39
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
const std::vector< const GeomDet * > & basicComponents() const override
T z() const
Definition: PV3DBase.h:61
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
const BoundDisk & specificSurface() const
Return the ring surface as a BoundDisk.
#define LogTrace(id)
GlobalPoint globalPosition() const
T sqrt(T t)
Definition: SSEVec.h:19
const PositionType & position() const
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
bool add(int idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const

◆ components()

const vector< const GeometricSearchDet * > & MTDDetRing::components ( ) const
overridevirtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 32 of file MTDDetRing.cc.

References mps_fire::result.

32  {
33  // FIXME dummy impl.
34  edm::LogError("MTDDetLayers") << "temporary dummy implementation of MTDDetRing::components()!!";
35  static const vector<const GeometricSearchDet*> result;
36  return result;
37 }
Log< level::Error, false > LogError

◆ groupedCompatibleDets()

vector< DetGroup > MTDDetRing::groupedCompatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
overridevirtual

Similar to compatibleDets(), but the compatible Dets are grouped in one or more groups. Dets are put in the same group if they are mutually exclusive for track crossing, i.e. a reconstructible track cannot cross more than one Det from a group. Pathological tracks (spirals etc.) can of course violate this rule.
The DetGroups are sorted in the sequence of crossing by a track. In order to define the direction of crossing the Propagator used in this method should have a defined direction() : either "alongMomentum" or "oppositeToMomentum" but not "anyDirection".
The three signatures of this method differ by the input trajectory state arguments: the starting state can be a TrajectoryStateOnSurface or a FreeTrajectoryState, and the state on this CompositeDet may be already known or not. The last two arguments are as for the method compatibleDets().
First signature: The first argument is a TrajectoryStateOnSurface, usually not on the surface of this CompositeDet.

Reimplemented from GeometricSearchDet.

Definition at line 151 of file MTDDetRing.cc.

References mps_fire::result.

153  {
154  // FIXME should be implemented to allow returning overlapping chambers
155  // as separate groups!
156  edm::LogError("MTDDetLayers") << "dummy implementation of MTDDetRing::groupedCompatibleDets()";
157  vector<DetGroup> result;
158  return result;
159 }
Log< level::Error, false > LogError

◆ init()

void MTDDetRing::init ( void  )
private

Definition at line 26 of file MTDDetRing.cc.

References ForwardDetRingOneZ::basicComponents(), phi, GeometricSearchDet::position(), findQualityFiles::size, and theBinFinder.

Referenced by MTDDetRing().

26  {
28 }
BinFinderType theBinFinder
Definition: MTDDetRing.h:44
size
Write out results.
virtual const Surface::PositionType & position() const
Returns position of the surface.
const std::vector< const GeomDet * > & basicComponents() const override
PeriodicBinFinderInPhi< float > BinFinderType
Definition: MTDDetRing.h:43

Member Data Documentation

◆ theBinFinder

BinFinderType MTDDetRing::theBinFinder
private

Definition at line 44 of file MTDDetRing.h.

Referenced by compatibleDets(), and init().