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

◆ LayerItr

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

Definition at line 43 of file MSLayersAtAngle.h.

Constructor & Destructor Documentation

◆ MSLayersAtAngle() [1/2]

MSLayersAtAngle::MSLayersAtAngle ( )
inline

Definition at line 18 of file MSLayersAtAngle.h.

18 {}

◆ MSLayersAtAngle() [2/2]

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

Definition at line 32 of file MSLayersAtAngle.cc.

References init().

Member Function Documentation

◆ findLayer() [1/2]

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

Definition at line 34 of file MSLayersAtAngle.cc.

References spr::find(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::layer, and theLayers.

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

34  {
35  vector<MSLayer>::const_iterator it = find(theLayers.begin(), theLayers.end(), layer);
36  return it == theLayers.end() ? nullptr : &(*it);
37 }
std::vector< MSLayer > theLayers
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ findLayer() [2/2]

MSLayersAtAngle::LayerItr MSLayersAtAngle::findLayer ( const PixelRecoPointRZ point,
MSLayersAtAngle::LayerItr  ibeg,
MSLayersAtAngle::LayerItr  iend 
) const
private

Definition at line 151 of file MSLayersAtAngle.cc.

References ztail::d, kinem::EPSILON, f, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and point.

153  {
154  const float BIG = 99999.f;
155  const float EPSILON = 1.e-8f;
156  LayerItr theIt = ibeg;
157  float dist = BIG;
158  for (LayerItr it = ibeg; it < iend; it++) {
159  float d = it->distance2(point);
160  if (d < dist) {
161  if (d < EPSILON)
162  return it;
163  dist = d;
164  theIt = it;
165  }
166  }
167  return theIt;
168 }
double f[11][100]
d
Definition: ztail.py:151
std::vector< MSLayer >::const_iterator LayerItr
const float EPSILON
Definition: AnglesUtil.h:22
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ init()

void MSLayersAtAngle::init ( void  )
private

Definition at line 16 of file MSLayersAtAngle.cc.

References mps_fire::i, MainPageGenerator::l, and jetUpdater_cfi::sort.

Referenced by MSLayersAtAngle(), and update().

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

◆ print()

void MSLayersAtAngle::print ( void  ) const

Definition at line 171 of file MSLayersAtAngle.cc.

References gather_cfg::cout, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and theLayers.

171  {
172  for (LayerItr it = theLayers.begin(); it != theLayers.end(); it++)
173  cout << *it << endl;
174 }
std::vector< MSLayer > theLayers
std::vector< MSLayer >::const_iterator LayerItr

◆ size()

int MSLayersAtAngle::size ( void  ) const
inline

Definition at line 33 of file MSLayersAtAngle.h.

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

33 { return theLayers.size(); }
std::vector< MSLayer > theLayers

◆ sum2RmRn()

float MSLayersAtAngle::sum2RmRn ( MSLayersAtAngle::LayerItr  i1,
MSLayersAtAngle::LayerItr  i2,
float  rTarget,
const SimpleLineRZ line 
) const
private

Definition at line 131 of file MSLayersAtAngle.cc.

References cross(), l1ctLayer1_cff::dr, MillePedeFileConverter_cfg::e, f, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and mps_splice::line.

Referenced by sumX0D().

134  {
135  float sum2 = 0.f;
136  float cotTh = line.cotLine();
137  for (LayerItr it = i1; it < i2; it++) {
138  std::pair<PixelRecoPointRZ, bool> cross = it->crossing(line);
139  if (cross.second) {
140  float x0 = it->x0(cotTh);
141  float dr = rTarget - cross.first.r();
142  if (x0 > 1.e-5f)
143  dr *= 1.f + 0.038f * unsafe_logf<2>(x0);
144  sum2 += x0 * dr * dr;
145  }
146  // cout << *it << " crossing: "<<cross.second<<endl;
147  }
148  return sum2;
149 }
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
double f[11][100]
std::vector< MSLayer >::const_iterator LayerItr

◆ sumX0D() [1/4]

float MSLayersAtAngle::sumX0D ( const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO 
) const

Definition at line 51 of file MSLayersAtAngle.cc.

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

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

51  {
52  LayerItr iO = findLayer(pointO, theLayers.begin(), theLayers.end());
53  // cout << "outer Layer: "<<*iO<<endl;
54  LayerItr iI = findLayer(pointI, theLayers.begin(), iO);
55  // cout << "inner Layer: "<<*iI<<endl;
56 
57  return sqrt(sum2RmRn(iI, iO, pointO.r(), SimpleLineRZ(pointI, pointO)));
58 }
std::vector< MSLayer > theLayers
const MSLayer * findLayer(const MSLayer &layer) const
T sqrt(T t)
Definition: SSEVec.h:23
float r() const
std::vector< MSLayer >::const_iterator LayerItr
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const

◆ sumX0D() [2/4]

float MSLayersAtAngle::sumX0D ( int  il,
int  ol,
const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO 
) const

Definition at line 60 of file MSLayersAtAngle.cc.

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

60  {
61  // if layer not at this angle (WHY???) revert to slow comp
62  if (il >= int(indeces.size()) || ol >= int(indeces.size()) || indeces[il] < 0 || indeces[ol] < 0)
63  return sumX0D(pointI, pointO);
64 
65  LayerItr iI = theLayers.begin() + indeces[il];
66  LayerItr iO = theLayers.begin() + indeces[ol];
67 
68  return sqrt(sum2RmRn(iI, iO, pointO.r(), SimpleLineRZ(pointI, pointO)));
69 }
std::vector< int > indeces
std::vector< MSLayer > theLayers
T sqrt(T t)
Definition: SSEVec.h:23
float r() const
std::vector< MSLayer >::const_iterator LayerItr
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const

◆ sumX0D() [3/4]

float MSLayersAtAngle::sumX0D ( const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointM,
const PixelRecoPointRZ pointO 
) const

Definition at line 75 of file MSLayersAtAngle.cc.

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

77  {
78  LayerItr iO = findLayer(pointO, theLayers.begin(), theLayers.end());
79  LayerItr iI = findLayer(pointI, theLayers.begin(), iO);
80  LayerItr iM = findLayer(pointM, iI, iO);
81 
82  float drOI = pointO.r() - pointI.r();
83  float drMO = pointO.r() - pointM.r();
84  float drMI = pointM.r() - pointI.r();
85 
86  SimpleLineRZ line(pointI, pointO);
87  float sum2I = sum2RmRn(iI + 1, iM, pointI.r(), line);
88  float sum2O = sum2RmRn(iM, iO, pointO.r(), line);
89 
90  float sum = std::sqrt(sum2I * sqr(drMO) + sum2O * sqr(drMI)) / drOI;
91 
92  // if (iI!=theLayers.begin() )
93  // doPrint = ((*iM).seqNum()<0 || (*iO).seqNum()<0);
94  if (doPrint)
95  std::cout << "old " << (*iI).seqNum() << " " << iI - theLayers.begin() << ", " << (*iM).seqNum() << " "
96  << iM - theLayers.begin() << ", " << (*iO).seqNum() << " " << iO - theLayers.begin() << " " << pointI.r()
97  << " " << pointI.z() << " " << sum << std::endl;
98 
99  return sum;
100 }
std::vector< MSLayer > theLayers
const MSLayer * findLayer(const MSLayer &layer) const
T sqrt(T t)
Definition: SSEVec.h:23
float r() const
std::vector< MSLayer >::const_iterator LayerItr
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
Square< F >::type sqr(const F &f)
Definition: Square.h:14
float z() const
static const bool doPrint

◆ sumX0D() [4/4]

float MSLayersAtAngle::sumX0D ( float  zV,
int  il,
int  ol,
const PixelRecoPointRZ pointI,
const PixelRecoPointRZ pointO 
) const

Definition at line 102 of file MSLayersAtAngle.cc.

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

103  {
104  PixelRecoPointRZ pointV(0.f, zV);
105 
106  // if layer not at this angle (WHY???) revert to slow comp
107  if (il >= int(indeces.size()) || ol >= int(indeces.size()) || indeces[il] < 0 || indeces[ol] < 0)
108  return sumX0D(pointV, pointI, pointO);
109 
110  LayerItr iI = theLayers.begin() + indeces[il];
111  LayerItr iO = theLayers.begin() + indeces[ol];
112 
113  float drOI = pointO.r();
114  float drMO = pointO.r() - pointI.r();
115  float drMI = pointI.r();
116 
117  SimpleLineRZ line(pointV, pointO);
118  float sum2I = sum2RmRn(theLayers.begin() + 1, iI, pointV.r(), line);
119  float sum2O = sum2RmRn(iI, iO, pointO.r(), line);
120 
121  float sum = std::sqrt(sum2I * sqr(drMO) + sum2O * sqr(drMI)) / drOI;
122 
123  if (doPrint)
124  std::cout << "new " << il << " " << (*iI).seqNum() << " " << iI - theLayers.begin() << ", " << ol << " "
125  << (*iO).seqNum() << " " << iO - theLayers.begin() << " " << zV << " " << sum << std::endl;
126 
127  return sum;
128 }
std::vector< int > indeces
std::vector< MSLayer > theLayers
T sqrt(T t)
Definition: SSEVec.h:23
double f[11][100]
float r() const
std::vector< MSLayer >::const_iterator LayerItr
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
Square< F >::type sqr(const F &f)
Definition: Square.h:14
static const bool doPrint
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const

◆ update()

void MSLayersAtAngle::update ( const MSLayer layer)

Definition at line 40 of file MSLayersAtAngle.cc.

References spr::find(), init(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::layer, and theLayers.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

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

Member Data Documentation

◆ indeces

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

Definition at line 38 of file MSLayersAtAngle.h.

Referenced by sumX0D().

◆ theLayers

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

Definition at line 37 of file MSLayersAtAngle.h.

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