CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static 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 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
 
 MTDDetSector (const std::vector< const GeomDet * > &dets)
 Construct from a vector of GeomDet*. More...
 
 MTDDetSector (std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
 Construct from iterators on GeomDet*. More...
 
const BoundDiskSectorspecificSurface () const
 
const BoundSurfacesurface () const final
 The surface of the GeometricSearchDet. More...
 
 ~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
 

Static Private Attributes

static constexpr size_t detsRange = 50
 

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 11 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 
)

Construct from iterators on GeomDet*.

Definition at line 17 of file MTDDetSector.cc.

18  : GeometricSearchDet(false), theDets(first, last) {
19  init();
20 }

References init().

◆ MTDDetSector() [2/2]

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

Construct from a vector of GeomDet*.

Definition at line 22 of file MTDDetSector.cc.

22 : GeometricSearchDet(false), theDets(vdets) { init(); }

References init().

◆ ~MTDDetSector()

MTDDetSector::~MTDDetSector ( )
inlineoverride

Definition at line 21 of file MTDDetSector.h.

21 {};

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 150 of file MTDDetSector.cc.

154  {
155  pair<bool, TrajectoryStateOnSurface> compat = theCompatibilityChecker.isCompatible(theDets[idet], tsos, prop, est);
156 
157  if (compat.first) {
158  result.push_back(DetWithState(theDets[idet], compat.second));
159  }
160 
161  return compat.first;
162 }

References GeomDetCompatibilityChecker::isCompatible(), mps_fire::result, GeometricSearchDet::theCompatibilityChecker, and theDets.

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

◆ basicComponents()

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

Implements GeometricSearchDet.

Definition at line 25 of file MTDDetSector.h.

