CMS 3D CMS Logo

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

#include <MSLayer.h>

Classes

struct  DataX0
 

Public Types

typedef PixelRecoRange< float > Range
 

Public Member Functions

std::pair< PixelRecoPointRZ, bool > crossing (const PixelRecoLineRZ &line) const
 
std::pair< PixelRecoPointRZ, bool > crossing (const SimpleLineRZ &line) const
 
float distance2 (const PixelRecoPointRZ &point) const
 
const
GeomDetEnumerators::Location
face () const
 
float halfThickness () const
 
 MSLayer (const DetLayer *layer, const DataX0 &dataX0=DataX0(nullptr))
 
 MSLayer ()
 
 MSLayer (GeomDetEnumerators::Location part, float position, Range range, float halfThickness=0., const DataX0 &dataX0=DataX0(nullptr))
 
bool operator< (const MSLayer &o) const
 
bool operator== (const MSLayer &o) const
 
float position () const
 
const Rangerange () const
 
int seqNum () const
 
float sumX0D (float cotTheta) const
 
float x0 (float cotTheta) const
 

Private Attributes

GeomDetEnumerators::Location theFace
 
float theHalfThickness
 
float thePosition
 
Range theRange
 
int theSeqNum
 
DataX0 theX0Data
 

Friends

class MSLayersKeeper
 
std::ostream & operator<< (std::ostream &s, const MSLayer &l)
 

Detailed Description

Definition at line 13 of file MSLayer.h.

Member Typedef Documentation

Definition at line 15 of file MSLayer.h.

Constructor & Destructor Documentation

MSLayer::MSLayer ( const DetLayer layer,
const DataX0 dataX0 = DataX0(nullptr) 
)

Definition at line 35 of file MSLayer.cc.

References Reference_intrackfit_cff::barrel, Surface::bounds(), gather_cfg::cout, Reference_intrackfit_cff::endcap, phase1PixelTopology::layer, Bounds::length(), GeometricSearchDet::position(), BarrelDetLayer::specificSurface(), ForwardDetLayer::specificSurface(), GeometricSearchDet::surface(), BarrelDetLayer::surface(), theFace, theHalfThickness, thePosition, theRange, Bounds::thickness(), and PV3DBase< T, PVType, FrameType >::z().

36  : theFace(layer->location()), theSeqNum(layer->seqNum()), theX0Data(dataX0) {
37  const BarrelDetLayer* bl;
38  const ForwardDetLayer* fl;
39  theHalfThickness = layer->surface().bounds().thickness() / 2;
40 
41  switch (theFace) {
42  case barrel:
43  bl = static_cast<const BarrelDetLayer*>(layer);
44  thePosition = bl->specificSurface().radius();
45  theRange = Range(-bl->surface().bounds().length() / 2, bl->surface().bounds().length() / 2);
46  break;
47  case endcap:
48  fl = static_cast<const ForwardDetLayer*>(layer);
49  thePosition = fl->position().z();
50  theRange = Range(fl->specificSurface().innerRadius(), fl->specificSurface().outerRadius());
51  break;
52  default:
53  // should throw or simimal
54  cout << " ** MSLayer ** unknown part - will not work!" << endl;
55  break;
56  }
57 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
virtual float length() const =0
const BoundSurface & surface() const final
GeometricSearchDet interface.
virtual Location location() const =0
Which part of the detector (barrel, endcap)
float theHalfThickness
Definition: MSLayer.h:71
Range theRange
Definition: MSLayer.h:70
const Bounds & bounds() const
Definition: Surface.h:87
constexpr std::array< uint8_t, layerIndexSize > layer
virtual float thickness() const =0
int seqNum() const
Definition: DetLayer.h:35
int theSeqNum
Definition: MSLayer.h:72
T z() const
Definition: PV3DBase.h:61
DataX0 theX0Data
Definition: MSLayer.h:74
virtual const Surface::PositionType & position() const
Returns position of the surface.
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
float thePosition
Definition: MSLayer.h:69
virtual const BoundDisk & specificSurface() const final
tuple cout
Definition: gather_cfg.py:144
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
PixelRecoRange< float > Range
Definition: MSLayer.h:15
MSLayer::MSLayer ( )
inline

Definition at line 38 of file MSLayer.h.

38 {}
MSLayer::MSLayer ( GeomDetEnumerators::Location  part,
float  position,
Range  range,
float  halfThickness = 0.,
const DataX0 dataX0 = DataX0(nullptr) 
)

Definition at line 59 of file MSLayer.cc.

60  : theFace(part),
62  theRange(range),
64  theSeqNum(-1),
65  theX0Data(dataX0) {}
float theHalfThickness
Definition: MSLayer.h:71
Range theRange
Definition: MSLayer.h:70
const Range & range() const
Definition: MSLayer.h:50
float position() const
Definition: MSLayer.h:53
int theSeqNum
Definition: MSLayer.h:72
float halfThickness() const
Definition: MSLayer.h:54
DataX0 theX0Data
Definition: MSLayer.h:74
part
Definition: HCALResponse.h:20
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68

Member Function Documentation

pair< PixelRecoPointRZ, bool > MSLayer::crossing ( const PixelRecoLineRZ line) const

Definition at line 84 of file MSLayer.cc.

References Reference_intrackfit_cff::barrel, gpuVertexFinder::eps, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), PixelRecoLineRZ::rAtZ(), std::swap(), theFace, thePosition, theRange, relativeConstraints::value, z, and PixelRecoLineRZ::zAtR().

