CMS 3D CMS Logo

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

#include <MTDTrayBarrelLayer.h>

Inheritance diagram for MTDTrayBarrelLayer:
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
 
 MTDTrayBarrelLayer (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
 
 ~MTDTrayBarrelLayer () 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 half-trays. Represents Barrel Timing Layer.

Author
L. Gray - FNAL

Definition at line 17 of file MTDTrayBarrelLayer.h.

Constructor & Destructor Documentation

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

Constructor, takes ownership of pointers.

Definition at line 26 of file MTDTrayBarrelLayer.cc.

References basicComponents(), popcon2dropbox::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(nullptr),
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 = "MTD|RecoMTD|RecoMTDDetLayers|MTDTrayBarrelLayer";
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 MTDTrayBarrelLayer: "
62  << basicComponents().size() << " Dets "
63  << theRods.size() << " Rods "
64  << " R: " << specificSurface().radius()
65  << " Per.: " << bf.isPhiPeriodic()
66  << " Overl.: " << isOverlapping;
67 }
virtual void initialize()
def copy(args, dbName)
const std::string metname
std::vector< const DetRod * > theRods
std::vector< const GeomDet * > theBasicComps
virtual const std::vector< const DetRod * > & rods() const
Return the vector of rods.
BarrelDetLayer RodBarrelLayer
#define LogTrace(id)
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
BaseBinFinder< double > * theBinFinder
const std::vector< const GeomDet * > & basicComponents() const override
std::vector< const GeometricSearchDet * > theComponents
MTDTrayBarrelLayer::~MTDTrayBarrelLayer ( )
override

Definition at line 70 of file MTDTrayBarrelLayer.cc.

References mps_fire::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 }
std::vector< const DetRod * > theRods
BaseBinFinder< double > * theBinFinder

Member Function Documentation

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

Definition at line 27 of file MTDTrayBarrelLayer.h.

References compatibleDets(), components(), groupedCompatibleDets(), subDetector(), and theBasicComps.

Referenced by MTDTrayBarrelLayer().

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

Definition at line 78 of file MTDTrayBarrelLayer.cc.

References BaseBinFinder< T >::binIndex(), Surface::bounds(), GeometricSearchDet::compatibleDets(), funct::false, 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().

Referenced by basicComponents().

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

Definition at line 204 of file MTDTrayBarrelLayer.cc.

References theComponents.

Referenced by basicComponents().

204  {
205  return theComponents;
206 }
std::vector< const GeometricSearchDet * > theComponents
vector< DetGroup > MTDTrayBarrelLayer::groupedCompatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const
override

Definition at line 189 of file MTDTrayBarrelLayer.cc.

References gather_cfg::cout.

Referenced by basicComponents().

191  {
192  // FIXME should return only 1 group
193  cout << "dummy implementation of MTDTrayBarrelLayer::groupedCompatibleDets()" << endl;
194  return vector<DetGroup>();
195 }
virtual const std::vector<const DetRod*>& MTDTrayBarrelLayer::rods ( ) const
inlinevirtual

Return the vector of rods.

Definition at line 48 of file MTDTrayBarrelLayer.h.

References theRods, and xError().

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

Definition at line 199 of file MTDTrayBarrelLayer.cc.

References theBasicComps.

Referenced by basicComponents().

199  {
200  return theBasicComps.front()->subDetector();
201 }
std::vector< const GeomDet * > theBasicComps
float MTDTrayBarrelLayer::xError ( const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 208 of file MTDTrayBarrelLayer.cc.

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

Referenced by compatibleDets(), and rods().

209  {
210  const float nSigmas = 3.f;
211  if (tsos.hasError()) {
212  return nSigmas * sqrt(tsos.localError().positionError().xx());
213  }
214  else return nSigmas * 0.5;
215 }
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 MTDTrayBarrelLayer::isOverlapping
private

Definition at line 60 of file MTDTrayBarrelLayer.h.

Referenced by compatibleDets(), and MTDTrayBarrelLayer().

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

Definition at line 58 of file MTDTrayBarrelLayer.h.

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

BaseBinFinder<double>* MTDTrayBarrelLayer::theBinFinder
private

Definition at line 59 of file MTDTrayBarrelLayer.h.

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

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

Definition at line 57 of file MTDTrayBarrelLayer.h.

Referenced by components(), and MTDTrayBarrelLayer().

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

Definition at line 56 of file MTDTrayBarrelLayer.h.

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