CMS 3D CMS Logo

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::Locationface () 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

◆ Range

Definition at line 15 of file MSLayer.h.

Constructor & Destructor Documentation

◆ MSLayer() [1/3]

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, makeMuonMisalignmentScenario::endcap, pixelTopology::layer, Bounds::length(), GeometricSearchDet::position(), ForwardDetLayer::specificSurface(), BarrelDetLayer::specificSurface(), BarrelDetLayer::surface(), theFace, theHalfThickness, thePosition, theRange, 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 Surface::PositionType & position() const
Returns position of the surface.
virtual float length() const =0
const BoundSurface & surface() const final
GeometricSearchDet interface.
T z() const
Definition: PV3DBase.h:61
float theHalfThickness
Definition: MSLayer.h:71
Range theRange
Definition: MSLayer.h:70
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
int theSeqNum
Definition: MSLayer.h:72
DataX0 theX0Data
Definition: MSLayer.h:74
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
float thePosition
Definition: MSLayer.h:69
virtual const BoundDisk & specificSurface() const final
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
PixelRecoRange< float > Range
Definition: MSLayer.h:15
const Bounds & bounds() const
Definition: Surface.h:87

◆ MSLayer() [2/3]

MSLayer::MSLayer ( )
inline

Definition at line 38 of file MSLayer.h.

38 {}

◆ MSLayer() [3/3]

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 position() const
Definition: MSLayer.h:53
float theHalfThickness
Definition: MSLayer.h:71
Range theRange
Definition: MSLayer.h:70
const Range & range() const
Definition: MSLayer.h:50
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

◆ crossing() [1/2]

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

Definition at line 84 of file MSLayer.cc.

References Reference_intrackfit_cff::barrel, HLT_2022v15_cff::eps, mps_splice::line, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), std::swap(), theFace, thePosition, theRange, and z.

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 }
Range theRange
Definition: MSLayer.h:70
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: value.py:1
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68

◆ crossing() [2/2]

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

Definition at line 100 of file MSLayer.cc.

References Reference_intrackfit_cff::barrel, HLT_2022v15_cff::eps, mps_splice::line, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), std::swap(), theFace, thePosition, theRange, and z.

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 }
Range theRange
Definition: MSLayer.h:70
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: value.py:1
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68

◆ distance2()

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(), point, sqr(), theFace, theHalfThickness, thePosition, theRange, and findQualityFiles::v.

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 }
bool inside(const T &value) const
T sqr(T t)
Definition: MSLayer.cc:13
float theHalfThickness
Definition: MSLayer.h:71
Range theRange
Definition: MSLayer.h: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
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ face()

const GeomDetEnumerators::Location& MSLayer::face ( ) const
inline

Definition at line 52 of file MSLayer.h.

References theFace.

52 { return theFace; }
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68

◆ halfThickness()

float MSLayer::halfThickness ( ) const
inline

Definition at line 54 of file MSLayer.h.

References theHalfThickness.

54 { return theHalfThickness; }
float theHalfThickness
Definition: MSLayer.h:71

◆ operator<()

bool MSLayer::operator< ( const MSLayer o) const

Definition at line 72 of file MSLayer.cc.

References funct::abs(), Reference_intrackfit_cff::barrel, makeMuonMisalignmentScenario::endcap, PixelRecoRange< T >::max(), EcalTangentSkim_cfg::o, 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)
78  return std::abs(thePosition) < std::abs(o.thePosition);
79  else
80  return range().max() < o.thePosition;
81 }
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

◆ operator==()

bool MSLayer::operator== ( const MSLayer o) const

Definition at line 68 of file MSLayer.cc.

References funct::abs(), f, EcalTangentSkim_cfg::o, 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
double f[11][100]
float thePosition
Definition: MSLayer.h:69
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68

◆ position()

float MSLayer::position ( ) const
inline

Definition at line 53 of file MSLayer.h.

References thePosition.

53 { return thePosition; }
float thePosition
Definition: MSLayer.h:69

◆ range()

const Range& MSLayer::range ( ) const
inline

Definition at line 50 of file MSLayer.h.

References theRange.

Referenced by operator<().

50 { return theRange; }
Range theRange
Definition: MSLayer.h:70

◆ seqNum()

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

◆ sumX0D()

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, makeMuonMisalignmentScenario::endcap, 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
#define LIKELY(x)
Definition: Likely.h:20
const MSLayer * findLayer(const MSLayer &layer) const
bool hasFSlope
Definition: MSLayer.h:31
T sqrt(T t)
Definition: SSEVec.h:19
DataX0 theX0Data
Definition: MSLayer.h:74
double f[11][100]
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
float cotTheta
Definition: MSLayer.h:32
float slopeSumX0D
Definition: MSLayer.h:32
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:144
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
float sumX0D
Definition: MSLayer.h:32

◆ x0()

float MSLayer::x0 ( float  cotTheta) const

Definition at line 131 of file MSLayer.cc.

References funct::abs(), MSLayer::DataX0::allLayers, Reference_intrackfit_cff::barrel, 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
const MSLayer * findLayer(const MSLayer &layer) const
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
double f[11][100]
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68

Friends And Related Function Documentation

◆ MSLayersKeeper

friend class MSLayersKeeper
friend

Definition at line 76 of file MSLayer.h.

◆ operator<<

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

Member Data Documentation

◆ theFace

GeomDetEnumerators::Location MSLayer::theFace
private

Definition at line 68 of file MSLayer.h.

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

◆ theHalfThickness

float MSLayer::theHalfThickness
private

Definition at line 71 of file MSLayer.h.

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

◆ thePosition

float MSLayer::thePosition
private

Definition at line 69 of file MSLayer.h.

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

◆ theRange

Range MSLayer::theRange
private

Definition at line 70 of file MSLayer.h.

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

◆ theSeqNum

int MSLayer::theSeqNum
private

Definition at line 72 of file MSLayer.h.

Referenced by seqNum().

◆ theX0Data

DataX0 MSLayer::theX0Data
private

Definition at line 74 of file MSLayer.h.

Referenced by sumX0D(), and x0().