CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Types | Protected Attributes | Private Member Functions
TECLayer Class Reference

#include <TECLayer.h>

Inheritance diagram for TECLayer:
ForwardDetLayer DetLayer GeometricSearchDet

Public Member Functions

const std::vector< const
GeomDet * > & 
basicComponents () const override
 
const std::vector< const
GeometricSearchDet * > & 
components () const override __attribute__((cold))
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
 
SubDetector subDetector () const override
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap) More...
 
 TECLayer (std::vector< const TECPetal * > &innerPetals, std::vector< const TECPetal * > &outerPetals) __attribute__((cold))
 
 ~TECLayer () override __attribute__((cold))
 
- Public Member Functions inherited from ForwardDetLayer
std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const override
 
bool contains (const Local3DPoint &p) const
 
 ForwardDetLayer (bool doHaveGroups)
 
Location location () const final
 Which part of the detector (barrel, endcap) More...
 
virtual const BoundDiskspecificSurface () const final
 
const BoundSurfacesurface () const final
 The surface of the GeometricSearchDet. More...
 
 ~ForwardDetLayer () override
 
- Public Member Functions inherited from DetLayer
 DetLayer (bool doHaveGroup, bool ibar)
 
bool isBarrel () const
 
bool isForward () const
 
int seqNum () const
 
void setSeqNum (int sq)
 
 ~DetLayer () override
 
- Public Member Functions inherited from GeometricSearchDet
virtual std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
virtual void compatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
 
 GeometricSearchDet (bool doHaveGroups)
 
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
bool hasGroups () const
 
virtual const
Surface::PositionType
position () const
 Returns position of the surface. More...
 
virtual ~GeometricSearchDet ()
 

Protected Types

typedef PeriodicBinFinderInPhi
< float > 
BinFinderPhi
 

Protected Attributes

BinFinderPhi theBackBinFinder
 
std::vector< const TECPetal * > theBackComps
 
ReferenceCountingPointer
< BoundDisk
theBackDisk
 
std::vector< const GeomDet * > theBasicComps
 
std::vector< const
GeometricSearchDet * > 
theComps
 
BinFinderPhi theFrontBinFinder
 
std::vector< const TECPetal * > theFrontComps
 
ReferenceCountingPointer
< BoundDisk
theFrontDisk
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
GeomDetCompatibilityChecker theCompatibilityChecker
 

Private Member Functions

