CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackingRecHitLessFromGlobalPosition Class Reference

#include <TrackingRecHitLessFromGlobalPosition.h>

List of all members.

Public Member Functions

bool operator() (const TrackingRecHit &a, const TrackingRecHit &b) const
 TrackingRecHitLessFromGlobalPosition (const TrackingGeometry *geometry_, PropagationDirection dir=alongMomentum)

Private Member Functions

bool barrelForwardLess (const TrackingRecHit &a, const TrackingRecHit &b) const
bool insideOutLess (const TrackingRecHit &a, const TrackingRecHit &b) const

Private Attributes

const TrackingGeometrygeometry
PropagationDirection theDir

Detailed Description

Defines order of layers in the Tracker as seen by straight tracks coming from the interaction region.

Definition at line 15 of file TrackingRecHitLessFromGlobalPosition.h.


Constructor & Destructor Documentation

TrackingRecHitLessFromGlobalPosition::TrackingRecHitLessFromGlobalPosition ( const TrackingGeometry geometry_,
PropagationDirection  dir = alongMomentum 
) [inline]

Definition at line 18 of file TrackingRecHitLessFromGlobalPosition.h.

                                                                                                                      :
    geometry(geometry_), theDir(dir){  }

Member Function Documentation

bool TrackingRecHitLessFromGlobalPosition::barrelForwardLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const [private]

Definition at line 58 of file TrackingRecHitLessFromGlobalPosition.cc.

References abs, TrackingRecHit::geographicalId(), geometry, TrackingGeometry::idToDet(), TrackingRecHit::localPosition(), GeomDet::surface(), Surface::toGlobal(), and z.

Referenced by insideOutLess().

                                                                                                                    {
  //
  // for the moment sort again in z, but since the z in the barrel is wrong (it is in the centre of the module)
  // add the semi length
  //
  DetId ida(a.geographicalId());
  DetId idb(b.geographicalId());
  return  static_cast<unsigned int>(std::abs( geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).z()) * 1E7) < static_cast<unsigned int>(std::abs( geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).z()) * 1E7);
}
bool TrackingRecHitLessFromGlobalPosition::insideOutLess ( const TrackingRecHit a,
const TrackingRecHit b 
) const [private]

Definition at line 7 of file TrackingRecHitLessFromGlobalPosition.cc.

References abs, barrelForwardLess(), TrackingRecHit::geographicalId(), geometry, TrackingGeometry::idToDet(), TrackingRecHit::localPosition(), perp(), PixelSubdetector::PixelBarrel, GeomDetEnumerators::PixelBarrel, PixelSubdetector::PixelEndcap, GeomDetEnumerators::PixelEndcap, GeomDet::surface(), StripSubdetector::TEC, sistripsummary::TEC, sistripsummary::TIB, StripSubdetector::TIB, sistripsummary::TID, StripSubdetector::TID, StripSubdetector::TOB, sistripsummary::TOB, Surface::toGlobal(), and z.

Referenced by operator()().

                                                                                                                {
  
  DetId ida(a.geographicalId());
  DetId idb(b.geographicalId());

  unsigned int idetA = static_cast<unsigned int>(ida.subdetId());
  unsigned int idetB = static_cast<unsigned int>(idb.subdetId());

  //check for mixed case...
  bool same_det = ( 
                   (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TIB) ||
                   (idetA == StripSubdetector::TID && idetB == StripSubdetector::TID) ||
                   (idetA == StripSubdetector::TIB && idetB == StripSubdetector::TID) ||
                   (idetA == StripSubdetector::TID && idetB == StripSubdetector::TIB) ||

                   (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TOB) ||
                   (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TEC) ||
                   (idetA == StripSubdetector::TOB && idetB == StripSubdetector::TEC) ||
                   (idetA == StripSubdetector::TEC && idetB == StripSubdetector::TOB) ||

                   (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelBarrel) ||
                   (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelEndcap) ||
                   (idetA == PixelSubdetector::PixelBarrel && idetB == PixelSubdetector::PixelEndcap) ||
                   (idetA == PixelSubdetector::PixelEndcap && idetB == PixelSubdetector::PixelBarrel) );

  if (!same_det) return (idetA < idetB);

  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
      (idetB == StripSubdetector::TIB || idetB == StripSubdetector::TOB || idetB == PixelSubdetector::PixelBarrel)) {  
    return  static_cast<unsigned int>(geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).perp() * 1E7) < static_cast<unsigned int>(geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).perp() * 1E7);
  }
  
  if( (idetA == StripSubdetector::TEC || idetA == StripSubdetector::TID || idetA == PixelSubdetector::PixelEndcap) &&
      (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {  
    return static_cast<unsigned int>(std::abs(geometry->idToDet(ida)->surface().toGlobal(a.localPosition()).z()) * 1E7) < static_cast<unsigned int>(std::abs(geometry->idToDet(idb)->surface().toGlobal(b.localPosition()).z()) * 1E7);
  }
  
  //
  //  here I have 1 barrel against one forward
  //
  
  if( (idetA == StripSubdetector::TIB || idetA == StripSubdetector::TOB || idetA == PixelSubdetector::PixelBarrel) &&
      (idetB == StripSubdetector::TEC || idetB == StripSubdetector::TID || idetB == PixelSubdetector::PixelEndcap)) {
    return barrelForwardLess( a, b);
  }else{
    return !barrelForwardLess( b, a);
  }
  
  throw Genexception("TrackingRecHitLessFromGlobalPosition: arguments are not Ok");
}
bool TrackingRecHitLessFromGlobalPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const [inline]

Definition at line 22 of file TrackingRecHitLessFromGlobalPosition.h.

References alongMomentum, insideOutLess(), and theDir.

                                                                           {
    if (theDir == alongMomentum) return insideOutLess( a, b);
    else return insideOutLess( b, a);
  }

Member Data Documentation

Definition at line 34 of file TrackingRecHitLessFromGlobalPosition.h.

Referenced by barrelForwardLess(), and insideOutLess().

Definition at line 35 of file TrackingRecHitLessFromGlobalPosition.h.

Referenced by operator()().