CMS 3D CMS Logo

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

#include <PixelForwardLayer.h>

Inheritance diagram for PixelForwardLayer:
ForwardDetLayer DetLayer GeometricSearchDet

Classes

struct  SubTurbineCrossings
 

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const __attribute__((cold))
 Returns basic components, if any. More...
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
 
 PixelForwardLayer (std::vector< const PixelBlade * > &blades)
 
virtual SubDetector subDetector () const
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap) More...
 
 ~PixelForwardLayer ()
 
- Public Member Functions inherited from ForwardDetLayer
virtual std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const
 
bool contains (const Local3DPoint &p) const
 
 ForwardDetLayer (bool doHaveGroups)
 
virtual Location location () const
 Which part of the detector (barrel, endcap) More...
 
virtual const BoundDiskspecificSurface () const
 
virtual const BoundSurfacesurface () const
 The surface of the GeometricSearchDet. More...
 
virtual ~ForwardDetLayer ()
 
- Public Member Functions inherited from DetLayer
 DetLayer (bool doHaveGroup, bool ibar)
 
bool isBarrel () const
 
bool isForward () const
 
int seqNum () const
 
void setSeqNum (int sq)
 
virtual ~DetLayer ()
 
- 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 Types

typedef PeriodicBinFinderInPhi
< float > 
BinFinderType
 

Private Member Functions

SubTurbineCrossings computeCrossings (const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
 
void searchNeighbors (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubTurbineCrossings &crossings, float window, std::vector< DetGroup > &result) const __attribute__((hot))
 

Static Private Member Functions

static int computeHelicity (const GeometricSearchDet *firstBlade, const GeometricSearchDet *secondBlade)
 
static float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
 

Private Attributes

std::vector< const GeomDet * > theBasicComps
 
BinFinderType theBinFinder
 
std::vector< const
GeometricSearchDet * > 
theComps
 

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
 
- Protected Attributes inherited from GeometricSearchDet
bool haveGroups
 
GeomDetCompatibilityChecker theCompatibilityChecker
 

Detailed Description

A concrete implementation for PixelForward layer built out of ForwardPixelBlade

Definition at line 15 of file PixelForwardLayer.h.

Member Typedef Documentation

Definition at line 66 of file PixelForwardLayer.h.

Constructor & Destructor Documentation

PixelForwardLayer::PixelForwardLayer ( std::vector< const PixelBlade * > &  blades)

Definition at line 23 of file PixelForwardLayer.cc.

References ForwardDetLayer::computeSurface(), LogDebug, PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), ForwardDetLayer::setSurface(), ForwardDetLayer::specificSurface(), ForwardDetLayer::surface(), theBasicComps, theBinFinder, theComps, and PV3DBase< T, PVType, FrameType >::z().

23  :
24  ForwardDetLayer(true),
25  theComps(blades.begin(),blades.end())
26 {
27  for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
28  it!=theComps.end();it++){
29  theBasicComps.insert(theBasicComps.end(),
30  (**it).basicComponents().begin(),
31  (**it).basicComponents().end());
32  }
33 
34  //They should be already phi-ordered. TO BE CHECKED!!
35  //sort( theBlades.begin(), theBlades.end(), PhiLess());
37 
38  //Is a "periodic" binFinderInPhi enough?. TO BE CHECKED!!
39  theBinFinder = BinFinderType( theComps.front()->surface().position().phi(),
40  theComps.size());
41 
42  //--------- DEBUG INFO --------------
43  LogDebug("TkDetLayers") << "DEBUG INFO for PixelForwardLayer" << "\n"
44  << "PixelForwardLayer.surfcace.phi(): "
45  << this->surface().position().phi() << "\n"
46  << "PixelForwardLayer.surfcace.z(): "
47  << this->surface().position().z() << "\n"
48  << "PixelForwardLayer.surfcace.innerR(): "
49  << this->specificSurface().innerRadius() << "\n"
50  << "PixelForwardLayer.surfcace.outerR(): "
51  << this->specificSurface().outerRadius() ;
52 
53  for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
54  it!=theComps.end(); it++){
55  LogDebug("TkDetLayers") << "blades phi,z,r: "
56  << (*it)->surface().position().phi() << " , "
57  << (*it)->surface().position().z() << " , "
58  << (*it)->surface().position().perp();
59  }
60  //-----------------------------------
61 
62 
63 }
#define LogDebug(id)
virtual BoundDisk * computeSurface()
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
void setSurface(BoundDisk *cp)
ForwardDetLayer(bool doHaveGroups)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:64
virtual const BoundDisk & specificSurface() const
PeriodicBinFinderInPhi< float > BinFinderType
std::vector< const GeometricSearchDet * > theComps
BinFinderType theBinFinder
const PositionType & position() const
std::vector< const GeomDet * > theBasicComps
PixelForwardLayer::~PixelForwardLayer ( )

