CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SimpleForwardNavigableLayer Class Referencefinal

#include <SimpleForwardNavigableLayer.h>

Inheritance diagram for SimpleForwardNavigableLayer:
SimpleNavigableLayer NavigableLayer

Public Member Functions

std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection dir) const override
 
std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const final
 
std::vector< const DetLayer * > compatibleLayers (NavigationDirection direction) const override
 
const DetLayerdetLayer () const override
 
std::vector< const DetLayer * > nextLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const override
 
std::vector< const DetLayer * > nextLayers (NavigationDirection direction) const override
 
void setAdditionalLink (const DetLayer *, NavigationDirection direction=insideOut) override
 
void setDetLayer (const DetLayer *dl) override
 
void setInwardLinks (const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn)) override
 
 SimpleForwardNavigableLayer (const ForwardDetLayer *detLayer, const BDLC &outerBL, const FDLC &outerFL, const MagneticField *field, float epsilon, bool checkCrossingSide=true)
 
- Public Member Functions inherited from SimpleNavigableLayer
virtual std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
 
virtual std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const
 
std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const final
 
virtual std::vector< const DetLayer * > compatibleLayers (NavigationDirection direction) const=0
 
void setCheckCrossingSide (bool docheck)
 
 SimpleNavigableLayer (const MagneticField *field, float eps, bool checkCrossingSide=true)
 
- Public Member Functions inherited from NavigableLayer
void setSchool (NavigationSchool const *sh)
 
virtual ~NavigableLayer ()
 

Private Attributes

const ForwardDetLayertheDetLayer
 
BDLC theInnerBarrelLayers
 
FDLC theInnerForwardLayers
 
DLC theInnerLayers
 
BDLC theOuterBarrelLayers
 
FDLC theOuterForwardLayers
 
DLC theOuterLayers
 

Additional Inherited Members

- Public Types inherited from SimpleNavigableLayer
typedef std::vector< const BarrelDetLayer * > BDLC
 
typedef std::vector< const DetLayer * > DLC
 
typedef std::vector< const ForwardDetLayer * > FDLC
 
- Public Attributes inherited from SimpleNavigableLayer
bool theSelfSearch
 
- Protected Types inherited from SimpleNavigableLayer
typedef BDLC::iterator BDLI
 
typedef BDLC::const_iterator ConstBDLI
 
typedef FDLC::const_iterator ConstFDLI
 
typedef FDLC::iterator FDLI
 
typedef TrajectoryStateOnSurface TSOS
 
- Protected Member Functions inherited from SimpleNavigableLayer
TSOS crossingState (const FreeTrajectoryState &fts, PropagationDirection dir) const
 
AnalyticalPropagator propagator (PropagationDirection dir) const
 
bool wellInside (const FreeTrajectoryState &fts, PropagationDirection dir, const BarrelDetLayer *bl, DLC &result) const
 
bool wellInside (const FreeTrajectoryState &fts, PropagationDirection dir, const DLC &layers, DLC &result) const
 
bool wellInside (const FreeTrajectoryState &fts, PropagationDirection dir, const ForwardDetLayer *bl, DLC &result) const
 
bool wellInside (const FreeTrajectoryState &fts, PropagationDirection dir, ConstBDLI begin, ConstBDLI end, DLC &result) const
 
bool wellInside (const FreeTrajectoryState &fts, PropagationDirection dir, ConstFDLI begin, ConstFDLI end, DLC &result) const
 
- Protected Attributes inherited from SimpleNavigableLayer
bool theCheckCrossingSide
 
float theEpsilon
 
const MagneticFieldtheField
 
- Protected Attributes inherited from NavigableLayer
NavigationSchool const * school = nullptr
 

Detailed Description

A concrete NavigableLayer for the forward

Definition at line 10 of file SimpleForwardNavigableLayer.h.

Constructor & Destructor Documentation

◆ SimpleForwardNavigableLayer()

SimpleForwardNavigableLayer::SimpleForwardNavigableLayer ( const ForwardDetLayer detLayer,
const BDLC outerBL,
const FDLC outerFL,
const MagneticField field,
float  epsilon,
bool  checkCrossingSide = true 
)

Definition at line 16 of file SimpleForwardNavigableLayer.cc.

22  : SimpleNavigableLayer(field, epsilon, checkCrossingSide),
24  theOuterBarrelLayers(outerBL),
26  theOuterForwardLayers(outerFL),
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 }

References jetUpdater_cfi::sort, theOuterBarrelLayers, theOuterForwardLayers, and theOuterLayers.

Member Function Documentation

◆ compatibleLayers() [1/3]

std::vector<const DetLayer*> SimpleForwardNavigableLayer::compatibleLayers ( const FreeTrajectoryState fts,
PropagationDirection  dir 
) const
inlineoverridevirtual

Reimplemented from NavigableLayer.

