CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes | Friends

MSLayer Class Reference

#include <MSLayer.h>

List of all members.

Classes

struct  DataX0

Public Types

typedef PixelRecoRange< float > Range

Public Member Functions

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

Private Attributes

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

Friends

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

Detailed Description

Definition at line 12 of file MSLayer.h.


Member Typedef Documentation

Definition at line 14 of file MSLayer.h.


Constructor & Destructor Documentation

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

Definition at line 31 of file MSLayer.h.

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

Definition at line 59 of file MSLayer.cc.


Member Function Documentation

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

Definition at line 76 of file MSLayer.cc.

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

{ 
 const float eps = 1.e-5;
  bool  inLayer = true;
  if (theFace==barrel) { 
    float value = line.zAtR(thePosition);
    if (value > theRange.max()) { 
      value = theRange.max()-eps;
      inLayer = false;
    } 
    else if (value < theRange.min() ) { 
      value = theRange.min()+eps;
      inLayer = false;
    }
    return make_pair( PixelRecoPointRZ(thePosition, value), inLayer) ;
  }
  else {
    float value = line.rAtZ(thePosition);
    if (value > theRange.max()) { 
      value = theRange.max()-eps;
      inLayer = false;
    }
    else if (value < theRange.min() ) { 
      value = theRange.min()+eps;
      inLayer = false;
    }
    return make_pair( PixelRecoPointRZ( value, thePosition), inLayer);
  }
}
float MSLayer::distance ( const PixelRecoPointRZ point) const

Definition at line 107 of file MSLayer.cc.

References abs, Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, PixelRecoRange< T >::inside(), GeomDetEnumerators::invalidLoc, PixelRecoRange< T >::max(), PixelRecoRange< T >::min(), PixelRecoPointRZ::r(), funct::sqr(), mathSSE::sqrt(), theFace, theHalfThickness, thePosition, theRange, and PixelRecoPointRZ::z().

{
  float dr = 0;
  float dz = 0;
  switch(theFace) { 
  case barrel: 
    dr = std::abs(point.r()-thePosition);
    if (theRange.inside(point.z())) {
      return (dr < theHalfThickness) ? 0.f : dr;
    }
    else {
      dz = point.z() > theRange.max() ?
          point.z()-theRange.max() : theRange.min() - point.z();
    }
    break;
  case endcap:
    dz = std::abs(point.z()-thePosition);
    if (theRange.inside(point.r())) {
      return (dz < theHalfThickness) ? 0. : dz;
    }
    else {
      dr = point.r() > theRange.max() ?
          point.r()-theRange.max() : theRange.min()-point.r();
    }
    break;
  case invalidLoc: break; // make gcc happy
  }
  return std::sqrt(sqr(dr)+sqr(dz));
}
const GeomDetEnumerators::Location& MSLayer::face ( ) const [inline]

Definition at line 39 of file MSLayer.h.

References theFace.

Referenced by operator<<().

{ return theFace; }
float MSLayer::halfThickness ( ) const [inline]

Definition at line 41 of file MSLayer.h.

References theHalfThickness.

{ return theHalfThickness; }
bool MSLayer::operator< ( const MSLayer o) const
bool MSLayer::operator== ( const MSLayer o) const

Definition at line 70 of file MSLayer.cc.

References abs, f, theFace, and thePosition.

{
  return  theFace == o.theFace && std::abs(thePosition-o.thePosition) < 1.e-3f;
}
float MSLayer::position ( ) const [inline]

Definition at line 40 of file MSLayer.h.

References thePosition.

Referenced by operator<<().

{ return thePosition; }
const Range& MSLayer::range ( ) const [inline]

Definition at line 37 of file MSLayer.h.

References theRange.

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

{ return theRange; }
float MSLayer::sumX0D ( float  cotTheta) const
float MSLayer::x0 ( float  cotTheta) const

Definition at line 151 of file MSLayer.cc.

References abs, MSLayer::DataX0::allLayers, Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, f, MSLayersAtAngle::findLayer(), MSLayer::DataX0::hasX0, GeomDetEnumerators::invalidLoc, MSLayersKeeper::layers(), mathSSE::sqrt(), theFace, theX0Data, x0(), and MSLayer::DataX0::x0.

Referenced by MSLayersKeeperX0Averaged::init(), and x0().

{
  if (theX0Data.hasX0) {
    float OverSinTheta = std::sqrt(1.f+cotTheta*cotTheta);
    switch(theFace) {
    case barrel:  return theX0Data.x0*OverSinTheta;
    case endcap: return theX0Data.x0*std::abs(OverSinTheta/cotTheta);
    case invalidLoc: return 0.;// make gcc happy
    }
  } else if (theX0Data.allLayers) {
    const MSLayer * dataLayer =
       theX0Data.allLayers->layers(cotTheta).findLayer(*this);
    if (dataLayer) return  dataLayer->x0(cotTheta);
  } 
  return 0.;
}

Friends And Related Function Documentation

friend struct MSLayersKeeper [friend]

Definition at line 60 of file MSLayer.h.

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

Member Data Documentation

Definition at line 54 of file MSLayer.h.

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

float MSLayer::theHalfThickness [private]

Definition at line 57 of file MSLayer.h.

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

float MSLayer::thePosition [private]

Definition at line 55 of file MSLayer.h.

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

Definition at line 56 of file MSLayer.h.

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