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 Attributes
SimpleBarrelNavigableLayer Class Referencefinal

#include <SimpleBarrelNavigableLayer.h>

Inheritance diagram for SimpleBarrelNavigableLayer:
SimpleNavigableLayer NavigableLayer

Public Member Functions

std::vector< const DetLayer * > compatibleLayers (NavigationDirection direction) const override
 
std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection dir) const override
 
const DetLayerdetLayer () const override
 
std::vector< const DetLayer * > nextLayers (NavigationDirection direction) const override
 
std::vector< const DetLayer * > nextLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const override
 
void setAdditionalLink (const DetLayer *, NavigationDirection direction=insideOut) override
 
void setDetLayer (const DetLayer *dl) override
 
void setInwardLinks (const BDLC &theBarrelv, const FDLC &theForwardv, TkLayerLess sorter=TkLayerLess(outsideIn)) override
 
 SimpleBarrelNavigableLayer (BarrelDetLayer const *detLayer, const BDLC &outerBLC, const FDLC &outerLeftFL, const FDLC &outerRightFL, const MagneticField *field, float epsilon, bool checkCrossingSide=true)
 
- Public Member Functions inherited from SimpleNavigableLayer
std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const final
 
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 BarrelDetLayertheDetLayer
 
BDLC theInnerBarrelLayers
 
FDLC theInnerLeftForwardLayers
 
FDLC theInnerRightForwardLayers
 
DLC theNegInnerLayers
 
DLC theNegOuterLayers
 
BDLC theOuterBarrelLayers
 
FDLC theOuterLeftForwardLayers
 
FDLC theOuterRightForwardLayers
 
DLC thePosInnerLayers
 
DLC thePosOuterLayers
 

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 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, const DLC &layers, 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 barrel

Definition at line 12 of file SimpleBarrelNavigableLayer.h.

Constructor & Destructor Documentation

SimpleBarrelNavigableLayer::SimpleBarrelNavigableLayer ( BarrelDetLayer const *  detLayer,
const BDLC outerBLC,
const FDLC outerLeftFL,
const FDLC outerRightFL,
const MagneticField field,
float  epsilon,
bool  checkCrossingSide = true 
)

Definition at line 20 of file SimpleBarrelNavigableLayer.cc.

References theNegOuterLayers, theOuterBarrelLayers, theOuterLeftForwardLayers, theOuterRightForwardLayers, and thePosOuterLayers.

27  : SimpleNavigableLayer(field, epsilon, checkCrossingSide),
29  theOuterBarrelLayers(outerBLC),
30  theOuterLeftForwardLayers(outerLeftFL),
31  theOuterRightForwardLayers(outerRightFL)
32 
33 {
34  // put barrel and forward layers together
35  theNegOuterLayers.reserve(outerBLC.size() + outerLeftFL.size());
36  thePosOuterLayers.reserve(outerBLC.size() + outerRightFL.size());
37 
38  for (ConstBDLI bl = outerBLC.begin(); bl != outerBLC.end(); bl++)
39  theNegOuterLayers.push_back(*bl);
40  thePosOuterLayers = theNegOuterLayers; // barrel part the same
41 
42  for (ConstFDLI fl = outerLeftFL.begin(); fl != outerLeftFL.end(); fl++)
43  theNegOuterLayers.push_back(*fl);
44  for (ConstFDLI fl = outerRightFL.begin(); fl != outerRightFL.end(); fl++)
45  thePosOuterLayers.push_back(*fl);
46 
47  // sort the outer layers
48  sort(theNegOuterLayers.begin(), theNegOuterLayers.end(), TkLayerLess());
49  sort(thePosOuterLayers.begin(), thePosOuterLayers.end(), TkLayerLess());
53 }
SimpleNavigableLayer(const MagneticField *field, float eps, bool checkCrossingSide=true)
FDLC::const_iterator ConstFDLI
const DetLayer * detLayer() const override
BDLC::const_iterator ConstBDLI

Member Function Documentation

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

Implements NavigableLayer.

Definition at line 171 of file SimpleBarrelNavigableLayer.cc.

171  {
172  edm::LogError("TkNavigation") << "ERROR: compatibleLayers() method used without all reachableLayers are set";
173  throw DetLayerException("compatibleLayers() method used without all reachableLayers are set");
174  return vector<const DetLayer*>();
175 }
Common base class.
Log< level::Error, false > LogError
std::vector<const DetLayer*> SimpleBarrelNavigableLayer::compatibleLayers ( const FreeTrajectoryState fts,
PropagationDirection  dir 
) const
inlineoverridevirtual

Reimplemented from NavigableLayer.

Definition at line 32 of file SimpleBarrelNavigableLayer.h.

References SimpleNavigableLayer::compatibleLayers(), and counter.

