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

Constructor, takes ownership of pointers.

Definition at line 25 of file MTDTrayBarrelLayer.cc.

26  : RodBarrelLayer(false), theRods(rods), theBinFinder(nullptr), isOverlapping(false) {
27  // Sort rods in phi
29 
30  theComponents.reserve(theRods.size());
31  std::copy(theRods.begin(), theRods.end(), back_inserter(theComponents));
32 
33  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDTrayBarrelLayer";
34 
35  // Cache chamber pointers (the basic components_)
36  for (vector<const DetRod*>::const_iterator it = rods.begin(); it != rods.end(); it++) {
37  vector<const GeomDet*> tmp2 = (*it)->basicComponents();
38  theBasicComps.insert(theBasicComps.end(), tmp2.begin(), tmp2.end());
39  }
40 
41  // Initialize the binfinder
43  isOverlapping = bf.isPhiOverlapping();
44 
45  if (bf.isPhiPeriodic()) {
46  theBinFinder = new PeriodicBinFinderInPhi<double>(theRods.front()->position().phi(), theRods.size());
47  } else {
49  }
50 
51  // Compute the layer's surface and bounds (from the components())
53 
54  LogTrace(metname) << "Constructing MTDTrayBarrelLayer: " << basicComponents().size() << " Dets " << theRods.size()
55  << " Rods "
56  << " R: " << specificSurface().radius() << " Per.: " << bf.isPhiPeriodic()
57  << " Overl.: " << isOverlapping;
58 }

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.

◆ ~MTDTrayBarrelLayer()

MTDTrayBarrelLayer::~MTDTrayBarrelLayer ( )
override

Definition at line 60 of file MTDTrayBarrelLayer.cc.

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

References mps_fire::i, theBinFinder, and theRods.

Member Function Documentation

◆ basicComponents()

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

Definition at line 26 of file MTDTrayBarrelLayer.h.

26 { return theBasicComps; }

References theBasicComps.

Referenced by MTDTrayBarrelLayer().

◆ compatibleDets()

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

Definition at line 67 of file MTDTrayBarrelLayer.cc.

68  {
69  const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDTrayBarrelLayer";
70  vector<DetWithState> result;
71 
72  LogTrace(metname) << "MTDTrayBarrelLayer::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) << " MTDTrayBarrelLayer::compatibleDets: not compatible"
79  << " (should not have been selected!)";
80  return vector<DetWithState>();
81  }
82 
83  TrajectoryStateOnSurface& tsos = compat.second;
84 
85  LogTrace(metname) << " MTDTrayBarrelLayer::compatibleDets, reached layer at: " << tsos.globalPosition()
86  << " R = " << tsos.globalPosition().perp() << " phi = " << tsos.globalPosition().phi();
87 
88  int closest = theBinFinder->binIndex(tsos.globalPosition().phi());
89  const DetRod* closestRod = theRods[closest];
90 
91  // Check the closest rod
92  LogTrace(metname) << " MTDTrayBarrelLayer::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 #ifdef EDM_ML_DEBUG
99  int nclosest = result.size(); // Debug counter
100 #endif
101 
102  bool checknext = false;
103  double dist;
104 
105  if (!result.empty()) {
106  // Check if the track go outside closest rod, then look for closest.
107  TrajectoryStateOnSurface& predictedState = result.front().second;
108  float xErr = xError(predictedState, est);
109  float halfWid = closestRod->surface().bounds().width() / 2.;
110  dist = predictedState.localPosition().x();
111 
112  // If the layer is overlapping, additionally reduce halfWid by 10%
113  // to account for overlap.
114  // FIXME: should we account for the real amount of overlap?
115  if (isOverlapping)
116  halfWid *= 0.9;
117 
118  if (fabs(dist) + xErr > halfWid) {
119  checknext = true;
120  }
121  } else { // Rod is not compatible
122  //FIXME: Usually next cannot be either. Implement proper logic.
123  // (in general at least one rod should be when this method is called by
124  // compatibleDets() which calls compatible())
125  checknext = true;
126 
127  // Look for the next-to closest in phi.
128  // Note Geom::Phi, subtraction is pi-border-safe
129  if (tsos.globalPosition().phi() - closestRod->surface().position().phi() > 0.) {
130  dist = -1.;
131  } else {
132  dist = +1.;
133  }
134 
135  LogTrace(metname) << " MTDTrayBarrelLayer::fastCompatibleDets, none on closest rod!";
136  }
137 
138  if (checknext) {
139  int next;
140  if (dist < 0.)
141  next = closest + 1;
142  else
143  next = closest - 1;
144 
145  next = theBinFinder->binIndex(next); // Bin Periodicity
146  const DetRod* nextRod = theRods[next];
147 
148  LogTrace(metname) << " MTDTrayBarrelLayer::fastCompatibleDets, next-to closest"
149  << " rod: " << next << " dist " << dist << " phi : " << nextRod->surface().position().phi()
150  << " FTS phi: " << tsos.globalPosition().phi();
151 
152  vector<DetWithState> nextRodDets = nextRod->compatibleDets(tsos, prop, est);
153  result.insert(result.end(), nextRodDets.begin(), nextRodDets.end());
154  }
155 
156 #ifdef EDM_ML_DEBUG
157  LogTrace(metname) << " MTDTrayBarrelLayer::fastCompatibleDets: found: " << result.size()
158  << " on closest: " << nclosest << " # checked rods: " << 1 + int(checknext);
159 #endif
160 
161  return result;
162 }

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