bool addClosest (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
 
SubLayerCrossings computeCrossings (const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
 
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const __attribute__((hot))
 
const std::vector< const
TECPetal * > & 
subLayer (int ind) const
 

Additional Inherited Members

- Public Types inherited from DetLayer
typedef
GeomDetEnumerators::Location 
Location
 
typedef
GeomDetEnumerators::SubDetector 
SubDetector
 
- Public Types inherited from GeometricSearchDet
typedef std::pair< const
GeomDet
*, TrajectoryStateOnSurface
DetWithState
 
typedef BoundSurface::PositionType PositionType
 
typedef BoundSurface::RotationType RotationType
 
typedef TrajectoryStateOnSurface TrajectoryState
 
- Protected Member Functions inherited from ForwardDetLayer
SimpleDiskBounds const & bounds () const
 
virtual BoundDiskcomputeSurface ()
 
virtual void initialize ()
 
float rmax () const
 
float rmin () const
 
void setSurface (BoundDisk *cp)
 
float zmax () const
 
float zmin () const
 

Detailed Description

A concrete implementation for TEC layer built out of TECPetals

Definition at line 15 of file TECLayer.h.

Member Typedef Documentation

Definition at line 65 of file TECLayer.h.

Constructor & Destructor Documentation

TECLayer::TECLayer ( std::vector< const TECPetal * > &  innerPetals,
std::vector< const TECPetal * > &  outerPetals 
)

Definition at line 50 of file TECLayer.cc.

References LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), ForwardDetLayer::setSurface(), ForwardDetLayer::specificSurface(), theBackBinFinder, theBackComps, theBackDisk, theBasicComps, theComps, theFrontBinFinder, theFrontComps, theFrontDisk, and PV3DBase< T, PVType, FrameType >::z().

51  : ForwardDetLayer(true),
52  theFrontComps(innerPetals.begin(), innerPetals.end()),
53  theBackComps(outerPetals.begin(), outerPetals.end()) {
54  theComps.assign(theFrontComps.begin(), theFrontComps.end());
55  theComps.insert(theComps.end(), theBackComps.begin(), theBackComps.end());
56 
57  for (vector<const GeometricSearchDet*>::const_iterator it = theComps.begin(); it != theComps.end(); it++) {
58  theBasicComps.insert(theBasicComps.end(), (**it).basicComponents().begin(), (**it).basicComponents().end());
59  }
60 
61  //This should be no necessary. TO BE CHECKED
62  //sort(theFrontPetals.begin(), theFrontPetals.end(), PetalLessPhi());
63  //sort(theBackPetals.begin(), theBackPetals.end(), PetalLessPhi());
64 
65  // building disk for front and back petals
66  setSurface(computeDisk(theComps));
67  theFrontDisk = computeDisk(theFrontComps);
68  theBackDisk = computeDisk(theBackComps);
69 
70  // set up the bin finders
71  theFrontBinFinder = BinFinderPhi(theFrontComps.front()->position().phi(), theFrontComps.size());
72  theBackBinFinder = BinFinderPhi(theBackComps.front()->position().phi(), theBackComps.size());
73 
74  //--------- DEBUG INFO --------------
75  LogDebug("TkDetLayers") << "DEBUG INFO for TECLayer"
76  << "\n"
77  << "TECLayer z,perp, innerRadius, outerR: " << this->position().z() << " , "
78  << this->position().perp() << " , " << this->specificSurface().innerRadius() << " , "
79  << this->specificSurface().outerRadius();
80 
81  for (auto it = theFrontComps.begin(); it != theFrontComps.end(); it++) {
82  LogDebug("TkDetLayers") << "frontPetal phi,z,r: " << (*it)->surface().position().phi() << " , "
83  << (*it)->surface().position().z() << " , " << (*it)->surface().position().perp();
84  }
85 
86  for (auto it = theBackComps.begin(); it != theBackComps.end(); it++) {
87  LogDebug("TkDetLayers") << "backPetal phi,z,r: " << (*it)->surface().position().phi() << " , "
88  << (*it)->surface().position().z() << " , " << (*it)->surface().position().perp();
89  }
90  //-----------------------------------
91 }
std::vector< const TECPetal * > theBackComps
Definition: TECLayer.h:60
T perp() const
Definition: PV3DBase.h:69
std::vector< const GeomDet * > theBasicComps
Definition: TECLayer.h:57
void setSurface(BoundDisk *cp)
ForwardDetLayer(bool doHaveGroups)
ReferenceCountingPointer< BoundDisk > theFrontDisk
Definition: TECLayer.h:62
std::vector< const GeometricSearchDet * > theComps
Definition: TECLayer.h:56
ReferenceCountingPointer< BoundDisk > theBackDisk
Definition: TECLayer.h:63
T z() const
Definition: PV3DBase.h:61
BinFinderPhi theBackBinFinder
Definition: TECLayer.h:68
virtual const Surface::PositionType & position() const
Returns position of the surface.
BinFinderPhi theFrontBinFinder
Definition: TECLayer.h:67
virtual const BoundDisk & specificSurface() const final
std::vector< const TECPetal * > theFrontComps
Definition: TECLayer.h:59
PeriodicBinFinderInPhi< float > BinFinderPhi
Definition: TECLayer.h:65
#define LogDebug(id)
TECLayer::~TECLayer ( )
override

Definition at line 93 of file TECLayer.cc.

References mps_fire::i, and theComps.

93  {
94  for (auto i = theComps.begin(); i != theComps.end(); i++) {
95  delete *i;
96  }
97 }
std::vector< const GeometricSearchDet * > theComps
Definition: TECLayer.h:56

Member Function Documentation

bool TECLayer::addClosest ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubLayerCrossing crossing,
std::vector< DetGroup > &  result 
) const
private

Definition at line 179 of file TECLayer.cc.

References CompatibleDetToGroupAdder::add(), SubLayerCrossing::closestDetIndex(), LogDebug, subLayer(), and SubLayerCrossing::subLayerIndex().

