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 &pointM, const PixelRecoPointRZ &pointO) const
 
float sumX0D (const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
 
float sumX0D (float zV, int il, int ol, const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
 
float sumX0D (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.

32 : theLayers(layers) { init(); }

References init().

Member Function Documentation

◆ findLayer() [1/2]

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

Definition at line 34 of file MSLayersAtAngle.cc.

34  {
35  vector<MSLayer>::const_iterator it = find(theLayers.begin(), theLayers.end(), layer);
36  return it == theLayers.end() ? nullptr : &(*it);
37 }

References spr::find(), and theLayers.

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

◆ 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.

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 }

References ztail::d, kinem::EPSILON, f, and point.

◆ init()

void MSLayersAtAngle::init ( void  )
private

Definition at line 16 of file MSLayersAtAngle.cc.

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 }

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

Referenced by MSLayersAtAngle(), and update().

◆ print()

void MSLayersAtAngle::print ( void  ) const

Definition at line 171 of file MSLayersAtAngle.cc.

171  {
172  for (LayerItr it = theLayers.begin(); it != theLayers.end(); it++)
173  cout << *it << endl;
174 }

References gather_cfg::cout, and theLayers.

◆ size()

int MSLayersAtAngle::size ( void  ) const
inline

Definition at line 33 of file MSLayersAtAngle.h.

33 { return theLayers.size(); }

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

◆ 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.

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 }

References cross(), flavorHistoryFilter_cfi::dr, MillePedeFileConverter_cfg::e, f, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, mps_splice::line, and combinedConstraintHelpers::sum2().

Referenced by sumX0D().

◆ sumX0D() [1/4]

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

Definition at line 75 of file MSLayersAtAngle.cc.

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 }

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

◆ sumX0D() [2/4]

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

Definition at line 51 of file MSLayersAtAngle.cc.

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 }

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

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

◆ sumX0D() [3/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.

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 }

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

◆ sumX0D() [4/4]

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

Definition at line 60 of file MSLayersAtAngle.cc.

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 }

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

◆ update()

void MSLayersAtAngle::update ( const MSLayer layer)

Definition at line 40 of file MSLayersAtAngle.cc.

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 }

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

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

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().

PixelRecoPointRZ::r
float r() const
Definition: PixelRecoPointRZ.h:10
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
mps_fire.i
i
Definition: mps_fire.py:428
MSLayersAtAngle::indeces
std::vector< int > indeces
Definition: MSLayersAtAngle.h:38
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
gather_cfg.cout
cout
Definition: gather_cfg.py:144
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
MSLayersAtAngle::findLayer
const MSLayer * findLayer(const MSLayer &layer) const
Definition: MSLayersAtAngle.cc:34
PixelRecoPointRZ::z
float z() const
Definition: PixelRecoPointRZ.h:11
MSLayersAtAngle::sum2RmRn
float sum2RmRn(LayerItr i1, LayerItr i2, float rTarget, const SimpleLineRZ &line) const
Definition: MSLayersAtAngle.cc:131
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MSLayersAtAngle::sumX0D
float sumX0D(const PixelRecoPointRZ &pointI, const PixelRecoPointRZ &pointO) const
Definition: MSLayersAtAngle.cc:51
cross
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Definition: Basic3DVectorLD.h:225
combinedConstraintHelpers::sum2
void sum2(T &x, T y)
Definition: CombinedKinematicConstraintT.h:74
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
PixelRecoPointRZ
Definition: PixelRecoPointRZ.h:6
SimpleLineRZ
Definition: PixelRecoLineRZ.h:63
MSLayersAtAngle::theLayers
std::vector< MSLayer > theLayers
Definition: MSLayersAtAngle.h:37
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
kinem::EPSILON
const float EPSILON
Definition: AnglesUtil.h:22
ztail.d
d
Definition: ztail.py:151
doPrint
static const bool doPrint
Definition: MSLayersAtAngle.cc:73
MSLayersAtAngle::LayerItr
std::vector< MSLayer >::const_iterator LayerItr
Definition: MSLayersAtAngle.h:43
point
*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
mps_splice.line
line
Definition: mps_splice.py:76
MSLayersAtAngle::init
void init()
Definition: MSLayersAtAngle.cc:16
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37