CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuRodBarrelLayer Class Reference

#include <MuRodBarrelLayer.h>

Inheritance diagram for MuRodBarrelLayer:
RodBarrelLayer BarrelDetLayer DetLayer GeometricSearchDet

List of all members.

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () 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.
virtual std::vector< DetGroupgroupedCompatibleDets (const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
virtual bool hasGroups () const
 MuRodBarrelLayer (std::vector< const DetRod * > &rods)
 Constructor, takes ownership of pointers.
virtual const std::vector
< const DetRod * > & 
rods () const
 Return the vector of rods.
virtual SubDetector subDetector () const
 The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
virtual ~MuRodBarrelLayer ()

Private Member Functions

float xError (const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const

Private Attributes

bool isOverlapping
std::vector< const GeomDet * > theBasicComps
BaseBinFinder< double > * theBinFinder
std::vector< const
GeometricSearchDet * > 
theComponents
std::vector< const DetRod * > theRods

Detailed Description

A cylinder composed of rods. Represents barrel muon DT/RPC stations.

Date:
2006/07/25 17:10:27
Revision:
1.8
Author:
N. Amapane - INFN Torino

Definition at line 19 of file MuRodBarrelLayer.h.


Constructor & Destructor Documentation

MuRodBarrelLayer::MuRodBarrelLayer ( std::vector< const DetRod * > &  rods)

Constructor, takes ownership of pointers.

Definition at line 28 of file MuRodBarrelLayer.cc.

References basicComponents(), filterCSVwithJSON::copy, BarrelDetLayer::initialize(), isOverlapping, PhiBorderFinder::isPhiOverlapping(), PhiBorderFinder::isPhiPeriodic(), LogTrace, metname, precomputed_value_sort(), Cylinder::radius(), BarrelDetLayer::specificSurface(), theBasicComps, theBinFinder, theComponents, and theRods.

                                                              :
  theRods(rods),
  theBinFinder(0),
  isOverlapping(false)
{
  // Sort rods in phi
  precomputed_value_sort(theRods.begin(),theRods.end(), geomsort::ExtractPhi<DetRod,float>());

  theComponents.reserve(theRods.size());
  std::copy(theRods.begin(),theRods.end(),back_inserter(theComponents));

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

  // Cache chamber pointers (the basic components_)
  for (vector<const DetRod*>::const_iterator it=rods.begin();
       it!=rods.end(); it++) {
    vector<const GeomDet*> tmp2 = (*it)->basicComponents();
    theBasicComps.insert(theBasicComps.end(),tmp2.begin(),tmp2.end());
  }

  // Initialize the binfinder
  PhiBorderFinder bf(theRods);
  isOverlapping = bf.isPhiOverlapping();

  if ( bf.isPhiPeriodic() ) { 
    theBinFinder = new PeriodicBinFinderInPhi<double>
    (theRods.front()->position().phi(),theRods.size());
  } else {
    theBinFinder = new GeneralBinFinderInPhi<double>(bf);
  }

  // Compute the layer's surface and bounds (from the components())
  BarrelDetLayer::initialize(); 
  
  LogTrace(metname) << "Constructing MuRodBarrelLayer: "
                    << basicComponents().size() << " Dets " 
                    << theRods.size() << " Rods "
                    << " R: " << specificSurface().radius()
                    << " Per.: " << bf.isPhiPeriodic()
                    << " Overl.: " << isOverlapping;
}
MuRodBarrelLayer::~MuRodBarrelLayer ( ) [virtual]

Definition at line 71 of file MuRodBarrelLayer.cc.

References i, theBinFinder, and theRods.

                                    {
  delete theBinFinder;
  for (vector <const DetRod*>::iterator i = theRods.begin();
       i<theRods.end(); i++) {delete *i;}
}

Member Function Documentation

virtual const std::vector<const GeomDet*>& MuRodBarrelLayer::basicComponents ( ) const [inline, virtual]

Implements GeometricSearchDet.

Definition at line 29 of file MuRodBarrelLayer.h.

References theBasicComps.

Referenced by MuRodBarrelLayer().

{return theBasicComps;}
vector< GeometricSearchDet::DetWithState > MuRodBarrelLayer::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 79 of file MuRodBarrelLayer.cc.

References BaseBinFinder< T >::binIndex(), BoundSurface::bounds(), BarrelDetLayer::compatible(), GeometricSearchDet::compatibleDets(), funct::false, TrajectoryStateOnSurface::globalPosition(), isOverlapping, TrajectoryStateOnSurface::localPosition(), LogTrace, metname, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), Cylinder::radius(), query::result, BarrelDetLayer::specificSurface(), DetRod::surface(), theBinFinder, theRods, Bounds::width(), PV3DBase< T, PVType, FrameType >::x(), and xError().

                                                                        {

  const std::string metname = "Muon|RecoMuon|RecoMuonDetLayers|MuRodBarrelLayer";
  vector<DetWithState> result; 

 
  LogTrace(metname) << "MuRodBarrelLayer::compatibleDets, Cyl R: " 
                    << specificSurface().radius()
                    << " TSOS at R= " << startingState.globalPosition().perp()
                    << " phi= " << startingState.globalPosition().phi();

  pair<bool, TrajectoryStateOnSurface> compat =
    compatible(startingState, prop, est);
  if (!compat.first) {
    LogTrace(metname) << "     MuRodBarrelLayer::compatibleDets: not compatible"
                      << " (should not have been selected!)";
    return vector<DetWithState>();
  } 

  TrajectoryStateOnSurface& tsos = compat.second;

  LogTrace(metname) << "     MuRodBarrelLayer::compatibleDets, reached layer at: "
                    << tsos.globalPosition()
                    << " R = " << tsos.globalPosition().perp()
                    << " phi = " << tsos.globalPosition().phi();

  int closest = theBinFinder->binIndex(tsos.globalPosition().phi());
  const DetRod* closestRod = theRods[closest];

  // Check the closest rod
  LogTrace(metname) << "     MuRodBarrelLayer::compatibleDets, closestRod: " << closest
                    << " phi : " << closestRod->surface().position().phi()
                    << " FTS phi: " << tsos.globalPosition().phi();
  
  result = closestRod->compatibleDets(tsos, prop, est);

  int nclosest = result.size(); // Debug counter

  bool checknext = false ;
  double dist;

  if (!result.empty()) { 
    // Check if the track go outside closest rod, then look for closest. 
    TrajectoryStateOnSurface& predictedState = result.front().second;
    float xErr = xError(predictedState, est);
    float halfWid = closestRod->surface().bounds().width()/2.;
    dist = predictedState.localPosition().x();

    // If the layer is overlapping, additionally reduce halfWid by 10%
    // to account for overlap.
    // FIXME: should we account for the real amount of overlap?
    if (isOverlapping) halfWid *= 0.9;

    if (fabs(dist) + xErr > halfWid) {
      checknext = true;
    }
  } else { // Rod is not compatible
    //FIXME: Usually next cannot be either. Implement proper logic.
    // (in general at least one rod should be when this method is called by
    // compatibleDets() which calls compatible())
    checknext = true;
    
    // Look for the next-to closest in phi.
    // Note Geom::Phi, subtraction is pi-border-safe
    if ( tsos.globalPosition().phi()-closestRod->surface().position().phi()>0.)
    {
      dist = -1.;
    } else {
      dist = +1.;
    }

    
    LogTrace(metname) << "     MuRodBarrelLayer::fastCompatibleDets, none on closest rod!";
  }

  if (checknext) {
    int next;
    if (dist<0.) next = closest+1;
    else next = closest-1;

    next = theBinFinder->binIndex(next); // Bin Periodicity
    const DetRod* nextRod = theRods[next];

  
    LogTrace(metname) << "     MuRodBarrelLayer::fastCompatibleDets, next-to closest"
                      << " rod: " << next << " dist " << dist
                      << " phi : " << nextRod->surface().position().phi()
                      << " FTS phi: " << tsos.globalPosition().phi();   
    
    vector<DetWithState> nextRodDets =
      nextRod->compatibleDets(tsos, prop, est);
    result.insert(result.end(), 
                  nextRodDets.begin(), nextRodDets.end());
  }
  
  
   LogTrace(metname) << "     MuRodBarrelLayer::fastCompatibleDets: found: "
                     << result.size()
                     << " on closest: " << nclosest
                     << " # checked rods: " << 1 + int(checknext);
  
  return result;
}
const vector< const GeometricSearchDet * > & MuRodBarrelLayer::components ( ) const [virtual]

Returns basic components, if any.

Returns direct components, if any

Implements GeometricSearchDet.

Definition at line 207 of file MuRodBarrelLayer.cc.

References theComponents.

                                   {
  return theComponents;
}
vector< DetGroup > MuRodBarrelLayer::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 187 of file MuRodBarrelLayer.cc.

References gather_cfg::cout.

                                                                                {
  // FIXME should return only 1 group 
  cout << "dummy implementation of MuRodBarrelLayer::groupedCompatibleDets()" << endl;
  return vector<DetGroup>();
}
bool MuRodBarrelLayer::hasGroups ( ) const [virtual]

Implements GeometricSearchDet.

Definition at line 196 of file MuRodBarrelLayer.cc.

                                       {
  // FIXME : depending on isOverlapping?
  return false;
}
virtual const std::vector<const DetRod*>& MuRodBarrelLayer::rods ( ) const [inline, virtual]

Return the vector of rods.

Definition at line 53 of file MuRodBarrelLayer.h.

References theRods.

{return theRods;}
GeomDetEnumerators::SubDetector MuRodBarrelLayer::subDetector ( ) const [virtual]

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

Implements DetLayer.

Definition at line 202 of file MuRodBarrelLayer.cc.

References theBasicComps.

                                                                  {
  return theBasicComps.front()->subDetector();
}
float MuRodBarrelLayer::xError ( const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const [private]

Definition at line 211 of file MuRodBarrelLayer.cc.

References TrajectoryStateOnSurface::hasError(), TrajectoryStateOnSurface::localError(), LocalTrajectoryError::positionError(), mathSSE::sqrt(), and LocalError::xx().

Referenced by compatibleDets().

                                                                      {
  const float nSigmas = 3.f;
  if (tsos.hasError()) {
    return nSigmas * sqrt(tsos.localError().positionError().xx());
  }
  else return nSigmas * 0.5;
}

Member Data Documentation

Definition at line 65 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), and MuRodBarrelLayer().

std::vector<const GeomDet*> MuRodBarrelLayer::theBasicComps [private]

Definition at line 63 of file MuRodBarrelLayer.h.

Referenced by basicComponents(), MuRodBarrelLayer(), and subDetector().

Definition at line 64 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), MuRodBarrelLayer(), and ~MuRodBarrelLayer().

std::vector<const GeometricSearchDet*> MuRodBarrelLayer::theComponents [private]

Definition at line 62 of file MuRodBarrelLayer.h.

Referenced by components(), and MuRodBarrelLayer().

std::vector<const DetRod*> MuRodBarrelLayer::theRods [private]

Definition at line 61 of file MuRodBarrelLayer.h.

Referenced by compatibleDets(), MuRodBarrelLayer(), rods(), and ~MuRodBarrelLayer().