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 ()
 
 MSLayer (const DetLayer *layer, const DataX0 &dataX0=DataX0(nullptr))
 
 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.

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 }

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

◆ 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) {}

Member Function Documentation

◆ crossing() [1/2]

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

Definition at line 84 of file MSLayer.cc.

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 }

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

◆ crossing() [2/2]

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

Definition at line 100 of file MSLayer.cc.

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 }

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

◆ distance2()

float MSLayer::distance2 ( const PixelRecoPointRZ point) const

Definition at line 118 of file MSLayer.cc.

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 }

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.

◆ face()

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

Definition at line 52 of file MSLayer.h.

52 { return theFace; }

References theFace.

◆ halfThickness()

float MSLayer::halfThickness ( ) const
inline

Definition at line 54 of file MSLayer.h.

54 { return theHalfThickness; }

References theHalfThickness.

◆ operator<()

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

Definition at line 72 of file MSLayer.cc.

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 }

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

◆ operator==()

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

Definition at line 68 of file MSLayer.cc.

68  {
69  return theFace == o.theFace && std::abs(thePosition - o.thePosition) < 1.e-3f;
70 }

References funct::abs(), f, EcalTangentSkim_cfg::o, theFace, and thePosition.

◆ position()

float MSLayer::position ( ) const
inline

Definition at line 53 of file MSLayer.h.

53 { return thePosition; }

References thePosition.

◆ range()

const Range& MSLayer::range ( ) const
inline

Definition at line 50 of file MSLayer.h.

50 { return theRange; }

References theRange.

Referenced by operator<().

◆ seqNum()

int MSLayer::seqNum ( ) const
inline

Definition at line 47 of file MSLayer.h.

47 { return theSeqNum; }

References theSeqNum.

◆ sumX0D()

float MSLayer::sumX0D ( float  cotTheta) const

Definition at line 146 of file MSLayer.cc.

146  {
147  if
149  switch (theFace) {
150  case barrel:
151  return theX0Data.sumX0D *
152  std::sqrt(std::sqrt((1.f + cotTheta * cotTheta) / (1.f + theX0Data.cotTheta * theX0Data.cotTheta)));
153  case endcap:
154  return (theX0Data.hasFSlope)
155  ? theX0Data.sumX0D + theX0Data.slopeSumX0D * (1.f / cotTheta - 1.f / theX0Data.cotTheta)
156  : theX0Data.sumX0D;
157  case invalidLoc:
158  break; // make gcc happy
159  }
160  }
161  else if (theX0Data.allLayers) {
162  const MSLayer* dataLayer = theX0Data.allLayers->layers(cotTheta).findLayer(*this);
163  if (dataLayer)
164  return dataLayer->sumX0D(cotTheta);
165  }
166  return 0.;
167 }

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::init(), and sumX0D().

◆ x0()

float MSLayer::x0 ( float  cotTheta) const

Definition at line 131 of file MSLayer.cc.

131  {
132  if
134  float OverSinTheta = std::sqrt(1.f + cotTheta * cotTheta);
135  return (theFace == barrel) ? theX0Data.x0 * OverSinTheta : theX0Data.x0 * OverSinTheta / std::abs(cotTheta);
136  }
137  else if (theX0Data.allLayers) {
138  const MSLayer* dataLayer = theX0Data.allLayers->layers(cotTheta).findLayer(*this);
139  if (dataLayer)
140  return dataLayer->x0(cotTheta);
141  }
142  return 0.;
143 }

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 x0().

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().

MSLayer::sumX0D
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:146
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
BarrelDetLayer::surface
const BoundSurface & surface() const final
GeometricSearchDet interface.
Definition: BarrelDetLayer.h:29
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MSLayer::halfThickness
float halfThickness() const
Definition: MSLayer.h:54
MSLayer::DataX0::cotTheta
float cotTheta
Definition: MSLayer.h:32
MSLayer::theX0Data
DataX0 theX0Data
Definition: MSLayer.h:74
MSLayer::theHalfThickness
float theHalfThickness
Definition: MSLayer.h:71
findQualityFiles.v
v
Definition: findQualityFiles.py:179
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
sqr
T sqr(T t)
Definition: MSLayer.cc:13
PixelRecoRange::min
T min() const
Definition: PixelRecoRange.h:25
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
Bounds::length
virtual float length() const =0
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
MSLayersAtAngle::findLayer
const MSLayer * findLayer(const MSLayer &layer) const
Definition: MSLayersAtAngle.cc:34
DetLayer::location
virtual Location location() const =0
Which part of the detector (barrel, endcap)
part
part
Definition: HCALResponse.h:20
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
MSLayer::DataX0::allLayers
const MSLayersKeeper * allLayers
Definition: MSLayer.h:33
MSLayer::Range
PixelRecoRange< float > Range
Definition: MSLayer.h:15
PixelRecoRange::max
T max() const
Definition: PixelRecoRange.h:26
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
DDAxes::z
MSLayer::DataX0::hasX0
bool hasX0
Definition: MSLayer.h:31
MSLayer::DataX0::sumX0D
float sumX0D
Definition: MSLayer.h:32
DetLayer::seqNum
int seqNum() const
Definition: DetLayer.h:35
MSLayer
Definition: MSLayer.h:13
MSLayer::DataX0::slopeSumX0D
float slopeSumX0D
Definition: MSLayer.h:32
MSLayer::position
float position() const
Definition: MSLayer.h:53
GeomDetEnumerators::invalidLoc
Definition: GeomDetEnumerators.h:9
Bounds::thickness
virtual float thickness() const =0
MSLayer::theSeqNum
int theSeqNum
Definition: MSLayer.h:72
MSLayer::thePosition
float thePosition
Definition: MSLayer.h:69
MSLayer::DataX0::x0
float x0
Definition: MSLayer.h:32
MSLayersKeeper::layers
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
MSLayer::range
const Range & range() const
Definition: MSLayer.h:50
value
Definition: value.py:1
MSLayer::x0
float x0(float cotTheta) const
Definition: MSLayer.cc:131
MSLayer::theRange
Range theRange
Definition: MSLayer.h:70
BarrelDetLayer
Definition: BarrelDetLayer.h:22
PixelRecoPointRZ
Definition: PixelRecoPointRZ.h:6
ForwardDetLayer
Definition: ForwardDetLayer.h:22
MSLayer::DataX0::hasFSlope
bool hasFSlope
Definition: MSLayer.h:31
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
GeometricSearchDet::surface
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
MSLayer::theFace
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:68
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PixelRecoRange::inside
bool inside(const T &value) const
Definition: PixelRecoRange.h:36
point
*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
mps_splice.line
line
Definition: mps_splice.py:76
BarrelDetLayer::specificSurface
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
Definition: BarrelDetLayer.h:39
ForwardDetLayer::specificSurface
virtual const BoundDisk & specificSurface() const final
Definition: ForwardDetLayer.h:39