CMS 3D CMS Logo

Public Member Functions | Private Attributes

SimpleForwardNavigableLayer Class Reference

#include <SimpleForwardNavigableLayer.h>

Inheritance diagram for SimpleForwardNavigableLayer:
SimpleNavigableLayer NavigableLayer

List of all members.

Public Member Functions

virtual std::vector< const
DetLayer * > 
compatibleLayers (NavigationDirection direction) const
virtual std::vector< const
DetLayer * > 
compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
virtual DetLayerdetLayer () const
virtual std::vector< const
DetLayer * > 
nextLayers (NavigationDirection direction) const
virtual std::vector< const
DetLayer * > 
nextLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
virtual void setAdditionalLink (DetLayer *, NavigationDirection direction=insideOut)
virtual void setDetLayer (DetLayer *dl)
virtual void setInwardLinks (const BDLC &, const FDLC &, TkLayerLess sorter=TkLayerLess(outsideIn))
 SimpleForwardNavigableLayer (ForwardDetLayer *detLayer, const BDLC &outerBL, const FDLC &outerFL, const MagneticField *field, float epsilon, bool checkCrossingSide=true)
 SimpleForwardNavigableLayer (ForwardDetLayer *detLayer, const BDLC &outerBL, const BDLC &allOuterBL, const BDLC &innerBL, const BDLC &allInnerBL, const FDLC &outerFL, const FDLC &allOuterFL, const FDLC &innerFL, const FDLC &allInnerFL, const MagneticField *field, float epsilon, bool checkCrossingSide=true)

Private Attributes

bool areAllReachableLayersSet
BDLC theAllInnerBarrelLayers
FDLC theAllInnerForwardLayers
DLC theAllInnerLayers
BDLC theAllOuterBarrelLayers
FDLC theAllOuterForwardLayers
DLC theAllOuterLayers
ForwardDetLayertheDetLayer
BDLC theInnerBarrelLayers
FDLC theInnerForwardLayers
DLC theInnerLayers
BDLC theOuterBarrelLayers
FDLC theOuterForwardLayers
DLC theOuterLayers

Detailed Description

A concrete NavigableLayer for the forward

Definition at line 9 of file SimpleForwardNavigableLayer.h.


Constructor & Destructor Documentation

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

Definition at line 17 of file SimpleForwardNavigableLayer.cc.

References python::multivaluedict::sort(), theOuterBarrelLayers, theOuterForwardLayers, and theOuterLayers.

                                                     :
  SimpleNavigableLayer(field,epsilon,checkCrossingSide),
  areAllReachableLayersSet(false),
  theDetLayer(detLayer), 
  theOuterBarrelLayers(outerBL),
  theInnerBarrelLayers(0),
  theOuterForwardLayers(outerFL),
  theInnerForwardLayers(0),
  theOuterLayers(0), 
  theInnerLayers(0)
{
  
  // put barrel and forward layers together
  theOuterLayers.reserve(outerBL.size() + outerFL.size());
  for ( ConstBDLI bl = outerBL.begin(); bl != outerBL.end(); bl++ ) 
    theOuterLayers.push_back(*bl);
  for ( ConstFDLI fl = outerFL.begin(); fl != outerFL.end(); fl++ ) 
    theOuterLayers.push_back(*fl);

  // sort the outer layers 
  sort(theOuterLayers.begin(), theOuterLayers.end(), TkLayerLess());
  sort(theOuterForwardLayers.begin(), theOuterForwardLayers.end(), TkLayerLess());
  sort(theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(), TkLayerLess());

}
SimpleForwardNavigableLayer::SimpleForwardNavigableLayer ( ForwardDetLayer detLayer,
const BDLC outerBL,
const BDLC allOuterBL,
const BDLC innerBL,
const BDLC allInnerBL,
const FDLC outerFL,
const FDLC allOuterFL,
const FDLC innerFL,
const FDLC allInnerFL,
const MagneticField field,
float  epsilon,
bool  checkCrossingSide = true 
)

Definition at line 49 of file SimpleForwardNavigableLayer.cc.