Referenced by MultipleScatteringParametrisation::operator()().

84  {
85  const float eps = 1.e-5;
86  bool inLayer = true;
87  float value = (theFace == barrel) ? line.zAtR(thePosition) : line.rAtZ(thePosition);
88  if (value > theRange.max()) {
89  value = theRange.max() - eps;
90  inLayer = false;
91  } else if (value < theRange.min()) {
92  value = theRange.min() + eps;
93  inLayer = false;
94  }
95  float z = thePosition;
96  if (theFace == barrel)
97  std::swap(z, value); // if barrel value is z
98  return make_pair(PixelRecoPointRZ(value, z), inLayer);
99 }
T max() const
WorkSpace int float eps
Range theRange
Definition: MSLayer.h:70
T min() const
float zAtR(float r) const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
float thePosition
Definition: MSLayer.h:69
float rAtZ(float z) const
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
pair< PixelRecoPointRZ, bool > MSLayer::crossing ( const SimpleLineRZ line) const

Definition at line 100 of file MSLayer.cc.

References Reference_intrackfit_cff::barrel, gpuVertexFinder::eps, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), SimpleLineRZ::rAtZ(), std::swap(), theFace, thePosition, theRange, relativeConstraints::value, z, and SimpleLineRZ::zAtR().

100  {
101  const float eps = 1.e-5;
102  bool inLayer = true;
103  float value = (theFace == barrel) ? line.zAtR(thePosition) : line.rAtZ(thePosition);
104  if (value > theRange.max()) {
105  value = theRange.max() - eps;
106  inLayer = false;
107  } else if (value < theRange.min()) {
108  value = theRange.min() + eps;
109  inLayer = false;
110  }
111  float z = thePosition;
112  if (theFace == barrel)
113  std::swap(z, value); // if barrel value is z
114  return make_pair(PixelRecoPointRZ(value, z), inLayer);
115 }
T max() const
WorkSpace int float eps
Range theRange
Definition: MSLayer.h:70
T min() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
float thePosition
Definition: MSLayer.h:69
float rAtZ(float z) const
float zAtR(float r) const
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
float MSLayer::distance2 ( const PixelRecoPointRZ point) const

Definition at line 118 of file MSLayer.cc.