Referenced by groupedCompatibleDetsV().

183  {
184  const auto& sub(subLayer(crossing.subLayerIndex()));
185  const auto det(sub[crossing.closestDetIndex()]);
186 
187  LogDebug("TkDetLayers") << "in TECLayer, adding petal at r,z,phi: (" << det->position().perp() << ","
188  << det->position().z() << "," << det->position().phi() << ")" << endl;
189 
190  return CompatibleDetToGroupAdder().add(*det, tsos, prop, est, result);
191 }
int closestDetIndex() const
const std::vector< const TECPetal * > & subLayer(int ind) const
Definition: TECLayer.h:53
tuple result
Definition: mps_fire.py:311
int subLayerIndex() const
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
#define LogDebug(id)
const std::vector<const GeomDet*>& TECLayer::basicComponents ( ) const
inlineoverridevirtual

Implements GeometricSearchDet.

Definition at line 22 of file TECLayer.h.

References theBasicComps.

22 { return theBasicComps; }
std::vector< const GeomDet * > theBasicComps
Definition: TECLayer.h:57
const std::vector<const GeometricSearchDet*>& TECLayer::components ( ) const
inlineoverridevirtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 24 of file TECLayer.h.

References theComps.

24 { return theComps; }
std::vector< const GeometricSearchDet * > theComps
Definition: TECLayer.h:56
SubLayerCrossings TECLayer::computeCrossings ( const TrajectoryStateOnSurface startingState,
PropagationDirection  propDir 
) const
private

Definition at line 137 of file TECLayer.cc.

References funct::abs(), PeriodicBinFinderInPhi< T >::binIndex(), srCondWrite_cfg::deltaPhi, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogDebug, rho, theBackBinFinder, theBackComps, theBackDisk, theFrontBinFinder, theFrontComps, theFrontDisk, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

138  {
139  double rho(startingState.transverseCurvature());
140 
141  HelixPlaneCrossing::PositionType startPos(startingState.globalPosition());
142  HelixPlaneCrossing::DirectionType startDir(startingState.globalMomentum());
143  HelixForwardPlaneCrossing crossing(startPos, startDir, rho, propDir);
144 
145  pair<bool, double> frontPath = crossing.pathLength(*theFrontDisk);
146  if (!frontPath.first)
147  return SubLayerCrossings();
148 
149  GlobalPoint gFrontPoint(crossing.position(frontPath.second));
150 
151  LogDebug("TkDetLayers") << "in TECLayer,front crossing point: r,z,phi: (" << gFrontPoint.perp() << ","
152  << gFrontPoint.z() << "," << gFrontPoint.phi() << ")" << endl;
153 
154  int frontIndex = theFrontBinFinder.binIndex(gFrontPoint.barePhi());
155  SubLayerCrossing frontSLC(0, frontIndex, gFrontPoint);
156 
157  pair<bool, double> backPath = crossing.pathLength(*theBackDisk);
158  if (!backPath.first)
159  return SubLayerCrossings();
160 
161  GlobalPoint gBackPoint(crossing.position(backPath.second));
162  LogDebug("TkDetLayers") << "in TECLayer,back crossing point: r,z,phi: (" << gBackPoint.perp() << ","
163  << gFrontPoint.z() << "," << gBackPoint.phi() << ")" << endl;
164 
165  int backIndex = theBackBinFinder.binIndex(gBackPoint.barePhi());
166  SubLayerCrossing backSLC(1, backIndex, gBackPoint);
167 
168  // 0ss: frontDisk has index=0, backDisk has index=1
169  float frontDist = std::abs(Geom::deltaPhi(gFrontPoint.barePhi(), theFrontComps[frontIndex]->surface().phi()));
170  float backDist = std::abs(Geom::deltaPhi(gBackPoint.barePhi(), theBackComps[backIndex]->surface().phi()));
171 
172  if (frontDist < backDist) {
173  return SubLayerCrossings(frontSLC, backSLC, 0);
174  } else {
175  return SubLayerCrossings(backSLC, frontSLC, 1);
176  }
177 }
std::vector< const TECPetal * > theBackComps
Definition: TECLayer.h:60
int binIndex(T phi) const override
returns an index in the valid range for the bin that contains phi
GlobalPoint globalPosition() const
ReferenceCountingPointer< BoundDisk > theFrontDisk
Definition: TECLayer.h:62
ReferenceCountingPointer< BoundDisk > theBackDisk
Definition: TECLayer.h:63
BinFinderPhi theBackBinFinder
Definition: TECLayer.h:68
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
BinFinderPhi theFrontBinFinder
Definition: TECLayer.h:67
GlobalVector globalMomentum() const
std::vector< const TECPetal * > theFrontComps
Definition: TECLayer.h:59
#define LogDebug(id)
void TECLayer::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
overridevirtual