References outsideIn, python::multivaluedict::sort(), theAllInnerLayers, theAllOuterLayers, theInnerBarrelLayers, theInnerForwardLayers, theInnerLayers, theOuterBarrelLayers, theOuterForwardLayers, and theOuterLayers.

                                                     :
  SimpleNavigableLayer(field,epsilon,checkCrossingSide),
  areAllReachableLayersSet(true),
  theDetLayer(detLayer), 
  theOuterBarrelLayers(outerBL),
  theAllOuterBarrelLayers(allOuterBL),
  theInnerBarrelLayers(innerBL),
  theAllInnerBarrelLayers(allInnerBL),
  theOuterForwardLayers(outerFL),
  theAllOuterForwardLayers(allOuterFL),
  theInnerForwardLayers(innerFL),
  theAllInnerForwardLayers(allInnerFL),
  theOuterLayers(0), 
  theInnerLayers(0),
  theAllOuterLayers(0),
  theAllInnerLayers(0)
{
  
  // put barrel and forward layers together
  theOuterLayers.reserve(outerBL.size() + outerFL.size());
  for ( ConstBDLI bl = outerBL.begin(); bl != outerBL.end(); bl++ ) 
    theOuterLayers.push_back(*bl);
  for ( ConstFDLI fl = outerFL.begin(); fl != outerFL.end(); fl++ ) 
    theOuterLayers.push_back(*fl);

  theAllOuterLayers.reserve(allOuterBL.size() + allOuterFL.size());
  for ( ConstBDLI bl = allOuterBL.begin(); bl != allOuterBL.end(); bl++ )
    theAllOuterLayers.push_back(*bl);
  for ( ConstFDLI fl = allOuterFL.begin(); fl != allOuterFL.end(); fl++ )
    theAllOuterLayers.push_back(*fl);

  theInnerLayers.reserve(innerBL.size() + innerFL.size());
  for ( ConstBDLI bl = innerBL.begin(); bl != innerBL.end(); bl++ )
    theInnerLayers.push_back(*bl);
  for ( ConstFDLI fl = innerFL.begin(); fl != innerFL.end(); fl++ )
    theInnerLayers.push_back(*fl);

  theAllInnerLayers.reserve(allInnerBL.size() + allInnerFL.size());
  for ( ConstBDLI bl = allInnerBL.begin(); bl != allInnerBL.end(); bl++ )
    theAllInnerLayers.push_back(*bl);
  for ( ConstFDLI fl = allInnerFL.begin(); fl != allInnerFL.end(); fl++ )
    theAllInnerLayers.push_back(*fl);


  // sort the outer layers 
  sort(theOuterLayers.begin(), theOuterLayers.end(), TkLayerLess());
  sort(theInnerLayers.begin(), theInnerLayers.end(),TkLayerLess(outsideIn));
  sort(theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(), TkLayerLess());
  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(),TkLayerLess(outsideIn));
  sort(theOuterForwardLayers.begin(), theOuterForwardLayers.end(), TkLayerLess());
  sort(theInnerForwardLayers.begin(), theInnerForwardLayers.end(),TkLayerLess(outsideIn));

  sort(theAllOuterLayers.begin(), theAllOuterLayers.end(), TkLayerLess());
  sort(theAllInnerLayers.begin(), theAllInnerLayers.end(),TkLayerLess(outsideIn));

}

Member Function Documentation

vector< const DetLayer * > SimpleForwardNavigableLayer::compatibleLayers ( NavigationDirection  direction) const [virtual]

Implements NavigableLayer.

Definition at line 202 of file SimpleForwardNavigableLayer.cc.

References areAllReachableLayersSet, insideOut, query::result, theAllInnerLayers, and theAllOuterLayers.

Referenced by compatibleLayers().

{
  if( !areAllReachableLayersSet ){
    edm::LogError("TkNavigation") << "ERROR: compatibleLayers() method used without all reachableLayers are set" ;
    throw DetLayerException("compatibleLayers() method used without all reachableLayers are set"); 
  }

  vector<const DetLayer*> result;

  if ( dir == insideOut ) {
    return theAllOuterLayers;
  }
  else {
    return theAllInnerLayers;
  }
  return result;

}
vector< const DetLayer * > SimpleForwardNavigableLayer::compatibleLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const [virtual]

Reimplemented from NavigableLayer.

Definition at line 222 of file SimpleForwardNavigableLayer.cc.