Definition at line 65 of file PixelForwardLayer.cc.

References i, and theComps.

65  {
66  vector<const GeometricSearchDet*>::const_iterator i;
67  for (i=theComps.begin(); i!=theComps.end(); i++) {
68  delete *i;
69  }
70 }
int i
Definition: DBlmapReader.cc:9
std::vector< const GeometricSearchDet * > theComps

Member Function Documentation

virtual const std::vector<const GeomDet*>& PixelForwardLayer::basicComponents ( ) const
inlinevirtual

Implements GeometricSearchDet.

Definition at line 22 of file PixelForwardLayer.h.

References theBasicComps.

22 {return theBasicComps;}
std::vector< const GeomDet * > theBasicComps
virtual const std::vector<const GeometricSearchDet*>& PixelForwardLayer::components ( ) const
inlinevirtual

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 24 of file PixelForwardLayer.h.

References theComps.

24 {return theComps;}
std::vector< const GeometricSearchDet * > theComps
PixelForwardLayer::SubTurbineCrossings PixelForwardLayer::computeCrossings ( const TrajectoryStateOnSurface startingState,
PropagationDirection  propDir 
) const
private

Definition at line 182 of file PixelForwardLayer.cc.

References funct::abs(), PeriodicBinFinderInPhi< T >::binIndex(), HelixArbitraryPlaneCrossing::direction(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), HelixArbitraryPlaneCrossing::pathLength(), HelixArbitraryPlaneCrossing2Order::pathLength(), GloballyPositioned< T >::phi(), HelixArbitraryPlaneCrossing::position(), HelixArbitraryPlaneCrossing2Order::position(), rho, ForwardDetLayer::specificSurface(), ForwardDetLayer::surface(), theBinFinder, theComps, GloballyPositioned< T >::toLocal(), TrajectoryStateOnSurface::transverseCurvature(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by groupedCompatibleDetsV().

184 {
186 
187  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition());
188  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum());
189 
190  auto rho = startingState.transverseCurvature();
191 
192  HelixArbitraryPlaneCrossing turbineCrossing( startPos, startDir, rho,
193  propDir);
194 
195  pair<bool,double> thePath = turbineCrossing.pathLength( specificSurface() );
196 
197  if (!thePath.first) {
198  //edm::LogInfo("TkDetLayers") << "ERROR in PixelForwardLayer: disk not crossed by track" ;
199  return SubTurbineCrossings();
200  }
201 
202  HelixPlaneCrossing::PositionType turbinePoint( turbineCrossing.position(thePath.second));
203  HelixPlaneCrossing::DirectionType turbineDir( turbineCrossing.direction(thePath.second));
204 
205  int closestIndex = theBinFinder.binIndex(turbinePoint.barePhi());
206 
207  const Plane& closestPlane( static_cast<const Plane&>(theComps[closestIndex]->surface()));
208 
209 
210  HelixArbitraryPlaneCrossing2Order theBladeCrossing(turbinePoint, turbineDir, rho);
211 
212  pair<bool,double> theClosestBladePath = theBladeCrossing.pathLength( closestPlane );
213  LocalPoint closestPos = closestPlane.toLocal(GlobalPoint(theBladeCrossing.position(theClosestBladePath.second)) );
214 
215  auto closestDist = closestPos.x(); // use fact that local X perp to global Y
216 
217  //int next = turbinePoint.phi() - closestPlane.position().phi() > 0 ? closest+1 : closest-1;
218 
219  int nextIndex = PhiLess()( closestPlane.phi(), turbinePoint.barePhi()) ?
220  closestIndex+1 : closestIndex-1;
221 
222  const Plane& nextPlane( static_cast<const Plane&>(
223  theComps[ theBinFinder.binIndex(nextIndex)]->surface()));
224 
225  pair<bool,double> theNextBladePath = theBladeCrossing.pathLength( nextPlane );
226  LocalPoint nextPos = nextPlane.toLocal(GlobalPoint(theBladeCrossing.position(theNextBladePath.second)) );
227 
228  auto nextDist = nextPos.x();
229 
230  if ( std::abs(closestDist) < std::abs(nextDist)) {
231  return SubTurbineCrossings( closestIndex, nextIndex, nextDist);
232  }
233  else {
234  return SubTurbineCrossings( nextIndex, closestIndex, closestDist);
235  }
236 }
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
Definition: Plane.h:17
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
virtual const BoundDisk & specificSurface() const
std::vector< const GeometricSearchDet * > theComps
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalVector globalMomentum() const
BinFinderType theBinFinder
T x() const
Definition: PV3DBase.h:62
int PixelForwardLayer::computeHelicity ( const GeometricSearchDet firstBlade,
const GeometricSearchDet secondBlade 
)
staticprivate

