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 | Private Member Functions | Private Attributes
CompositeTECWedge Class Referencefinal

#include <CompositeTECWedge.h>

Inheritance diagram for CompositeTECWedge:
TECWedge GeometricSearchDet

Public Member Functions

 __attribute__ ((cold))
 
const std::vector< const
GeomDet * > & 
basicComponents () const override
 
std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const override __attribute__((cold))
 
const std::vector< const
GeometricSearchDet * > & 
components () const override __attribute__((cold))
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
 
 ~CompositeTECWedge () override __attribute__((cold))
 
- Public Member Functions inherited from TECWedge
virtual const BoundDiskSectorspecificSurface () const final
 
const BoundSurfacesurface () const final
 The surface of the GeometricSearchDet. More...
 
 TECWedge ()
 
- 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 ()
 

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 &tsos, PropagationDirection propDir) const __attribute__((hot))
 
int findClosestDet (const GlobalPoint &startPos, int sectorId) const
 
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
GeomDet * > & 
subWedge (int ind) const
 

Private Attributes

std::vector< const GeomDet * > theBackDets
 
ReferenceCountingPointer
< BoundDiskSector
theBackSector
 
std::vector< const GeomDet * > theDets
 
std::vector< const GeomDet * > theFrontDets
 
ReferenceCountingPointer
< BoundDiskSector
theFrontSector
 

Additional Inherited Members

- Public Types inherited from GeometricSearchDet
typedef std::pair< const
GeomDet
*, TrajectoryStateOnSurface
DetWithState
 
typedef BoundSurface::PositionType PositionType
 
typedef BoundSurface::RotationType RotationType
 
typedef TrajectoryStateOnSurface TrajectoryState
 
- Protected Attributes inherited from TECWedge
ReferenceCountingPointer
< BoundDiskSector
theDiskSector
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
GeomDetCompatibilityChecker theCompatibilityChecker
 

Detailed Description

A concrete implementation for TEC layer built out of TECPetals

Definition at line 12 of file CompositeTECWedge.h.

Constructor & Destructor Documentation

CompositeTECWedge::~CompositeTECWedge ( )
override

Definition at line 64 of file CompositeTECWedge.cc.

64 {}

Member Function Documentation

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

Definition at line 161 of file CompositeTECWedge.cc.

References CompatibleDetToGroupAdder::add(), SubLayerCrossing::closestDetIndex(), LogDebug, mps_fire::result, SubLayerCrossing::subLayerIndex(), and subWedge().

Referenced by groupedCompatibleDetsV().

165  {
166  const vector<const GeomDet*>& sWedge(subWedge(crossing.subLayerIndex()));
167 
168  LogDebug("TkDetLayers") << "in CompositeTECWedge,adding GeomDet at r,z,phi: ("
169  << sWedge[crossing.closestDetIndex()]->position().perp() << ","
170  << sWedge[crossing.closestDetIndex()]->position().z() << ","
171  << sWedge[crossing.closestDetIndex()]->position().phi() << ")";
172 
173  return CompatibleDetToGroupAdder().add(*sWedge[crossing.closestDetIndex()], tsos, prop, est, result);
174 }
int closestDetIndex() const
tuple result
Definition: mps_fire.py:311
const std::vector< const GeomDet * > & subWedge(int ind) const
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*>& CompositeTECWedge::basicComponents ( ) const
inlineoverridevirtual

Implements GeometricSearchDet.

Definition at line 20 of file CompositeTECWedge.h.

References theDets.

20 { return theDets; }
std::vector< const GeomDet * > theDets
pair< bool, TrajectoryStateOnSurface > CompositeTECWedge::compatible ( const TrajectoryStateOnSurface ts,
const Propagator ,
const MeasurementEstimator  
) const
overridevirtual

tests the geometrical compatibility of the Det with the predicted state. The FreeTrajectoryState argument is propagated to the Det surface using the Propagator argument. The resulting TrajectoryStateOnSurface is tested for compatibility with the surface bounds. If compatible, a std::pair< true, propagatedState> is returned. If the propagation fails, or if the state is not compatible, a std::pair< false, propagatedState> is returned.

Implements GeometricSearchDet.

Definition at line 70 of file CompositeTECWedge.cc.

72  {
73  edm::LogError("TkDetLayers") << "temporary dummy implementation of CompositeTECWedge::compatible()!!";
74  return pair<bool, TrajectoryStateOnSurface>();
75 }
Log< level::Error, false > LogError
const vector< const GeometricSearchDet * > & CompositeTECWedge::components ( ) const
overridevirtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 66 of file CompositeTECWedge.cc.

66  {
67  throw DetLayerException("CompositeTECWedge doesn't have GeometricSearchDet components");
68 }
Common base class.
SubLayerCrossings CompositeTECWedge::computeCrossings ( const TrajectoryStateOnSurface tsos,
PropagationDirection  propDir 
) const
private