References areAllReachableLayersSet, compatibleLayers(), FreeTrajectoryState::hasError(), FreeTrajectoryState::momentum(), oppositeToMomentum, FreeTrajectoryState::parameters(), FreeTrajectoryState::position(), query::result, theAllInnerBarrelLayers, theAllInnerForwardLayers, theAllInnerLayers, theAllOuterBarrelLayers, theAllOuterForwardLayers, theAllOuterLayers, SimpleNavigableLayer::wellInside(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
  if( !areAllReachableLayersSet ){
    int counter = 0;
    return SimpleNavigableLayer::compatibleLayers(fts,dir,counter);
    //    edm::LogError("TkNavigation") << "ERROR: compatibleLayers() method used without all reachableLayers are set" ;
    //    throw DetLayerException("compatibleLayers() method used without all reachableLayers are set"); 
  }

  vector<const DetLayer*> result;
  FreeTrajectoryState ftsWithoutErrors = (fts.hasError()) ?
    FreeTrajectoryState(fts.parameters()) : fts;

  //establish whether the tracks is crossing the tracker from outer layers to inner ones 
  //or from inner to outer.
  //bool isInOutTrack  = (fts.position().basicVector().dot(fts.momentum().basicVector())>0) ? 1 : 0;
/*  float zpos = fts.position().z();
  bool isInOutTrack = fts.momentum().z()*zpos>0;
  
  //establish whether inner or outer layers are crossed after propagation, according
  //to BOTH propagationDirection AND track momentum
  bool dirOppositeXORisInOutTrack = ( !(dir == oppositeToMomentum) && isInOutTrack) || ((dir == oppositeToMomentum) && !isInOutTrack);

  if ( dirOppositeXORisInOutTrack ) {
    wellInside(ftsWithoutErrors, dir, theAllOuterLayers, result);
  }
  else { // !dirOppositeXORisInOutTrack
    wellInside(ftsWithoutErrors, dir, theAllInnerLayers, result);
  }
*/

  float zpos = fts.position().z();
  bool isInOutTrackFWD = fts.momentum().z()*zpos>0;
  GlobalVector transversePosition(fts.position().x(), fts.position().y(), 0);
  bool isInOutTrackBarrel  = (transversePosition.dot(fts.momentum())>0) ? 1 : 0;

  //establish whether inner or outer layers are crossed after propagation, according
  //to BOTH propagationDirection AND track momentum
  bool dirOppositeXORisInOutTrackBarrel = ( !(dir == oppositeToMomentum) && isInOutTrackBarrel) || ( (dir == oppositeToMomentum) && !isInOutTrackBarrel);
  bool dirOppositeXORisInOutTrackFWD = ( !(dir == oppositeToMomentum) && isInOutTrackFWD) || ( (dir == oppositeToMomentum) && !isInOutTrackFWD);
  //bool dirOppositeXORisInOutTrack = ( !(dir == oppositeToMomentum) && isInOutTrack) || ( (dir == oppositeToMomentum) && !isInOutTrack);

  if ( dirOppositeXORisInOutTrackFWD && dirOppositeXORisInOutTrackBarrel ) { //standard tracks

    //wellInside(ftsWithoutErrors, dir, theOuterForwardLayers.begin(), theOuterForwardLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theAllOuterLayers, result);

  }
  else if (!dirOppositeXORisInOutTrackFWD && !dirOppositeXORisInOutTrackBarrel){ // !dirOppositeXORisInOutTrack
  
    //wellInside(ftsWithoutErrors, dir, theInnerForwardLayers.begin(), theInnerForwardLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theAllInnerLayers, result);
  
  } else if (!dirOppositeXORisInOutTrackFWD && dirOppositeXORisInOutTrackBarrel ) {
        
    wellInside(ftsWithoutErrors, dir, theAllInnerForwardLayers.begin(), theAllInnerForwardLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theAllOuterBarrelLayers.begin(), theAllOuterBarrelLayers.end(), result);
  
  } else { 
  
    wellInside(ftsWithoutErrors, dir, theAllInnerBarrelLayers.begin(), theAllInnerBarrelLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theAllOuterForwardLayers.begin(), theAllOuterForwardLayers.end(), result);

  }
  return result;
}
DetLayer * SimpleForwardNavigableLayer::detLayer ( ) const [virtual]

Implements NavigableLayer.

Definition at line 291 of file SimpleForwardNavigableLayer.cc.

References theDetLayer.

