CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

MuRingForwardDoubleLayer Class Reference

#include <MuRingForwardDoubleLayer.h>

Inheritance diagram for MuRingForwardDoubleLayer:
RingedForwardLayer ForwardDetLayer DetLayer GeometricSearchDet

List of all members.

Public Member Functions

const MuRingForwardLayerbackLayer () const
virtual const std::vector
< const GeomDet * > & 
basicComponents () const
virtual std::pair< bool,
TrajectoryStateOnSurface
compatible (const TrajectoryStateOnSurface &, const Propagator &, const MeasurementEstimator &) const
virtual std::vector< DetWithStatecompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
virtual const std::vector
< const GeometricSearchDet * > & 
components () const
 Returns basic components, if any.
const MuRingForwardLayerfrontLayer () const
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
virtual bool hasGroups () const
bool isCrack (const GlobalPoint &gp) const
bool isInsideOut (const TrajectoryStateOnSurface &tsos) const
 MuRingForwardDoubleLayer (const std::vector< const ForwardDetRing * > &frontRings, const std::vector< const ForwardDetRing * > &backRings)
 Constructor, takes ownership of pointers.
virtual const std::vector
< const ForwardDetRing * > & 
rings () const
 Return the vector of rings.
void selfTest () const
virtual SubDetector subDetector () const
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
virtual ~MuRingForwardDoubleLayer ()

Protected Member Functions

virtual BoundDiskcomputeSurface ()

Private Attributes

MuRingForwardLayer theBackLayer
std::vector< const GeomDet * > theBasicComponents
std::vector< const
GeometricSearchDet * > 
theComponents
MuRingForwardLayer theFrontLayer
std::vector< const
ForwardDetRing * > 
theRings

Detailed Description

A plane composed two layers of disks. Represents forward muon CSC stations.

Date:
2007/12/19 09:48:34
Revision:
1.2
Author:
R. Wilkinson

Definition at line 21 of file MuRingForwardDoubleLayer.h.


Constructor & Destructor Documentation

MuRingForwardDoubleLayer::MuRingForwardDoubleLayer ( const std::vector< const ForwardDetRing * > &  frontRings,
const std::vector< const ForwardDetRing * > &  backRings 
)

Constructor, takes ownership of pointers.

Definition at line 23 of file MuRingForwardDoubleLayer.cc.

References basicComponents(), computeSurface(), BoundDisk::innerRadius(), LogTrace, metname, BoundDisk::outerRadius(), GloballyPositioned< T >::position(), selfTest(), ForwardDetLayer::setSurface(), ForwardDetLayer::specificSurface(), theBasicComponents, theComponents, theRings, and PV3DBase< T, PVType, FrameType >::z().

                                                                                       :

  theFrontLayer(frontRings),
  theBackLayer(backRings),
  theRings(frontRings), // add back later
  theComponents(),
  theBasicComponents()
{

  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer";

  theRings.insert(theRings.end(), backRings.begin(), backRings.end());
  theComponents = std::vector <const GeometricSearchDet*>(theRings.begin(), theRings.end());

  // Cache chamber pointers (the basic components_)
  // and find extension in R and Z
  for (vector<const ForwardDetRing*>::const_iterator it=theRings.begin();
       it!=theRings.end(); it++) {
    vector<const GeomDet*> tmp2 = (*it)->basicComponents();
    theBasicComponents.insert(theBasicComponents.end(),tmp2.begin(),tmp2.end());
  }  
  
  setSurface(computeSurface());
   
  LogTrace(metname) << "Constructing MuRingForwardDoubleLayer: "
                    << basicComponents().size() << " Dets " 
                    << theRings.size() << " Rings "
                    << " Z: " << specificSurface().position().z()
                    << " R1: " << specificSurface().innerRadius()
                    << " R2: " << specificSurface().outerRadius();

  selfTest();
}
virtual MuRingForwardDoubleLayer::~MuRingForwardDoubleLayer ( ) [inline, virtual]

Definition at line 29 of file MuRingForwardDoubleLayer.h.

{}

Member Function Documentation

const MuRingForwardLayer* MuRingForwardDoubleLayer::backLayer ( ) const [inline]

Definition at line 71 of file MuRingForwardDoubleLayer.h.

References theBackLayer.