◆ components()

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

Definition at line 174 of file MTDTrayBarrelLayer.cc.

174 { return theComponents; }

References theComponents.

◆ groupedCompatibleDets()

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

Definition at line 164 of file MTDTrayBarrelLayer.cc.

166  {
167  // FIXME should return only 1 group
168  cout << "dummy implementation of MTDTrayBarrelLayer::groupedCompatibleDets()" << endl;
169  return vector<DetGroup>();
170 }

References gather_cfg::cout.

◆ rods()

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

Return the vector of rods.

Definition at line 44 of file MTDTrayBarrelLayer.h.

44 { return theRods; }

References theRods.

Referenced by MTDTrayBarrelLayer().

◆ subDetector()

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

Definition at line 172 of file MTDTrayBarrelLayer.cc.

172 { return theBasicComps.front()->subDetector(); }

References theBasicComps.

◆ xError()

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

Definition at line 176 of file MTDTrayBarrelLayer.cc.

176  {
177  const float nSigmas = 3.f;
178  if (tsos.hasError()) {
179  return nSigmas * sqrt(tsos.localError().positionError().xx());
180  } else
181  return nSigmas * 0.5;
182 }

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

Referenced by compatibleDets().

Member Data Documentation

◆ isOverlapping

bool MTDTrayBarrelLayer::isOverlapping
private

Definition at line 53 of file MTDTrayBarrelLayer.h.

Referenced by compatibleDets(), and MTDTrayBarrelLayer().

◆ theBasicComps

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

Definition at line 51 of file MTDTrayBarrelLayer.h.

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

◆ theBinFinder

BaseBinFinder<double>* MTDTrayBarrelLayer::theBinFinder
private

Definition at line 52 of file MTDTrayBarrelLayer.h.

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

◆ theComponents

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

Definition at line 50 of file MTDTrayBarrelLayer.h.

Referenced by components(), and MTDTrayBarrelLayer().

◆ theRods

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

Definition at line 49 of file MTDTrayBarrelLayer.h.

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

MTDTrayBarrelLayer::theRods
std::vector< const DetRod * > theRods
Definition: MTDTrayBarrelLayer.h:49
mps_fire.i
i
Definition: mps_fire.py:355
Bounds::width
virtual float width() const =0
PhiBorderFinder
Definition: PhiBorderFinder.h:27
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BarrelDetLayer::initialize
virtual void initialize()
Definition: BarrelDetLayer.cc:18
MTDTrayBarrelLayer::rods
virtual const std::vector< const DetRod * > & rods() const
Return the vector of rods.
Definition: MTDTrayBarrelLayer.h:44
GeometricSearchDet::compatibleDets
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: GeometricSearchDet.cc:35
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
LocalError::xx
float xx() const
Definition: LocalError.h:22
TrajectoryStateOnSurface::hasError
bool hasError() const
Definition: TrajectoryStateOnSurface.h:56
DetRod
Definition: DetRod.h:13
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDTrayBarrelLayer::theComponents
std::vector< const GeometricSearchDet * > theComponents
Definition: MTDTrayBarrelLayer.h:50
RodBarrelLayer
BarrelDetLayer RodBarrelLayer
Definition: RodBarrelLayer.h:13
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
DetRod::surface
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
Definition: DetRod.h:19
createfilelist.int
int
Definition: createfilelist.py:10
MTDTrayBarrelLayer::basicComponents
const std::vector< const GeomDet * > & basicComponents() const override
Definition: MTDTrayBarrelLayer.h:26
geomsort::ExtractPhi
Definition: GeometricSorting.h:45
GloballyPositioned::position
const PositionType & position() const
Definition: GloballyPositioned.h:36
PeriodicBinFinderInPhi
Definition: MagBLayer.h:22
MTDTrayBarrelLayer::theBinFinder
BaseBinFinder< double > * theBinFinder
Definition: MTDTrayBarrelLayer.h:52
GeneralBinFinderInPhi
Definition: GeneralBinFinderInPhi.h:18
MTDTrayBarrelLayer::isOverlapping
bool isOverlapping
Definition: MTDTrayBarrelLayer.h:53
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
MTDTrayBarrelLayer::theBasicComps
std::vector< const GeomDet * > theBasicComps
Definition: MTDTrayBarrelLayer.h:51
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
MTDTrayBarrelLayer::xError
float xError(const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const
Definition: MTDTrayBarrelLayer.cc:176
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
BaseBinFinder::binIndex
virtual int binIndex(T pos) const =0
Return the index of bin at given position.
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43