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 33 of file MSLayer.cc.

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

34  : theFace(layer->location()), theSeqNum(layer->seqNum()), theX0Data(dataX0)
35 {
36  const BarrelDetLayer* bl; const ForwardDetLayer * fl;
37  theHalfThickness = layer->surface().bounds().thickness()/2;
38 
39  switch (theFace) {
40  case barrel :
41  bl = static_cast<const BarrelDetLayer* >(layer);
42  thePosition = bl->specificSurface().radius();
43  theRange = Range(-bl->surface().bounds().length()/2,
44  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(),
50  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 float length() const =0
virtual Location location() const =0
Which part of the detector (barrel, endcap)
float theHalfThickness
Definition: MSLayer.h:69
Range theRange
Definition: MSLayer.h:68
const Bounds & bounds() const
Definition: Surface.h:120
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
int seqNum() const
Definition: DetLayer.h:36
int theSeqNum
Definition: MSLayer.h:70
T z() const
Definition: PV3DBase.h:64
DataX0 theX0Data
Definition: MSLayer.h:72
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:67
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66
PixelRecoRange< float > Range
Definition: MSLayer.h:16
const BoundSurface & surface() const final
GeometricSearchDet interface.
MSLayer::MSLayer ( )
inline

Definition at line 33 of file MSLayer.h.

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

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

Definition at line 59 of file MSLayer.cc.

61  : theFace(part),
63  theRange(range),
65  theSeqNum(-1),
66  theX0Data(dataX0)
67  { }
float theHalfThickness
Definition: MSLayer.h:69
Range theRange
Definition: MSLayer.h:68
const Range & range() const
Definition: MSLayer.h:45
float position() const
Definition: MSLayer.h:48
int theSeqNum
Definition: MSLayer.h:70
float halfThickness() const
Definition: MSLayer.h:49
DataX0 theX0Data
Definition: MSLayer.h:72
part
Definition: HCALResponse.h:20
float thePosition
Definition: MSLayer.h:67
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66

Member Function Documentation

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

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

90  {
91  const float eps = 1.e-5;
92  bool inLayer = true;
93  float value = (theFace==barrel) ? line.zAtR(thePosition) : line.rAtZ(thePosition);
94  if (value > theRange.max()) {
95  value = theRange.max()-eps;
96  inLayer = false;
97  } else if (value < theRange.min() ) {
98  value = theRange.min()+eps;
99  inLayer = false;
100  }
101  float z = thePosition;
102  if (theFace==barrel) std::swap(z,value); // if barrel value is z
103  return make_pair( PixelRecoPointRZ( value, z), inLayer);
104 }
T max() const
Range theRange
Definition: MSLayer.h:68
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:67
float rAtZ(float z) const
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66
pair< PixelRecoPointRZ, bool > MSLayer::crossing ( const SimpleLineRZ line) const

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

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

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

123 {
124  float u = (theFace==barrel) ? point.r() : point.z();
125  float v = (theFace==barrel) ? point.z() : point.r();
126 
127  float du = std::abs(u-thePosition);
128  if (theRange.inside(v)) return (du < theHalfThickness) ? 0.f : du*du;
129 
130  float dv = (v > theRange.max()) ?
131  v-theRange.max() : theRange.min() - v;
132  return sqr(du)+sqr(dv);
133 }
T max() const
T sqr(T t)
Definition: MSLayer.cc:12
float theHalfThickness
Definition: MSLayer.h:69
Range theRange
Definition: MSLayer.h:68
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:67
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66
const GeomDetEnumerators::Location& MSLayer::face ( ) const
inline

Definition at line 47 of file MSLayer.h.

References theFace.

Referenced by operator<<().

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

Definition at line 76 of file MSLayer.cc.

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

Referenced by halfThickness().

77 {
78 
79  if (theFace==barrel && o.theFace==barrel)
80  return thePosition < o.thePosition;
81  else if (theFace==barrel && o.theFace==endcap)
82  return thePosition < o.range().max();
83  else if (theFace==endcap && o.theFace==endcap )
85  else
86  return range().max() < o.thePosition;
87 }
T max() const
const Range & range() const
Definition: MSLayer.h:45
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float thePosition
Definition: MSLayer.h:67
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66
bool MSLayer::operator== ( const MSLayer o) const

Definition at line 71 of file MSLayer.cc.

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

Referenced by halfThickness().

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

Definition at line 48 of file MSLayer.h.

References thePosition.

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

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

Definition at line 45 of file MSLayer.h.

References theRange.

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

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

Definition at line 41 of file MSLayer.h.

References theSeqNum.

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

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

153 {
154 if LIKELY(theX0Data.hasX0) {
155  switch(theFace) {
156  case barrel:
157  return theX0Data.sumX0D
158  *std::sqrt( std::sqrt( (1.f+cotTheta*cotTheta)
160  )
161  );
162  case endcap:
163  return (theX0Data.hasFSlope) ?
165  + theX0Data.slopeSumX0D * (1.f/cotTheta-1.f/theX0Data.cotTheta)
166  : theX0Data.sumX0D;
167  case invalidLoc: break;// make gcc happy
168  }
169  } else if (theX0Data.allLayers) {
170  const MSLayer* dataLayer =
171  theX0Data.allLayers->layers(cotTheta).findLayer(*this);
172  if (dataLayer) return dataLayer->sumX0D(cotTheta);
173  }
174  return 0.;
175 
176 }
const MSLayersKeeper * allLayers
Definition: MSLayer.h:28
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:152
#define LIKELY(x)
Definition: Likely.h:20
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
bool hasFSlope
Definition: MSLayer.h:26
T sqrt(T t)
Definition: SSEVec.h:18
DataX0 theX0Data
Definition: MSLayer.h:72
double f[11][100]
float cotTheta
Definition: MSLayer.h:27
float slopeSumX0D
Definition: MSLayer.h:27
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66
const MSLayer * findLayer(const MSLayer &layer) const
float sumX0D
Definition: MSLayer.h:27
float MSLayer::x0 ( float  cotTheta) const

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

138 {
139  if LIKELY(theX0Data.hasX0) {
140  float OverSinTheta = std::sqrt(1.f+cotTheta*cotTheta);
141  return (theFace==barrel) ? theX0Data.x0*OverSinTheta :
142  theX0Data.x0*OverSinTheta/std::abs(cotTheta);
143  } else if (theX0Data.allLayers) {
144  const MSLayer * dataLayer =
145  theX0Data.allLayers->layers(cotTheta).findLayer(*this);
146  if (dataLayer) return dataLayer->x0(cotTheta);
147  }
148  return 0.;
149 }
const MSLayersKeeper * allLayers
Definition: MSLayer.h:28
#define LIKELY(x)
Definition: Likely.h:20
float x0(float cotTheta) const
Definition: MSLayer.cc:137
virtual const MSLayersAtAngle & layers(float cotTheta) const =0
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DataX0 theX0Data
Definition: MSLayer.h:72
double f[11][100]
GeomDetEnumerators::Location theFace
Definition: MSLayer.h:66
const MSLayer * findLayer(const MSLayer &layer) const

Friends And Related Function Documentation

friend class MSLayersKeeper
friend

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

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

float MSLayer::theHalfThickness
private

Definition at line 69 of file MSLayer.h.

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

float MSLayer::thePosition
private

Definition at line 67 of file MSLayer.h.

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

Range MSLayer::theRange
private

Definition at line 68 of file MSLayer.h.

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

int MSLayer::theSeqNum
private

Definition at line 70 of file MSLayer.h.

Referenced by seqNum().

DataX0 MSLayer::theX0Data
private