CMS 3D CMS Logo

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

#include <TkLayerLess.h>

Inheritance diagram for TkLayerLess:

Public Member Functions

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

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 15 of file TkLayerLess.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file TkLayerLess.h.

References theFromLayerSign, and theOriginLayer.

19  :
20  theDir(dir) {
21  if (fromLayer){
22  theOriginLayer = true;
23  theFromLayerSign = (fromLayer->position().z()>0 ? 1 : -1) ;
24  }else theOriginLayer = false;
25  }
NavigationDirection theDir
Definition: TkLayerLess.h:40
T z() const
Definition: PV3DBase.h:64
int theFromLayerSign
Definition: TkLayerLess.h:42
virtual const Surface::PositionType & position() const
Returns position of the surface.
dbl *** dir
Definition: mlp_gen.cc:35
bool theOriginLayer
Definition: TkLayerLess.h:41

Member Function Documentation

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

Definition at line 39 of file TkLayerLess.cc.

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

Referenced by insideOutLess(), and insideOutLessSigned().

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

Definition at line 5 of file TkLayerLess.cc.

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

Referenced by operator()().

6 {
7  if (a == b) return false;
8 
9  const BarrelDetLayer* bla =
10  dynamic_cast<BarrelDetLayer*>(const_cast<DetLayer*>(a));
11  const BarrelDetLayer* blb =
12  dynamic_cast<BarrelDetLayer*>(const_cast<DetLayer*>(b));
13 
14  if ( bla!=0 && blb!=0) { // barrel with barrel
15  return bla->specificSurface().radius() < blb->specificSurface().radius();
16  }
17 
18  const ForwardDetLayer* flb =
19  dynamic_cast<ForwardDetLayer*>(const_cast<DetLayer*>(b));
20 
21  if ( bla!=0 && flb!=0) { // barrel with forward
22  return barrelForwardLess( bla, flb);
23  }
24 
25  const ForwardDetLayer* fla =
26  dynamic_cast<ForwardDetLayer*>(const_cast<DetLayer*>(a));
27 
28  if (fla!=0 && flb!=0) { // forward with forward
29  return fabs( fla->position().z()) < fabs( flb->position().z());
30  }
31  if ( fla!=0 && blb!=0) { // forward with barrel
32  return !barrelForwardLess( blb, fla);
33  }
34  //throw DetLogicError("TkLayerLess: arguments are not Barrel or Forward DetLayers");
35  throw cms::Exception("TkLayerLess", "Arguments are not Barrel or Forward DetLayers");
36 
37 }
T z() const
Definition: PV3DBase.h:64
bool barrelForwardLess(const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
Definition: TkLayerLess.cc:39
virtual const Surface::PositionType & position() const
Returns position of the surface.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
bool TkLayerLess::insideOutLessSigned ( const DetLayer a,
const DetLayer b 
) const
private

Definition at line 46 of file TkLayerLess.cc.

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

Referenced by operator()().

47 {
48  if (a == b) return false;
49 
50  const BarrelDetLayer* bla =
51  dynamic_cast<BarrelDetLayer*>(const_cast<DetLayer*>(a));
52  const BarrelDetLayer* blb =
53  dynamic_cast<BarrelDetLayer*>(const_cast<DetLayer*>(b));
54 
55  if ( bla!=0 && blb!=0) { // barrel with barrel
56  return bla->specificSurface().radius() < blb->specificSurface().radius();
57  }
58 
59  const ForwardDetLayer* flb =
60  dynamic_cast<ForwardDetLayer*>(const_cast<DetLayer*>(b));
61 
62  if ( bla!=0 && flb!=0) { // barrel with forward
63  return barrelForwardLess( bla, flb);
64  }
65 
66  const ForwardDetLayer* fla =
67  dynamic_cast<ForwardDetLayer*>(const_cast<DetLayer*>(a));
68 
69  if (fla!=0 && flb!=0) { // forward with forward
70  if (fla->position().z()*flb->position().z() > 0) {// same z-sign
71  //regular ordering when same sign
72  LogDebug("BeamHaloTkLayerLess")<<"reaching this: "
73  <<theFromLayerSign<<" "
74  <<fla->position().z()<<" "
75  <<flb->position().z();
76  return (fabs(fla->position().z()) < fabs( flb->position().z()));
77  }
78  else{//layers compared are not on the same z-side
79  LogDebug("BeamHaloTkLayerLess")<<"reaching this at least: "
80  <<theFromLayerSign<<" "
81  <<fla->position().z()<<" "
82  <<flb->position().z();
83 
84  if (theFromLayerSign*fla->position().z()>0){
85  //"fla" and original layer are on the same side
86  //say that fla is less than flb
87  return false;
88  }else{
89  return true;
90  }
91  }
92  }
93  if ( fla!=0 && blb!=0) { // forward with barrel
94  return !barrelForwardLess( blb, fla);
95  }
96  throw cms::Exception("BeamHaloTkLayerLess", "Arguments are not Barrel or Forward DetLayers");
97 
98 }
#define LogDebug(id)
T z() const
Definition: PV3DBase.h:64
bool barrelForwardLess(const BarrelDetLayer *blb, const ForwardDetLayer *fla) const
Definition: TkLayerLess.cc:39
int theFromLayerSign
Definition: TkLayerLess.h:42
virtual const Surface::PositionType & position() const
Returns position of the surface.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
bool TkLayerLess::operator() ( const DetLayer a,
const DetLayer b 
) const
inline

Definition at line 27 of file TkLayerLess.h.

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

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

Member Data Documentation

NavigationDirection TkLayerLess::theDir
private

Definition at line 40 of file TkLayerLess.h.

Referenced by operator()().

int TkLayerLess::theFromLayerSign
private

Definition at line 42 of file TkLayerLess.h.

Referenced by insideOutLessSigned(), and TkLayerLess().

bool TkLayerLess::theOriginLayer
private

Definition at line 41 of file TkLayerLess.h.

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