Reimplemented from GeometricSearchDet.

Definition at line 99 of file TECLayer.cc.

References addClosest(), SubLayerCrossings::closest(), SubLayerCrossings::closestIndex(), computeCrossings(), tkDetUtil::computeWindowSize(), LayerCrossingSide::endcapSide(), SubLayerCrossings::isValid(), LogDebug, eostools::move(), DetGroupMerger::orderAndMergeTwoLevels(), SubLayerCrossings::other(), Propagator::propagationDirection(), and searchNeighbors().

102  {
103  SubLayerCrossings crossings;
104  crossings = computeCrossings(tsos, prop.propagationDirection());
105  if (!crossings.isValid())
106  return;
107 
108  vector<DetGroup> closestResult;
109  addClosest(tsos, prop, est, crossings.closest(), closestResult);
110  LogDebug("TkDetLayers") << "in TECLayer, closestResult.size(): " << closestResult.size();
111 
112  // this differs from other groupedCompatibleDets logic, which DON'T check next in such cases!!!
113  if (closestResult.empty()) {
114  vector<DetGroup> nextResult;
115  addClosest(tsos, prop, est, crossings.other(), nextResult);
116  LogDebug("TkDetLayers") << "in TECLayer, nextResult.size(): " << nextResult.size();
117  if (nextResult.empty())
118  return;
119 
120  DetGroupElement nextGel(nextResult.front().front());
121  int crossingSide = LayerCrossingSide::endcapSide(nextGel.trajectoryState(), prop);
123  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
124  } else {
125  DetGroupElement closestGel(closestResult.front().front());
126  float phiWindow = tkDetUtil::computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
127  searchNeighbors(tsos, prop, est, crossings.closest(), phiWindow, closestResult, false);
128  vector<DetGroup> nextResult;
129  searchNeighbors(tsos, prop, est, crossings.other(), phiWindow, nextResult, true);
130 
131  int crossingSide = LayerCrossingSide::endcapSide(closestGel.trajectoryState(), prop);
133  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
134  }
135 }
int closestIndex() const
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
tuple result
Definition: mps_fire.py:311
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:10
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const __attribute__((hot))
Definition: TECLayer.cc:205
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TECLayer.cc:179
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
Definition: TECLayer.cc:137
def move
Definition: eostools.py:511
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
const SubLayerCrossing & other() const
const SubLayerCrossing & closest() const
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
#define LogDebug(id)
void TECLayer::searchNeighbors ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubLayerCrossing crossing,
float  window,
std::vector< DetGroup > &  result,
bool  checkClosest 
) const
private

Definition at line 205 of file TECLayer.cc.

References PVValHelper::add(), PV3DBase< T, PVType, FrameType >::barePhi(), PeriodicBinFinderInPhi< T >::binIndex(), SubLayerCrossing::closestDetIndex(), muon::overlap(), phi, Geom::phiLess(), SubLayerCrossing::position(), subLayer(), SubLayerCrossing::subLayerIndex(), ForwardDetLayer::surface(), theBackBinFinder, and theFrontBinFinder.

Referenced by groupedCompatibleDetsV().

