CMS 3D CMS Logo

SimpleForwardNavigableLayer.cc
Go to the documentation of this file.
2 
6 
9 
13 
14 using namespace std;
15 
17  const BDLC& outerBL,
18  const FDLC& outerFL,
19  const MagneticField* field,
20  float epsilon,
21  bool checkCrossingSide)
22  : SimpleNavigableLayer(field, epsilon, checkCrossingSide),
23  theDetLayer(detLayer),
24  theOuterBarrelLayers(outerBL),
25  theInnerBarrelLayers(0),
26  theOuterForwardLayers(outerFL),
27  theInnerForwardLayers(0),
28  theOuterLayers(0),
29  theInnerLayers(0) {
30  // put barrel and forward layers together
31  theOuterLayers.reserve(outerBL.size() + outerFL.size());
32  for (ConstBDLI bl = outerBL.begin(); bl != outerBL.end(); bl++)
33  theOuterLayers.push_back(*bl);
34  for (ConstFDLI fl = outerFL.begin(); fl != outerFL.end(); fl++)
35  theOuterLayers.push_back(*fl);
36 
37  // sort the outer layers
38  sort(theOuterLayers.begin(), theOuterLayers.end(), TkLayerLess());
41 }
42 
44  vector<const DetLayer*> result;
45 
46  // the order is the one in which layers
47  // should be checked for a reasonable trajectory
48 
49  if (dir == insideOut) {
50  return theOuterLayers;
51  } else {
52  return theInnerLayers;
53  }
54 
55  return result;
56 }
57 
59  PropagationDirection dir) const {
60  // This method contains the sequence in which the layers are tested.
61  // The iteration stops as soon as a layer contains the propagated state
62  // within epsilon
63 
64  vector<const DetLayer*> result;
65 
66  FreeTrajectoryState ftsWithoutErrors = (fts.hasError()) ? FreeTrajectoryState(fts.parameters()) : fts;
67 
68  auto const position = fts.position();
69  auto const momentum = fts.momentum();
70 
71  //establish whether the tracks is crossing the tracker from outer layers to inner ones
72  //or from inner to outer
73  float zpos = position.z();
74  bool isInOutTrackFWD = momentum.z() * zpos > 0;
75  GlobalVector transversePosition(position.x(), position.y(), 0);
76  bool isInOutTrackBarrel = (transversePosition.dot(momentum) > 0);
77 
78  //establish whether inner or outer layers are crossed after propagation, according
79  //to BOTH propagationDirection AND track momentum
80  bool dirOppositeXORisInOutTrackBarrel =
81  (!(dir == oppositeToMomentum) && isInOutTrackBarrel) || ((dir == oppositeToMomentum) && !isInOutTrackBarrel);
82  bool dirOppositeXORisInOutTrackFWD =
83  (!(dir == oppositeToMomentum) && isInOutTrackFWD) || ((dir == oppositeToMomentum) && !isInOutTrackFWD);
84  //bool dirOppositeXORisInOutTrack = ( !(dir == oppositeToMomentum) && isInOutTrack) || ( (dir == oppositeToMomentum) && !isInOutTrack);
85 
86  if
87  LIKELY(dirOppositeXORisInOutTrackFWD && dirOppositeXORisInOutTrackBarrel) { //standard tracks
88  wellInside(ftsWithoutErrors, dir, theOuterLayers, result);
89  }
90  else if (!dirOppositeXORisInOutTrackFWD && !dirOppositeXORisInOutTrackBarrel) { // !dirOppositeXORisInOutTrack
91  wellInside(ftsWithoutErrors, dir, theInnerLayers, result);
92  } else if (!dirOppositeXORisInOutTrackFWD && dirOppositeXORisInOutTrackBarrel) {
93  wellInside(ftsWithoutErrors, dir, theInnerForwardLayers.begin(), theInnerForwardLayers.end(), result);
94  wellInside(ftsWithoutErrors, dir, theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(), result);
95  } else {
96  wellInside(ftsWithoutErrors, dir, theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), result);
97  wellInside(ftsWithoutErrors, dir, theOuterForwardLayers.begin(), theOuterForwardLayers.end(), result);
98  }
99 
100  return result;
101 }
102 
104  edm::LogError("TkNavigation") << "ERROR: compatibleLayers() method used without all reachableLayers are set";
105  throw DetLayerException("compatibleLayers() method used without all reachableLayers are set");
106  return vector<const DetLayer*>();
107 }
108 
110  cerr << "Warning: SimpleForwardNavigableLayer::setDetLayer called." << endl << "This should never happen!" << endl;
111 }
112 
114  theInnerBarrelLayers = innerBL;
115  theInnerForwardLayers = innerFL;
116 
117  theInnerLayers.clear();
118  theInnerLayers.reserve(innerBL.size() + innerFL.size());
119  for (ConstBDLI bl = innerBL.begin(); bl != innerBL.end(); bl++)
120  theInnerLayers.push_back(*bl);
121  for (ConstFDLI fl = innerFL.begin(); fl != innerFL.end(); fl++)
122  theInnerLayers.push_back(*fl);
123 
124  // sort the inner layers
125  sort(theInnerLayers.begin(), theInnerLayers.end(), sorter);
126  sort(theInnerForwardLayers.begin(), theInnerForwardLayers.end(), sorter);
127  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), sorter);
128 }
129 
131  const ForwardDetLayer* fadditional = dynamic_cast<const ForwardDetLayer*>(additional);
132  const BarrelDetLayer* badditional = dynamic_cast<const BarrelDetLayer*>(additional);
133  if (badditional) {
134  if (direction == insideOut) {
135  theOuterBarrelLayers.push_back(badditional);
136  theOuterLayers.push_back(badditional);
137  return;
138  }
139  theInnerBarrelLayers.push_back(badditional);
140  theInnerLayers.push_back(badditional);
141  return;
142  } else if (fadditional) {
143  if (direction == insideOut) {
144  theOuterForwardLayers.push_back(fadditional);
145  theOuterLayers.push_back(badditional);
146  return;
147  }
148  theInnerForwardLayers.push_back(fadditional);
149  theInnerLayers.push_back(badditional);
150  return;
151  }
152  edm::LogError("TkNavigation") << "trying to add neither a ForwardDetLayer nor a BarrelDetLayer";
153  return;
154 }
Vector3DBase
Definition: Vector3DBase.h:8
Likely.h
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
MessageLogger.h
FreeTrajectoryState::hasError
bool hasError() const
Definition: FreeTrajectoryState.h:77
DetLayer
Definition: DetLayer.h:21
BoundDisk.h
SimpleForwardNavigableLayer::theInnerForwardLayers
FDLC theInnerForwardLayers
Definition: SimpleForwardNavigableLayer.h:48
TkLayerLess.h
oppositeToMomentum
Definition: PropagationDirection.h:4
BoundCylinder.h
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
SimpleForwardNavigableLayer.h
geometryDiff.epsilon
int epsilon
Definition: geometryDiff.py:26
SimpleNavigableLayer::wellInside
bool wellInside(const FreeTrajectoryState &fts, PropagationDirection dir, const BarrelDetLayer *bl, DLC &result) const
Definition: SimpleNavigableLayer.cc:65
SimpleForwardNavigableLayer::compatibleLayers
std::vector< const DetLayer * > compatibleLayers(NavigationDirection direction) const override
Definition: SimpleForwardNavigableLayer.cc:103
DetLayerException.h
SimpleForwardNavigableLayer::setInwardLinks
void setInwardLinks(const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn)) override
Definition: SimpleForwardNavigableLayer.cc:113
edm::LogError
Definition: MessageLogger.h:183
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
FreeTrajectoryState::parameters
const GlobalTrajectoryParameters & parameters() const
Definition: FreeTrajectoryState.h:79
SimpleForwardNavigableLayer::SimpleForwardNavigableLayer
SimpleForwardNavigableLayer(const ForwardDetLayer *detLayer, const BDLC &outerBL, const FDLC &outerFL, const MagneticField *field, float epsilon, bool checkCrossingSide=true)
Definition: SimpleForwardNavigableLayer.cc:16
SimpleForwardNavigableLayer::theInnerBarrelLayers
BDLC theInnerBarrelLayers
Definition: SimpleForwardNavigableLayer.h:45
BarrelDetLayer.h
SimpleNavigableLayer::ConstFDLI
FDLC::const_iterator ConstFDLI
Definition: SimpleNavigableLayer.h:52
BarrelDetLayer
Definition: BarrelDetLayer.h:22
SimpleNavigableLayer
Definition: SimpleNavigableLayer.h:20
DetLayerException
Common base class.
Definition: DetLayerException.h:15
MCScenario_CRAFT1_22X.sorter
def sorter(a, b)
Definition: MCScenario_CRAFT1_22X.py:97
std
Definition: JetResolutionObject.h:76
NavigationDirection
NavigationDirection
Definition: NavigationDirection.h:4
ForwardDetLayer
Definition: ForwardDetLayer.h:22
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
SimpleForwardNavigableLayer::theOuterLayers
DLC theOuterLayers
Definition: SimpleForwardNavigableLayer.h:50
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
SimpleNavigableLayer::FDLC
std::vector< const ForwardDetLayer * > FDLC
Definition: SimpleNavigableLayer.h:24
ForwardDetLayer.h
SimpleForwardNavigableLayer::theOuterForwardLayers
FDLC theOuterForwardLayers
Definition: SimpleForwardNavigableLayer.h:47
SimpleNavigableLayer::BDLC
std::vector< const BarrelDetLayer * > BDLC
Definition: SimpleNavigableLayer.h:23
SimpleForwardNavigableLayer::setAdditionalLink
void setAdditionalLink(const DetLayer *, NavigationDirection direction=insideOut) override
Definition: SimpleForwardNavigableLayer.cc:130
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
SimpleForwardNavigableLayer::theInnerLayers
DLC theInnerLayers
Definition: SimpleForwardNavigableLayer.h:51
SimpleForwardNavigableLayer::setDetLayer
void setDetLayer(const DetLayer *dl) override
Definition: SimpleForwardNavigableLayer.cc:109
SimpleForwardNavigableLayer::nextLayers
std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const override
Definition: SimpleForwardNavigableLayer.cc:43
insideOut
Definition: NavigationDirection.h:4
mps_fire.result
result
Definition: mps_fire.py:303
SimpleNavigableLayer::ConstBDLI
BDLC::const_iterator ConstBDLI
Definition: SimpleNavigableLayer.h:51
MagneticField
Definition: MagneticField.h:19
TkLayerLess
Definition: TkLayerLess.h:14
SimpleForwardNavigableLayer::theOuterBarrelLayers
BDLC theOuterBarrelLayers
Definition: SimpleForwardNavigableLayer.h:44
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23