Definition at line 109 of file CompositeTECWedge.cc.

References funct::abs(), srCondWrite_cfg::deltaPhi, findClosestDet(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogDebug, HelixForwardPlaneCrossing::pathLength(), HelixForwardPlaneCrossing::position(), rho, theBackDets, theBackSector, theFrontDets, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

110  {
111  HelixPlaneCrossing::PositionType startPos(startingState.globalPosition());
112  HelixPlaneCrossing::DirectionType startDir(startingState.globalMomentum());
113 
114  auto rho = startingState.transverseCurvature();
115 
116  HelixForwardPlaneCrossing crossing(startPos, startDir, rho, propDir);
117 
118  pair<bool, double> frontPath = crossing.pathLength(*theFrontSector);
119  if (!frontPath.first)
120  return SubLayerCrossings();
121 
122  pair<bool, double> backPath = crossing.pathLength(*theBackSector);
123  if (!backPath.first)
124  return SubLayerCrossings();
125 
126  GlobalPoint gFrontPoint(crossing.position(frontPath.second));
127  GlobalPoint gBackPoint(crossing.position(backPath.second));
128 
129  LogDebug("TkDetLayers") << "in TECWedge,front crossing r,z,phi: (" << gFrontPoint.perp() << "," << gFrontPoint.z()
130  << "," << gFrontPoint.phi() << ")";
131 
132  LogDebug("TkDetLayers") << "in TECWedge,back crossing r,z,phi: (" << gBackPoint.perp() << "," << gBackPoint.z() << ","
133  << gBackPoint.phi() << ")" << endl;
134 
135  int frontIndex = findClosestDet(gFrontPoint, 0);
136  SubLayerCrossing frontSLC(0, frontIndex, gFrontPoint);
137 
138  int backIndex = findClosestDet(gBackPoint, 1);
139  SubLayerCrossing backSLC(1, backIndex, gBackPoint);
140 
141  auto frontDist = std::abs(Geom::deltaPhi(gFrontPoint.barePhi(), theFrontDets[frontIndex]->surface().phi()));
142  /*
143  float frontDist = theFrontDets[frontIndex]->surface().phi() - gFrontPoint.phi();
144  frontDist *= Geom::phiLess( theFrontDets[frontIndex]->surface().phi(),gFrontPoint.barePhi()) ? -1. : 1.;
145  if (frontDist < 0.) { frontDist += 2.*Geom::pi();}
146  */
147  auto backDist = std::abs(Geom::deltaPhi(gBackPoint.barePhi(), theBackDets[backIndex]->surface().phi()));
148  /*
149  float backDist = theBackDets[backIndex]->surface().phi() - gBackPoint.phi();
150  backDist *= Geom::phiLess( theBackDets[backIndex]->surface().phi(),gBackPoint.barePhi()) ? -1. : 1.;
151  if ( backDist < 0.) { backDist += 2.*Geom::pi();}
152  */
153 
154  if (frontDist < backDist) {
155  return SubLayerCrossings(frontSLC, backSLC, 0);
156  } else {
157  return SubLayerCrossings(backSLC, frontSLC, 1);
158  }
159 }
std::vector< const GeomDet * > theFrontDets
int findClosestDet(const GlobalPoint &startPos, int sectorId) const
std::vector< const GeomDet * > theBackDets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ReferenceCountingPointer< BoundDiskSector > theBackSector
ReferenceCountingPointer< BoundDiskSector > theFrontSector
#define LogDebug(id)
int CompositeTECWedge::findClosestDet ( const GlobalPoint startPos,
int  sectorId 
) const
private

Definition at line 216 of file CompositeTECWedge.cc.

References funct::abs(), mps_fire::i, theBackDets, theFrontDets, toLocal(), and x.

Referenced by computeCrossings().

216  {
217  vector<const GeomDet*> const& myDets = sectorId == 0 ? theFrontDets : theBackDets;
218 
219  int close = 0;
220  auto closeDist = std::abs((myDets.front()->toLocal(startPos)).x());
221  for (unsigned int i = 1; i < myDets.size(); i++) {
222  auto dist = std::abs((myDets[i]->toLocal(startPos)).x());
223  if (dist < closeDist) {
224  close = i;
225  closeDist = dist;
226  }
227  }
228  return close;
229 }
std::vector< const GeomDet * > theFrontDets
std::vector< const GeomDet * > theBackDets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
void CompositeTECWedge::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
overridevirtual

Reimplemented from GeometricSearchDet.

Definition at line 77 of file CompositeTECWedge.cc.

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

80  {
82  if (!crossings.isValid())
83  return;
84 
85  std::vector<DetGroup> closestResult;
86  addClosest(tsos, prop, est, crossings.closest(), closestResult);
87 
88  LogDebug("TkDetLayers") << "in CompositeTECWedge::groupedCompatibleDets,closestResult.size(): "
89  << closestResult.size();
90 
91  if (closestResult.empty())
92  return;
93 
94  DetGroupElement closestGel(closestResult.front().front());
95  auto window = tkDetUtil::computeWindowSize(closestGel.det(), closestGel.trajectoryState(), est);
96 
97  searchNeighbors(tsos, prop, est, crossings.closest(), window, closestResult, false);
98 
99  std::vector<DetGroup> nextResult;
100  searchNeighbors(tsos, prop, est, crossings.other(), window, nextResult, true);
101 
102  int crossingSide = LayerCrossingSide().endcapSide(closestGel.trajectoryState(), prop);
104  std::move(closestResult), std::move(nextResult), result, crossings.closestIndex(), crossingSide);
105 }
def window
Definition: svgfig.py:643
int closestIndex() const
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const __attribute__((hot))
tuple result
Definition: mps_fire.py:311
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:10
def move
Definition: eostools.py:511
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
const SubLayerCrossing & other() const
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 SubLayerCrossing & closest() const
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const __attribute__((hot))
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
#define LogDebug(id)
void CompositeTECWedge::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 176 of file CompositeTECWedge.cc.

