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
CompositeTECWedge Class Reference

#include <CompositeTECWedge.h>

Inheritance diagram for CompositeTECWedge:
TECWedge GeometricSearchDetWithGroups GeometricSearchDet

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const
 Returns basic components, if any. More...
 
 CompositeTECWedge (std::vector< const GeomDet * > &innerDets, std::vector< const GeomDet * > &outerDets)
 
virtual void groupedCompatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
 
 ~CompositeTECWedge ()
 
- Public Member Functions inherited from TECWedge
virtual const BoundDiskSectorspecificSurface () const
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
- Public Member Functions inherited from GeometricSearchDetWithGroups
void compatibleDetsV (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
 
bool hasGroups () const
 
- Public Member Functions inherited from GeometricSearchDet
virtual std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
 GeometricSearchDet ()
 
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) 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
 
SubLayerCrossings computeCrossings (const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
 
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
 
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 GeometricSearchDetWithGroups
typedef
GeometricSearchDet::DetWithState 
DetWithState
 
- 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
GeomDetCompatibilityChecker theCompatibilityChecker
 

Detailed Description

A concrete implementation for TEC layer built out of TECPetals

Definition at line 14 of file CompositeTECWedge.h.

Constructor & Destructor Documentation

CompositeTECWedge::CompositeTECWedge ( std::vector< const GeomDet * > &  innerDets,
std::vector< const GeomDet * > &  outerDets 
)

Definition at line 34 of file CompositeTECWedge.cc.

References LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GeometricSearchDet::position(), python.multivaluedict::sort(), theBackDets, theBackSector, theDets, TECWedge::theDiskSector, theFrontDets, theFrontSector, and PV3DBase< T, PVType, FrameType >::z().

35  :
36  theFrontDets(innerDets.begin(),innerDets.end()), theBackDets(outerDets.begin(),outerDets.end())
37 {
38  theDets.assign(theFrontDets.begin(),theFrontDets.end());
39  theDets.insert(theDets.end(),theBackDets.begin(),theBackDets.end());
40 
41 
42  //
43  std::sort( theFrontDets.begin(), theFrontDets.end(), DetPhiLess() );
44  std::sort( theBackDets.begin(), theBackDets.end(), DetPhiLess() );
45 
49 
50  //--------- DEBUG INFO --------------
51  LogDebug("TkDetLayers") << "DEBUG INFO for CompositeTECWedge" << "\n"
52  << "TECWedge z, perp,innerRadius,outerR: "
53  << this->position().z() << " , "
54  << this->position().perp() << " , "
55  << theDiskSector->innerRadius() << " , "
56  << theDiskSector->outerRadius() ;
57 
58 
59  for(vector<const GeomDet*>::const_iterator it=theFrontDets.begin();
60  it!=theFrontDets.end(); it++){
61  LogDebug("TkDetLayers") << "frontDet phi,z,r: "
62  << (*it)->surface().position().phi() << " , "
63  << (*it)->surface().position().z() << " , "
64  << (*it)->surface().position().perp();
65  }
66 
67  for(vector<const GeomDet*>::const_iterator it=theBackDets.begin();
68  it!=theBackDets.end(); it++){
69  LogDebug("TkDetLayers") << "backDet phi,z,r: "
70  << (*it)->surface().phi() << " , "
71  << (*it)->surface().position().z() << " , "
72  << (*it)->surface().position().perp() ;
73  }
74  //-----------------------------------
75 
76 
77 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:71
std::vector< const GeomDet * > theDets
ReferenceCountingPointer< BoundDiskSector > theDiskSector
Definition: TECWedge.h:25
std::vector< const GeomDet * > theFrontDets
std::vector< const GeomDet * > theBackDets
T z() const
Definition: PV3DBase.h:63
ReferenceCountingPointer< BoundDiskSector > theBackSector
virtual const Surface::PositionType & position() const
Returns position of the surface.
ReferenceCountingPointer< BoundDiskSector > theFrontSector
CompositeTECWedge::~CompositeTECWedge ( )

Definition at line 79 of file CompositeTECWedge.cc.

79  {
80 
81 }

Member Function Documentation

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

Definition at line 196 of file CompositeTECWedge.cc.

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

Referenced by groupedCompatibleDetsV().

201 {
202  const vector<const GeomDet*>& sWedge( subWedge( crossing.subLayerIndex()));
203 
204  LogDebug("TkDetLayers")
205  << "in CompositeTECWedge,adding GeomDet at r,z,phi: ("
206  << sWedge[crossing.closestDetIndex()]->position().perp() << ","
207  << sWedge[crossing.closestDetIndex()]->position().z() << ","
208  << sWedge[crossing.closestDetIndex()]->position().phi() << ")" ;
209 
210  return CompatibleDetToGroupAdder().add( *sWedge[crossing.closestDetIndex()],
211  tsos, prop, est, result);
212 }
#define LogDebug(id)
int closestDetIndex() const
const std::vector< const GeomDet * > & subWedge(int ind) const
int subLayerIndex() const
tuple result
Definition: query.py:137
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result)
virtual const std::vector<const GeomDet*>& CompositeTECWedge::basicComponents ( ) const
inlinevirtual

Implements GeometricSearchDet.

Definition at line 22 of file CompositeTECWedge.h.

References theDets.

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

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 91 of file CompositeTECWedge.cc.

92  {
93  edm::LogError("TkDetLayers") << "temporary dummy implementation of CompositeTECWedge::compatible()!!" ;
94  return pair<bool,TrajectoryStateOnSurface>();
95 }
const vector< const GeometricSearchDet * > & CompositeTECWedge::components ( ) const
virtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 85 of file CompositeTECWedge.cc.

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

Definition at line 137 of file CompositeTECWedge.cc.

References abs, Geom::deltaPhi(), findClosestDet(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), LogDebug, GloballyPositioned< T >::phi(), rho, TECWedge::surface(), theBackDets, theBackSector, theFrontDets, theFrontSector, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

139 {
140  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition() );
141  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum() );
142  float rho( startingState.transverseCurvature());
143 
144  HelixForwardPlaneCrossing crossing( startPos, startDir, rho, propDir);
145 
146  pair<bool,double> frontPath = crossing.pathLength( *theFrontSector);
147  if (!frontPath.first) return SubLayerCrossings();
148 
149  GlobalPoint gFrontPoint( crossing.position(frontPath.second));
150  LogDebug("TkDetLayers") << "in TECWedge,front crossing r,z,phi: ("
151  << gFrontPoint.perp() << ","
152  << gFrontPoint.z() << ","
153  << gFrontPoint.phi() << ")" ;
154 
155 
156  int frontIndex = findClosestDet(gFrontPoint,0);
157  SubLayerCrossing frontSLC( 0, frontIndex, gFrontPoint);
158 
159  pair<bool,double> backPath = crossing.pathLength( *theBackSector);
160  if (!backPath.first) return SubLayerCrossings();
161 
162  GlobalPoint gBackPoint( crossing.position(backPath.second));
163  LogDebug("TkDetLayers")
164  << "in TECWedge,back crossing r,z,phi: ("
165  << gBackPoint.perp() << ","
166  << gBackPoint.z() << ","
167  << gBackPoint.phi() << ")" << endl;
168 
169  int backIndex = findClosestDet(gBackPoint,1);
170  SubLayerCrossing backSLC( 1, backIndex, gBackPoint);
171 
172  float frontDist = std::abs(Geom::deltaPhi( double(gFrontPoint.barePhi()),
173  double(theFrontDets[frontIndex]->surface().phi())));
174  /*
175  float frontDist = theFrontDets[frontIndex]->surface().phi() - gFrontPoint.phi();
176  frontDist *= Geom::phiLess( theFrontDets[frontIndex]->surface().phi(),gFrontPoint.barePhi()) ? -1. : 1.;
177  if (frontDist < 0.) { frontDist += 2.*Geom::pi();}
178  */
179  float backDist = std::abs(Geom::deltaPhi( double(gBackPoint.barePhi()),
180  double(theBackDets[backIndex]->surface().phi())));
181  /*
182  float backDist = theBackDets[backIndex]->surface().phi() - gBackPoint.phi();
183  backDist *= Geom::phiLess( theBackDets[backIndex]->surface().phi(),gBackPoint.barePhi()) ? -1. : 1.;
184  if ( backDist < 0.) { backDist += 2.*Geom::pi();}
185  */
186 
187  if (frontDist < backDist) {
188  return SubLayerCrossings( frontSLC, backSLC, 0);
189  }
190  else {
191  return SubLayerCrossings( backSLC, frontSLC, 1);
192  }
193 }
#define LogDebug(id)
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
Definition: DDAxes.h:10
#define abs(x)
Definition: mlp_lapack.h:159
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Definition: TECWedge.h:16
std::vector< const GeomDet * > theFrontDets
int findClosestDet(const GlobalPoint &startPos, int sectorId) const
std::vector< const GeomDet * > theBackDets
ReferenceCountingPointer< BoundDiskSector > theBackSector
ReferenceCountingPointer< BoundDiskSector > theFrontSector
int CompositeTECWedge::findClosestDet ( const GlobalPoint startPos,
int  sectorId 
) const
private

