CMS 3D CMS Logo

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

Constructor & Destructor Documentation

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

Definition at line 17 of file TkLayerLess.h.

References theFromLayerSign, and theOriginLayer.

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

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(), 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<const BarrelDetLayer*>(a);
11  const BarrelDetLayer* blb =
12  dynamic_cast<const BarrelDetLayer*>(b);
13 
14  if ( bla!=nullptr && blb!=nullptr) { // barrel with barrel
15  return bla->specificSurface().radius() < blb->specificSurface().radius();
16  }
17 
18  const ForwardDetLayer* flb =
19  dynamic_cast<const ForwardDetLayer*>(b);
20 
21  if ( bla!=nullptr && flb!=nullptr) { // barrel with forward
22  return barrelForwardLess( bla, flb);
23  }
24 
25  const ForwardDetLayer* fla =
26  dynamic_cast<const ForwardDetLayer*>(a);
27 
28  if (fla!=nullptr && flb!=nullptr) { // forward with forward
29  return fabs( fla->position().z()) < fabs( flb->position().z());
30  }
31  if ( fla!=nullptr && blb!=nullptr) { // 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 }
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
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
bool TkLayerLess::insideOutLessSigned ( const DetLayer a,
const DetLayer b 
) const
private

Definition at line 46 of file TkLayerLess.cc.

References a, b, barrelForwardLess(), 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<const BarrelDetLayer*>(a);
52  const BarrelDetLayer* blb =
53  dynamic_cast<const BarrelDetLayer*>(b);
54 
55  if ( bla!=nullptr && blb!=nullptr) { // barrel with barrel
56  return bla->specificSurface().radius() < blb->specificSurface().radius();
57  }
58 
59  const ForwardDetLayer* flb =
60  dynamic_cast<const ForwardDetLayer*>(b);
61 
62  if ( bla!=nullptr && flb!=nullptr) { // barrel with forward
63  return barrelForwardLess( bla, flb);
64  }
65 
66  const ForwardDetLayer* fla =
67  dynamic_cast<const ForwardDetLayer*>(a);
68 
69  if (fla!=nullptr && flb!=nullptr) { // 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!=nullptr && blb!=nullptr) { // 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)
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
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:40
virtual const Surface::PositionType & position() const
Returns position of the surface.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
bool TkLayerLess::operator() ( const DetLayer a,
const DetLayer b 
) const
inline

Definition at line 25 of file TkLayerLess.h.

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

25  {
26  if (!theOriginLayer){
27  if (theDir == insideOut) return insideOutLess( a, b);
28  else return insideOutLess( b, a);
29  }
30  else{
31  if (theDir == insideOut) return insideOutLessSigned( a, b);
32  else return insideOutLessSigned(b, a);
33  }
34  }
NavigationDirection theDir
Definition: TkLayerLess.h:38
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:39

Member Data Documentation

NavigationDirection TkLayerLess::theDir
private

Definition at line 38 of file TkLayerLess.h.

Referenced by operator()().

int TkLayerLess::theFromLayerSign
private

Definition at line 40 of file TkLayerLess.h.

Referenced by insideOutLessSigned(), and TkLayerLess().

bool TkLayerLess::theOriginLayer
private

Definition at line 39 of file TkLayerLess.h.

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