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 }
TkLayerLess::barrelForwardLess
bool barrelForwardLess(const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
Definition: TkLayerLess.cc:34
TkLayerLess::insideOutLessSigned
bool insideOutLessSigned(const DetLayer *, const DetLayer *) const
Definition: TkLayerLess.cc:38
MessageLogger.h
DetLayer
Definition: DetLayer.h:21
BarrelDetLayer::surface
const BoundSurface & surface() const final
GeometricSearchDet interface.
Definition: BarrelDetLayer.h:29
TkLayerLess.h
GeometricSearchDet::position
virtual const Surface::PositionType & position() const
Returns position of the surface.
Definition: GeometricSearchDet.h:31
Bounds::length
virtual float length() const =0
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
b
double b
Definition: hdecay.h:118
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
a
double a
Definition: hdecay.h:119
TkLayerLess::theFromLayerSign
int theFromLayerSign
Definition: TkLayerLess.h:41
BarrelDetLayer
Definition: BarrelDetLayer.h:22
ForwardDetLayer
Definition: ForwardDetLayer.h:22
Exception
Definition: hltDiff.cc:245
Exception.h
TkLayerLess::insideOutLess
bool insideOutLess(const DetLayer *, const DetLayer *) const
Definition: TkLayerLess.cc:5
BarrelDetLayer::specificSurface
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
Definition: BarrelDetLayer.h:39