References funct::abs(), Reference_intrackfit_cff::barrel, PixelRecoRange< T >::inside(), PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), PixelRecoPointRZ::r(), sqr(), theFace, theHalfThickness, thePosition, theRange, findQualityFiles::v, and PixelRecoPointRZ::z().

118  {
119  float u = (theFace == barrel) ? point.r() : point.z();
120  float v = (theFace == barrel) ? point.z() : point.r();
121 
122  float du = std::abs(u - thePosition);
123  if (theRange.inside(v))
124  return (du < theHalfThickness) ? 0.f : du * du;
125 
126  float dv = (v > theRange.max()) ? v - theRange.max() : theRange.min() - v;
127  return sqr(du) + sqr(dv);
128 }
T max() const
float theHalfThickness
Definition: MSLayer.h:71
Range theRange
Definition: MSLayer.h:70
T min() const
int sqr(const T &t)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float z() const
bool inside(const T &value) const
float r() const
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
const GeomDetEnumerators::Location& MSLayer::face ( ) const
inline

Definition at line 52 of file MSLayer.h.

References theFace.

Referenced by operator<<().

52 { return theFace; }
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
float MSLayer::halfThickness ( ) const
inline

Definition at line 54 of file MSLayer.h.

References theHalfThickness.

54 { return theHalfThickness; }
float theHalfThickness
Definition: MSLayer.h:71
bool MSLayer::operator< ( const MSLayer o) const

Definition at line 72 of file MSLayer.cc.

References funct::abs(), Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, PixelRecoRange< T >::max(), range(), theFace, and thePosition.

72  {
73  if (theFace == barrel && o.theFace == barrel)
74  return thePosition < o.thePosition;
75  else if (theFace == barrel && o.theFace == endcap)
76  return thePosition < o.range().max();
77  else if (theFace == endcap && o.theFace == endcap)
79  else
80  return range().max() < o.thePosition;
81 }
T max() const
const Range & range() const
Definition: MSLayer.h:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
bool MSLayer::operator== ( const MSLayer o) const

Definition at line 68 of file MSLayer.cc.

References funct::abs(), validate-o2o-wbm::f, theFace, and thePosition.