Definition at line 176 of file PixelForwardLayer.cc.

References funct::abs(), GeometricSearchDet::position(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV(), and searchNeighbors().

177 {
178  return std::abs(firstBlade->position().z()) < std::abs(secondBlade->position().z()) ? 0 : 1;
179 }
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const Surface::PositionType & position() const
Returns position of the surface.
float PixelForwardLayer::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
)
staticprivate

Definition at line 239 of file PixelForwardLayer.cc.

References MeasurementEstimator::maximalLocalDisplacement(), GeomDet::surface(), and x.

Referenced by groupedCompatibleDetsV().

241  {
242  return est.maximalLocalDisplacement(tsos, det->surface()).x();
243 }
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
void PixelForwardLayer::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
virtual

Reimplemented from GeometricSearchDet.

Definition at line 73 of file PixelForwardLayer.cc.

References Clusterizer1DCommons::add(), PeriodicBinFinderInPhi< T >::binIndex(), PixelForwardLayer::SubTurbineCrossings::closestIndex, computeCrossings(), computeHelicity(), computeWindowSize(), LayerCrossingSide::endcapSide(), PixelForwardLayer::SubTurbineCrossings::isValid, eostools::move(), PixelForwardLayer::SubTurbineCrossings::nextIndex, DetGroupMerger::orderAndMergeTwoLevels(), Propagator::propagationDirection(), query::result, searchNeighbors(), theBinFinder, theComps, and svgfig::window().

76  {
77  std::vector<DetGroup> closestResult;
78  SubTurbineCrossings crossings;
79 
80  crossings = computeCrossings( tsos, prop.propagationDirection());
81  if (!crossings.isValid){
82  //edm::LogInfo("TkDetLayers") << "computeCrossings returns invalid in PixelForwardLayer::groupedCompatibleDets:";
83  return;
84  }
85 
86  typedef CompatibleDetToGroupAdder Adder;
87  Adder::add( *theComps[theBinFinder.binIndex(crossings.closestIndex)],
88  tsos, prop, est, closestResult);
89 
90  if(closestResult.empty()){
91  Adder::add( *theComps[theBinFinder.binIndex(crossings.nextIndex)],
92  tsos, prop, est, result);
93  return;
94  }
95 
96  DetGroupElement closestGel( closestResult.front().front());
97  float window = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
98 
99  //float detWidth = closestGel.det()->surface().bounds().width();
100  //if (crossings.nextDistance < detWidth + window) {
101  vector<DetGroup> nextResult;
102  if (Adder::add( *theComps[theBinFinder.binIndex(crossings.nextIndex)],
103  tsos, prop, est, nextResult)) {
104  int crossingSide = LayerCrossingSide().endcapSide( tsos, prop);
105  int theHelicity = computeHelicity(theComps[theBinFinder.binIndex(crossings.closestIndex)],
106  theComps[theBinFinder.binIndex(crossings.nextIndex)] );
107  DetGroupMerger::orderAndMergeTwoLevels( std::move(closestResult), std::move(nextResult), result,
108  theHelicity, crossingSide);
109  }
110  else {
111  result.swap(closestResult);
112  }
113 
114  /*
115  }
116  else {
117  result.swap(closestResult);
118  }
119  */
120 
121  // --- THIS lines may speed up the reconstruction. But it reduces slightly the efficiency.
122  // only loop over neighbors (other than closest and next) if window is BIG
123  //if (window > 0.5*detWidth) {
124  searchNeighbors( tsos, prop, est, crossings, window, result);
125  //}
126 }
def window
Definition: svgfig.py:642
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:155
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
static int computeHelicity(const GeometricSearchDet *firstBlade, const GeometricSearchDet *secondBlade)
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
tuple result
Definition: query.py:137
def move
Definition: eostools.py:510
std::vector< const GeometricSearchDet * > theComps
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
static float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
SubTurbineCrossings computeCrossings(const TrajectoryStateOnSurface &startingState, PropagationDirection propDir) const __attribute__((hot))
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
void searchNeighbors(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, const SubTurbineCrossings &crossings, float window, std::vector< DetGroup > &result) const __attribute__((hot))
BinFinderType theBinFinder
void PixelForwardLayer::searchNeighbors ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
const SubTurbineCrossings crossings,
float  window,
std::vector< DetGroup > &  result 
) const
private