211  {
212  const GlobalPoint& gCrossingPos = crossing.position();
213  auto gphi = gCrossingPos.barePhi();
214 
215  const auto& sLayer(subLayer(crossing.subLayerIndex()));
216 
217  int closestIndex = crossing.closestDetIndex();
218  int negStartIndex = closestIndex - 1;
219  int posStartIndex = closestIndex + 1;
220 
221  if (checkClosest) { // must decide if the closest is on the neg or pos side
222  if (Geom::phiLess(gphi, sLayer[closestIndex]->surface().phi())) {
223  posStartIndex = closestIndex;
224  } else {
225  negStartIndex = closestIndex;
226  }
227  }
228 
229  const BinFinderPhi& binFinder = (crossing.subLayerIndex() == 0 ? theFrontBinFinder : theBackBinFinder);
230 
231  typedef CompatibleDetToGroupAdder Adder;
232  int half = sLayer.size() / 2; // to check if dets are called twice....
233  for (int idet = negStartIndex; idet >= negStartIndex - half; idet--) {
234  const auto& neighborPetal = *sLayer[binFinder.binIndex(idet)];
235  if (!overlap(gphi, neighborPetal, window))
236  break;
237  if (!Adder::add(neighborPetal, tsos, prop, est, result))
238  break;
239  // maybe also add shallow crossing angle test here???
240  }
241  for (int idet = posStartIndex; idet < posStartIndex + half; idet++) {
242  const auto& neighborPetal = *sLayer[binFinder.binIndex(idet)];
243  if (!overlap(gphi, neighborPetal, window))
244  break;
245  if (!Adder::add(neighborPetal, tsos, prop, est, result))
246  break;
247  // maybe also add shallow crossing angle test here???
248  }
249 }
def window
Definition: svgfig.py:643
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
int closestDetIndex() const
const std::vector< const TECPetal * > & subLayer(int ind) const
Definition: TECLayer.h:53
tuple result
Definition: mps_fire.py:311
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
const GlobalPoint & position() const
T barePhi() const
Definition: PV3DBase.h:65
int subLayerIndex() const
BinFinderPhi theBackBinFinder
Definition: TECLayer.h:68
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
BinFinderPhi theFrontBinFinder
Definition: TECLayer.h:67
PeriodicBinFinderInPhi< float > BinFinderPhi
Definition: TECLayer.h:65
SubDetector TECLayer::subDetector ( ) const
inlineoverridevirtual

The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)

Implements DetLayer.

Definition at line 32 of file TECLayer.h.

References GeomDetEnumerators::subDetGeom, and GeomDetEnumerators::TEC.

const std::vector<const TECPetal*>& TECLayer::subLayer ( int  ind) const
inlineprivate

Definition at line 53 of file TECLayer.h.

References theBackComps, and theFrontComps.

Referenced by addClosest(), and searchNeighbors().

53 { return (ind == 0 ? theFrontComps : theBackComps); }
std::vector< const TECPetal * > theBackComps
Definition: TECLayer.h:60
std::vector< const TECPetal * > theFrontComps
Definition: TECLayer.h:59

Member Data Documentation

BinFinderPhi TECLayer::theBackBinFinder
protected

Definition at line 68 of file TECLayer.h.

Referenced by computeCrossings(), searchNeighbors(), and TECLayer().

std::vector<const TECPetal*> TECLayer::theBackComps
protected

Definition at line 60 of file TECLayer.h.

Referenced by computeCrossings(), subLayer(), and TECLayer().

ReferenceCountingPointer<BoundDisk> TECLayer::theBackDisk
protected

Definition at line 63 of file TECLayer.h.

Referenced by computeCrossings(), and TECLayer().

std::vector<const GeomDet*> TECLayer::theBasicComps
protected

Definition at line 57 of file TECLayer.h.

Referenced by basicComponents(), and TECLayer().

std::vector<const GeometricSearchDet*> TECLayer::theComps
protected

Definition at line 56 of file TECLayer.h.

Referenced by components(), TECLayer(), and ~TECLayer().

BinFinderPhi TECLayer::theFrontBinFinder
protected

Definition at line 67 of file TECLayer.h.

Referenced by computeCrossings(), searchNeighbors(), and TECLayer().

std::vector<const TECPetal*> TECLayer::theFrontComps
protected

Definition at line 59 of file TECLayer.h.

Referenced by computeCrossings(), subLayer(), and TECLayer().

ReferenceCountingPointer<BoundDisk> TECLayer::theFrontDisk
protected

Definition at line 62 of file TECLayer.h.

Referenced by computeCrossings(), and TECLayer().