CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MSLayersAtAngle Class Reference

#include <MSLayersAtAngle.h>

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 &pointO) const
 
float sumX0D (int il, int ol, const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
 
float sumX0D (const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointM, const PixelRecoPointRZ &pointO) const
 
float sumX0D (float zV, int il, int ol, const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) 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
 
void init ()
 
float sum2RmRn (LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
 

Private Attributes

std::vector< int > indeces
 
std::vector< MSLayertheLayers
 

Detailed Description

Definition at line 16 of file MSLayersAtAngle.h.

Member Typedef Documentation

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

Definition at line 51 of file MSLayersAtAngle.h.

Constructor & Destructor Documentation

MSLayersAtAngle::MSLayersAtAngle ( )
inline

Definition at line 19 of file MSLayersAtAngle.h.

References LayerTriplets::layers(), and update.

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

Definition at line 28 of file MSLayersAtAngle.cc.

References init().

29  : theLayers(layers)
30 {
31  init();
32 }
std::vector< MSLayer > theLayers
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4

Member Function Documentation

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

Definition at line 34 of file MSLayersAtAngle.cc.

References spr::find(), and theLayers.

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

35 {
36  vector<MSLayer>::const_iterator it =
37  find(theLayers.begin(), theLayers.end(), layer);
38  return it==theLayers.end() ? nullptr : &(*it);
39 }
std::vector< MSLayer > theLayers
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MSLayersAtAngle::LayerItr MSLayersAtAngle::findLayer ( const PixelRecoPointRZ point,
MSLayersAtAngle::LayerItr  ibeg,
MSLayersAtAngle::LayerItr  iend 
) const
private

Definition at line 181 of file MSLayersAtAngle.cc.

References edmIntegrityCheck::d, kinem::EPSILON, and f.

185 {
186  const float BIG=99999.f;
187  const float EPSILON = 1.e-8f;
188  LayerItr theIt = ibeg; float dist = BIG;
189  for (LayerItr it = ibeg; it < iend; it++) {
190  float d = it->distance2(point);
191  if (d < dist) {
192  if (d < EPSILON) return it;
193  dist = d;
194  theIt = it;
195  }
196  }
197  return theIt;
198 }
double f[11][100]
std::vector< MSLayer >::const_iterator LayerItr
const float EPSILON
Definition: AnglesUtil.h:22
void MSLayersAtAngle::init ( void  )
private

Definition at line 15 of file MSLayersAtAngle.cc.

References mps_fire::i, and checklumidiff::l.

Referenced by MSLayersAtAngle(), and update().

15  {
16  std::sort(theLayers.begin(), theLayers.end());
17  int i = -1; indeces.clear();
18  for ( auto const & l : theLayers ) {
19  ++i;
20  int sq = l.seqNum();
21  if (sq<0) continue;
22  if (sq>=int(indeces.size())) indeces.resize(sq+1,-1);
23  indeces[sq]=i;
24  }
25 }
std::vector< int > indeces
std::vector< MSLayer > theLayers
void MSLayersAtAngle::print ( void  ) const

Definition at line 201 of file MSLayersAtAngle.cc.

References gather_cfg::cout, and theLayers.

202 {
203  for (LayerItr it = theLayers.begin(); it != theLayers.end(); it++)
204  cout <<*it<<endl;
205 }
std::vector< MSLayer > theLayers
std::vector< MSLayer >::const_iterator LayerItr
int MSLayersAtAngle::size ( void  ) const
inline

Definition at line 41 of file MSLayersAtAngle.h.

References edm::print().

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

41 { return theLayers.size(); }
std::vector< MSLayer > theLayers
float MSLayersAtAngle::sum2RmRn ( MSLayersAtAngle::LayerItr  i1,
MSLayersAtAngle::LayerItr  i2,
float  rTarget,
const SimpleLineRZ line 
) const
private

Definition at line 160 of file MSLayersAtAngle.cc.

References SimpleLineRZ::cotLine(), cross(), runTauDisplay::dr, MillePedeFileConverter_cfg::e, f, and combinedConstraintHelpers::sum2().

Referenced by sumX0D().

165 {
166  float sum2 = 0.f;
167  float cotTh = line.cotLine();
168  for (LayerItr it = i1; it < i2; it++) {
169  std::pair<PixelRecoPointRZ,bool> cross = it->crossing(line);
170  if (cross.second) {
171  float x0 = it->x0(cotTh);
172  float dr = rTarget-cross.first.r();
173  if (x0 > 1.e-5f) dr *= 1.f+0.038f*unsafe_logf<2>(x0);
174  sum2 += x0*dr*dr;
175  }
176 // cout << *it << " crossing: "<<cross.second<<endl;
177  }
178  return sum2;
179 }
float cotLine() const
double f[11][100]
std::vector< MSLayer >::const_iterator LayerItr
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
float MSLayersAtAngle::sumX0D ( const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO 
) const

Definition at line 54 of file MSLayersAtAngle.cc.

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

Referenced by MultipleScatteringParametrisation::operator()(), and sumX0D().

57 {
58  LayerItr iO = findLayer(pointO, theLayers.begin(), theLayers.end());
59 // cout << "outer Layer: "<<*iO<<endl;
60  LayerItr iI = findLayer(pointI, theLayers.begin(), iO);
61 // cout << "inner Layer: "<<*iI<<endl;
62 
63  return sqrt(sum2RmRn(iI,iO, pointO.r(),
64  SimpleLineRZ(pointI, pointO)));
65 }
std::vector< MSLayer > theLayers
T sqrt(T t)
Definition: SSEVec.h:18
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
std::vector< MSLayer >::const_iterator LayerItr
float r() const
const MSLayer * findLayer(const MSLayer &layer) const
float MSLayersAtAngle::sumX0D ( int  il,
int  ol,
const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO 
) const

Definition at line 68 of file MSLayersAtAngle.cc.

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

71 {
72  // if layer not at this angle (WHY???) revert to slow comp
73  if (il>=int(indeces.size()) || ol>=int(indeces.size()) ||
74  indeces[il]<0 || indeces[ol] < 0) return sumX0D(pointI,pointO);
75 
76  LayerItr iI = theLayers.begin() + indeces[il];
77  LayerItr iO = theLayers.begin() + indeces[ol];
78 
79 
80  return sqrt(sum2RmRn(iI,iO, pointO.r(),
81  SimpleLineRZ(pointI, pointO)));
82 }
std::vector< int > indeces
std::vector< MSLayer > theLayers
T sqrt(T t)
Definition: SSEVec.h:18
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
std::vector< MSLayer >::const_iterator LayerItr
float r() const
float MSLayersAtAngle::sumX0D ( const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointM,
const PixelRecoPointRZ pointO 
) const

Definition at line 88 of file MSLayersAtAngle.cc.

References gather_cfg::cout, doPrint, findLayer(), mps_splice::line, PixelRecoPointRZ::r(), funct::sqr(), mathSSE::sqrt(), sum2RmRn(), theLayers, and PixelRecoPointRZ::z().

92 {
93  LayerItr iO = findLayer(pointO, theLayers.begin(), theLayers.end());
94  LayerItr iI = findLayer(pointI, theLayers.begin(), iO);
95  LayerItr iM = findLayer(pointM, iI, iO);
96 
97 
98  float drOI = pointO.r() - pointI.r();
99  float drMO = pointO.r() - pointM.r();
100  float drMI = pointM.r() - pointI.r();
101 
102  SimpleLineRZ line(pointI, pointO);
103  float sum2I = sum2RmRn(iI+1, iM, pointI.r(), line);
104  float sum2O = sum2RmRn(iM, iO, pointO.r(), line);
105 
106  float sum = std::sqrt( sum2I* sqr(drMO) + sum2O*sqr(drMI) )/drOI;
107 
108  // if (iI!=theLayers.begin() )
109  // doPrint = ((*iM).seqNum()<0 || (*iO).seqNum()<0);
110  if (doPrint)
111  std::cout << "old " << (*iI).seqNum() << " " << iI-theLayers.begin() << ", "
112  << (*iM).seqNum() << " " << iM-theLayers.begin() << ", "
113  << (*iO).seqNum() << " " << iO-theLayers.begin() << " "
114  << pointI.r() << " " << pointI.z()
115  << " " << sum
116  << std::endl;
117 
118 
119  return sum;
120 }
std::vector< MSLayer > theLayers
T sqrt(T t)
Definition: SSEVec.h:18
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
std::vector< MSLayer >::const_iterator LayerItr
float z() const
float r() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
static const bool doPrint
const MSLayer * findLayer(const MSLayer &layer) const
float MSLayersAtAngle::sumX0D ( float  zV,
int  il,
int  ol,
const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO 
) const

Definition at line 123 of file MSLayersAtAngle.cc.

References gather_cfg::cout, doPrint, f, indeces, mps_splice::line, PixelRecoPointRZ::r(), funct::sqr(), mathSSE::sqrt(), sum2RmRn(), sumX0D(), and theLayers.

125  {
126 
127  PixelRecoPointRZ pointV(0.f,zV);
128 
129  // if layer not at this angle (WHY???) revert to slow comp
130  if (il>=int(indeces.size()) || ol>=int(indeces.size()) ||
131  indeces[il]<0 || indeces[ol] < 0) return sumX0D(pointV,pointI,pointO);
132 
133  LayerItr iI = theLayers.begin() + indeces[il];
134  LayerItr iO = theLayers.begin() + indeces[ol];
135 
136 
137 
138  float drOI = pointO.r();
139  float drMO = pointO.r() - pointI.r();
140  float drMI = pointI.r();
141 
142  SimpleLineRZ line(pointV, pointO);
143  float sum2I = sum2RmRn(theLayers.begin()+1, iI, pointV.r(), line);
144  float sum2O = sum2RmRn(iI, iO, pointO.r(), line);
145 
146  float sum = std::sqrt( sum2I* sqr(drMO) + sum2O*sqr(drMI) )/drOI;
147 
148  if (doPrint)
149  std::cout << "new " << il << " " << (*iI).seqNum() << " " << iI-theLayers.begin() << ", "
150  << ol << " " << (*iO).seqNum() << " " << iO-theLayers.begin() << " " << zV
151  << " " << sum
152  << std::endl;
153 
154  return sum;
155 
156 }
std::vector< int > indeces
std::vector< MSLayer > theLayers
T sqrt(T t)
Definition: SSEVec.h:18
double f[11][100]
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
std::vector< MSLayer >::const_iterator LayerItr
float r() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
static const bool doPrint
void MSLayersAtAngle::update ( const MSLayer layer)

Definition at line 42 of file MSLayersAtAngle.cc.

References spr::find(), init(), and theLayers.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

43 {
44  vector<MSLayer>::iterator it = find(theLayers.begin(),theLayers.end(),layer);
45  if (it == theLayers.end()) {
46  theLayers.push_back(layer);
47  init();
48  } else {
49  *it = layer;
50  }
51 }
std::vector< MSLayer > theLayers
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20

Member Data Documentation

std::vector<int> MSLayersAtAngle::indeces
private

Definition at line 46 of file MSLayersAtAngle.h.

Referenced by sumX0D().

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

Definition at line 45 of file MSLayersAtAngle.h.

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