Definition at line 29 of file SimpleForwardNavigableLayer.h.

30  {
31  int counter = 0;
33  }

References SimpleNavigableLayer::compatibleLayers(), and DeadROC_duringRun::dir.

◆ compatibleLayers() [2/3]

std::vector< const DetLayer * > SimpleNavigableLayer::compatibleLayers
final

Definition at line 216 of file SimpleNavigableLayer.cc.

218  {
219  typedef std::vector<const DetLayer*> Lvect;
220  typedef std::set<const DetLayer*> Lset;
221 
222  //initiate the first iteration
223  const Lvect& someLayers = nextLayers(fts, timeDirection);
224  if (someLayers.empty()) {
225  LogDebug("SimpleNavigableLayer") << "Number of compatible layers: " << 0;
226  return someLayers;
227  }
228 
229  Lset collect; //a container of unique instances. to avoid duplicates
230  Lset layerToTry, nextLayerToTry; //set used for iterations
231  layerToTry.insert(someLayers.begin(), someLayers.end());
232 
233  while (!layerToTry.empty() && (counter++) <= 150) {
234  LogDebug("SimpleNavigableLayer") << counter << "] going to check on : " << layerToTry.size() << " next layers.";
235  //clear this set first, it will be swaped with layerToTry
236  nextLayerToTry.clear();
237  for (auto toTry : layerToTry) {
238  //add the layer you tried.
239  LogDebug("SimpleNavigableLayer") << counter << "] adding layer with pointer: " << (toTry)
240  << " first detid: " << (toTry)->basicComponents().front()->geographicalId();
241  if (!collect.insert(toTry).second)
242  continue;
243 
244  //find the next layers from it
245  Lvect&& nextLayers = school->nextLayers(*toTry, fts, timeDirection);
246  LogDebug("SimpleNavigableLayer") << counter << "] this layer has : " << nextLayers.size() << " next layers.";
247  nextLayerToTry.insert(nextLayers.begin(), nextLayers.end());
248  } // layerToTry
249  //swap now that you where to go next.
250  layerToTry.swap(nextLayerToTry);
251  }
252  if (counter >= 150) {
253  edm::LogWarning("SimpleNavigableLayer") << "WARNING: compatibleLayers() more than 150 iterations!!! Bailing out..";
254  counter = -1;
255  return Lvect();
256  }
257 
258  LogDebug("SimpleNavigableLayer") << "Number of compatible layers: " << collect.size();
259 
260  return Lvect(collect.begin(), collect.end());
261 }

◆ compatibleLayers() [3/3]

vector< const DetLayer * > SimpleForwardNavigableLayer::compatibleLayers ( NavigationDirection  direction) const
overridevirtual

Implements NavigableLayer.

Definition at line 103 of file SimpleForwardNavigableLayer.cc.

103  {
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 }

◆ detLayer()

const DetLayer* SimpleForwardNavigableLayer::detLayer ( ) const
inlineoverridevirtual

Implements NavigableLayer.

Definition at line 37 of file SimpleForwardNavigableLayer.h.

37 { return theDetLayer; }

◆ nextLayers() [1/2]

vector< const DetLayer * > SimpleForwardNavigableLayer::nextLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const
overridevirtual

Implements NavigableLayer.

Definition at line 58 of file SimpleForwardNavigableLayer.cc.

59  {
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 }

References DeadROC_duringRun::dir, FreeTrajectoryState::hasError(), LIKELY, FreeTrajectoryState::momentum(), oppositeToMomentum, FreeTrajectoryState::parameters(), FreeTrajectoryState::position(), position, mps_fire::result, theInnerBarrelLayers, theInnerForwardLayers, theInnerLayers, theOuterBarrelLayers, theOuterForwardLayers, theOuterLayers, and SimpleNavigableLayer::wellInside().

◆ nextLayers() [2/2]

vector< const DetLayer * > SimpleForwardNavigableLayer::nextLayers ( NavigationDirection  direction) const
overridevirtual

Implements NavigableLayer.

Definition at line 43 of file SimpleForwardNavigableLayer.cc.

43  {
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 }

References DeadROC_duringRun::dir, insideOut, mps_fire::result, theInnerLayers, and theOuterLayers.

◆ setAdditionalLink()

void SimpleForwardNavigableLayer::setAdditionalLink ( const DetLayer additional,
NavigationDirection  direction = insideOut 
)
overridevirtual

Implements SimpleNavigableLayer.

Definition at line 130 of file SimpleForwardNavigableLayer.cc.

130  {
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 }

References insideOut, theInnerBarrelLayers, theInnerForwardLayers, theInnerLayers, theOuterBarrelLayers, theOuterForwardLayers, and theOuterLayers.

Referenced by CosmicNavigationSchool::buildAdditionalForwardLinks().

◆ setDetLayer()

