CMS 3D CMS Logo

MTDDetRing.cc
Go to the documentation of this file.
1 
11 
12 #include <iostream>
13 #include <vector>
14 
15 using namespace std;
16 
17 MTDDetRing::MTDDetRing(vector<const GeomDet*>::const_iterator first, vector<const GeomDet*>::const_iterator last)
19  init();
20 }
21 
22 MTDDetRing::MTDDetRing(const vector<const GeomDet*>& vdets) : ForwardDetRingOneZ(vdets) { init(); }
23 
26 }
27 
29 
30 const vector<const GeometricSearchDet*>& MTDDetRing::components() const {
31  // FIXME dummy impl.
32  edm::LogError("MTDDetRing") << "temporary dummy implementation of MTDDetRing::components()!!" << endl;
33  static const vector<const GeometricSearchDet*> result;
34  return result;
35 }
36 
37 pair<bool, TrajectoryStateOnSurface> MTDDetRing::compatible(const TrajectoryStateOnSurface& ts,
38  const Propagator& prop,
39  const MeasurementEstimator& est) const {
40  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDDetRing";
42 
43  LogTrace(metname) << "MTDDetRing::compatible, Surface at Z: " << specificSurface().position().z()
44  << " R1: " << specificSurface().innerRadius() << " R2: " << specificSurface().outerRadius()
45  << " TS at Z,R: " << ts.globalPosition().z() << "," << ts.globalPosition().perp();
46  if (ms.isValid()) {
47  LogTrace(metname) << " DEST at Z,R: " << ms.globalPosition().z() << "," << ms.globalPosition().perp()
48  << " local Z: " << ms.localPosition().z() << endl;
49  } else
50  LogTrace(metname) << " DEST: not valid" << endl;
51 
52  if (ms.isValid())
53  return make_pair(est.estimate(ms, specificSurface()) != 0, ms);
54  else
55  return make_pair(false, ms);
56 }
57 
58 vector<GeometricSearchDet::DetWithState> MTDDetRing::compatibleDets(const TrajectoryStateOnSurface& startingState,
59  const Propagator& prop,
60  const MeasurementEstimator& est) const {
61  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDDetRing";
62 
63  LogTrace(metname) << "MTDDetRing::compatibleDets, Surface at Z: " << surface().position().z()
64  << " R1: " << specificSurface().innerRadius() << " R2: " << specificSurface().outerRadius()
65  << " TS at Z,R: " << startingState.globalPosition().z() << ","
66  << startingState.globalPosition().perp() << " DetRing pos." << position();
67 
68  vector<DetWithState> result;
69 
70  // Propagate and check that the result is within bounds
71  pair<bool, TrajectoryStateOnSurface> compat = compatible(startingState, prop, est);
72  if (!compat.first) {
73  LogTrace(metname) << " MTDDetRing::compatibleDets: not compatible"
74  << " (should not have been selected!)";
75  return result;
76  }
77 
78  // Find the most probable destination component
79  TrajectoryStateOnSurface& tsos = compat.second;
80  GlobalPoint startPos = tsos.globalPosition();
81  int closest = theBinFinder.binIndex(startPos.phi());
82  const vector<const GeomDet*> dets = basicComponents();
83  LogTrace(metname) << " MTDDetRing::compatibleDets, closest det: " << closest
84  << " Phi: " << dets[closest]->surface().position().phi() << " impactPhi " << startPos.phi();
85 
86  // Add this detector, if it is compatible
87  // NOTE: add performs a null propagation
88  add(closest, result, tsos, prop, est);
89 
90 #ifdef EDM_ML_DEBUG
91  int nclosest = result.size();
92  int nnextdet = 0; // MDEBUG counters
93 #endif
94 
95  // Try the neighbors on each side until no more compatible.
96  float dphi = 0;
97  if (!result.empty()) { // If closest is not compatible the next cannot be either
98  float nSigmas = 3.;
99  if (result.back().second.hasError()) {
100  dphi = nSigmas * atan(sqrt(result.back().second.localError().positionError().xx()) /
101  result.back().second.globalPosition().perp());
102  }
103  } else {
104  LogTrace(metname) << " MTDDetRing::compatibleDets, closest not compatible!";
105  //FIXME: if closest is not compatible the next cannot be either
106  }
107 
108  for (int idet = closest + 1; idet < closest + int(dets.size()) / 4 + 1; idet++) {
109  // FIXME: should use dphi to decide if det must be queried.
110  // Right now query until not compatible.
111  int idetp = theBinFinder.binIndex(idet);
112  {
113  LogTrace(metname) << " next det:" << idetp << " at Z: " << dets[idetp]->position().z()
114  << " phi: " << dets[idetp]->position().phi() << " FTS phi " << startPos.phi() << " max dphi "
115  << dphi;
116 #ifdef EDM_ML_DEBUG
117  nnextdet++;
118 #endif
119  if (!add(idetp, result, tsos, prop, est))
120  break;
121  }
122  }
123 
124  for (int idet = closest - 1; idet > closest - int(dets.size()) / 4 - 1; idet--) {
125  // FIXME: should use dphi to decide if det must be queried.
126  // Right now query until not compatible.
127  int idetp = theBinFinder.binIndex(idet);
128  {
129  LogTrace(metname) << " 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 #ifdef EDM_ML_DEBUG
133  nnextdet++;
134 #endif
135  if (!add(idetp, result, tsos, prop, est))
136  break;
137  }
138  }
139 
140 #ifdef EDM_ML_DEBUG
141  LogTrace(metname) << " MTDDetRing::compatibleDets, size: " << result.size() << " on closest: " << nclosest
142  << " # checked dets: " << nnextdet + 1;
143 #endif
144 
145  if (result.empty()) {
146  LogTrace(metname) << " ***Ring not compatible,should have been discarded before!!!";
147  }
148 
149  return result;
150 }
151 
152 vector<DetGroup> MTDDetRing::groupedCompatibleDets(const TrajectoryStateOnSurface& startingState,
153  const Propagator& prop,
154  const MeasurementEstimator& est) const {
155  // FIXME should be implemented to allow returning overlapping chambers
156  // as separate groups!
157  cout << "dummy implementation of MTDDetRod::groupedCompatibleDets()" << endl;
158  vector<DetGroup> result;
159  return result;
160 }
Propagator.h
MeasurementEstimator
Definition: MeasurementEstimator.h:19
MTDDetRing::~MTDDetRing
~MTDDetRing() override
Definition: MTDDetRing.cc:28
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:58
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MTDDetRing::components
const std::vector< const GeometricSearchDet * > & components() const override
Returns basic components, if any.
Definition: MTDDetRing.cc:30
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:152
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:37
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
edm::LogError
Definition: MessageLogger.h:183
MTDDetRing.h
createfilelist.int
int
Definition: createfilelist.py:10
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
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:24
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:17
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:303
ForwardDetRing::surface
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
Definition: ForwardDetRing.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
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
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43