CMS 3D CMS Logo

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

#include <MuRodBarrelLayer.h>

Inheritance diagram for MuRodBarrelLayer:
RodBarrelLayer

Public Member Functions

const std::vector< const GeomDet * > & basicComponents () const override
 
std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
 
const std::vector< const GeometricSearchDet * > & components () const override
 
std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const override
 
 MuRodBarrelLayer (std::vector< const DetRod *> &rods)
 Constructor, takes ownership of pointers. More...
 
virtual const std::vector< const DetRod * > & rods () const
 Return the vector of rods. More...
 
SubDetector subDetector () const override
 
 ~MuRodBarrelLayer () override
 

Private Member Functions

float xError (const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
 

Private Attributes

bool isOverlapping
 
std::vector< const GeomDet * > theBasicComps
 
BaseBinFinder< double > * theBinFinder
 
std::vector< const GeometricSearchDet * > theComponents
 
std::vector< const DetRod * > theRods
 

Detailed Description

A cylinder composed of rods. Represents barrel muon DT/RPC stations.

Author
N. Amapane - INFN Torino

Definition at line 17 of file MuRodBarrelLayer.h.

Constructor & Destructor Documentation

◆ MuRodBarrelLayer()

MuRodBarrelLayer::MuRodBarrelLayer ( std::vector< const DetRod *> &  rods)

Constructor, takes ownership of pointers.

Definition at line 24 of file MuRodBarrelLayer.cc.

References basicComponents(), filterCSVwithJSON::copy, BarrelDetLayer::initialize(), isOverlapping, PhiBorderFinder::isPhiOverlapping(), PhiBorderFinder::isPhiPeriodic(), LogTrace, metname, precomputed_value_sort(), rods(), AlCaHLTBitMon_QueryRunRegistry::string, theBasicComps, theBinFinder, theComponents, and theRods.

25  : RodBarrelLayer(false), theRods(rods), theBinFinder(nullptr), isOverlapping(false) {
26  // Sort rods in phi
28 
29  theComponents.reserve(theRods.size());
30  std::copy(theRods.begin(), theRods.end(), back_inserter(theComponents));
31 
32  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRodBarrelLayer";
33 
34  // Cache chamber pointers (the basic components_)
35  for (vector<const DetRod*>::const_iterator it = rods.begin(); it != rods.end(); it++) {
36  vector<const GeomDet*> tmp2 = (*it)->basicComponents();
37  theBasicComps.insert(theBasicComps.end(), tmp2.begin(), tmp2.end());
38  }
39 
40  // Initialize the binfinder
42  isOverlapping = bf.isPhiOverlapping();
43 
44  if (bf.isPhiPeriodic()) {
45  theBinFinder = new PeriodicBinFinderInPhi<double>(theRods.front()->position().phi(), theRods.size());
46  } else {
48  }
49 
50  // Compute the layer's surface and bounds (from the components())
52 
53  LogTrace(metname) << "Constructing MuRodBarrelLayer: " << basicComponents().size() << " Dets " << theRods.size()
54  << " Rods "
55  << " R: " << specificSurface().radius() << " Per.: " << bf.isPhiPeriodic()
56  << " Overl.: " << isOverlapping;
57 }
const std::vector< const GeomDet * > & basicComponents() const override
virtual void initialize()
const std::string metname
#define LogTrace(id)
std::vector< const GeomDet * > theBasicComps
BaseBinFinder< double > * theBinFinder
BarrelDetLayer RodBarrelLayer
std::vector< const GeometricSearchDet * > theComponents
std::vector< const DetRod * > theRods
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
virtual const std::vector< const DetRod * > & rods() const
Return the vector of rods.

◆ ~MuRodBarrelLayer()

MuRodBarrelLayer::~MuRodBarrelLayer ( )
override

Definition at line 59 of file MuRodBarrelLayer.cc.

References mps_fire::i, theBinFinder, and theRods.

59  {
60  delete theBinFinder;
61  for (vector<const DetRod*>::iterator i = theRods.begin(); i < theRods.end(); i++) {
62  delete *i;
63  }
64 }
BaseBinFinder< double > * theBinFinder
std::vector< const DetRod * > theRods

Member Function Documentation

◆ basicComponents()

const std::vector<const GeomDet*>& MuRodBarrelLayer::basicComponents ( ) const
inlineoverride

Definition at line 26 of file MuRodBarrelLayer.h.

References theBasicComps.

Referenced by MuRodBarrelLayer().

26 { return theBasicComps; }
std::vector< const GeomDet * > theBasicComps

◆ compatibleDets()

vector< GeometricSearchDet::DetWithState > MuRodBarrelLayer::compatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
override

Definition at line 66 of file MuRodBarrelLayer.cc.

References BaseBinFinder< T >::binIndex(), Surface::bounds(), pv::closest(), GeometricSearchDet::compatibleDets(), TrajectoryStateOnSurface::globalPosition(), createfilelist::int, isOverlapping, TrajectoryStateOnSurface::localPosition(), LogTrace, metname, GetRecoTauVFromDQM_MC_cff::next, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, DetRod::surface(), theBinFinder, theRods, Bounds::width(), PV3DBase< T, PVType, FrameType >::x(), and xError().

68  {
69  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRodBarrelLayer";
70  vector<DetWithState> result;
71 
72  LogTrace(metname) << "MuRodBarrelLayer::compatibleDets, Cyl R: " << specificSurface().radius()
73  << " TSOS at R= " << startingState.globalPosition().perp()
74  << " phi= " << startingState.globalPosition().phi();
75 
76  pair<bool, TrajectoryStateOnSurface> compat = compatible(startingState, prop, est);
77  if (!compat.first) {
78  LogTrace(metname) << " MuRodBarrelLayer::compatibleDets: not compatible"
79  << " (should not have been selected!)";
80  return vector<DetWithState>();
81  }
82 
83  TrajectoryStateOnSurface& tsos = compat.second;
84 
85  LogTrace(metname) << " MuRodBarrelLayer::compatibleDets, reached layer at: " << tsos.globalPosition()
86  << " R = " << tsos.globalPosition().perp() << " phi = " << tsos.globalPosition().phi();
87 
89  const DetRod* closestRod = theRods[closest];
90 
91  // Check the closest rod
92  LogTrace(metname) << " MuRodBarrelLayer::compatibleDets, closestRod: " << closest
93  << " phi : " << closestRod->surface().position().phi()
94  << " FTS phi: " << tsos.globalPosition().phi();
95 
96  result = closestRod->compatibleDets(tsos, prop, est);
97 
98  int nclosest = result.size(); // Debug counter
99 
100  bool checknext = false;
101  double dist;
102 
103  if (!result.empty()) {
104  // Check if the track go outside closest rod, then look for closest.
105  TrajectoryStateOnSurface& predictedState = result.front().second;
106  float xErr = xError(predictedState, est);
107  float halfWid = closestRod->surface().bounds().width() / 2.;
108  dist = predictedState.localPosition().x();
109 
110  // If the layer is overlapping, additionally reduce halfWid by 10%
111  // to account for overlap.
112  // FIXME: should we account for the real amount of overlap?
113  if (isOverlapping)
114  halfWid *= 0.9;
115 
116  if (fabs(dist) + xErr > halfWid) {
117  checknext = true;
118  }
119  } else { // Rod is not compatible
120  //FIXME: Usually next cannot be either. Implement proper logic.
121  // (in general at least one rod should be when this method is called by
122  // compatibleDets() which calls compatible())
123  checknext = true;
124 
125  // Look for the next-to closest in phi.
126  // Note Geom::Phi, subtraction is pi-border-safe
127  if (tsos.globalPosition().phi() - closestRod->surface().position().phi() > 0.) {
128  dist = -1.;
129  } else {
130  dist = +1.;
131  }
132 
133  LogTrace(metname) << " MuRodBarrelLayer::fastCompatibleDets, none on closest rod!";
134  }
135 
136  if (checknext) {
137  int next;
138  if (dist < 0.)
139  next = closest + 1;
140  else
141  next = closest - 1;
142 
143  next = theBinFinder->binIndex(next); // Bin Periodicity
144  const DetRod* nextRod = theRods[next];
145 
146  LogTrace(metname) << " MuRodBarrelLayer::fastCompatibleDets, next-to closest"
147  << " rod: " << next << " dist " << dist << " phi : " << nextRod->surface().position().phi()
148  << " FTS phi: " << tsos.globalPosition().phi();
149 
150  vector<DetWithState> nextRodDets = nextRod->compatibleDets(tsos, prop, est);
151  result.insert(result.end(), nextRodDets.begin(), nextRodDets.end());
152  }
153 
154  LogTrace(metname) << " MuRodBarrelLayer::fastCompatibleDets: found: " << result.size()
155  << " on closest: " << nclosest << " # checked rods: " << 1 + int(checknext);
156 
157  return result;
158 }
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
Definition: DetRod.h:19
T perp() const
Definition: PV3DBase.h:69
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const std::string metname
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
int closest(std::vector< int > const &vec, int value)
virtual int binIndex(T pos) const =0
Return the index of bin at given position.
#define LogTrace(id)
float xError(const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
T x() const
Definition: PV3DBase.h:59
BaseBinFinder< double > * theBinFinder
GlobalPoint globalPosition() const
std::vector< const DetRod * > theRods
Definition: DetRod.h:13
const PositionType & position() const
virtual float width() const =0
const Bounds & bounds() const
Definition: Surface.h:87

◆ components()

const vector< const GeometricSearchDet * > & MuRodBarrelLayer::components ( ) const
override

Definition at line 170 of file MuRodBarrelLayer.cc.

References theComponents.

170 { return theComponents; }
std::vector< const GeometricSearchDet * > theComponents

◆ groupedCompatibleDets()

vector< DetGroup > MuRodBarrelLayer::groupedCompatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
override

Definition at line 160 of file MuRodBarrelLayer.cc.

References gather_cfg::cout.

162  {
163  // FIXME should return only 1 group
164  cout << "dummy implementation of MuRodBarrelLayer::groupedCompatibleDets()" << endl;
165  return vector<DetGroup>();
166 }

◆ rods()

virtual const std::vector<const DetRod*>& MuRodBarrelLayer::rods ( ) const
inlinevirtual

Return the vector of rods.

Definition at line 44 of file MuRodBarrelLayer.h.

References theRods.

Referenced by MuRodBarrelLayer().

44 { return theRods; }
std::vector< const DetRod * > theRods

◆ subDetector()

GeomDetEnumerators::SubDetector MuRodBarrelLayer::subDetector ( ) const
override

Definition at line 168 of file MuRodBarrelLayer.cc.

References theBasicComps.

168 { return theBasicComps.front()->subDetector(); }
std::vector< const GeomDet * > theBasicComps

◆ xError()

float MuRodBarrelLayer::xError ( const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 172 of file MuRodBarrelLayer.cc.

References TrajectoryStateOnSurface::hasError(), TrajectoryStateOnSurface::localError(), LocalTrajectoryError::positionError(), mathSSE::sqrt(), and LocalError::xx().

Referenced by compatibleDets().

172  {
173  const float nSigmas = 3.f;
174  if (tsos.hasError()) {
175  return nSigmas * sqrt(tsos.localError().positionError().xx());
176  } else
177  return nSigmas * 0.5;
178 }
const LocalTrajectoryError & localError() const
LocalError positionError() const
T sqrt(T t)
Definition: SSEVec.h:19
float xx() const
Definition: LocalError.h:22

Member Data Documentation

◆ isOverlapping

bool MuRodBarrelLayer::isOverlapping
private

Definition at line 53 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), and MuRodBarrelLayer().

◆ theBasicComps

std::vector<const GeomDet*> MuRodBarrelLayer::theBasicComps
private

Definition at line 51 of file MuRodBarrelLayer.h.

Referenced by basicComponents(), MuRodBarrelLayer(), and subDetector().

◆ theBinFinder

BaseBinFinder<double>* MuRodBarrelLayer::theBinFinder
private

Definition at line 52 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), MuRodBarrelLayer(), and ~MuRodBarrelLayer().

◆ theComponents

std::vector<const GeometricSearchDet*> MuRodBarrelLayer::theComponents
private

Definition at line 50 of file MuRodBarrelLayer.h.

Referenced by components(), and MuRodBarrelLayer().

◆ theRods

std::vector<const DetRod*> MuRodBarrelLayer::theRods
private

Definition at line 49 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), MuRodBarrelLayer(), rods(), and ~MuRodBarrelLayer().