CMS 3D CMS Logo

TkLayerLess.cc
Go to the documentation of this file.
4 
5 bool TkLayerLess::insideOutLess(const DetLayer* a, const DetLayer* b) const {
6  if (a == b)
7  return false;
8 
9  const BarrelDetLayer* bla = dynamic_cast<const BarrelDetLayer*>(a);
10  const BarrelDetLayer* blb = dynamic_cast<const BarrelDetLayer*>(b);
11 
12  if (bla != nullptr && blb != nullptr) { // barrel with barrel
13  return bla->specificSurface().radius() < blb->specificSurface().radius();
14  }
15 
16  const ForwardDetLayer* flb = dynamic_cast<const ForwardDetLayer*>(b);
17 
18  if (bla != nullptr && flb != nullptr) { // barrel with forward
19  return barrelForwardLess(bla, flb);
20  }
21 
22  const ForwardDetLayer* fla = dynamic_cast<const ForwardDetLayer*>(a);
23 
24  if (fla != nullptr && flb != nullptr) { // forward with forward
25  return fabs(fla->position().z()) < fabs(flb->position().z());
26  }
27  if (fla != nullptr && blb != nullptr) { // forward with barrel
28  return !barrelForwardLess(blb, fla);
29  }
30  //throw DetLogicError("TkLayerLess: arguments are not Barrel or Forward DetLayers");
31  throw cms::Exception("TkLayerLess", "Arguments are not Barrel or Forward DetLayers");
32 }
33 
35  return bla->surface().bounds().length() / 2. < fabs(flb->position().z());
36 }
37 
39  if (a == b)
40  return false;
41 
42  const BarrelDetLayer* bla = dynamic_cast<const BarrelDetLayer*>(a);
43  const BarrelDetLayer* blb = dynamic_cast<const BarrelDetLayer*>(b);
44 
45  if (bla != nullptr && blb != nullptr) { // barrel with barrel
46  return bla->specificSurface().radius() < blb->specificSurface().radius();
47  }
48 
49  const ForwardDetLayer* flb = dynamic_cast<const ForwardDetLayer*>(b);
50 
51  if (bla != nullptr && flb != nullptr) { // barrel with forward
52  return barrelForwardLess(bla, flb);
53  }
54 
55  const ForwardDetLayer* fla = dynamic_cast<const ForwardDetLayer*>(a);
56 
57  if (fla != nullptr && flb != nullptr) { // forward with forward
58  if (fla->position().z() * flb->position().z() > 0) { // same z-sign
59  //regular ordering when same sign
60  LogDebug("BeamHaloTkLayerLess") << "reaching this: " << theFromLayerSign << " " << fla->position().z() << " "
61  << flb->position().z();
62  return (fabs(fla->position().z()) < fabs(flb->position().z()));
63  } else { //layers compared are not on the same z-side
64  LogDebug("BeamHaloTkLayerLess") << "reaching this at least: " << theFromLayerSign << " " << fla->position().z()
65  << " " << flb->position().z();
66 
67  if (theFromLayerSign * fla->position().z() > 0) {
68  //"fla" and original layer are on the same side
69  //say that fla is less than flb
70  return false;
71  } else {
72  return true;
73  }
74  }
75  }
76  if (fla != nullptr && blb != nullptr) { // forward with barrel
77  return !barrelForwardLess(blb, fla);
78  }
79  throw cms::Exception("BeamHaloTkLayerLess", "Arguments are not Barrel or Forward DetLayers");
80 }
virtual const Surface::PositionType & position() const
Returns position of the surface.
bool barrelForwardLess(const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
Definition: TkLayerLess.cc:34
virtual float length() const =0
const BoundSurface & surface() const final
GeometricSearchDet interface.
T z() const
Definition: PV3DBase.h:61
bool insideOutLessSigned(const DetLayer *, const DetLayer *) const
Definition: TkLayerLess.cc:38
int theFromLayerSign
Definition: TkLayerLess.h:41
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
double b
Definition: hdecay.h:120
bool insideOutLess(const DetLayer *, const DetLayer *) const
Definition: TkLayerLess.cc:5
double a
Definition: hdecay.h:121
#define LogDebug(id)
const Bounds & bounds() const
Definition: Surface.h:87