CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

MSLayersAtAngle Class Reference

#include <MSLayersAtAngle.h>

List of all members.

Public Member Functions

const MSLayerfindLayer (const MSLayer &layer) const
 MSLayersAtAngle ()
 MSLayersAtAngle (const std::vector< MSLayer > &layers)
void print () const
int size () const
float sumX0D (const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointM, const PixelRecoPointRZ &pointO, float tip=0.) const
float sumX0D (const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO, float tip=0.) const
void update (const MSLayer &layer)

Private Types

typedef std::vector< MSLayer >
::const_iterator 
LayerItr

Private Member Functions

LayerItr findLayer (const PixelRecoPointRZ &point, LayerItr i1, LayerItr i2) const
float sum2RmRn (LayerItr i1, LayerItr i2, float rTarget, const PixelRecoLineRZ &line) const

Private Attributes

std::vector< MSLayertheLayers

Detailed Description

Definition at line 14 of file MSLayersAtAngle.h.


Member Typedef Documentation

typedef std::vector<MSLayer>::const_iterator MSLayersAtAngle::LayerItr [private]

Definition at line 37 of file MSLayersAtAngle.h.


Constructor & Destructor Documentation

MSLayersAtAngle::MSLayersAtAngle ( ) [inline]

Definition at line 17 of file MSLayersAtAngle.h.

{ }
MSLayersAtAngle::MSLayersAtAngle ( const std::vector< MSLayer > &  layers)

Member Function Documentation

const MSLayer * MSLayersAtAngle::findLayer ( const MSLayer layer) const

Definition at line 14 of file MSLayersAtAngle.cc.

References spr::find(), and theLayers.

Referenced by MSLayersKeeperX0AtEta::init(), MSLayersKeeperX0Averaged::init(), MSLayersKeeperX0Averaged::layer(), MSLayersKeeperX0DetLayer::layer(), MSLayer::sumX0D(), sumX0D(), and MSLayer::x0().

{
  vector<MSLayer>::const_iterator it =
     find(theLayers.begin(), theLayers.end(), layer);
  return it==theLayers.end() ? 0 : &(*it);  
}
MSLayersAtAngle::LayerItr MSLayersAtAngle::findLayer ( const PixelRecoPointRZ point,
MSLayersAtAngle::LayerItr  ibeg,
MSLayersAtAngle::LayerItr  iend 
) const [private]

Definition at line 91 of file MSLayersAtAngle.cc.

References kinem::EPSILON, and f.

{
  const float BIG=99999.f;
  const float EPSILON = 1.e-4f;
  LayerItr theIt = ibeg; float dist = BIG;
  for (LayerItr it = ibeg; it < iend; it++) {
    float d = it->distance(point);
    if (d < dist) {
      if (d < EPSILON) return it; 
      dist = d;
      theIt = it;
    }
  }
  return theIt;
}
void MSLayersAtAngle::print ( void  ) const

Definition at line 111 of file MSLayersAtAngle.cc.

References gather_cfg::cout, and theLayers.

{
  for (LayerItr it = theLayers.begin(); it != theLayers.end(); it++) 
    cout <<*it<<endl;
}
int MSLayersAtAngle::size ( void  ) const [inline]

Definition at line 30 of file MSLayersAtAngle.h.

References theLayers.

{ return theLayers.size(); }
float MSLayersAtAngle::sum2RmRn ( MSLayersAtAngle::LayerItr  i1,
MSLayersAtAngle::LayerItr  i2,
float  rTarget,
const PixelRecoLineRZ line 
) const [private]

Definition at line 70 of file MSLayersAtAngle.cc.

References PixelRecoLineRZ::cotLine(), cross(), f, and funct::log().

Referenced by sumX0D().

{
  float sum2 = 0.f;
  float cotTh = line.cotLine();
  for (LayerItr it = i1; it < i2; it++) {
    pair<PixelRecoPointRZ,bool> cross = it->crossing(line);
    if (cross.second) {
      float x0 = it->x0(cotTh);
      float dr = rTarget-cross.first.r();
      if (x0 > 1.e-5f) dr *= 1.f+0.038f*std::log(x0); 
      sum2 += x0*dr*dr;
    } 
//  cout << *it << " crossing: "<<cross.second<<endl;
  }
  return sum2;
}
float MSLayersAtAngle::sumX0D ( const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointM,
const PixelRecoPointRZ pointO,
float  tip = 0. 
) const

Definition at line 48 of file MSLayersAtAngle.cc.

References findLayer(), geometryCSVtoXML::line, PixelRecoPointRZ::r(), funct::sqr(), mathSSE::sqrt(), sum2RmRn(), and theLayers.

{
  LayerItr iO = findLayer(pointO, theLayers.begin(), theLayers.end());
  LayerItr iI = findLayer(pointI, theLayers.begin(), iO);
  LayerItr iM = findLayer(pointM, iI, iO);

  float drOI = pointO.r() - pointI.r();
  float drMO = pointO.r() - pointM.r();
  float drMI = pointM.r() - pointI.r();

  PixelRecoLineRZ line(pointI, pointO, tip);
  float sum2I = sum2RmRn(iI+1, iM, pointI.r(), line);
  float sum2O = sum2RmRn(iM, iO, pointO.r(), line);

  return sqrt( sum2I* sqr(drMO) + sum2O*sqr(drMI) )/drOI;
}
float MSLayersAtAngle::sumX0D ( const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO,
float  tip = 0. 
) const

Definition at line 34 of file MSLayersAtAngle.cc.

References findLayer(), PixelRecoPointRZ::r(), mathSSE::sqrt(), sum2RmRn(), and theLayers.

Referenced by MultipleScatteringParametrisation::operator()().

{
  LayerItr iO = findLayer(pointO, theLayers.begin(), theLayers.end());
//  cout << "outer Layer: "<<*iO<<endl;
  LayerItr iI = findLayer(pointI, theLayers.begin(), iO);
//  cout << "inner Layer: "<<*iI<<endl;

  return sqrt(sum2RmRn(iI,iO, pointO.r(),
                              PixelRecoLineRZ(pointI, pointO, tip)));
}
void MSLayersAtAngle::update ( const MSLayer layer)

Definition at line 22 of file MSLayersAtAngle.cc.

References spr::find(), python::multivaluedict::sort(), and theLayers.

{
  vector<MSLayer>::iterator it = find(theLayers.begin(),theLayers.end(),layer); 
  if (it == theLayers.end()) {
    theLayers.push_back(layer);
    sort(theLayers.begin(), theLayers.end()); 
  } else {
    *it = layer;
  }
}

Member Data Documentation

std::vector<MSLayer> MSLayersAtAngle::theLayers [private]

Definition at line 34 of file MSLayersAtAngle.h.

Referenced by findLayer(), print(), size(), sumX0D(), and update().