{return &theBackLayer;}
virtual const std::vector<const GeomDet*>& MuRingForwardDoubleLayer::basicComponents ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 34 of file MuRingForwardDoubleLayer.h.

References theBasicComponents.

Referenced by MuRingForwardDoubleLayer().

std::pair< bool, TrajectoryStateOnSurface > MuRingForwardDoubleLayer::compatible ( const TrajectoryStateOnSurface ts,
const Propagator ,
const MeasurementEstimator  
) const [virtual]

tests the geometrical compatibility of the Det with the predicted state. The FreeTrajectoryState argument is propagated to the Det surface using the Propagator argument. The resulting TrajectoryStateOnSurface is tested for compatibility with the surface bounds. If compatible, a std::pair< true, propagatedState> is returned. If the propagation fails, or if the state is not compatible, a std::pair< false, propagatedState> is returned.

Reimplemented from ForwardDetLayer.

Definition at line 90 of file MuRingForwardDoubleLayer.cc.

References BoundSurface::bounds(), deltaR(), TrajectoryStateOnSurface::hasError(), SimpleDiskBounds::inside(), insideOut, isInsideOut(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), LogTrace, metname, LocalTrajectoryError::positionError(), Propagator::propagate(), ForwardDetLayer::rmax(), ForwardDetLayer::rmin(), ForwardDetLayer::specificSurface(), mathSSE::sqrt(), ForwardDetLayer::surface(), funct::tan(), theBackLayer, theFrontLayer, PV3DBase< T, PVType, FrameType >::theta(), Bounds::thickness(), tmp, LocalError::xx(), LocalError::yy(), ForwardDetLayer::zmax(), ForwardDetLayer::zmin(), and zPos.

Referenced by compatibleDets().

{
  // mostly copied from ForwardDetLayer, except propagates to closest surface,
  // not to center
  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer";

  bool insideOut = isInsideOut(startingState);
  const MuRingForwardLayer & closerLayer = (insideOut) ? theFrontLayer : theBackLayer;
  LogTrace("Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer") 
    << "MuRingForwardDoubleLayer::compatible is assuming inside-out direction: "<< insideOut;


  //std::pair<bool, TrajectoryStateOnSurface> result 
  //  = closerLayer.compatible(startingState, prop, est);
  //if(!result.first)
  // {
  //  result = furtherLayer.compatible(startingState, prop, est);
  //}


  TrajectoryStateOnSurface myState = prop.propagate( startingState, closerLayer.specificSurface());
  if ( !myState.isValid()) return make_pair( false, myState);

  // take into account the thickness of the layer
  float deltaR = surface().bounds().thickness()/2. *
    fabs( tan( myState.localDirection().theta()));

  // take into account the error on the predicted state
  const float nSigma = 3.;
  if (myState.hasError()) {
    LocalError err = myState.localError().positionError();
    // ignore correlation for the moment...
    deltaR += nSigma * sqrt(err.xx() + err.yy());
  }

  float zPos = (zmax()+zmin())/2.;
  SimpleDiskBounds tmp( rmin()-deltaR, rmax()+deltaR,
                        zmin()-zPos, zmax()-zPos);

  return make_pair( tmp.inside(myState.localPosition()), myState);
}
vector< GeometricSearchDet::DetWithState > MuRingForwardDoubleLayer::compatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const [virtual]

Returns all Dets compatible with a trajectory state according to the estimator est. The startingState should be propagated to the surface of each compatible Det using the Propagator passed as an argument. The default implementation should be overridden in dets with specific surface types to avoid propagation to a generic Surface

Reimplemented from GeometricSearchDet.

Definition at line 135 of file MuRingForwardDoubleLayer.cc.