68  {
69  return theFace == o.theFace && std::abs(thePosition - o.thePosition) < 1.e-3f;
70 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
float MSLayer::position ( ) const
inline

Definition at line 53 of file MSLayer.h.

References thePosition.

Referenced by operator<<().

53 { return thePosition; }
float thePosition
Definition: MSLayer.h:69
const Range& MSLayer::range ( ) const
inline

Definition at line 50 of file MSLayer.h.

References theRange.

Referenced by operator<(), and operator<<().

50 { return theRange; }
Range theRange
Definition: MSLayer.h:70
int MSLayer::seqNum ( ) const
inline

Definition at line 47 of file MSLayer.h.

References theSeqNum.

Referenced by MultipleScatteringParametrisation::operator()().

47 { return theSeqNum; }
int theSeqNum
Definition: MSLayer.h:72
float MSLayer::sumX0D ( float  cotTheta) const

Definition at line 144 of file MSLayer.cc.

References MSLayer::DataX0::allLayers, Reference_intrackfit_cff::barrel, MSLayer::DataX0::cotTheta, Reference_intrackfit_cff::endcap, validate-o2o-wbm::f, MSLayersAtAngle::findLayer(), MSLayer::DataX0::hasFSlope, MSLayer::DataX0::hasX0, GeomDetEnumerators::invalidLoc, MSLayersKeeper::layers(), LIKELY, MSLayer::DataX0::slopeSumX0D, mathSSE::sqrt(), MSLayer::DataX0::sumX0D, sumX0D(), theFace, and theX0Data.

Referenced by MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged(), MultipleScatteringParametrisation::operator()(), and sumX0D().

144  {
145  if LIKELY (theX0Data.hasX0) {
146  switch (theFace) {
147  case barrel:
148  return theX0Data.sumX0D *
149  std::sqrt(std::sqrt((1.f + cotTheta * cotTheta) / (1.f + theX0Data.cotTheta * theX0Data.cotTheta)));
150  case endcap:
151  return (theX0Data.hasFSlope)
152  ? theX0Data.sumX0D + theX0Data.slopeSumX0D * (1.f / cotTheta - 1.f / theX0Data.cotTheta)
153  : theX0Data.sumX0D;
154  case invalidLoc:
155  break; // make gcc happy
156  }
157  } else if (theX0Data.allLayers) {
158  const MSLayer* dataLayer = theX0Data.allLayers->layers(cotTheta).findLayer(*this);
159  if (dataLayer)
160  return dataLayer->sumX0D(cotTheta);
161  }
162  return 0.;
163 }
const MSLayersKeeper * allLayers
Definition: MSLayer.h:33
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:144
#define LIKELY(x)
Definition: Likely.h:20
bool hasFSlope
Definition: MSLayer.h:31
T sqrt(T t)
Definition: SSEVec.h:19
DataX0 theX0Data
Definition: MSLayer.h:74
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
float cotTheta
Definition: MSLayer.h:32
float slopeSumX0D
Definition: MSLayer.h:32
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
const MSLayer * findLayer(const MSLayer &layer) const
float sumX0D
Definition: MSLayer.h:32
float MSLayer::x0 ( float  cotTheta) const

Definition at line 131 of file MSLayer.cc.

References funct::abs(), MSLayer::DataX0::allLayers, Reference_intrackfit_cff::barrel, validate-o2o-wbm::f, MSLayersAtAngle::findLayer(), MSLayer::DataX0::hasX0, MSLayersKeeper::layers(), LIKELY, mathSSE::sqrt(), theFace, theX0Data, MSLayer::DataX0::x0, and x0().

Referenced by MultipleScatteringParametrisation::operator()(), and x0().

131  {
132  if LIKELY (theX0Data.hasX0) {
133  float OverSinTheta = std::sqrt(1.f + cotTheta * cotTheta);
134  return (theFace == barrel) ? theX0Data.x0 * OverSinTheta : theX0Data.x0 * OverSinTheta / std::abs(cotTheta);
135  } else if (theX0Data.allLayers) {
136  const MSLayer* dataLayer = theX0Data.allLayers->layers(cotTheta).findLayer(*this);
137  if (dataLayer)
138  return dataLayer->x0(cotTheta);
139  }
140  return 0.;
141 }
const MSLayersKeeper * allLayers
Definition: MSLayer.h:33
#define LIKELY(x)
Definition: Likely.h:20
float x0(float cotTheta) const
Definition: MSLayer.cc:131
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DataX0 theX0Data
Definition: MSLayer.h:74
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
const MSLayer * findLayer(const MSLayer &layer) const

Friends And Related Function Documentation

friend class MSLayersKeeper
friend

Definition at line 76 of file MSLayer.h.

std::ostream& operator<< ( std::ostream &  s,
const MSLayer l 
)
friend

Member Data Documentation

GeomDetEnumerators::Location MSLayer::theFace
private

Definition at line 68 of file MSLayer.h.

Referenced by crossing(), distance2(), face(), MSLayer(), operator<(), operator==(), sumX0D(), and x0().

float MSLayer::theHalfThickness
private

Definition at line 71 of file MSLayer.h.

Referenced by distance2(), halfThickness(), and MSLayer().

float MSLayer::thePosition
private

Definition at line 69 of file MSLayer.h.

Referenced by crossing(), distance2(), MSLayer(), operator<(), operator==(), and position().

Range MSLayer::theRange
private

Definition at line 70 of file MSLayer.h.

Referenced by crossing(), distance2(), MSLayer(), and range().

int MSLayer::theSeqNum
private

Definition at line 72 of file MSLayer.h.

Referenced by seqNum().

DataX0 MSLayer::theX0Data
private