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 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 21 of file SimpleBarrelNavigableLayer.cc.

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

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

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

Reimplemented from NavigableLayer.

Definition at line 39 of file SimpleBarrelNavigableLayer.h.

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

40  {
41  int counter=0;
42  return SimpleNavigableLayer::compatibleLayers(fts,dir,counter);
43  }
dbl *** dir
Definition: mlp_gen.cc: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 47 of file SimpleBarrelNavigableLayer.h.

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

Referenced by nextLayers().

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

Implements NavigableLayer.

Definition at line 59 of file SimpleBarrelNavigableLayer.cc.

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

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

Implements NavigableLayer.

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

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

Implements SimpleNavigableLayer.

Definition at line 237 of file SimpleBarrelNavigableLayer.cc.

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

237  {
238  const ForwardDetLayer* fadditional = dynamic_cast<const ForwardDetLayer*>(additional);
239  const BarrelDetLayer* badditional = dynamic_cast<const BarrelDetLayer*>(additional);
240  if (badditional){
241  if (direction==insideOut){
242  theOuterBarrelLayers.push_back(badditional);
243  theNegOuterLayers.push_back(badditional);
244  thePosOuterLayers.push_back(badditional);
245  return;
246  }
247  theInnerBarrelLayers.push_back(badditional);
248  theNegInnerLayers.push_back(badditional);
249  thePosInnerLayers.push_back(badditional);
250  return;
251  } else if (fadditional){
252  double zpos = fadditional->position().z();
253  if (direction==insideOut){
254  if (zpos>0){
255  theOuterRightForwardLayers.push_back(fadditional);
256  thePosOuterLayers.push_back(fadditional);
257  return;
258  }
259  theOuterLeftForwardLayers.push_back(fadditional);
260  theNegOuterLayers.push_back(fadditional);
261  return;
262  }
263  if (zpos>0){
264  theInnerRightForwardLayers.push_back(fadditional);
265  thePosInnerLayers.push_back(fadditional);
266  return;
267  }
268  theInnerLeftForwardLayers.push_back(fadditional);
269  theNegInnerLayers.push_back(fadditional);
270  return;
271  }
272  edm::LogError("TkNavigation") << "trying to add neither a ForwardDetLayer nor a BarrelDetLayer";
273  return;
274 }
T z() const
Definition: PV3DBase.h:64
virtual const Surface::PositionType & position() const
Returns position of the surface.
void SimpleBarrelNavigableLayer::setDetLayer ( const DetLayer dl)
override

Definition at line 190 of file SimpleBarrelNavigableLayer.cc.

References MessageLogger_cfi::cerr.

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

Implements SimpleNavigableLayer.

Definition at line 195 of file SimpleBarrelNavigableLayer.cc.

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

198 {
199  theInnerBarrelLayers=theBarrelv;
200  // sort the inner layers
201  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(),sorter);
202 
203 
204  ConstFDLI middle = find_if( theForwardv.begin(),theForwardv.end(),
205  [](const GeometricSearchDet* a){ return a->position().z() >= 0.0; });
206  theInnerLeftForwardLayers=FDLC(theForwardv.begin(),middle);
207  theInnerRightForwardLayers=FDLC(middle,theForwardv.end());
208 
209  // sort the inner layers
210  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),sorter);
211  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),sorter);
212 
213 
214 
215  // put barrel and forward layers together
216  theNegInnerLayers.reserve( theInnerBarrelLayers.size() + theInnerLeftForwardLayers.size());
217  thePosInnerLayers.reserve( theInnerBarrelLayers.size() + theInnerRightForwardLayers.size());
218 
219  for (ConstBDLI bl=theInnerBarrelLayers.begin(); bl!=theInnerBarrelLayers.end(); bl++)
220  theNegInnerLayers.push_back( *bl);
221  thePosInnerLayers = theNegInnerLayers; // barrel part the same
222 
223  for (ConstFDLI fl=theInnerLeftForwardLayers.begin(); fl!=theInnerLeftForwardLayers.end(); fl++)
224  theNegInnerLayers.push_back( *fl);
225  for (ConstFDLI fl=theInnerRightForwardLayers.begin(); fl!=theInnerRightForwardLayers.end(); fl++)
226  thePosInnerLayers.push_back( *fl);
227 
228  // sort the inner layers
229  sort( theNegInnerLayers.begin(), theNegInnerLayers.end(), sorter);
230  sort( thePosInnerLayers.begin(), thePosInnerLayers.end(), sorter);
231  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(),sorter);
232  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),sorter);
233  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),sorter);
234 
235 }
std::vector< const ForwardDetLayer * > FDLC
FDLC::const_iterator ConstFDLI
double a
Definition: hdecay.h:121
BDLC::const_iterator ConstBDLI

Member Data Documentation

const BarrelDetLayer* SimpleBarrelNavigableLayer::theDetLayer
private

Definition at line 53 of file SimpleBarrelNavigableLayer.h.

BDLC SimpleBarrelNavigableLayer::theInnerBarrelLayers
private

Definition at line 55 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerLeftForwardLayers
private

Definition at line 60 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerRightForwardLayers
private

Definition at line 61 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::theNegInnerLayers
private

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

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

DLC SimpleBarrelNavigableLayer::thePosOuterLayers
private