CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
MTDDetSector Class Reference

#include <MTDDetSector.h>

Inheritance diagram for MTDDetSector:
GeometricSearchDet

Public Member Functions

const std::vector< const GeomDet * > & basicComponents () const override
 
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
 
void compatibleDetsLine (const size_t idetMin, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
 
void compatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const override
 
const std::vector< const GeometricSearchDet * > & components () const override
 Returns basic components, if any. More...
 
 GeometricSearchDet (bool doHaveGroups)
 
std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
 
size_t hshift (const uint32_t detid, const int horizontalShift) const
 
 MTDDetSector (const std::vector< const GeomDet * > &dets, const MTDTopology &topo)
 Construct from a vector of GeomDet*. More...
 
 MTDDetSector (std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last, const MTDTopology &topo)
 Construct from iterators on GeomDet*. More...
 
const BoundDiskSectorspecificSurface () const
 
const BoundSurfacesurface () const final
 The surface of the GeometricSearchDet. More...
 
size_t vshift (const uint32_t detid, const int verticalShift, size_t &closest) const
 
 ~MTDDetSector () 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 ()
 

Protected Member Functions

bool add (size_t idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
 
void setDisk (BoundDiskSector *diskS)
 

Private Member Functions

void init ()
 

Private Attributes

std::vector< const GeomDet * > theDets
 
ReferenceCountingPointer< BoundDiskSectortheDiskS
 
const MTDTopologytopo_
 

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

Definition at line 12 of file MTDDetSector.h.

Constructor & Destructor Documentation

◆ MTDDetSector() [1/2]

MTDDetSector::MTDDetSector ( std::vector< const GeomDet * >::const_iterator  first,
std::vector< const GeomDet * >::const_iterator  last,
const MTDTopology topo 
)

Construct from iterators on GeomDet*.

Definition at line 18 of file MTDDetSector.cc.

21  : GeometricSearchDet(false), theDets(first, last), topo_(&topo) {
22  init();
23 }

References init().

◆ MTDDetSector() [2/2]

MTDDetSector::MTDDetSector ( const std::vector< const GeomDet * > &  dets,
const MTDTopology topo 
)

Construct from a vector of GeomDet*.

Definition at line 25 of file MTDDetSector.cc.

26  : GeometricSearchDet(false), theDets(vdets), topo_(&topo) {
27  init();
28 }

References init().

◆ ~MTDDetSector()

MTDDetSector::~MTDDetSector ( )
inlineoverride

Definition at line 24 of file MTDDetSector.h.

24 {};

Member Function Documentation

◆ add()

bool MTDDetSector::add ( size_t  idet,
std::vector< DetWithState > &  result,
const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est 
) const
protected

Definition at line 162 of file MTDDetSector.cc.

166  {
167  pair<bool, TrajectoryStateOnSurface> compat = theCompatibilityChecker.isCompatible(theDets[idet], tsos, prop, est);
168 
169  if (compat.first) {
170  result.push_back(DetWithState(theDets[idet], compat.second));
171  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det idetMin " << idet
172  << " detId = " << theDets[idet]->geographicalId().rawId() << " at "
173  << theDets[idet]->position()
174  << " dist = " << std::sqrt((tsos.globalPosition() - theDets[idet]->position()).mag2());
175  }
176 
177  return compat.first;
178 }

References TrajectoryStateOnSurface::globalPosition(), GeomDetCompatibilityChecker::isCompatible(), LogTrace, mag2(), mps_fire::result, mathSSE::sqrt(), GeometricSearchDet::theCompatibilityChecker, and theDets.

Referenced by compatibleDets(), compatibleDetsLine(), and counter.Counter::register().

◆ basicComponents()

const std::vector<const GeomDet*>& MTDDetSector::basicComponents ( ) const
inlineoverridevirtual

Implements GeometricSearchDet.

Definition at line 28 of file MTDDetSector.h.

28 { return theDets; }

References theDets.

Referenced by compatibleDets().

◆ compatible()

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

46  {
47  TrajectoryStateOnSurface ms = prop.propagate(ts, specificSurface());
48 
49 #ifdef EDM_ML_DEBUG
50  LogTrace("MTDDetLayers") << "MTDDetSector::compatible, sector: \n"
51  << (*this) << "\n TS at Z,R,phi: " << std::fixed << std::setw(14) << ts.globalPosition().z()
52  << " , " << std::setw(14) << ts.globalPosition().perp() << " , " << std::setw(14)
53  << ts.globalPosition().phi();
54  if (ms.isValid()) {
55  LogTrace("MTDDetLayers") << " DEST at Z,R,phi: " << std::fixed << std::setw(14) << ms.globalPosition().z() << " , "
56  << std::setw(14) << ms.globalPosition().perp() << " , " << std::setw(14)
57  << ms.globalPosition().phi() << " local Z: " << std::setw(14) << ms.localPosition().z();
58  } else {
59  LogTrace("MTDDetLayers") << " DEST: not valid";
60  }
61 #endif
62 
63  return make_pair(ms.isValid() and est.estimate(ms, specificSurface()) != 0, ms);
64 }

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

Referenced by compatibleDets().

◆ compatibleDets()

vector< GeometricSearchDet::DetWithState > MTDDetSector::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 66 of file MTDDetSector.cc.

68  {
69  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, sector: \n"
70  << (*this) << "\n TS at Z,R,phi: " << std::fixed << std::setw(14)
71  << startingState.globalPosition().z() << " , " << std::setw(14)
72  << startingState.globalPosition().perp() << " , " << std::setw(14)
73  << startingState.globalPosition().phi();
74 
75  vector<DetWithState> result;
76 
77  // Propagate and check that the result is within bounds
78  pair<bool, TrajectoryStateOnSurface> compat = compatible(startingState, prop, est);
79  if (!compat.first) {
80  LogTrace("MTDDetLayers") << " MTDDetSector::compatibleDets: not compatible"
81  << " (should not have been selected!)";
82  return result;
83  }
84 
85  TrajectoryStateOnSurface& tsos = compat.second;
86  GlobalPoint startPos = tsos.globalPosition();
87 
88  LogTrace("MTDDetLayers") << "Starting position: " << startPos << " starting p/pT: " << tsos.globalMomentum().mag()
89  << " / " << tsos.globalMomentum().perp();
90 
91  // determine distance of det center from extrapolation on the surface, sort dets accordingly
92 
93  size_t idetMin = basicComponents().size();
94  double dist2Min = std::numeric_limits<double>::max();
95  std::vector<std::pair<double, size_t> > tmpDets;
96  tmpDets.reserve(basicComponents().size());
97 
98  for (size_t idet = 0; idet < basicComponents().size(); idet++) {
99  double dist2 = (startPos - theDets[idet]->position()).mag2();
100  tmpDets.emplace_back(dist2, idet);
101  if (dist2 < dist2Min) {
102  dist2Min = dist2;
103  idetMin = idet;
104  }
105  }
106 
107  //look for the compatibledets considering each line of the sector
108 
109  if (add(idetMin, result, tsos, prop, est)) {
110  compatibleDetsLine(idetMin, result, tsos, prop, est);
111 
112  for (int iside = -1; iside <= 1; iside += 2) {
113  bool isCompatible(true);
114  size_t idetNew(idetMin);
115  size_t closest = theDets.size();
116 
117  while (isCompatible) {
118  idetNew = vshift(theDets[idetNew]->geographicalId().rawId(), iside, closest);
119  if (idetNew >= theDets.size()) {
120  if (closest < theDets.size()) {
121  idetNew = closest;
122  } else {
123  break;
124  }
125  }
126  isCompatible = add(idetNew, result, tsos, prop, est);
127  if (isCompatible) {
128  compatibleDetsLine(idetNew, result, tsos, prop, est);
129  }
130  }
131  }
132  }
133 
134 #ifdef EDM_ML_DEBUG
135  if (result.empty()) {
136  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, closest not compatible!";
137  } else {
138  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, found " << result.size() << " compatible dets";
139  }
140 #endif
141 
142  return result;
143 }

References add(), basicComponents(), compatible(), compatibleDetsLine(), alignBH_cfg::fixed, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), mag2(), SiStripPI::max, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), mps_fire::result, findQualityFiles::size, theDets, vshift(), and PV3DBase< T, PVType, FrameType >::z().