Definition at line 256 of file CompositeTECWedge.cc.

References i, theBackDets, theFrontDets, and vdt::x.

Referenced by computeCrossings().

257 {
258  vector<const GeomDet*> myDets = sectorId==0 ? theFrontDets : theBackDets;
259 
260  int close = 0;
261  float closeDist = fabs( (myDets.front()->toLocal(startPos)).x());
262  for (unsigned int i = 0; i < myDets.size(); i++ ) {
263  float dist = (myDets[i]->surface().toLocal(startPos)).x();
264  if ( fabs(dist) < fabs(closeDist) ) {
265  close = i;
266  closeDist = dist;
267  }
268  }
269  return close;
270 }
int i
Definition: DBlmapReader.cc:9
std::vector< const GeomDet * > theFrontDets
std::vector< const GeomDet * > theBackDets
x
Definition: VDTMath.h:216
void CompositeTECWedge::groupedCompatibleDetsV ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 99 of file CompositeTECWedge.cc.

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

102  {
103  SubLayerCrossings crossings;
104  crossings = computeCrossings( tsos, prop.propagationDirection());
105  if(! crossings.isValid()) return;
106 
107  std::vector<DetGroup> closestResult;
108  addClosest( tsos, prop, est, crossings.closest(), closestResult);
109  LogDebug("TkDetLayers")
110  << "in CompositeTECWedge::groupedCompatibleDets,closestResult.size(): "
111  << closestResult.size() ;
112 
113  if (closestResult.empty()) return;
114 
115  DetGroupElement closestGel( closestResult.front().front());
116  float window = tkDetUtil::computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
117 
118  searchNeighbors( tsos, prop, est, crossings.closest(), window,
119  closestResult, false);
120 
121  vector<DetGroup> nextResult;
122  searchNeighbors( tsos, prop, est, crossings.other(), window,
123  nextResult, true);
124 
125  int crossingSide = LayerCrossingSide().endcapSide( closestGel.trajectoryState(), prop);
126  DetGroupMerger::orderAndMergeTwoLevels( closestResult, nextResult, result,
127  crossings.closestIndex(), crossingSide);
128 }
#define LogDebug(id)
static void orderAndMergeTwoLevels(const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
def window
Definition: svgfig.py:642
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
int closestIndex() const
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
Definition: TkDetUtil.cc:31
int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
tuple result
Definition: query.py:137
const SubLayerCrossing & other() const
SubLayerCrossings computeCrossings(const TrajectoryStateOnSurface &tsos, PropagationDirection propDir) const
bool addClosest(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, std::vector< DetGroup > &result) const
const SubLayerCrossing & closest() const
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubLayerCrossing &crossing, float window, std::vector< DetGroup > &result, bool checkClosest) const
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 215 of file CompositeTECWedge.cc.

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

