CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SimpleBarrelNavigableLayer Class Reference

#include <SimpleBarrelNavigableLayer.h>

Inheritance diagram for SimpleBarrelNavigableLayer:
SimpleNavigableLayer NavigableLayer

Public Member Functions

virtual std::vector< const
DetLayer * > 
compatibleLayers (NavigationDirection direction) const override
 
virtual std::vector< const
DetLayer * > 
compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection dir) const override
 
virtual const DetLayerdetLayer () const override
 
virtual std::vector< const
DetLayer * > 
nextLayers (NavigationDirection direction) const override
 
virtual std::vector< const
DetLayer * > 
nextLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const override
 
virtual void setAdditionalLink (const DetLayer *, NavigationDirection direction=insideOut) override
 
virtual void setDetLayer (const DetLayer *dl) override
 
virtual 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
virtual std::vector< const
DetLayer * > 
compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const
 
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 = 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 23 of file SimpleBarrelNavigableLayer.cc.

References python.multivaluedict::sort(), theNegOuterLayers, theOuterBarrelLayers, theOuterLeftForwardLayers, theOuterRightForwardLayers, and thePosOuterLayers.

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

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

Reimplemented from NavigableLayer.

Definition at line 37 of file SimpleBarrelNavigableLayer.h.

References SimpleNavigableLayer::compatibleLayers(), and counter.

38  {
39  int counter=0;
40  return SimpleNavigableLayer::compatibleLayers(fts,dir,counter);
41  }
virtual std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const
static std::atomic< unsigned int > counter
dbl *** dir
Definition: mlp_gen.cc:35
virtual const DetLayer* SimpleBarrelNavigableLayer::detLayer ( ) const
inlineoverridevirtual

Implements NavigableLayer.

Definition at line 45 of file SimpleBarrelNavigableLayer.h.

Referenced by nextLayers().

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

Implements NavigableLayer.

Definition at line 61 of file SimpleBarrelNavigableLayer.cc.

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

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

Implements NavigableLayer.

Definition at line 88 of file SimpleBarrelNavigableLayer.cc.

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

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

Implements SimpleNavigableLayer.

Definition at line 239 of file SimpleBarrelNavigableLayer.cc.

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

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

Implements NavigableLayer.

Definition at line 192 of file SimpleBarrelNavigableLayer.cc.

References dtNoiseDBValidation_cfg::cerr.

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

Implements SimpleNavigableLayer.

Definition at line 197 of file SimpleBarrelNavigableLayer.cc.

References python.multivaluedict::sort(), MCScenario_CRAFT1_22X::sorter(), theInnerBarrelLayers, theInnerLeftForwardLayers, theInnerRightForwardLayers, theNegInnerLayers, and thePosInnerLayers.

200 {
201  theInnerBarrelLayers=theBarrelv;
202  // sort the inner layers
204 
205 
206  ConstFDLI middle = find_if( theForwardv.begin(),theForwardv.end(),
207  not1(DetBelowZ(0)));
208  theInnerLeftForwardLayers=FDLC(theForwardv.begin(),middle);
209  theInnerRightForwardLayers=FDLC(middle,theForwardv.end());
210 
211  // sort the inner layers
212  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),sorter);
213  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),sorter);
214 
215 
216 
217  // put barrel and forward layers together
218  theNegInnerLayers.reserve( theInnerBarrelLayers.size() + theInnerLeftForwardLayers.size());
219  thePosInnerLayers.reserve( theInnerBarrelLayers.size() + theInnerRightForwardLayers.size());
220 
221  for (ConstBDLI bl=theInnerBarrelLayers.begin(); bl!=theInnerBarrelLayers.end(); bl++)
222  theNegInnerLayers.push_back( *bl);
223  thePosInnerLayers = theNegInnerLayers; // barrel part the same
224 
225  for (ConstFDLI fl=theInnerLeftForwardLayers.begin(); fl!=theInnerLeftForwardLayers.end(); fl++)
226  theNegInnerLayers.push_back( *fl);
227  for (ConstFDLI fl=theInnerRightForwardLayers.begin(); fl!=theInnerRightForwardLayers.end(); fl++)
228  thePosInnerLayers.push_back( *fl);
229 
230  // sort the inner layers
234  sort(theInnerLeftForwardLayers.begin(), theInnerLeftForwardLayers.end(),sorter);
235  sort(theInnerRightForwardLayers.begin(), theInnerRightForwardLayers.end(),sorter);
236 
237 }
std::vector< const ForwardDetLayer * > FDLC
FDLC::const_iterator ConstFDLI
BDLC::const_iterator ConstBDLI

Member Data Documentation

const BarrelDetLayer* SimpleBarrelNavigableLayer::theDetLayer
private

Definition at line 51 of file SimpleBarrelNavigableLayer.h.

BDLC SimpleBarrelNavigableLayer::theInnerBarrelLayers
private

Definition at line 53 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerLeftForwardLayers
private

Definition at line 58 of file SimpleBarrelNavigableLayer.h.

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

FDLC SimpleBarrelNavigableLayer::theInnerRightForwardLayers
private

Definition at line 59 of file SimpleBarrelNavigableLayer.h.

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

DLC SimpleBarrelNavigableLayer::theNegInnerLayers
private

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

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

DLC SimpleBarrelNavigableLayer::thePosOuterLayers
private