CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TkLayerLess Class Reference

#include <TkLayerLess.h>

Public Member Functions

bool operator() (const DetLayer *a, const DetLayer *b) const
 
 TkLayerLess (NavigationDirection dir=insideOut, const DetLayer *fromLayer=nullptr)
 

Private Member Functions

bool barrelForwardLess (const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
 
bool insideOutLess (const DetLayer *, const DetLayer *) const
 
bool insideOutLessSigned (const DetLayer *, const DetLayer *) const
 

Private Attributes

NavigationDirection theDir
 
int theFromLayerSign
 
bool theOriginLayer
 

Detailed Description

Defines order of layers in the Tracker as seen by straight tracks coming from the interaction region.

Definition at line 14 of file TkLayerLess.h.

Constructor & Destructor Documentation

TkLayerLess::TkLayerLess ( NavigationDirection  dir = insideOut,
const DetLayer fromLayer = nullptr 
)
inline

Definition at line 16 of file TkLayerLess.h.

References theFromLayerSign, and theOriginLayer.

16  : theDir(dir) {
17  if (fromLayer) {
18  theOriginLayer = true;
19  theFromLayerSign = (fromLayer->position().z() > 0 ? 1 : -1);
20  } else
21  theOriginLayer = false;
22  }
NavigationDirection theDir
Definition: TkLayerLess.h:39
T z() const
Definition: PV3DBase.h:61
int theFromLayerSign
Definition: TkLayerLess.h:41
virtual const Surface::PositionType & position() const
Returns position of the surface.
bool theOriginLayer
Definition: TkLayerLess.h:40

Member Function Documentation

bool TkLayerLess::barrelForwardLess ( const BarrelDetLayer blb,
const ForwardDetLayer fla 
) const
private

Definition at line 34 of file TkLayerLess.cc.

References Surface::bounds(), Bounds::length(), GeometricSearchDet::position(), BarrelDetLayer::surface(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by insideOutLess(), and insideOutLessSigned().

34  {
35  return bla->surface().bounds().length() / 2. < fabs(flb->position().z());
36 }
bool TkLayerLess::insideOutLess ( const DetLayer a,
const DetLayer b 
) const
private

Definition at line 5 of file TkLayerLess.cc.

References a, b, barrelForwardLess(), Exception, GeometricSearchDet::position(), BarrelDetLayer::specificSurface(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by operator()().

5  {
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 }
T z() const
Definition: PV3DBase.h:61
bool barrelForwardLess(const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
Definition: TkLayerLess.cc:34
virtual const Surface::PositionType & position() const
Returns position of the surface.
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
bool TkLayerLess::insideOutLessSigned ( const DetLayer a,
const DetLayer b 
) const
private

Definition at line 38 of file TkLayerLess.cc.

References a, b, barrelForwardLess(), Exception, LogDebug, GeometricSearchDet::position(), BarrelDetLayer::specificSurface(), theFromLayerSign, and PV3DBase< T, PVType, FrameType >::z().

Referenced by operator()().

38  {
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 }
T z() const
Definition: PV3DBase.h:61
bool barrelForwardLess(const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
Definition: TkLayerLess.cc:34
int theFromLayerSign
Definition: TkLayerLess.h:41
virtual const Surface::PositionType & position() const
Returns position of the surface.
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
#define LogDebug(id)
bool TkLayerLess::operator() ( const DetLayer a,
const DetLayer b 
) const
inline

Definition at line 24 of file TkLayerLess.h.

References insideOut, insideOutLess(), insideOutLessSigned(), theDir, and theOriginLayer.

24  {
25  if (!theOriginLayer) {
26  if (theDir == insideOut)
27  return insideOutLess(a, b);
28  else
29  return insideOutLess(b, a);
30  } else {
31  if (theDir == insideOut)
32  return insideOutLessSigned(a, b);
33  else
34  return insideOutLessSigned(b, a);
35  }
36  }
NavigationDirection theDir
Definition: TkLayerLess.h:39
bool insideOutLess(const DetLayer *, const DetLayer *) const
Definition: TkLayerLess.cc:5
bool insideOutLessSigned(const DetLayer *, const DetLayer *) const
Definition: TkLayerLess.cc:38
bool theOriginLayer
Definition: TkLayerLess.h:40

Member Data Documentation

NavigationDirection TkLayerLess::theDir
private

Definition at line 39 of file TkLayerLess.h.

Referenced by operator()().

int TkLayerLess::theFromLayerSign
private

Definition at line 41 of file TkLayerLess.h.

Referenced by insideOutLessSigned(), and TkLayerLess().

bool TkLayerLess::theOriginLayer
private

Definition at line 40 of file TkLayerLess.h.

Referenced by operator()(), and TkLayerLess().