◆ compatibleDetsLine()

void MTDDetSector::compatibleDetsLine ( const size_t  idetMin,
std::vector< DetWithState > &  result,
const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est 
) const

Definition at line 192 of file MTDDetSector.cc.

196  {
197  for (int iside = -1; iside <= 1; iside += 2) {
198  bool isCompatible(true);
199  size_t idetNew(idetMin);
200 
201  while (isCompatible) {
202  idetNew = hshift(theDets[idetNew]->geographicalId().rawId(), iside);
203  if (idetNew >= theDets.size()) {
204  break;
205  }
206  isCompatible = add(idetNew, result, tsos, prop, est);
207  }
208  }
209 
210  return;
211 }

References add(), hshift(), mps_fire::result, and theDets.

Referenced by compatibleDets().

◆ compatibleDetsV()

void MTDDetSector::compatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetWithState > &  result 
) const
overridevirtual

Reimplemented from GeometricSearchDet.

Definition at line 145 of file MTDDetSector.cc.

148  {
149  edm::LogError("MTDDetLayers") << "At the moment not a real implementation";
150 }

◆ components()

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 37 of file MTDDetSector.cc.

37  {
38  // FIXME dummy impl.
39  edm::LogError("MTDDetLayers") << "temporary dummy implementation of MTDDetSector::components()!!";
40  static const vector<const GeometricSearchDet*> result;
41  return result;
42 }

References mps_fire::result.

◆ GeometricSearchDet()

GeometricSearchDet::GeometricSearchDet
inline

Definition at line 24 of file GeometricSearchDet.h.

24 : haveGroups(doHaveGroups) {}

◆ groupedCompatibleDets()

vector< DetGroup > MTDDetSector::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 152 of file MTDDetSector.cc.

154  {
155  // FIXME should be implemented to allow returning overlapping chambers
156  // as separate groups!
157  edm::LogInfo("MTDDetLayers") << "dummy implementation of MTDDetSector::groupedCompatibleDets()";
158  vector<DetGroup> result;
159  return result;
160 }

