CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DirectMuonNavigation Class Reference

#include <DirectMuonNavigation.h>

List of all members.

Public Member Functions

DirectMuonNavigationclone () const
std::vector< const DetLayer * > compatibleEndcapLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection) const
 DirectMuonNavigation (const edm::ESHandle< MuonDetLayerGeometry > &, const edm::ParameterSet &)
 DirectMuonNavigation (const edm::ESHandle< MuonDetLayerGeometry > &)
 ~DirectMuonNavigation ()

Private Member Functions

bool checkCompatible (const FreeTrajectoryState &fts, const BarrelDetLayer *) const
bool checkCompatible (const FreeTrajectoryState &fts, const ForwardDetLayer *) const
void inOutBackward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void inOutBarrel (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void inOutForward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void outInBackward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void outInBarrel (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
void outInForward (const FreeTrajectoryState &, std::vector< const DetLayer * > &) const
bool outward (const FreeTrajectoryState &fts) const

Private Attributes

float epsilon_
bool theBarrelFlag
bool theEndcapFlag
edm::ESHandle
< MuonDetLayerGeometry
theMuonDetLayerGeometry

Detailed Description

Definition at line 22 of file DirectMuonNavigation.h.


Constructor & Destructor Documentation

DirectMuonNavigation::DirectMuonNavigation ( const edm::ESHandle< MuonDetLayerGeometry > &  muonLayout)

Definition at line 21 of file DirectMuonNavigation.cc.

Referenced by clone().

                                                                                              : theMuonDetLayerGeometry(muonLayout), epsilon_(100.), theEndcapFlag(true), theBarrelFlag(true) {
}
DirectMuonNavigation::DirectMuonNavigation ( const edm::ESHandle< MuonDetLayerGeometry > &  muonLayout,
const edm::ParameterSet par 
)

Definition at line 24 of file DirectMuonNavigation.cc.

                                                                                                                          : theMuonDetLayerGeometry(muonLayout), epsilon_(100.), theEndcapFlag(par.getParameter<bool>("Endcap")), theBarrelFlag(par.getParameter<bool>("Barrel")) {

}
DirectMuonNavigation::~DirectMuonNavigation ( ) [inline]

Definition at line 36 of file DirectMuonNavigation.h.

{}

Member Function Documentation

bool DirectMuonNavigation::checkCompatible ( const FreeTrajectoryState fts,
const BarrelDetLayer dl 
) const [private]

Definition at line 206 of file DirectMuonNavigation.cc.

References BoundSurface::bounds(), epsilon_, Bounds::length(), FreeTrajectoryState::momentum(), outward(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), CosmicsPD_Skims::radius, Cylinder::radius(), submit::rm, slope, BarrelDetLayer::specificSurface(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by inOutBackward(), inOutBarrel(), inOutForward(), outInBackward(), outInBarrel(), and outInForward().

                                                                                                        {

  float z0 = fts.position().z();
  float r0 = fts.position().perp();
  float zm = fts.momentum().z();
  float rm = fts.momentum().perp();
  float slope = zm/rm; 
  if (!outward(fts) ) slope = -slope;
  const BoundCylinder bc = dl->specificSurface();
  float radius = bc.radius();
  float length = bc.bounds().length()/2.;

  float z1 = slope*(radius - r0) + z0;
  return ( fabs(z1) <= fabs(length)+epsilon_ );

}
bool DirectMuonNavigation::checkCompatible ( const FreeTrajectoryState fts,
const ForwardDetLayer dl 
) const [private]

Definition at line 223 of file DirectMuonNavigation.cc.

References epsilon_, BoundDisk::innerRadius(), FreeTrajectoryState::momentum(), BoundDisk::outerRadius(), outward(), PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), FreeTrajectoryState::position(), submit::rm, slope, ForwardDetLayer::specificSurface(), PV3DBase< T, PVType, FrameType >::z(), and z.

                                                                                                         {

  float z0 = fts.position().z();
  float r0 = fts.position().perp();
  float zm = fts.momentum().z();
  float rm = fts.momentum().perp();
  float slope = rm/zm; 

  if (!outward(fts) ) slope = -slope;

  const BoundDisk bd = dl->specificSurface();

  float outRadius = bd.outerRadius();
  float inRadius = bd.innerRadius();
  float z = bd.position().z();

  float r1 = slope*(z - z0) + r0;
  return (r1 >= inRadius-epsilon_ && r1 <= outRadius+epsilon_);

}
DirectMuonNavigation* DirectMuonNavigation::clone ( void  ) const [inline]

Definition at line 31 of file DirectMuonNavigation.h.

References DirectMuonNavigation().

                                        {
      return new DirectMuonNavigation(*this);
    }
vector< const DetLayer * > DirectMuonNavigation::compatibleEndcapLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const

Definition at line 83 of file DirectMuonNavigation.cc.

References alongMomentum, inOutForward(), FreeTrajectoryState::momentum(), oppositeToMomentum, outInBackward(), convertSQLitetoXML_cfg::output, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CosmicMuonTrajectoryBuilder::build(), and CosmicMuonTrajectoryBuilder::trajectories().

                                                                               {

  float zm = fts.momentum().z();

  vector<const DetLayer*> output;

  // collect all endcap layers on 2 sides
  outInBackward(fts,output);
  inOutForward(fts,output);

  // check direction FTS to get a correct order of DetLayers
  if ( ( zm > 0 && dir == oppositeToMomentum ) || 
       ( zm < 0 && dir == alongMomentum )  )
           std::reverse(output.begin(),output.end());

  return output;
}
vector< const DetLayer * > DirectMuonNavigation::compatibleLayers ( const FreeTrajectoryState fts,
PropagationDirection  timeDirection 
) const

Definition at line 31 of file DirectMuonNavigation.cc.

References inOutBackward(), inOutBarrel(), inOutForward(), FreeTrajectoryState::momentum(), oppositeToMomentum, outInBackward(), outInBarrel(), outInForward(), convertSQLitetoXML_cfg::output, outward(), FreeTrajectoryState::position(), theBarrelFlag, theEndcapFlag, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CosmicMuonTrajectoryBuilder::build(), GeometricSearchDet::compatibleDets(), DTChamberEfficiency::compatibleLayers(), StandAloneMuonFilter::compatibleLayers(), StandAloneMuonTrajectoryBuilder::propagateTheSeedTSOS(), and CosmicMuonTrajectoryBuilder::trajectories().

                                                                         {

  float z0 = fts.position().z();
  float zm = fts.momentum().z();

  bool inOut = outward(fts);

  vector<const DetLayer*> output;

  // check direction and position of FTS to get a correct order of DetLayers

  if (inOut) { 
     if ((zm * z0) >= 0) {
        if (theBarrelFlag) inOutBarrel(fts,output);
        if (theEndcapFlag) {
           if ( z0 >= 0 ) inOutForward(fts,output);
           else inOutBackward(fts,output);
        } 
      } else {
        if (theEndcapFlag) {
        if ( z0 >= 0 ) outInForward(fts,output);
           else outInBackward(fts,output);
        }
        if (theBarrelFlag) inOutBarrel(fts,output);
      } 
   } else {
     if ((zm * z0) >= 0) {
        if (theBarrelFlag) outInBarrel(fts,output);
        if (theEndcapFlag) {
          if ( z0 >= 0 ) inOutForward(fts,output);
          else inOutBackward(fts,output);
        }
      } else {
        if (theEndcapFlag) {
          if ( z0 >= 0 ) outInForward(fts,output);
          else outInBackward(fts,output);
        }
        if (theBarrelFlag) outInBarrel(fts,output);
      } 
   }

  if ( dir == oppositeToMomentum ) std::reverse(output.begin(),output.end());

  return output;
}
void DirectMuonNavigation::inOutBackward ( const FreeTrajectoryState ,
std::vector< const DetLayer * > &   
) const [private]

Definition at line 171 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

                                                                                                              {
  bool cont = false;
  const vector<DetLayer*>& backward = theMuonDetLayerGeometry->allBackwardLayers();

  for (vector<DetLayer*>::const_iterator iter_E = backward.begin(); iter_E != backward.end(); 
       iter_E++){
      if( cont ) output.push_back((*iter_E));
      else if ( checkCompatible(fts,dynamic_cast<ForwardDetLayer*>(*iter_E))) {
        output.push_back((*iter_E));
        cont = true;
      }
   }
}
void DirectMuonNavigation::inOutBarrel ( const FreeTrajectoryState ,
std::vector< const DetLayer * > &   
) const [private]

Definition at line 102 of file DirectMuonNavigation.cc.

References Reference_intrackfit_cff::barrel, checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

                                                                                                            {

  bool cont = false;
  const vector<DetLayer*>& barrel = theMuonDetLayerGeometry->allBarrelLayers();

  for (vector<DetLayer*>::const_iterator iter_B = barrel.begin(); iter_B != barrel.end(); iter_B++){

      if( cont ) output.push_back((*iter_B));
      else if ( checkCompatible(fts,dynamic_cast<const BarrelDetLayer*>(*iter_B))) {
      output.push_back((*iter_B));
      cont = true;
      }
  }
}
void DirectMuonNavigation::inOutForward ( const FreeTrajectoryState ,
std::vector< const DetLayer * > &   
) const [private]

Definition at line 138 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleEndcapLayers(), and compatibleLayers().

                                                                                                             {

  const vector<DetLayer*>& forward = theMuonDetLayerGeometry->allForwardLayers();
  bool cont = false;
  for (vector<DetLayer*>::const_iterator iter_E = forward.begin(); iter_E != forward.end(); 
         iter_E++){
      if( cont ) output.push_back((*iter_E));
      else if ( checkCompatible(fts,dynamic_cast<ForwardDetLayer*>(*iter_E))) {
        output.push_back((*iter_E));
        cont = true;
      }
    }
}
void DirectMuonNavigation::outInBackward ( const FreeTrajectoryState ,
std::vector< const DetLayer * > &   
) const [private]

Definition at line 185 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleEndcapLayers(), and compatibleLayers().

                                                                                                              {

  bool cont = false;
  const vector<DetLayer*>& backward = theMuonDetLayerGeometry->allBackwardLayers();

  vector<DetLayer*>::const_iterator rbegin = backward.end();
  rbegin--;
  vector<DetLayer*>::const_iterator rend = backward.begin();
  rend--;
  for (vector<DetLayer*>::const_iterator iter_E = rbegin; iter_E != rend;
       iter_E--){
      if( cont ) output.push_back((*iter_E));
      else if ( checkCompatible(fts,dynamic_cast<ForwardDetLayer*>(*iter_E))) {
        output.push_back((*iter_E));
        cont = true;
      }
   }

}
void DirectMuonNavigation::outInBarrel ( const FreeTrajectoryState ,
std::vector< const DetLayer * > &   
) const [private]

Definition at line 118 of file DirectMuonNavigation.cc.

References Reference_intrackfit_cff::barrel, checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

                                                                                                            {

// default barrel layers are in out, reverse order 
  const vector<DetLayer*>& barrel = theMuonDetLayerGeometry->allBarrelLayers();

  bool cont = false;
  vector<DetLayer*>::const_iterator rbegin = barrel.end(); 
  rbegin--;
  vector<DetLayer*>::const_iterator rend = barrel.begin();
  rend--;

  for (vector<DetLayer*>::const_iterator iter_B = rbegin; iter_B != rend; iter_B--){
      if( cont ) output.push_back((*iter_B));
      else if ( checkCompatible(fts,dynamic_cast<BarrelDetLayer*>(*iter_B))) {
      output.push_back((*iter_B));
      cont = true;
      }
  }
}
void DirectMuonNavigation::outInForward ( const FreeTrajectoryState ,
std::vector< const DetLayer * > &   
) const [private]

Definition at line 152 of file DirectMuonNavigation.cc.

References checkCompatible(), cont, and theMuonDetLayerGeometry.

Referenced by compatibleLayers().

                                                                                                             {
// default forward layers are in out, reverse order

  bool cont = false;
  const vector<DetLayer*>& forward = theMuonDetLayerGeometry->allForwardLayers();
  vector<DetLayer*>::const_iterator rbegin = forward.end();
  rbegin--;
  vector<DetLayer*>::const_iterator rend = forward.begin();
  rend--;
  for (vector<DetLayer*>::const_iterator iter_E = rbegin; iter_E != rend;
         iter_E--){
      if( cont ) output.push_back((*iter_E));
      else if ( checkCompatible(fts,dynamic_cast<ForwardDetLayer*>(*iter_E))) {
        output.push_back((*iter_E));
        cont = true;
      }
    }
}
bool DirectMuonNavigation::outward ( const FreeTrajectoryState fts) const [private]

Definition at line 244 of file DirectMuonNavigation.cc.

References FreeTrajectoryState::momentum(), FreeTrajectoryState::position(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by checkCompatible(), and compatibleLayers().

                                                                       {
 
//  return (fts.position().basicVector().dot(fts.momentum().basicVector())>0);

  float x0 = fts.position().x();
  float y0 = fts.position().y();

  float xm = fts.momentum().x();
  float ym = fts.momentum().y();

  return ((x0 * xm + y0 * ym ) > 0);


}

Member Data Documentation

Definition at line 63 of file DirectMuonNavigation.h.

Referenced by checkCompatible().

Definition at line 65 of file DirectMuonNavigation.h.

Referenced by compatibleLayers().

Definition at line 64 of file DirectMuonNavigation.h.

Referenced by compatibleLayers().