Definition at line 131 of file PixelForwardLayer.cc.

References Clusterizer1DCommons::add(), PeriodicBinFinderInPhi< T >::binIndex(), PixelForwardLayer::SubTurbineCrossings::closestIndex, computeHelicity(), LayerCrossingSide::endcapSide(), bookConverter::max, HLT_25ns14e33_v1_cff::Merger, min(), eostools::move(), PixelForwardLayer::SubTurbineCrossings::nextIndex, theBinFinder, and theComps.

Referenced by groupedCompatibleDetsV().

137 {
138  typedef CompatibleDetToGroupAdder Adder;
139  int crossingSide = LayerCrossingSide().endcapSide( tsos, prop);
140  typedef DetGroupMerger Merger;
141 
142  int negStart = min( crossings.closestIndex, crossings.nextIndex) - 1;
143  int posStart = max( crossings.closestIndex, crossings.nextIndex) + 1;
144 
145  int quarter = theComps.size()/4;
146 
147  for (int idet=negStart; idet >= negStart - quarter+1; idet--) {
148  std::vector<DetGroup> tmp1;
149  const GeometricSearchDet* neighbor = theComps[theBinFinder.binIndex(idet)];
150  // if (!overlap( gCrossingPos, *neighbor, window)) break; // mybe not needed?
151  // maybe also add shallow crossing angle test here???
152  if (!Adder::add( *neighbor, tsos, prop, est, tmp1)) break;
153  int theHelicity = computeHelicity(theComps[theBinFinder.binIndex(idet)],
154  theComps[theBinFinder.binIndex(idet+1)] );
155  std::vector<DetGroup> tmp2; tmp2.swap(result);
156  std::vector<DetGroup> newResult;
157  Merger::orderAndMergeTwoLevels( std::move(tmp1), std::move(tmp2), newResult, theHelicity, crossingSide);
158  result.swap(newResult);
159  }
160  for (int idet=posStart; idet < posStart + quarter-1; idet++) {
161  vector<DetGroup> tmp1;
162  const GeometricSearchDet* neighbor = theComps[theBinFinder.binIndex(idet)];
163  // if (!overlap( gCrossingPos, *neighbor, window)) break; // mybe not needed?
164  // maybe also add shallow crossing angle test here???
165  if (!Adder::add( *neighbor, tsos, prop, est, tmp1)) break;
166  int theHelicity = computeHelicity(theComps[theBinFinder.binIndex(idet-1)],
167  theComps[theBinFinder.binIndex(idet)] );
168  std::vector<DetGroup> tmp2; tmp2.swap(result);
169  std::vector<DetGroup> newResult;
170  Merger::orderAndMergeTwoLevels(std::move(tmp2), std::move(tmp1), newResult, theHelicity, crossingSide);
171  result.swap(newResult);
172  }
173 }
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
static int computeHelicity(const GeometricSearchDet *firstBlade, const GeometricSearchDet *secondBlade)
virtual int binIndex(T phi) const
returns an index in the valid range for the bin that contains phi
tuple result
Definition: query.py:137
def move
Definition: eostools.py:510
std::vector< const GeometricSearchDet * > theComps
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
T min(T a, T b)
Definition: MathUtil.h:58
BinFinderType theBinFinder
virtual SubDetector PixelForwardLayer::subDetector ( ) const
inlinevirtual

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

Implements DetLayer.

Definition at line 32 of file PixelForwardLayer.h.

References GeomDetEnumerators::PixelEndcap, and GeomDetEnumerators::subDetGeom.

Member Data Documentation

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

Definition at line 70 of file PixelForwardLayer.h.

Referenced by basicComponents(), and PixelForwardLayer().

BinFinderType PixelForwardLayer::theBinFinder
private
std::vector<const GeometricSearchDet*> PixelForwardLayer::theComps
private