CMS 3D CMS Logo

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
virtual void setDetLayer (DetLayer const *dl)=0
 
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 = 0
 

Detailed Description

A concrete NavigableLayer for the barrel

Definition at line 11 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 19 of file SimpleBarrelNavigableLayer.cc.

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

26  : SimpleNavigableLayer(field, epsilon, checkCrossingSide),
28  theOuterBarrelLayers(outerBLC),
29  theOuterLeftForwardLayers(outerLeftFL),
30  theOuterRightForwardLayers(outerRightFL)
31 
32 {
33  // put barrel and forward layers together
34  theNegOuterLayers.reserve(outerBLC.size() + outerLeftFL.size());
35  thePosOuterLayers.reserve(outerBLC.size() + outerRightFL.size());
36 
37  for (ConstBDLI bl = outerBLC.begin(); bl != outerBLC.end(); bl++)
38  theNegOuterLayers.push_back(*bl);
39  thePosOuterLayers = theNegOuterLayers; // barrel part the same
40 
41  for (ConstFDLI fl = outerLeftFL.begin(); fl != outerLeftFL.end(); fl++)
42  theNegOuterLayers.push_back(*fl);
43  for (ConstFDLI fl = outerRightFL.begin(); fl != outerRightFL.end(); fl++)
44  thePosOuterLayers.push_back(*fl);
45 
46  // sort the outer layers
47  sort(theNegOuterLayers.begin(), theNegOuterLayers.end(), TkLayerLess());
48  sort(thePosOuterLayers.begin(), thePosOuterLayers.end(), TkLayerLess());
52 }
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 173 of file SimpleBarrelNavigableLayer.cc.

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

Reimplemented from NavigableLayer.

Definition at line 31 of file SimpleBarrelNavigableLayer.h.

References SimpleNavigableLayer::compatibleLayers(), insideOut, and SimpleNavigableLayer::setAdditionalLink().

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

Implements NavigableLayer.

Definition at line 39 of file SimpleBarrelNavigableLayer.h.

References outsideIn, NavigableLayer::setDetLayer(), and SimpleNavigableLayer::setInwardLinks().

Referenced by nextLayers().

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

Implements NavigableLayer.

Definition at line 54 of file SimpleBarrelNavigableLayer.cc.

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

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

Implements NavigableLayer.

Definition at line 78 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().

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

Implements SimpleNavigableLayer.

Definition at line 218 of file SimpleBarrelNavigableLayer.cc.

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

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

Definition at line 179 of file SimpleBarrelNavigableLayer.cc.

References beam_dqm_sourceclient-live_cfg::cerr.

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

Implements SimpleNavigableLayer.

Definition at line 183 of file SimpleBarrelNavigableLayer.cc.

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

183  {
184  theInnerBarrelLayers = theBarrelv;
185  // sort the inner layers
186  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), sorter);
187 
188  ConstFDLI middle = find_if(
189  theForwardv.begin(), theForwardv.end(), [](const GeometricSearchDet* a) { return a->position().z() >= 0.0; });
190  theInnerLeftForwardLayers = FDLC(theForwardv.begin(), middle);
191  theInnerRightForwardLayers = FDLC(middle, theForwardv.end());
192 
193  // sort the inner layers
194  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(), sorter);
195  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(), sorter);
196 
197  // put barrel and forward layers together
198  theNegInnerLayers.reserve(theInnerBarrelLayers.size() + theInnerLeftForwardLayers.size());
199  thePosInnerLayers.reserve(theInnerBarrelLayers.size() + theInnerRightForwardLayers.size());
200 
201  for (ConstBDLI bl = theInnerBarrelLayers.begin(); bl != theInnerBarrelLayers.end(); bl++)
202  theNegInnerLayers.push_back(*bl);
203  thePosInnerLayers = theNegInnerLayers; // barrel part the same
204 
205  for (ConstFDLI fl = theInnerLeftForwardLayers.begin(); fl != theInnerLeftForwardLayers.end(); fl++)
206  theNegInnerLayers.push_back(*fl);
207  for (ConstFDLI fl = theInnerRightForwardLayers.begin(); fl != theInnerRightForwardLayers.end(); fl++)
208  thePosInnerLayers.push_back(*fl);
209 
210  // sort the inner layers
211  sort(theNegInnerLayers.begin(), theNegInnerLayers.end(), sorter);
212  sort(thePosInnerLayers.begin(), thePosInnerLayers.end(), sorter);
213  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), sorter);
214  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(), sorter);
215  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(), sorter);
216 }
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 47 of file SimpleBarrelNavigableLayer.h.

BDLC SimpleBarrelNavigableLayer::theInnerBarrelLayers
private

Definition at line 49 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerLeftForwardLayers
private

Definition at line 54 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerRightForwardLayers
private

Definition at line 55 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::theNegInnerLayers
private

Definition at line 59 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 60 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::thePosOuterLayers
private