References compatible(), groupedCompatibleDets(), LogTrace, metname, and query::result.

                                                                          {
  vector<DetWithState> result;
  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer";
  pair<bool, TrajectoryStateOnSurface> compat =
    compatible(startingState, prop, est);

  if (!compat.first) {

    LogTrace(metname) << "     MuRingForwardDoubleLayer::compatibleDets: not compatible"
                      << " (should not have been selected!)";
    return result;
  }


  TrajectoryStateOnSurface& tsos = compat.second;

   // standard implementation of compatibleDets() for class which have 
  // groupedCompatibleDets implemented.
  // This code should be moved in a common place intead of being 
  // copied many times.
  vector<DetGroup> vectorGroups = groupedCompatibleDets(tsos,prop,est);
  for(vector<DetGroup>::const_iterator itDG=vectorGroups.begin();
      itDG!=vectorGroups.end();itDG++){
    for(vector<DetGroupElement>::const_iterator itDGE=itDG->begin();
        itDGE!=itDG->end();itDGE++){
      result.push_back(DetWithState(itDGE->det(),itDGE->trajectoryState()));
    }
  }
  return result;  
} 
virtual const std::vector<const GeometricSearchDet*>& MuRingForwardDoubleLayer::components ( ) const [inline, virtual]

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 36 of file MuRingForwardDoubleLayer.h.

References theComponents.

{return theComponents;}
BoundDisk * MuRingForwardDoubleLayer::computeSurface ( ) [protected, virtual]

Reimplemented from ForwardDetLayer.

Definition at line 59 of file MuRingForwardDoubleLayer.cc.

References BoundSurface::bounds(), BoundDisk::innerRadius(), max(), min, BoundDisk::outerRadius(), pos, GloballyPositioned< T >::position(), ForwardDetLayer::rmax(), ForwardDetLayer::rmin(), makeMuonMisalignmentScenario::rot, ForwardDetLayer::specificSurface(), theBackLayer, theFrontLayer, Bounds::thickness(), PV3DBase< T, PVType, FrameType >::z(), ForwardDetLayer::zmax(), ForwardDetLayer::zmin(), and zPos.

Referenced by MuRingForwardDoubleLayer().

{
  const BoundDisk & frontDisk = theFrontLayer.specificSurface();
  const BoundDisk & backDisk  = theBackLayer.specificSurface();

  float rmin = min( frontDisk.innerRadius(), backDisk.innerRadius() );
  float rmax = max( frontDisk.outerRadius(), backDisk.outerRadius() );
  float zmin = frontDisk.position().z();
  float halfThickness = frontDisk.bounds().thickness()/2.;
  zmin = (zmin > 0) ? zmin-halfThickness : zmin+halfThickness;
  float zmax = backDisk.position().z();
  halfThickness = backDisk.bounds().thickness()/2.;
  zmax = (zmax > 0) ? zmax+halfThickness : zmax-halfThickness;
  float zPos = (zmax+zmin)/2.;
  PositionType pos(0.,0.,zPos);
  RotationType rot;

  return new BoundDisk( pos, rot,
                        SimpleDiskBounds( rmin, rmax,
                                          zmin-zPos, zmax-zPos));
}
const MuRingForwardLayer* MuRingForwardDoubleLayer::frontLayer ( ) const [inline]

Definition at line 70 of file MuRingForwardDoubleLayer.h.

References theFrontLayer.

