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 
12 
14 {
15  ConstFDLI middle = find_if( flc.begin(), flc.end(),
16  [](const GeometricSearchDet* a){ return a->position().z() >= 0.0; });
17 
18  FDLC leftLayers = FDLC( flc.begin(), middle);
19  FDLC rightLayers = FDLC( middle, flc.end());
20  vector<PairType> foundPairs;
21 
22  for ( FDLI i = leftLayers.begin(); i != leftLayers.end(); i++) {
23  const ForwardDetLayer* partner = mirrorPartner( *i, rightLayers);
24  //if ( partner == 0) throw DetLogicError("Assymmetric forward layers in Tracker");
25  if ( partner == nullptr) throw cms::Exception("SymmetricLayerFinder", "Assymmetric forward layers in Tracker");
26 
27  foundPairs.push_back( make_pair( *i, partner));
28  }
29 
30  // fill the map
31  for ( vector<PairType>::iterator ipair = foundPairs.begin();
32  ipair != foundPairs.end(); ipair++) {
33  theForwardMap[ipair->first] = ipair->second;
34  theForwardMap[ipair->second] = ipair->first;
35  }
36 }
37 
39  const FDLC& rightLayers)
40 {
41 
42  auto mirrorImage = [=]( const ForwardDetLayer* a) ->bool {
43  auto zdiff = a->position().z() + layer->position().z();
44  auto rdiff = a->specificSurface().innerRadius() -
45  layer->specificSurface().innerRadius();
46 
47  // equality based on z position and inner radius
48  return std::abs(zdiff) < 2.f && std::abs(rdiff) < 1.f; // units are cm
49  };
50 
51 
53  find_if( rightLayers.begin(), rightLayers.end(), mirrorImage);
54  if ( result == rightLayers.end()) return nullptr;
55  else return *result;
56 }
57 
60  FDLC result;
61  for ( ConstFDLI i = input.begin(); i != input.end(); i++) {
62  result.push_back( mirror(*i));
63  }
64  return result;
65 }
SymmetricLayerFinder(const FDLC &)
const ForwardDetLayer * mirror(const ForwardDetLayer *layer)
static std::string const input
Definition: EdmProvDump.cc:48
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const ForwardDetLayer * mirrorPartner(const ForwardDetLayer *layer, const FDLC &rightLayers)
virtual const BoundDisk & specificSurface() const final
virtual const Surface::PositionType & position() const
Returns position of the surface.
double a
Definition: hdecay.h:121
std::vector< const ForwardDetLayer * > FDLC
FDLC::const_iterator ConstFDLI