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(0))
 
 MSLayer ()
 
 MSLayer (GeomDetEnumerators::Location part, float position, Range range, float halfThickness=0., const DataX0 &dataX0=DataX0(0))
 
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 14 of file MSLayer.h.

Member Typedef Documentation

Definition at line 16 of file MSLayer.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file MSLayer.cc.

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

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

Definition at line 39 of file MSLayer.h.

References MSLayer::DataX0::DataX0(), dso_hidden, halfThickness(), position(), and range().

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

Definition at line 58 of file MSLayer.cc.

59  : theFace(part),
61  theRange(range),
63  theSeqNum(-1),
64  theX0Data(dataX0) {}
float theHalfThickness
Definition: MSLayer.h:72
Range theRange
Definition: MSLayer.h:71
const Range & range() const
Definition: MSLayer.h:51
float position() const
Definition: MSLayer.h:54
int theSeqNum
Definition: MSLayer.h:73
float halfThickness() const
Definition: MSLayer.h:55
DataX0 theX0Data
Definition: MSLayer.h:75
part
Definition: HCALResponse.h:20
float thePosition
Definition: MSLayer.h:70
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:69

Member Function Documentation

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

Definition at line 83 of file MSLayer.cc.

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

Referenced by halfThickness().

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

Definition at line 99 of file MSLayer.cc.

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

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

Definition at line 117 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().

Referenced by halfThickness().

117  {
118  float u = (theFace == barrel) ? point.r() : point.z();
119  float v = (theFace == barrel) ? point.z() : point.r();
120 
121  float du = std::abs(u - thePosition);
122  if (theRange.inside(v))
123  return (du < theHalfThickness) ? 0.f : du * du;
124 
125  float dv = (v > theRange.max()) ? v - theRange.max() : theRange.min() - v;
126  return sqr(du) + sqr(dv);
127 }
T max() const
T sqr(T t)
Definition: MSLayer.cc:12
float theHalfThickness
Definition: MSLayer.h:72
Range theRange
Definition: MSLayer.h:71
T min() const
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:70
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:69
const GeomDetEnumerators::Location& MSLayer::face ( ) const
inline

Definition at line 53 of file MSLayer.h.

References theFace.

Referenced by operator<<().

53 { return theFace; }
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:69
float MSLayer::halfThickness ( ) const
inline
bool MSLayer::operator< ( const MSLayer o) const

Definition at line 71 of file MSLayer.cc.

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

Referenced by halfThickness().

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

Definition at line 67 of file MSLayer.cc.

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

Referenced by halfThickness().

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

Definition at line 54 of file MSLayer.h.

References thePosition.

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

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

Definition at line 51 of file MSLayer.h.

References theRange.

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

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

Definition at line 48 of file MSLayer.h.

References theSeqNum.

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

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

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

Definition at line 130 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 x0().

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

Friends And Related Function Documentation

friend class MSLayersKeeper
friend

Definition at line 77 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 69 of file MSLayer.h.

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

float MSLayer::theHalfThickness
private

Definition at line 72 of file MSLayer.h.

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

float MSLayer::thePosition
private

Definition at line 70 of file MSLayer.h.

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

Range MSLayer::theRange
private

Definition at line 71 of file MSLayer.h.

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

int MSLayer::theSeqNum
private

Definition at line 73 of file MSLayer.h.

Referenced by seqNum().

DataX0 MSLayer::theX0Data
private