CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuDetRod.cc
Go to the documentation of this file.
1 
11 
12 #include <iostream>
13 
14 using namespace std;
15 
16 
17 MuDetRod::MuDetRod(vector<const GeomDet*>::const_iterator first,
18  vector<const GeomDet*>::const_iterator last)
19  : DetRodOneR(first,last) {
20  init();
21 }
22 
23 MuDetRod::MuDetRod(const vector<const GeomDet*>& vdets)
24  : DetRodOneR(vdets) {
25  init();
26 }
27 
28 
31 }
32 
33 
35 
36 const vector<const GeometricSearchDet*>&
38 
39  // FIXME dummy impl.
40  cout << "temporary dummy implementation of MuDetRod::components()!!" << endl;
41  static const vector<const GeometricSearchDet*> result;
42  return result;
43 }
44 
45 pair<bool, TrajectoryStateOnSurface>
47  const MeasurementEstimator& est) const {
48 
50  if (ms.isValid()) return make_pair(est.estimate(ms, specificSurface()) != 0, ms);
51  else return make_pair(false, ms);
52 }
53 
54 
55 vector<GeometricSearchDet::DetWithState>
57  const Propagator& prop,
58  const MeasurementEstimator& est) const {
59  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuDetRod";
60 
61  LogTrace(metname) << "MuDetRod::compatibleDets, Surface at R,phi: "
62  << surface().position().perp() << ","
63  << surface().position().phi() << " DetRod pos.";
64  // FIXME << " TS at R,phi: " << startingState.position().perp() << ","
65  // << startingState.position().phi()
66 
67 
68  vector<DetWithState> result;
69 
70  // Propagate and check that the result is within bounds
71  pair<bool, TrajectoryStateOnSurface> compat =
72  compatible(startingState, prop, est);
73 
74  if (!compat.first) {
75  LogTrace(metname) << " MuDetRod::compatibleDets: not compatible"
76  << " (should not have been selected!)";
77  return result;
78  }
79 
80  // Find the most probable destination component
81  TrajectoryStateOnSurface& tsos = compat.second;
82  GlobalPoint startPos = tsos.globalPosition();
83  int closest = theBinFinder.binIndex(startPos.z());
84  const vector<const GeomDet*> dets = basicComponents();
85  LogTrace(metname) << " MuDetRod::compatibleDets, closest det: " << closest
86  << " pos: " << dets[closest]->surface().position()
87  << " impact " << startPos;
88 
89  // Add this detector, if it is compatible
90  // NOTE: add performs a null propagation
91  add(closest, result, tsos, prop, est);
92 
93  int nclosest = result.size(); int nnextdet=0; // just DEBUG counters
94 
95  // Try the neighbors on each side until no more compatible.
96  // If closest is not compatible the next cannot be either
97  if (!result.empty()) {
98  const BoundPlane& closestPlane(dets[closest]->surface());
100  est.maximalLocalDisplacement( result.front().second, closestPlane);
101 
102  // detHalfLen is assumed to be the same for all detectors.
103  float detHalfLen = closestPlane.bounds().length()/2.;
104 
105  for (unsigned int idet=closest+1; idet < dets.size(); idet++) {
106  LocalPoint nextPos(dets[idet]->toLocal(startPos));
107  if (fabs(nextPos.y()) < detHalfLen + maxDistance.y()) {
108  LogTrace(metname) << " negativeZ: det:" << idet
109  << " pos " << nextPos.y()
110  << " maxDistance " << maxDistance.y();
111  nnextdet++;
112  if ( !add(idet, result, tsos, prop, est)) break;
113  } else {
114  break;
115  }
116  }
117 
118  for (int idet=closest-1; idet >= 0; idet--) {
119  LocalPoint nextPos( dets[idet]->toLocal(startPos));
120  if (fabs(nextPos.y()) < detHalfLen + maxDistance.y()) {
121  LogTrace(metname) << " positiveZ: det:" << idet
122  << " pos " << nextPos.y()
123  << " maxDistance " << maxDistance.y();
124  nnextdet++;
125  if ( !add(idet, result, tsos, prop, est)) break;
126  } else {
127  break;
128  }
129  }
130  }
131 
132  LogTrace(metname) << " MuDetRod::compatibleDets, size: " << result.size()
133  << " on closest: " << nclosest
134  << " # checked dets: " << nnextdet+1;
135  if (result.size()==0) {
136  LogTrace(metname) << " ***Rod not compatible---should have been discarded before!!!";
137  }
138  return result;
139 }
140 
141 
142 vector<DetGroup>
144  const Propagator& prop,
145  const MeasurementEstimator& est) const {
146  // FIXME should return only 1 group
147  cout << "dummy implementation of MuDetRod::groupedCompatibleDets()" << endl;
148  vector<DetGroup> result;
149  return result;
150 }
virtual const Plane & specificSurface() const GCC11_FINAL
Return the rod surface as a Plane.
Definition: DetRod.h:27
T y() const
Definition: PV2DBase.h:46
T perp() const
Definition: PV3DBase.h:72
const std::string metname
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
MuDetRod(std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
Construct from iterators on GeomDet*.
Definition: MuDetRod.cc:17
bool add(int idet, std::vector< DetWithState > &result, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Query detector idet for compatible and add the output to result.
Definition: DetRodOneR.cc:42
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
virtual ~MuDetRod()
Destructor.
Definition: MuDetRod.cc:34
virtual std::vector< DetGroup > groupedCompatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: MuDetRod.cc:143
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est) const
Definition: MuDetRod.cc:46
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: MuDetRod.cc:56
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:37
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
GenericBinFinderInZ< float, GeomDet > BinFinderType
Definition: MuDetRod.h:52
bool first
Definition: L1TdeRCT.cc:75
virtual const BoundSurface & surface() const GCC11_FINAL
The surface of the GeometricSearchDet.
Definition: DetRod.h:21
#define LogTrace(id)
void init()
Definition: MuDetRod.cc:29
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
susybsm::MuonSegment ms
Definition: classes.h:31
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:56
BinFinderType theBinFinder
Definition: MuDetRod.h:53
#define begin
Definition: vmac.h:30
virtual int binIndex(T z) const
returns an index in the valid range for the bin closest to Z
tuple cout
Definition: gather_cfg.py:121
virtual const std::vector< const GeomDet * > & basicComponents() const
Definition: DetRodOneR.h:28
const PositionType & position() const
virtual const std::vector< const GeometricSearchDet * > & components() const
Returns basic components, if any.
Definition: MuDetRod.cc:37