CMS 3D CMS Logo

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 
36 const ForwardDetLayer* SymmetricLayerFinder::mirrorPartner(const ForwardDetLayer* layer, const FDLC& rightLayers) {
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::ConstFDLI
FDLC::const_iterator ConstFDLI
Definition: SymmetricLayerFinder.h:20
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
BoundDisk.h
SymmetricLayerFinder.h
SymmetricLayerFinder::FDLC
std::vector< const ForwardDetLayer * > FDLC
Definition: SymmetricLayerFinder.h:18
BoundCylinder.h
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
a
double a
Definition: hdecay.h:119
SymmetricLayerFinder::mirror
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
Definition: SymmetricLayerFinder.h:26
SymmetricLayerFinder::mirrorPartner
const ForwardDetLayer * mirrorPartner(const ForwardDetLayer *layer, const FDLC &rightLayers)
Definition: SymmetricLayerFinder.cc:36
EmbeddingLHEProducer_cfi.mirror
mirror
Definition: EmbeddingLHEProducer_cfi.py:9
SymmetricLayerFinder::FDLI
FDLC::iterator FDLI
Definition: SymmetricLayerFinder.h:19
std
Definition: JetResolutionObject.h:76
ForwardDetLayer
Definition: ForwardDetLayer.h:22
ForwardDetLayer.h
Exception
Definition: hltDiff.cc:246
Exception.h
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GeometricSearchDet
Definition: GeometricSearchDet.h:17
SymmetricLayerFinder::SymmetricLayerFinder
SymmetricLayerFinder(const FDLC &)
Definition: SymmetricLayerFinder.cc:12
ForwardDetLayer::specificSurface
virtual const BoundDisk & specificSurface() const final
Definition: ForwardDetLayer.h:39