25 { 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 38 of file MTDDetSector.cc.

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

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 60 of file MTDDetSector.cc.

62  {
63  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, sector: \n"
64  << (*this) << "\n TS at Z,R,phi: " << std::fixed << std::setw(14)
65  << startingState.globalPosition().z() << " , " << std::setw(14)
66  << startingState.globalPosition().perp() << " , " << std::setw(14)
67  << startingState.globalPosition().phi();
68 
69  vector<DetWithState> result;
70 
71  // Propagate and check that the result is within bounds
72  pair<bool, TrajectoryStateOnSurface> compat = compatible(startingState, prop, est);
73  if (!compat.first) {
74  LogTrace("MTDDetLayers") << " MTDDetSector::compatibleDets: not compatible"
75  << " (should not have been selected!)";
76  return result;
77  }
78 
79  TrajectoryStateOnSurface& tsos = compat.second;
80  GlobalPoint startPos = tsos.globalPosition();
81 
82  LogTrace("MTDDetLayers") << "Starting position: " << startPos;
83 
84  // determine distance of det center from extrapolation on the surface, sort dets accordingly
85 
86  size_t idetMin = basicComponents().size();
87  double dist2Min = std::numeric_limits<double>::max();
88  std::vector<std::pair<double, size_t> > tmpDets;
89  tmpDets.reserve(basicComponents().size());
90 
91  for (size_t idet = 0; idet < basicComponents().size(); idet++) {
92  double dist2 = (startPos - theDets[idet]->position()).mag2();
93  tmpDets.emplace_back(dist2, idet);
94  if (dist2 < dist2Min) {
95  dist2Min = dist2;
96  idetMin = idet;
97  }
98  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets " << std::fixed << std::setw(8) << idet << " "
99  << theDets[idet]->geographicalId().rawId() << " dist = " << std::setw(10)
100  << std::sqrt(dist2) << " Min idet/dist = " << std::setw(8) << idetMin << " "
101  << std::setw(10) << std::sqrt(dist2Min) << " " << theDets[idet]->position();
102  }
103 
104  // loop on an interval od ordered detIds around the minimum
105  // set a range of GeomDets around the minimum compatible with the geometry of ETL
106 
107  size_t iniPos(idetMin > detsRange ? idetMin - detsRange : static_cast<size_t>(0));
108  size_t endPos(std::min(idetMin + detsRange, basicComponents().size() - 1));
109  tmpDets.erase(tmpDets.begin() + endPos, tmpDets.end());
110  tmpDets.erase(tmpDets.begin(), tmpDets.begin() + iniPos);
111  std::sort(tmpDets.begin(), tmpDets.end());
112 
113  for (const auto& thisDet : tmpDets) {
114  if (add(thisDet.second, result, tsos, prop, est)) {
115  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det " << thisDet.second
116  << " detId = " << theDets[thisDet.second]->geographicalId().rawId() << " at "
117  << theDets[thisDet.second]->position() << " dist = " << std::sqrt(thisDet.first);
118  } else {
119  break;
120  }
121  }
122 #ifdef EDM_ML_DEBUG
123  if (result.empty()) {
124  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, closest not compatible!";
125  } else {
126  LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, found " << result.size() << " compatible dets";
127  }
128 #endif
129 
130  return result;
131 }

References add(), basicComponents(), compatible(), detsRange, alignBH_cfg::fixed, TrajectoryStateOnSurface::globalPosition(), LogTrace, mag2(), SiStripPI::max, min(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), mps_fire::result, findQualityFiles::size, jetUpdater_cfi::sort, mathSSE::sqrt(), theDets, and PV3DBase< T, PVType, FrameType >::z().

◆ 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 133 of file MTDDetSector.cc.

136  {
137  edm::LogError("MTDDetLayers") << "At the moment not a real implementation";
138 }

◆ components()

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

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 31 of file MTDDetSector.cc.

31  {
32  // FIXME dummy impl.
33  edm::LogError("MTDDetLayers") << "temporary dummy implementation of MTDDetSector::components()!!";
34  static const vector<const GeometricSearchDet*> result;
35  return result;
36 }

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 140 of file MTDDetSector.cc.

142  {
143  // FIXME should be implemented to allow returning overlapping chambers
144  // as separate groups!
145  edm::LogInfo("MTDDetLayers") << "dummy implementation of MTDDetSector::groupedCompatibleDets()";
146  vector<DetGroup> result;
147  return result;
148 }

References mps_fire::result.

◆ init()

void MTDDetSector::init ( void  )
private

Definition at line 24 of file MTDDetSector.cc.

24  {
25  // Add here the sector build based on a collection of GeomDets, mimic what done in ForwardDetRingOneZ
26  // using the code from tracker BladeShapeBuilderFromDet
27  // simple initial version, no sorting for the time being
29 }

References setDisk(), and theDets.

Referenced by MTDDetSector().

◆ setDisk()

void MTDDetSector::setDisk ( BoundDiskSector diskS)
inlineprotected

Definition at line 53 of file MTDDetSector.h.

53 { theDiskS = diskS; }

References theDiskS.

Referenced by init().

◆ specificSurface()

const BoundDiskSector& MTDDetSector::specificSurface ( ) const
inline

Definition at line 50 of file MTDDetSector.h.

50 { return *theDiskS; }

References theDiskS.

Referenced by compatible().

◆ surface()

const BoundSurface& MTDDetSector::surface ( ) const
inlinefinalvirtual

The surface of the GeometricSearchDet.

Implements GeometricSearchDet.

Definition at line 27 of file MTDDetSector.h.

27 { return *theDiskS; }

References theDiskS.

Member Data Documentation

◆ detsRange

constexpr size_t MTDDetSector::detsRange = 50
staticconstexprprivate

Definition at line 70 of file MTDDetSector.h.

Referenced by compatibleDets().

◆ theDets

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

Definition at line 63 of file MTDDetSector.h.

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

◆ theDiskS

ReferenceCountingPointer<BoundDiskSector> MTDDetSector::theDiskS
private

Definition at line 62 of file MTDDetSector.h.

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

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
min
T min(T a, T b)
Definition: MathUtil.h:58
MTDDetSector::theDets
std::vector< const GeomDet * > theDets
Definition: MTDDetSector.h:63
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
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::add
bool add(size_t idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
Definition: MTDDetSector.cc:150
Point3DBase< float, GlobalTag >
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
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
MTDDetSector::theDiskS
ReferenceCountingPointer< BoundDiskSector > theDiskS
Definition: MTDDetSector.h:62
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
MTDDetSector::specificSurface
const BoundDiskSector & specificSurface() const
Definition: MTDDetSector.h:50
MTDDetSector::compatible
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDDetSector.cc:38
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
MTDDetSector::init
void init()
Definition: MTDDetSector.cc:24
MTDDetSector::setDisk
void setDisk(BoundDiskSector *diskS)
Definition: MTDDetSector.h:53
MTDDetSector::basicComponents
const std::vector< const GeomDet * > & basicComponents() const override
Definition: MTDDetSector.h:25
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
MTDDetSector::detsRange
static constexpr size_t detsRange
Definition: MTDDetSector.h:70
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