Referenced by groupedCompatibleDetsV().

222 {
223  GlobalPoint gCrossingPos = crossing.position();
224 
225  const vector<const GeomDet*>& sWedge( subWedge( crossing.subLayerIndex()));
226 
227  int closestIndex = crossing.closestDetIndex();
228  int negStartIndex = closestIndex-1;
229  int posStartIndex = closestIndex+1;
230 
231  if (checkClosest) { // must decide if the closest is on the neg or pos side
232  if ( Geom::phiLess(gCrossingPos.barePhi(), sWedge[closestIndex]->surface().phi()) ) {
233  posStartIndex = closestIndex;
234  }
235  else {
236  negStartIndex = closestIndex;
237  }
238  }
239 
240  typedef CompatibleDetToGroupAdder Adder;
241  for (int idet=negStartIndex; idet >= 0; idet--) {
242  //if(idet <0 || idet>=sWedge.size()) {edm::LogInfo(TkDetLayers) << "==== warning! gone out vector bounds.idet: " << idet ;break;}
243  if (!tkDetUtil::overlapInPhi( gCrossingPos, *sWedge[idet], window)) break;
244  if (!Adder::add( *sWedge[idet], tsos, prop, est, result)) break;
245  }
246  for (int idet=posStartIndex; idet < static_cast<int>(sWedge.size()); idet++) {
247  //if(idet <0 || idet>=sWedge.size()) {edm::LogInfo(TkDetLayers) << "==== warning! gone out vector bounds.idet: " << idet ;break;}
248  if (!tkDetUtil::overlapInPhi( gCrossingPos, *sWedge[idet], window)) break;
249  if (!Adder::add( *sWedge[idet], tsos, prop, est, result)) break;
250  }
251 }
def window
Definition: svgfig.py:642
int closestDetIndex() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
const GlobalPoint & position() const
T barePhi() const
Definition: PV3DBase.h:67
const std::vector< const GeomDet * > & subWedge(int ind) const
int subLayerIndex() const
bool overlapInPhi(const GlobalPoint &crossPoint, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.cc:21
tuple result
Definition: query.py:137
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:57
const std::vector<const GeomDet*>& CompositeTECWedge::subWedge ( int  ind) const
inlineprivate

Definition at line 57 of file CompositeTECWedge.h.

References theBackDets, and theFrontDets.

Referenced by addClosest(), and searchNeighbors().

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

Member Data Documentation

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

Definition at line 64 of file CompositeTECWedge.h.

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

ReferenceCountingPointer<BoundDiskSector> CompositeTECWedge::theBackSector
private

Definition at line 68 of file CompositeTECWedge.h.

Referenced by CompositeTECWedge(), and computeCrossings().

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

Definition at line 65 of file CompositeTECWedge.h.

Referenced by basicComponents(), and CompositeTECWedge().

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

Definition at line 63 of file CompositeTECWedge.h.

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

ReferenceCountingPointer<BoundDiskSector> CompositeTECWedge::theFrontSector
private

Definition at line 67 of file CompositeTECWedge.h.

Referenced by CompositeTECWedge(), and computeCrossings().