{return &theFrontLayer;}
vector< DetGroup > MuRingForwardDoubleLayer::groupedCompatibleDets ( const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const [virtual]

Similar to compatibleDets(), but the compatible Dets are grouped in one or more groups. Dets are put in the same group if they are mutually exclusive for track crossing, i.e. a reconstructible track cannot cross more than one Det from a group. Pathological tracks (spirals etc.) can of course violate this rule.
The DetGroups are sorted in the sequence of crossing by a track. In order to define the direction of crossing the Propagator used in this method should have a defined direction() : either "alongMomentum" or "oppositeToMomentum" but not "anyDirection".
The three signatures of this method differ by the input trajectory state arguments: the starting state can be a TrajectoryStateOnSurface or a FreeTrajectoryState, and the state on this CompositeDet may be already known or not. The last two arguments are as for the method compatibleDets().
First signature: The first argument is a TrajectoryStateOnSurface, usually not on the surface of this CompositeDet.

Reimplemented from GeometricSearchDet.

Definition at line 170 of file MuRingForwardDoubleLayer.cc.

References MuRingForwardLayer::compatibleDets(), LogTrace, metname, query::result, theBackLayer, and theFrontLayer.

Referenced by compatibleDets().

                                                                                  {

  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer";
  vector<GeometricSearchDet::DetWithState> detWithStates1, detWithStates2;
  
  LogTrace(metname) << "groupedCompatibleDets are currently given always in inside-out order";
  // this should be fixed either in RecoMuon/MeasurementDet/MuonDetLayerMeasurements or
  // RecoMuon/DetLayers/MuRingForwardDoubleLayer
  // and removed the reverse operation in StandAloneMuonFilter::findBestMeasurements

  detWithStates1 = theFrontLayer.compatibleDets(startingState, prop, est);
  detWithStates2 = theBackLayer.compatibleDets(startingState, prop, est);    
  
  vector<DetGroup> result;
  if(!detWithStates1.empty()) result.push_back( DetGroup(detWithStates1) );
  if(!detWithStates2.empty()) result.push_back( DetGroup(detWithStates2) );
  LogTrace(metname) << "DoubleLayer Compatible dets: " << result.size();
  return result;
}
virtual bool MuRingForwardDoubleLayer::hasGroups ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 56 of file MuRingForwardDoubleLayer.h.

{return true;}
bool MuRingForwardDoubleLayer::isCrack ( const GlobalPoint gp) const

Definition at line 193 of file MuRingForwardDoubleLayer.cc.

References BoundDisk::innerRadius(), LogTrace, metname, BoundDisk::outerRadius(), PV3DBase< T, PVType, FrameType >::perp(), alignCSCRings::r, query::result, MuRingForwardLayer::rings(), ForwardDetRing::specificSurface(), and theBackLayer.

{
  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRingForwardDoubleLayer";
  // approximate
  bool result = false;
  double r = gp.perp();
  const std::vector<const ForwardDetRing*>& backRings = theBackLayer.rings(); 
  if(backRings.size() > 1)
  {
    const MuDetRing * innerRing = dynamic_cast<const MuDetRing *>(backRings[0]);
    const MuDetRing * outerRing = dynamic_cast<const MuDetRing *>(backRings[1]);
    assert(innerRing && outerRing);
    float crackInner = innerRing->specificSurface().outerRadius();
    float crackOuter = outerRing->specificSurface().innerRadius();
    LogTrace(metname)  << "In a crack:" << crackInner << " " << r << " " << crackOuter;
    if(r > crackInner && r < crackOuter) return true;
  }
  // non-overlapping rings
  //double phi = gp.phi().degrees();
  return result;
}
bool MuRingForwardDoubleLayer::isInsideOut ( const TrajectoryStateOnSurface tsos) const
virtual const std::vector<const ForwardDetRing*>& MuRingForwardDoubleLayer::rings ( ) const [inline, virtual]

Return the vector of rings.

Definition at line 66 of file MuRingForwardDoubleLayer.h.

References theRings.

{return theRings;}
void MuRingForwardDoubleLayer::selfTest ( ) const

Definition at line 216 of file MuRingForwardDoubleLayer.cc.

References MuRingForwardLayer::basicComponents(), theBackLayer, and theFrontLayer.

Referenced by MuRingForwardDoubleLayer().

{
  const std::vector<const GeomDet*>& frontDets = theFrontLayer.basicComponents();
  const std::vector<const GeomDet*>& backDets = theBackLayer.basicComponents();

  std::vector<const GeomDet*>::const_iterator frontItr = frontDets.begin(),
                                              lastFront = frontDets.end(),
                                              backItr = backDets.begin(),
                                              lastBack = backDets.end();

  // test that each front z is less than each back z
  for( ; frontItr != lastFront; ++frontItr)
  {
    float frontz = fabs( (**frontItr).surface().position().z() );
    for( ; backItr != lastBack; ++backItr)
    {
      float backz = fabs( (**backItr).surface().position().z() );
      assert(frontz < backz);
    }
  }
}
virtual SubDetector MuRingForwardDoubleLayer::subDetector ( ) const [inline, virtual]

The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)

Implements DetLayer.

Definition at line 60 of file MuRingForwardDoubleLayer.h.

References MuRingForwardLayer::subDetector(), and theBackLayer.


Member Data Documentation

Definition at line 81 of file MuRingForwardDoubleLayer.h.

Referenced by basicComponents(), and MuRingForwardDoubleLayer().

Definition at line 80 of file MuRingForwardDoubleLayer.h.

Referenced by components(), and MuRingForwardDoubleLayer().

std::vector<const ForwardDetRing*> MuRingForwardDoubleLayer::theRings [private]

Definition at line 79 of file MuRingForwardDoubleLayer.h.

Referenced by MuRingForwardDoubleLayer(), and rings().