void SimpleForwardNavigableLayer::setDetLayer ( const DetLayer dl)
overridevirtual

Implements NavigableLayer.

Definition at line 109 of file SimpleForwardNavigableLayer.cc.

109  {
110  cerr << "Warning: SimpleForwardNavigableLayer::setDetLayer called." << endl << "This should never happen!" << endl;
111 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr.

◆ setInwardLinks()

void SimpleForwardNavigableLayer::setInwardLinks ( const BDLC innerBL,
const FDLC innerFL,
TkLayerLess  sorter = TkLayerLess(outsideIn) 
)
overridevirtual

Implements SimpleNavigableLayer.

Definition at line 113 of file SimpleForwardNavigableLayer.cc.

113  {
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);
128 }

References jetUpdater_cfi::sort, MCScenario_CRAFT1_22X::sorter(), theInnerBarrelLayers, theInnerForwardLayers, and theInnerLayers.

Member Data Documentation

◆ theDetLayer

const ForwardDetLayer* SimpleForwardNavigableLayer::theDetLayer
private

Definition at line 43 of file SimpleForwardNavigableLayer.h.

◆ theInnerBarrelLayers

BDLC SimpleForwardNavigableLayer::theInnerBarrelLayers
private

Definition at line 45 of file SimpleForwardNavigableLayer.h.

Referenced by nextLayers(), setAdditionalLink(), and setInwardLinks().

◆ theInnerForwardLayers

FDLC SimpleForwardNavigableLayer::theInnerForwardLayers
private

Definition at line 48 of file SimpleForwardNavigableLayer.h.

Referenced by nextLayers(), setAdditionalLink(), and setInwardLinks().

◆ theInnerLayers

DLC SimpleForwardNavigableLayer::theInnerLayers
private

Definition at line 51 of file SimpleForwardNavigableLayer.h.

Referenced by nextLayers(), setAdditionalLink(), and setInwardLinks().

◆ theOuterBarrelLayers

BDLC SimpleForwardNavigableLayer::theOuterBarrelLayers
private

◆ theOuterForwardLayers

FDLC SimpleForwardNavigableLayer::theOuterForwardLayers
private

◆ theOuterLayers

DLC SimpleForwardNavigableLayer::theOuterLayers
private
Vector3DBase
Definition: Vector3DBase.h:8
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
counter
Definition: counter.py:1
FreeTrajectoryState::hasError
bool hasError() const
Definition: FreeTrajectoryState.h:77
SimpleForwardNavigableLayer::theInnerForwardLayers
FDLC theInnerForwardLayers
Definition: SimpleForwardNavigableLayer.h:48
oppositeToMomentum
Definition: PropagationDirection.h:4
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
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::detLayer
const DetLayer * detLayer() const override
Definition: SimpleForwardNavigableLayer.h:37
NavigationSchool::nextLayers
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&... args) const
Definition: NavigationSchool.h:33
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
SimpleNavigableLayer::compatibleLayers
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const final
Definition: SimpleNavigableLayer.cc:216
FreeTrajectoryState::parameters
const GlobalTrajectoryParameters & parameters() const
Definition: FreeTrajectoryState.h:79
SimpleForwardNavigableLayer::theInnerBarrelLayers
BDLC theInnerBarrelLayers
Definition: SimpleForwardNavigableLayer.h:45
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SimpleForwardNavigableLayer::theDetLayer
const ForwardDetLayer * theDetLayer
Definition: SimpleForwardNavigableLayer.h:43
SimpleNavigableLayer::ConstFDLI
FDLC::const_iterator ConstFDLI
Definition: SimpleNavigableLayer.h:52
BarrelDetLayer
Definition: BarrelDetLayer.h:22
DetLayerException
Common base class.
Definition: DetLayerException.h:15
NavigableLayer::school
NavigationSchool const * school
Definition: NavigableLayer.h:52
MCScenario_CRAFT1_22X.sorter
def sorter(a, b)
Definition: MCScenario_CRAFT1_22X.py:97
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
SimpleForwardNavigableLayer::theOuterForwardLayers
FDLC theOuterForwardLayers
Definition: SimpleForwardNavigableLayer.h:47
SimpleForwardNavigableLayer::theInnerLayers
DLC theInnerLayers
Definition: SimpleForwardNavigableLayer.h:51
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:311
SimpleNavigableLayer::ConstBDLI
BDLC::const_iterator ConstBDLI
Definition: SimpleNavigableLayer.h:51
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
TkLayerLess
Definition: TkLayerLess.h:14
SimpleForwardNavigableLayer::theOuterBarrelLayers
BDLC theOuterBarrelLayers
Definition: SimpleForwardNavigableLayer.h:44
SimpleNavigableLayer::SimpleNavigableLayer
SimpleNavigableLayer(const MagneticField *field, float eps, bool checkCrossingSide=true)
Definition: SimpleNavigableLayer.h:26
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23