{ return theDetLayer; }
vector< const DetLayer * > SimpleForwardNavigableLayer::nextLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const [virtual]

Implements NavigableLayer.

Definition at line 138 of file SimpleForwardNavigableLayer.cc.

References FreeTrajectoryState::hasError(), FreeTrajectoryState::momentum(), oppositeToMomentum, FreeTrajectoryState::parameters(), FreeTrajectoryState::position(), query::result, theInnerBarrelLayers, theInnerForwardLayers, theInnerLayers, theOuterBarrelLayers, theOuterForwardLayers, theOuterLayers, SimpleNavigableLayer::wellInside(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
  // This method contains the sequence in which the layers are tested.
  // The iteration stops as soon as a layer contains the propagated state
  // within epsilon

  vector<const DetLayer*> result;

  FreeTrajectoryState ftsWithoutErrors = (fts.hasError()) ?
    FreeTrajectoryState(fts.parameters()) : fts;

  //establish whether the tracks is crossing the tracker from outer layers to inner ones 
  //or from inner to outer
  //bool isInOutTrack  = (fts.position().basicVector().dot(fts.momentum().basicVector())>0) ? 1 : 0;
  float zpos = fts.position().z();
  bool isInOutTrackFWD = fts.momentum().z()*zpos>0;
  GlobalVector transversePosition(fts.position().x(), fts.position().y(), 0);
  bool isInOutTrackBarrel  = (transversePosition.dot(fts.momentum())>0) ? 1 : 0;        

  //establish whether inner or outer layers are crossed after propagation, according
  //to BOTH propagationDirection AND track momentum
  bool dirOppositeXORisInOutTrackBarrel = ( !(dir == oppositeToMomentum) && isInOutTrackBarrel) || ( (dir == oppositeToMomentum) && !isInOutTrackBarrel);
  bool dirOppositeXORisInOutTrackFWD = ( !(dir == oppositeToMomentum) && isInOutTrackFWD) || ( (dir == oppositeToMomentum) && !isInOutTrackFWD);
  //bool dirOppositeXORisInOutTrack = ( !(dir == oppositeToMomentum) && isInOutTrack) || ( (dir == oppositeToMomentum) && !isInOutTrack);

  if ( dirOppositeXORisInOutTrackFWD && dirOppositeXORisInOutTrackBarrel ) { //standard tracks

    //wellInside(ftsWithoutErrors, dir, theOuterForwardLayers.begin(), theOuterForwardLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theOuterLayers, result);

  }
  else if (!dirOppositeXORisInOutTrackFWD && !dirOppositeXORisInOutTrackBarrel){ // !dirOppositeXORisInOutTrack

    //wellInside(ftsWithoutErrors, dir, theInnerForwardLayers.begin(), theInnerForwardLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theInnerLayers, result);

  } else if (!dirOppositeXORisInOutTrackFWD && dirOppositeXORisInOutTrackBarrel ) {
    wellInside(ftsWithoutErrors, dir, theInnerForwardLayers.begin(), theInnerForwardLayers.end(), result);
    wellInside(ftsWithoutErrors, dir, theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(), result);                

  } else {
    wellInside(ftsWithoutErrors, dir, theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), result);        
    wellInside(ftsWithoutErrors, dir, theOuterForwardLayers.begin(), theOuterForwardLayers.end(), result);

  }
/*
  if ( dirOppositeXORisInOutTrackBarrel ) {

    wellInside(ftsWithoutErrors, dir, theOuterBarrelLayers.begin(), theOuterBarrelLayers.end(), result);

  }
  else { // !dirOppositeXORisInOutTrack

    wellInside(ftsWithoutErrors, dir, theInnerBarrelLayers.begin(),theInnerBarrelLayers.end(), result);

  }
*/

  return result;
}
vector< const DetLayer * > SimpleForwardNavigableLayer::nextLayers ( NavigationDirection  direction) const [virtual]

Implements NavigableLayer.

Definition at line 120 of file SimpleForwardNavigableLayer.cc.

References insideOut, query::result, theInnerLayers, and theOuterLayers.

{
  vector<const DetLayer*> result;
  
  // the order is the one in which layers
  // should be checked for a reasonable trajectory

  if ( dir == insideOut ) {
    return theOuterLayers;
  }
  else {
    return theInnerLayers;
  }

  return result;
}
void SimpleForwardNavigableLayer::setAdditionalLink ( DetLayer additional,
NavigationDirection  direction = insideOut 
) [virtual]

