CMS 3D CMS Logo

MTDDetRing.cc
Go to the documentation of this file.
1 //#define EDM_ML_DEBUG
2 
13 
14 #include <iostream>
15 #include <vector>
16 
17 using namespace std;
18 
19 MTDDetRing::MTDDetRing(vector<const GeomDet*>::const_iterator first, vector<const GeomDet*>::const_iterator last)
21  init();
22 }
23 
24 MTDDetRing::MTDDetRing(const vector<const GeomDet*>& vdets) : ForwardDetRingOneZ(vdets) { init(); }
25 
28 }
29 
31 
32 const vector<const GeometricSearchDet*>& MTDDetRing::components() const {
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 }
38 
39 pair<bool, TrajectoryStateOnSurface> MTDDetRing::compatible(const TrajectoryStateOnSurface& ts,
40  const Propagator& prop,
41  const MeasurementEstimator& est) const {
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 }
58 
59 vector<GeometricSearchDet::DetWithState> MTDDetRing::compatibleDets(const TrajectoryStateOnSurface& startingState,
60  const Propagator& prop,
61  const MeasurementEstimator& est) const {
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 }
150 
151 vector<DetGroup> MTDDetRing::groupedCompatibleDets(const TrajectoryStateOnSurface& startingState,
152  const Propagator& prop,
153  const MeasurementEstimator& est) const {
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 }
Propagator.h
MeasurementEstimator
Definition: MeasurementEstimator.h:19
MTDDetRing::~MTDDetRing
~MTDDetRing() override
Definition: MTDDetRing.cc:30
ForwardDetRing::specificSurface
const BoundDisk & specificSurface() const
Return the ring surface as a BoundDisk.
Definition: ForwardDetRing.h:27
MessageLogger.h
MTDDetRing::compatibleDets
std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDDetRing.cc:59
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
MTDDetRing::components
const std::vector< const GeometricSearchDet * > & components() const override
Returns basic components, if any.
Definition: MTDDetRing.cc:32
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
dqmdumpme.first
first
Definition: dqmdumpme.py:55
MTDDetRing::groupedCompatibleDets
std::vector< DetGroup > groupedCompatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDDetRing.cc:151
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
dqmdumpme.last
last
Definition: dqmdumpme.py:56
MTDDetRing::compatible
std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est) const override
Definition: MTDDetRing.cc:39
ForwardDetRingOneZ::basicComponents
const std::vector< const GeomDet * > & basicComponents() const override
Definition: ForwardDetRingOneZ.h:21
ForwardDetRingOneZ::add
bool add(int idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est) const
Definition: ForwardDetRingOneZ.cc:33
MeasurementEstimator.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MTDDetRing::BinFinderType
PeriodicBinFinderInPhi< float > BinFinderType
Definition: MTDDetRing.h:43
Point3DBase< float, GlobalTag >
ForwardDetRingOneZ
Definition: ForwardDetRingOneZ.h:10
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
MTDDetRing.h
createfilelist.int
int
Definition: createfilelist.py:10
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DDAxes::phi
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
GeomDet.h
std
Definition: JetResolutionObject.h:76
MTDDetRing::init
void init()
Definition: MTDDetRing.cc:26
MTDDetRing::MTDDetRing
MTDDetRing(std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
Construct from iterators on GeomDet*.
Definition: MTDDetRing.cc:19
PeriodicBinFinderInPhi::binIndex
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
Definition: PeriodicBinFinderInPhi.h:25
mps_fire.result
result
Definition: mps_fire.py:311
ForwardDetRing::surface
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
Definition: ForwardDetRing.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
MTDDetRing::theBinFinder
BinFinderType theBinFinder
Definition: MTDDetRing.h:44
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