33  {
34  int counter = 0;
35  return SimpleNavigableLayer::compatibleLayers(fts, dir, counter);
36  }
std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const final
static std::atomic< unsigned int > counter
const DetLayer* SimpleBarrelNavigableLayer::detLayer ( ) const
inlineoverridevirtual

Implements NavigableLayer.

Definition at line 40 of file SimpleBarrelNavigableLayer.h.

Referenced by nextLayers().

40 { return theDetLayer; }
vector< const DetLayer * > SimpleBarrelNavigableLayer::nextLayers ( NavigationDirection  direction) const
overridevirtual

Implements NavigableLayer.

Definition at line 55 of file SimpleBarrelNavigableLayer.cc.

References GeomDetEnumerators::endcap, mps_fire::i, insideOut, mps_fire::result, theNegInnerLayers, theNegOuterLayers, thePosInnerLayers, and thePosOuterLayers.

55  {
56  vector<const DetLayer*> result;
57 
58  // the order is the one in which layers
59  // should be checked for a reasonable trajectory
60 
61  if (dir == insideOut) {
62  result = theNegOuterLayers;
63  for (DLC::const_iterator i = thePosOuterLayers.begin(); i != thePosOuterLayers.end(); i++) {
64  // avoid duplication of barrel layers
65  if ((**i).location() == GeomDetEnumerators::endcap)
66  result.push_back(*i);
67  }
68  } else {
69  result = theNegInnerLayers;
70  for (DLC::const_iterator i = thePosInnerLayers.begin(); i != thePosInnerLayers.end(); i++) {
71  // avoid duplication of barrel layers
72  if ((**i).location() == GeomDetEnumerators::endcap)
73  result.push_back(*i);
74  }
75  }
76  return result;
77 }
tuple result
Definition: mps_fire.py:311
vector< const DetLayer * > SimpleBarrelNavigableLayer::nextLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const
overridevirtual

Implements NavigableLayer.

Definition at line 79 of file SimpleBarrelNavigableLayer.cc.

References alongMomentum, detLayer(), FreeTrajectoryState::hasError(), LIKELY, LogDebug, FreeTrajectoryState::momentum(), oppositeToMomentum, FreeTrajectoryState::parameters(), FreeTrajectoryState::position(), position, mps_fire::result, theInnerBarrelLayers, theInnerLeftForwardLayers, theInnerRightForwardLayers, theNegInnerLayers, theNegOuterLayers, theOuterBarrelLayers, theOuterLeftForwardLayers, theOuterRightForwardLayers, thePosInnerLayers, thePosOuterLayers, SimpleNavigableLayer::theSelfSearch, UNLIKELY, and SimpleNavigableLayer::wellInside().