References PVValHelper::add(), PV3DBase< T, PVType, FrameType >::barePhi(), SubLayerCrossing::closestDetIndex(), tkDetUtil::overlapInPhi(), Geom::phiLess(), SubLayerCrossing::position(), SubLayerCrossing::subLayerIndex(), and subWedge().

Referenced by groupedCompatibleDetsV().

182  {
183  const GlobalPoint& gCrossingPos = crossing.position();
184 
185  const vector<const GeomDet*>& sWedge(subWedge(crossing.subLayerIndex()));
186 
187  int closestIndex = crossing.closestDetIndex();
188  int negStartIndex = closestIndex - 1;
189  int posStartIndex = closestIndex + 1;
190 
191  if (checkClosest) { // must decide if the closest is on the neg or pos side
192  if (Geom::phiLess(gCrossingPos.barePhi(), sWedge[closestIndex]->surface().phi())) {
193  posStartIndex = closestIndex;
194  } else {
195  negStartIndex = closestIndex;
196  }
197  }
198 
199  typedef CompatibleDetToGroupAdder Adder;
200  for (int idet = negStartIndex; idet >= 0; idet--) {
201  //if(idet <0 || idet>=sWedge.size()) {edm::LogInfo(TkDetLayers) << "==== warning! gone out vector bounds.idet: " << idet ;break;}
202  if (!tkDetUtil::overlapInPhi(gCrossingPos, *sWedge[idet], window))
203  break;
204  if (!Adder::add(*sWedge[idet], tsos, prop, est, result))
205  break;
206  }
207  for (int idet = posStartIndex; idet < static_cast<int>(sWedge.size()); idet++) {
208  //if(idet <0 || idet>=sWedge.size()) {edm::LogInfo(TkDetLayers) << "==== warning! gone out vector bounds.idet: " << idet ;break;}
209  if (!tkDetUtil::overlapInPhi(gCrossingPos, *sWedge[idet], window))
210  break;
211  if (!Adder::add(*sWedge[idet], tsos, prop, est, result))
212  break;
213  }
214 }
def window
Definition: svgfig.py:643
int closestDetIndex() const
bool overlapInPhi(float phi, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.h:18
tuple result
Definition: mps_fire.py:311
const GlobalPoint & position() const
T barePhi() const
Definition: PV3DBase.h:65
const std::vector< const GeomDet * > & subWedge(int ind) const
int subLayerIndex() const
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
const std::vector<const GeomDet*>& CompositeTECWedge::subWedge ( int  ind) const
inlineprivate

Definition at line 55 of file CompositeTECWedge.h.

References theBackDets, and theFrontDets.

Referenced by addClosest(), and searchNeighbors().

55 { return (ind == 0 ? theFrontDets : theBackDets); }
std::vector< const GeomDet * > theFrontDets
std::vector< const GeomDet * > theBackDets

Member Data Documentation

std::vector<const GeomDet*> CompositeTECWedge::theBackDets
private

Definition at line 59 of file CompositeTECWedge.h.

Referenced by computeCrossings(), findClosestDet(), and subWedge().

ReferenceCountingPointer<BoundDiskSector> CompositeTECWedge::theBackSector
private

Definition at line 63 of file CompositeTECWedge.h.

Referenced by computeCrossings().

std::vector<const GeomDet*> CompositeTECWedge::theDets
private

Definition at line 60 of file CompositeTECWedge.h.

Referenced by basicComponents().

std::vector<const GeomDet*> CompositeTECWedge::theFrontDets
private

Definition at line 58 of file CompositeTECWedge.h.

Referenced by computeCrossings(), findClosestDet(), and subWedge().

ReferenceCountingPointer<BoundDiskSector> CompositeTECWedge::theFrontSector
private

Definition at line 62 of file CompositeTECWedge.h.