CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SymmetricLayerFinder.cc
Go to the documentation of this file.
1 #include "SymmetricLayerFinder.h"
6 
7 #include <algorithm>
8 #include <cmath>
9 
10 using namespace std;
11 
13  ConstFDLI middle =
14  find_if(flc.begin(), flc.end(), [](const GeometricSearchDet* a) { return a->position().z() >= 0.0; });
15 
16  FDLC leftLayers = FDLC(flc.begin(), middle);
17  FDLC rightLayers = FDLC(middle, flc.end());
18  vector<PairType> foundPairs;
19 
20  for (FDLI i = leftLayers.begin(); i != leftLayers.end(); i++) {
21  const ForwardDetLayer* partner = mirrorPartner(*i, rightLayers);
22  //if ( partner == 0) throw DetLogicError("Assymmetric forward layers in Tracker");
23  if (partner == nullptr)
24  throw cms::Exception("SymmetricLayerFinder", "Assymmetric forward layers in Tracker");
25 
26  foundPairs.push_back(make_pair(*i, partner));
27  }
28 
29  // fill the map
30  for (vector<PairType>::iterator ipair = foundPairs.begin(); ipair != foundPairs.end(); ipair++) {
31  theForwardMap[ipair->first] = ipair->second;
32  theForwardMap[ipair->second] = ipair->first;
33  }
34 }
35 
37  auto mirrorImage = [=](const ForwardDetLayer* a) -> bool {
38  auto zdiff = a->position().z() + layer->position().z();
39  auto rdiff = a->specificSurface().innerRadius() - layer->specificSurface().innerRadius();
40 
41  // equality based on z position and inner radius
42  return std::abs(zdiff) < 2.f && std::abs(rdiff) < 1.f; // units are cm
43  };
44 
45  ConstFDLI result = find_if(rightLayers.begin(), rightLayers.end(), mirrorImage);
46  if (result == rightLayers.end())
47  return nullptr;
48  else
49  return *result;
50 }
51 
53  FDLC result;
54  for (ConstFDLI i = input.begin(); i != input.end(); i++) {
55  result.push_back(mirror(*i));
56  }
57  return result;
58 }
SymmetricLayerFinder(const FDLC &)
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
constexpr std::array< uint8_t, layerIndexSize > layer
static std::string const input
Definition: EdmProvDump.cc:47
tuple result
Definition: mps_fire.py:311
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const ForwardDetLayer * mirrorPartner(const ForwardDetLayer *layer, const FDLC &rightLayers)
virtual const Surface::PositionType & position() const
Returns position of the surface.
double a
Definition: hdecay.h:119
virtual const BoundDisk & specificSurface() const final
std::vector< const ForwardDetLayer * > FDLC
FDLC::const_iterator ConstFDLI