80  {
81  // This method contains the sequence in which the layers are tested.
82  // The iteration stops as soon as a layer contains the propagated state
83  // within epsilon.
84 
85  vector<const DetLayer*> result;
86 
87  FreeTrajectoryState ftsWithoutErrors = (fts.hasError()) ? FreeTrajectoryState(fts.parameters()) : fts;
88 
89  auto const position = fts.position();
90  auto const momentum = fts.momentum();
91 
92  //establish whether the tracks is crossing the tracker from outer layers to inner ones
93  //or from inner to outer.
94  GlobalVector transversePosition(position.x(), position.y(), 0);
95  bool isInOutTrackBarrel = (transversePosition.dot(momentum) > 0);
96 
97  float zpos = position.z();
98  bool isInOutTrackFWD = momentum.z() * zpos > 0;
99 
100  //establish whether inner or outer layers are crossed after propagation, according
101  //to BOTH propagationDirection AND track momentum
102  bool dirOppositeXORisInOutTrackBarrel =
103  (!(dir == oppositeToMomentum) && isInOutTrackBarrel) || ((dir == oppositeToMomentum) && !isInOutTrackBarrel);
104  bool dirOppositeXORisInOutTrackFWD =
105  (!(dir == oppositeToMomentum) && isInOutTrackFWD) || ((dir == oppositeToMomentum) && !isInOutTrackFWD);
106 
107  LogDebug("SimpleBarrelNavigableLayer") << "is alongMomentum? " << (dir == alongMomentum) << endl
108  << "isInOutTrackBarrel: " << isInOutTrackBarrel << endl
109  << "isInOutTrackFWD: " << isInOutTrackFWD << endl
110  << "dirOppositeXORisInOutTrackFWD: " << dirOppositeXORisInOutTrackFWD << endl
111  << "dirOppositeXORisInOutTrackBarrel: " << dirOppositeXORisInOutTrackBarrel
112  << endl;
113 
114  bool signZmomentumXORdir =
115  (((momentum.z() > 0) && !(dir == alongMomentum)) || (!(momentum.z() > 0) && (dir == alongMomentum)));
116 
117  if LIKELY (dirOppositeXORisInOutTrackBarrel && dirOppositeXORisInOutTrackFWD) {
118  if (signZmomentumXORdir) {
119  wellInside(ftsWithoutErrors, dir, theNegOuterLayers, result);
120  } else {
121  wellInside(ftsWithoutErrors, dir, thePosOuterLayers, result);
122  }
123  } else if (!dirOppositeXORisInOutTrackBarrel && !dirOppositeXORisInOutTrackFWD) {
124  if (signZmomentumXORdir) {
125  wellInside(ftsWithoutErrors, dir, thePosInnerLayers, result);
126  } else {
127  wellInside(ftsWithoutErrors, dir, theNegInnerLayers, result);
128  }
129  } else if (!dirOppositeXORisInOutTrackBarrel && dirOppositeXORisInOutTrackFWD) {
130  wellInside(ftsWithoutErrors, dir, theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), result);
131 
132  if (signZmomentumXORdir) {
133  wellInside(ftsWithoutErrors, dir, theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(), result);
134  wellInside(ftsWithoutErrors, dir, theOuterLeftForwardLayers.begin(), theOuterLeftForwardLayers.end(), result);
135  } else {
136  wellInside(ftsWithoutErrors, dir, theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(), result);
137  wellInside(ftsWithoutErrors, dir, theOuterRightForwardLayers.begin(), theOuterRightForwardLayers.end(), result);
138  }
139  } else {
140  if (signZmomentumXORdir) {
141  wellInside(ftsWithoutErrors, dir, theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(), result);
142  } else {
143  wellInside(ftsWithoutErrors, dir, theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(), result);
144  }
145  wellInside(ftsWithoutErrors, dir, theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(), result);
146  }
147 
148  bool goingIntoTheBarrel =
149  (!isInOutTrackBarrel && dir == alongMomentum) || (isInOutTrackBarrel && dir == oppositeToMomentum);
150 
151  LogDebug("SimpleBarrelNavigableLayer") << "goingIntoTheBarrel: " << goingIntoTheBarrel;
152 
153  if UNLIKELY (theSelfSearch && result.empty()) {
154  if (!goingIntoTheBarrel) {
155  LogDebug("SimpleBarrelNavigableLayer")
156  << " state is not going toward the center of the barrel. not adding self search.";
157  } else {
158  const BarrelDetLayer* bl = reinterpret_cast<const BarrelDetLayer*>(detLayer());
159  unsigned int before = result.size();
160  LogDebug("SimpleBarrelNavigableLayer") << " I am trying to added myself as a next layer.";
161  wellInside(ftsWithoutErrors, dir, bl, result);
162  unsigned int after = result.size();
163  if (before != after)
164  LogDebug("SimpleBarrelNavigableLayer") << " I have added myself as a next layer.";
165  }
166  }
167 
168  return result;
169 }
const GlobalTrajectoryParameters & parameters() const
#define LIKELY(x)
Definition: Likely.h:20
tuple result
Definition: mps_fire.py:311
const DetLayer * detLayer() const override
GlobalVector momentum() const
GlobalPoint position() const
bool wellInside(const FreeTrajectoryState &fts, PropagationDirection dir, const BarrelDetLayer *bl, DLC &result) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
#define UNLIKELY(x)
Definition: Likely.h:21
#define LogDebug(id)
void SimpleBarrelNavigableLayer::setAdditionalLink ( const DetLayer additional,
NavigationDirection  direction = insideOut 
)
overridevirtual

Implements SimpleNavigableLayer.

Definition at line 216 of file SimpleBarrelNavigableLayer.cc.

References insideOut, GeometricSearchDet::position(), theInnerBarrelLayers, theInnerLeftForwardLayers, theInnerRightForwardLayers, theNegInnerLayers, theNegOuterLayers, theOuterBarrelLayers, theOuterLeftForwardLayers, theOuterRightForwardLayers, thePosInnerLayers, thePosOuterLayers, and PV3DBase< T, PVType, FrameType >::z().