References mps_fire::result.

◆ hshift()

size_t MTDDetSector::hshift ( const uint32_t  detid,
const int  horizontalShift 
) const

Definition at line 213 of file MTDDetSector.cc.

213  {
214  return topo_->hshiftETL(detid, horizontalShift);
215 }

References MTDTopology::hshiftETL(), and topo_.

Referenced by compatibleDetsLine().

◆ init()

void MTDDetSector::init ( void  )
private

Definition at line 30 of file MTDDetSector.cc.

30  {
31  // Add here the sector build based on a collection of GeomDets, mimic what done in ForwardDetRingOneZ
32  // using the code from tracker BladeShapeBuilderFromDet
33  // simple initial version, no sorting for the time being
35 }

References setDisk(), and theDets.

Referenced by MTDDetSector().

◆ setDisk()

void MTDDetSector::setDisk ( BoundDiskSector diskS)
inlineprotected

Definition at line 65 of file MTDDetSector.h.

65 { theDiskS = diskS; }

References theDiskS.

Referenced by init().

◆ specificSurface()

const BoundDiskSector& MTDDetSector::specificSurface ( ) const
inline

Definition at line 53 of file MTDDetSector.h.

53 { return *theDiskS; }

References theDiskS.

Referenced by compatible().

◆ surface()

const BoundSurface& MTDDetSector::surface ( ) const
inlinefinalvirtual

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 30 of file MTDDetSector.h.

30 { return *theDiskS; }

References theDiskS.

◆ vshift()

size_t MTDDetSector::vshift ( const uint32_t  detid,
const int  verticalShift,
size_t &  closest 
) const

Definition at line 217 of file MTDDetSector.cc.

217  {
218  return topo_->vshiftETL(detid, verticalShift, closest);
219 }

References topo_, and MTDTopology::vshiftETL().

Referenced by compatibleDets().

Member Data Documentation

◆ theDets

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

Definition at line 75 of file MTDDetSector.h.

Referenced by add(), basicComponents(), compatibleDets(), compatibleDetsLine(), and init().

◆ theDiskS

ReferenceCountingPointer<BoundDiskSector> MTDDetSector::theDiskS
private

Definition at line 74 of file MTDDetSector.h.

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

◆ topo_

const MTDTopology* MTDDetSector::topo_
private

Definition at line 77 of file MTDDetSector.h.

Referenced by hshift(), and vshift().

MTDDetSector::hshift
size_t hshift(const uint32_t detid, const int horizontalShift) const
Definition: MTDDetSector.cc:213
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
GeometricSearchDet::GeometricSearchDet
GeometricSearchDet(bool doHaveGroups)
Definition: GeometricSearchDet.h:24
GeometricSearchDet::haveGroups
bool haveGroups
Definition: GeometricSearchDet.h:103
GeometricSearchDet::theCompatibilityChecker
GeomDetCompatibilityChecker theCompatibilityChecker
Definition: GeometricSearchDet.h:102
MTDDetSector::theDets
std::vector< const GeomDet * > theDets
Definition: MTDDetSector.h:75
MTDDetSector::topo_
const MTDTopology * topo_
Definition: MTDDetSector.h:77
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
MTDTopology::hshiftETL
size_t hshiftETL(const uint32_t detid, const int horizontalShift) const
Definition: MTDTopology.cc:20
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
MTDDiskSectorBuilderFromDet
Definition: MTDDiskSectorBuilderFromDet.h:15
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
dqmdumpme.last
last
Definition: dqmdumpme.py:56
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MTDDetSector::compatibleDetsLine
void compatibleDetsLine(const size_t idetMin, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
Definition: MTDDetSector.cc:192
MTDDetSector::add
bool add(size_t idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
Definition: MTDDetSector.cc:162
Point3DBase< float, GlobalTag >
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
GeomDetCompatibilityChecker::isCompatible
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
Definition: GeomDetCompatibilityChecker.cc:58
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
MTDTopology::vshiftETL
size_t vshiftETL(const uint32_t detid, const int verticalShift, size_t &closest) const
Definition: MTDTopology.cc:56
MTDDetSector::theDiskS
ReferenceCountingPointer< BoundDiskSector > theDiskS
Definition: MTDDetSector.h:74
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MTDDetSector::specificSurface
const BoundDiskSector & specificSurface() const
Definition: MTDDetSector.h:53
MTDDetSector::compatible
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDDetSector.cc:44
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GeometricSearchDet::DetWithState
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Definition: GeometricSearchDet.h:19
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
MTDDetSector::init
void init()
Definition: MTDDetSector.cc:30
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
MTDDetSector::setDisk
void setDisk(BoundDiskSector *diskS)
Definition: MTDDetSector.h:65
MTDDetSector::basicComponents
const std::vector< const GeomDet * > & basicComponents() const override
Definition: MTDDetSector.h:28
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
MTDDetSector::vshift
size_t vshift(const uint32_t detid, const int verticalShift, size_t &closest) const
Definition: MTDDetSector.cc:217
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443