Implements SimpleNavigableLayer.

Definition at line 319 of file SimpleForwardNavigableLayer.cc.

References insideOut, theAllInnerBarrelLayers, theAllInnerForwardLayers, theAllInnerLayers, theAllOuterBarrelLayers, theAllOuterForwardLayers, theAllOuterLayers, theInnerBarrelLayers, theInnerForwardLayers, theInnerLayers, theOuterBarrelLayers, theOuterForwardLayers, and theOuterLayers.

Referenced by CosmicNavigationSchool::buildAdditionalForwardLinks().

                                                                                                      {
  ForwardDetLayer* fadditional = dynamic_cast<ForwardDetLayer*>(additional);
  BarrelDetLayer*  badditional = dynamic_cast<BarrelDetLayer*>(additional);
  if (badditional){
        if (direction==insideOut){
                theOuterBarrelLayers.push_back(badditional);
                theAllOuterBarrelLayers.push_back(badditional);
                theOuterLayers.push_back(badditional);
                theAllOuterLayers.push_back(badditional);
                return;
        }
        theInnerBarrelLayers.push_back(badditional);
        theAllInnerBarrelLayers.push_back(badditional);
        theInnerLayers.push_back(badditional);
        theAllInnerLayers.push_back(badditional);
        return;
  } else if (fadditional){
        if (direction==insideOut){
                theOuterForwardLayers.push_back(fadditional);
                theAllOuterForwardLayers.push_back(fadditional);        
                theOuterLayers.push_back(badditional);
                theAllOuterLayers.push_back(badditional);
                return;
        }
        theInnerForwardLayers.push_back(fadditional);
        theAllInnerForwardLayers.push_back(fadditional);
        theInnerLayers.push_back(badditional);
        theAllInnerLayers.push_back(badditional);
        return;
  }
  edm::LogError("TkNavigation") << "trying to add neither a ForwardDetLayer nor a BarrelDetLayer";
  return;
} 
void SimpleForwardNavigableLayer::setDetLayer ( DetLayer dl) [virtual]

Implements NavigableLayer.

Definition at line 293 of file SimpleForwardNavigableLayer.cc.

References benchmark_cfg::cerr.

                                                           {
  cerr << "Warning: SimpleForwardNavigableLayer::setDetLayer called."
       << endl << "This should never happen!" << endl;
}
void SimpleForwardNavigableLayer::setInwardLinks ( const BDLC innerBL,
const FDLC innerFL,
TkLayerLess  sorter = TkLayerLess(outsideIn) 
) [virtual]

Implements SimpleNavigableLayer.

Definition at line 298 of file SimpleForwardNavigableLayer.cc.

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

                                                                     {

  theInnerBarrelLayers  = innerBL;
  theInnerForwardLayers = innerFL;

  theInnerLayers.clear();
  theInnerLayers.reserve(innerBL.size() + innerFL.size());
  for ( ConstBDLI bl = innerBL.begin(); bl != innerBL.end(); bl++ )
    theInnerLayers.push_back(*bl);
  for ( ConstFDLI fl = innerFL.begin(); fl != innerFL.end(); fl++ )
    theInnerLayers.push_back(*fl);

  // sort the inner layers
  sort(theInnerLayers.begin(), theInnerLayers.end(),sorter);
  sort(theInnerForwardLayers.begin(), theInnerForwardLayers.end(),sorter);
  sort(theInnerBarrelLayers.begin(), theInnerBarrelLayers.end(), sorter);

}

Member Data Documentation

Definition at line 56 of file SimpleForwardNavigableLayer.h.

Referenced by compatibleLayers().

Definition at line 62 of file SimpleForwardNavigableLayer.h.

Referenced by compatibleLayers(), and setAdditionalLink().

Definition at line 66 of file SimpleForwardNavigableLayer.h.

Referenced by compatibleLayers(), and setAdditionalLink().

Definition at line 60 of file SimpleForwardNavigableLayer.h.

Referenced by compatibleLayers(), and setAdditionalLink().

Definition at line 64 of file SimpleForwardNavigableLayer.h.

Referenced by compatibleLayers(), and setAdditionalLink().

Definition at line 58 of file SimpleForwardNavigableLayer.h.

Referenced by detLayer().