216  {
217  const ForwardDetLayer* fadditional = dynamic_cast<const ForwardDetLayer*>(additional);
218  const BarrelDetLayer* badditional = dynamic_cast<const BarrelDetLayer*>(additional);
219  if (badditional) {
220  if (direction == insideOut) {
221  theOuterBarrelLayers.push_back(badditional);
222  theNegOuterLayers.push_back(badditional);
223  thePosOuterLayers.push_back(badditional);
224  return;
225  }
226  theInnerBarrelLayers.push_back(badditional);
227  theNegInnerLayers.push_back(badditional);
228  thePosInnerLayers.push_back(badditional);
229  return;
230  } else if (fadditional) {
231  double zpos = fadditional->position().z();
232  if (direction == insideOut) {
233  if (zpos > 0) {
234  theOuterRightForwardLayers.push_back(fadditional);
235  thePosOuterLayers.push_back(fadditional);
236  return;
237  }
238  theOuterLeftForwardLayers.push_back(fadditional);
239  theNegOuterLayers.push_back(fadditional);
240  return;
241  }
242  if (zpos > 0) {
243  theInnerRightForwardLayers.push_back(fadditional);
244  thePosInnerLayers.push_back(fadditional);
245  return;
246  }
247  theInnerLeftForwardLayers.push_back(fadditional);
248  theNegInnerLayers.push_back(fadditional);
249  return;
250  }
251  edm::LogError("TkNavigation") << "trying to add neither a ForwardDetLayer nor a BarrelDetLayer";
252  return;
253 }
Log< level::Error, false > LogError
T z() const
Definition: PV3DBase.h:61
virtual const Surface::PositionType & position() const
Returns position of the surface.
void SimpleBarrelNavigableLayer::setDetLayer ( const DetLayer dl)
overridevirtual

Implements NavigableLayer.

Definition at line 177 of file SimpleBarrelNavigableLayer.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr.

177  {
178  cerr << "Warniong: SimpleBarrelNavigableLayer::setDetLayer called." << endl << "This should never happen!" << endl;
179 }
void SimpleBarrelNavigableLayer::setInwardLinks ( const BDLC theBarrelv,
const FDLC theForwardv,
TkLayerLess  sorter = TkLayerLess(outsideIn) 
)
overridevirtual

Implements SimpleNavigableLayer.

Definition at line 181 of file SimpleBarrelNavigableLayer.cc.

References a, MCScenario_CRAFT1_22X::sorter(), theInnerBarrelLayers, theInnerLeftForwardLayers, theInnerRightForwardLayers, theNegInnerLayers, and thePosInnerLayers.

181  {
182  theInnerBarrelLayers = theBarrelv;
183  // sort the inner layers
184  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), sorter);
185 
186  ConstFDLI middle = find_if(
187  theForwardv.begin(), theForwardv.end(), [](const GeometricSearchDet* a) { return a->position().z() >= 0.0; });
188  theInnerLeftForwardLayers = FDLC(theForwardv.begin(), middle);
189  theInnerRightForwardLayers = FDLC(middle, theForwardv.end());
190 
191  // sort the inner layers
192  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(), sorter);
193  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(), sorter);
194 
195  // put barrel and forward layers together
196  theNegInnerLayers.reserve(theInnerBarrelLayers.size() + theInnerLeftForwardLayers.size());
197  thePosInnerLayers.reserve(theInnerBarrelLayers.size() + theInnerRightForwardLayers.size());
198 
199  for (ConstBDLI bl = theInnerBarrelLayers.begin(); bl != theInnerBarrelLayers.end(); bl++)
200  theNegInnerLayers.push_back(*bl);
201  thePosInnerLayers = theNegInnerLayers; // barrel part the same
202 
203  for (ConstFDLI fl = theInnerLeftForwardLayers.begin(); fl != theInnerLeftForwardLayers.end(); fl++)
204  theNegInnerLayers.push_back(*fl);
205  for (ConstFDLI fl = theInnerRightForwardLayers.begin(); fl != theInnerRightForwardLayers.end(); fl++)
206  thePosInnerLayers.push_back(*fl);
207 
208  // sort the inner layers
209  sort(theNegInnerLayers.begin(), theNegInnerLayers.end(), sorter);
210  sort(thePosInnerLayers.begin(), thePosInnerLayers.end(), sorter);
211  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), sorter);
212  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(), sorter);
213  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(), sorter);
214 }
std::vector< const ForwardDetLayer * > FDLC
FDLC::const_iterator ConstFDLI
double a
Definition: hdecay.h:119
BDLC::const_iterator ConstBDLI

Member Data Documentation

const BarrelDetLayer* SimpleBarrelNavigableLayer::theDetLayer
private

Definition at line 48 of file SimpleBarrelNavigableLayer.h.

BDLC SimpleBarrelNavigableLayer::theInnerBarrelLayers
private

Definition at line 50 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerLeftForwardLayers
private

Definition at line 55 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerRightForwardLayers
private

Definition at line 56 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::theNegInnerLayers
private

Definition at line 60 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::theNegOuterLayers
private
BDLC SimpleBarrelNavigableLayer::theOuterBarrelLayers
private
FDLC SimpleBarrelNavigableLayer::theOuterLeftForwardLayers
private
FDLC SimpleBarrelNavigableLayer::theOuterRightForwardLayers
private
DLC SimpleBarrelNavigableLayer::thePosInnerLayers
private

Definition at line 61 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::thePosOuterLayers
private