CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const
 
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
 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...
 
virtual SubDetector subDetector () const
 
virtual ~MuRodBarrelLayer ()
 

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 ( std::vector< const DetRod * > &  rods)

Constructor, takes ownership of pointers.

Definition at line 26 of file MuRodBarrelLayer.cc.

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

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

Definition at line 70 of file MuRodBarrelLayer.cc.

References i, theBinFinder, and theRods.

70  {
71  delete theBinFinder;
72  for (vector <const DetRod*>::iterator i = theRods.begin();
73  i<theRods.end(); i++) {delete *i;}
74 }
int i
Definition: DBlmapReader.cc:9
BaseBinFinder< double > * theBinFinder
std::vector< const DetRod * > theRods

Member Function Documentation

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

Definition at line 27 of file MuRodBarrelLayer.h.

References theBasicComps.

Referenced by MuRodBarrelLayer().

27 {return theBasicComps;}
std::vector< const GeomDet * > theBasicComps
vector< GeometricSearchDet::DetWithState > MuRodBarrelLayer::compatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
virtual

Definition at line 78 of file MuRodBarrelLayer.cc.

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

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

Definition at line 201 of file MuRodBarrelLayer.cc.

References theComponents.

201  {
202  return theComponents;
203 }
std::vector< const GeometricSearchDet * > theComponents
vector< DetGroup > MuRodBarrelLayer::groupedCompatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
virtual

Definition at line 186 of file MuRodBarrelLayer.cc.

References gather_cfg::cout.

188  {
189  // FIXME should return only 1 group
190  cout << "dummy implementation of MuRodBarrelLayer::groupedCompatibleDets()" << endl;
191  return vector<DetGroup>();
192 }
tuple cout
Definition: gather_cfg.py:145
virtual const std::vector<const DetRod*>& MuRodBarrelLayer::rods ( ) const
inlinevirtual

Return the vector of rods.

Definition at line 48 of file MuRodBarrelLayer.h.

References theRods.

48 {return theRods;}
std::vector< const DetRod * > theRods
GeomDetEnumerators::SubDetector MuRodBarrelLayer::subDetector ( ) const
virtual

Definition at line 196 of file MuRodBarrelLayer.cc.

References theBasicComps.

196  {
197  return theBasicComps.front()->subDetector();
198 }
std::vector< const GeomDet * > theBasicComps
float MuRodBarrelLayer::xError ( const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 205 of file MuRodBarrelLayer.cc.

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

Referenced by compatibleDets().

206  {
207  const float nSigmas = 3.f;
208  if (tsos.hasError()) {
209  return nSigmas * sqrt(tsos.localError().positionError().xx());
210  }
211  else return nSigmas * 0.5;
212 }
float xx() const
Definition: LocalError.h:24
LocalError positionError() const
T sqrt(T t)
Definition: SSEVec.h:18
const LocalTrajectoryError & localError() const

Member Data Documentation

bool MuRodBarrelLayer::isOverlapping
private

Definition at line 60 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), and MuRodBarrelLayer().

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

Definition at line 58 of file MuRodBarrelLayer.h.

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

BaseBinFinder<double>* MuRodBarrelLayer::theBinFinder
private

Definition at line 59 of file MuRodBarrelLayer.h.

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

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

Definition at line 57 of file MuRodBarrelLayer.h.

Referenced by components(), and MuRodBarrelLayer().

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

Definition at line 56 of file MuRodBarrelLayer.h.

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