CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

TkPixelMeasurementDet Class Reference

#include <TkPixelMeasurementDet.h>

Inheritance diagram for TkPixelMeasurementDet:
MeasurementDet

List of all members.

Public Types

typedef detset::const_iterator const_iterator
typedef edmNew::DetSet
< SiPixelCluster
detset
typedef
PixelClusterParameterEstimator::LocalValues 
LocalValues
typedef edm::Ref
< edmNew::DetSetVector
< SiPixelCluster >
, SiPixelCluster
SiPixelClusterRef

Public Member Functions

bool accept (SiPixelClusterRefNew &r) const
TransientTrackingRecHit::RecHitPointer buildRecHit (const SiPixelClusterRef &cluster, const LocalTrajectoryParameters &ltp) const
void clearBadRocPositions ()
 Clear the list of bad ROCs.
virtual std::vector
< TrajectoryMeasurement
fastMeasurements (const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &startingState, const Propagator &, const MeasurementEstimator &) const
bool hasBadComponents (const TrajectoryStateOnSurface &tsos) const
bool isActive () const
 Is this module active in reconstruction? It must be both 'setActiveThisEvent' and 'setActive'.
virtual RecHitContainer recHits (const TrajectoryStateOnSurface &) const
void setActive (bool active)
 Turn on/off the module for reconstruction, for the full run or lumi (using info from DB, usually). This also resets the 'setActiveThisEvent' to true.
void setActiveThisEvent (bool active)
 Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call to 'update' or 'setEmpty'.
void setBadRocPositions (std::vector< LocalPoint > &positions)
 Sets the list of bad ROCs, identified by the positions of their centers in the local coordinate frame.
void setClusterToSkip (const std::vector< bool > *skip)
void setEmpty ()
const PixelGeomDetUnitspecificGeomDet () const
 TkPixelMeasurementDet (const GeomDet *gdet, const PixelClusterParameterEstimator *cpe)
void update (const detset &detSet, const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > &h, unsigned int id)
virtual ~TkPixelMeasurementDet ()

Private Attributes

bool activeThisEvent_
bool activeThisPeriod_
std::vector< LocalPointbadRocPositions_
detset detSet_
bool empty
edm::Handle
< edmNew::DetSetVector
< SiPixelCluster > > 
handle_
unsigned int id_
const std::vector< bool > * skipClusters_
const
PixelClusterParameterEstimator
theCPE

Detailed Description

Definition at line 15 of file TkPixelMeasurementDet.h.


Member Typedef Documentation

Definition at line 21 of file TkPixelMeasurementDet.h.

Definition at line 20 of file TkPixelMeasurementDet.h.

Definition at line 22 of file TkPixelMeasurementDet.h.

Definition at line 18 of file TkPixelMeasurementDet.h.


Constructor & Destructor Documentation

TkPixelMeasurementDet::TkPixelMeasurementDet ( const GeomDet gdet,
const PixelClusterParameterEstimator cpe 
)

Definition at line 17 of file TkPixelMeasurementDet.cc.

                                                                                         : 
    MeasurementDet (gdet),
    theCPE(cpe),
    skipClusters_(0),
    empty(true),
    activeThisEvent_(true), activeThisPeriod_(true)
  {
    if ( dynamic_cast<const PixelGeomDetUnit*>(gdet) == 0) {
      throw MeasurementDetException( "TkPixelMeasurementDet constructed with a GeomDet which is not a PixelGeomDetUnit");
    }
  }
virtual TkPixelMeasurementDet::~TkPixelMeasurementDet ( ) [inline, virtual]

Definition at line 39 of file TkPixelMeasurementDet.h.

{ }

Member Function Documentation

bool TkPixelMeasurementDet::accept ( SiPixelClusterRefNew r) const [inline]

Definition at line 83 of file TkPixelMeasurementDet.h.

References edm::Ref< C, T, F >::key(), and skipClusters_.

                                                     {
    
    if(0==skipClusters_ || skipClusters_->empty()) return true;
    if (r.key()>=skipClusters_->size()){
      edm::LogError("IndexMisMatch")<<r.key()<<" is larger than: "<<skipClusters_->size()<<" no skipping done";
      return true;
    }
    return not (*skipClusters_)[r.key()];
  }
TransientTrackingRecHit::RecHitPointer TkPixelMeasurementDet::buildRecHit ( const SiPixelClusterRef cluster,
const LocalTrajectoryParameters ltp 
) const

Definition at line 71 of file TkPixelMeasurementDet.cc.

References newFWLiteAna::build, MeasurementDet::fastGeomDet(), ClusterParameterEstimator< T >::localParameters(), specificGeomDet(), and theCPE.

Referenced by recHits().

{
  const GeomDetUnit& gdu( specificGeomDet());
  LocalValues lv = theCPE->localParameters( * cluster, gdu, ltp );
  return TSiPixelRecHit::build( lv.first, lv.second, &fastGeomDet(), cluster, theCPE);
}
void TkPixelMeasurementDet::clearBadRocPositions ( ) [inline]

Clear the list of bad ROCs.

Definition at line 69 of file TkPixelMeasurementDet.h.

References badRocPositions_.

{ badRocPositions_.clear(); }
std::vector< TrajectoryMeasurement > TkPixelMeasurementDet::fastMeasurements ( const TrajectoryStateOnSurface stateOnThisDet,
const TrajectoryStateOnSurface startingState,
const Propagator ,
const MeasurementEstimator  
) const [virtual]

faster version in case the TrajectoryState on the surface of the Det is already available. The first TrajectoryStateOnSurface is on the surface of this Det, and the second TrajectoryStateOnSurface is the statrting state, usually not on the surface of this Det. The stateOnThisDet should the result of
prop.propagate( startingState, this->surface())

Implements MeasurementDet.

Definition at line 31 of file TkPixelMeasurementDet.cc.

References newFWLiteAna::build, MeasurementEstimator::estimate(), F(), MeasurementDet::fastGeomDet(), hasBadComponents(), TrackingRecHit::inactive, isActive(), combine::missing, recHits(), query::result, and python::multivaluedict::sort().

{
  std::vector<TrajectoryMeasurement> result;

  if (isActive() == false) {
    result.push_back( TrajectoryMeasurement( stateOnThisDet, 
                InvalidTransientRecHit::build(&fastGeomDet(), TrackingRecHit::inactive), 
                0.F));
    return result;
  }
 
  MeasurementDet::RecHitContainer allHits = recHits( stateOnThisDet);
  for (RecHitContainer::const_iterator ihit=allHits.begin();
       ihit != allHits.end(); ihit++) {
    std::pair<bool,double> diffEst = est.estimate( stateOnThisDet, **ihit);
    if ( diffEst.first) {
      result.push_back( TrajectoryMeasurement( stateOnThisDet, *ihit, 
                                               diffEst.second));
    }
    //RC else delete *ihit; // we own allHits and have to delete the ones we don't return
  }
  if ( result.empty()) {
    // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
    TrackingRecHit::Type type = (hasBadComponents(stateOnThisDet) ? TrackingRecHit::inactive : TrackingRecHit::missing);
    result.push_back( TrajectoryMeasurement( stateOnThisDet, 
                                             InvalidTransientRecHit::build(&fastGeomDet(), type), 0.F)); 
  }
  else {
    // sort results according to estimator value
    if ( result.size() > 1) {
      sort( result.begin(), result.end(), TrajMeasLessEstim());
    }
  }
  return result;
}
bool TkPixelMeasurementDet::hasBadComponents ( const TrajectoryStateOnSurface tsos) const [virtual]

Implements MeasurementDet.

Definition at line 112 of file TkPixelMeasurementDet.cc.

References abs, badRocPositions_, asciidump::le, TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), LocalTrajectoryError::positionError(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by fastMeasurements().

                                                                                    {
    if (badRocPositions_.empty()) return false;
    LocalPoint lp = tsos.localPosition();
    LocalError le = tsos.localError().positionError();
    double dx = 3*std::sqrt(le.xx()) + theRocWidth, dy = 3*std::sqrt(le.yy()) + theRocHeight;
    for (std::vector<LocalPoint>::const_iterator it = badRocPositions_.begin(), ed = badRocPositions_.end(); it != ed; ++it) {
        if ( (std::abs(it->x() - lp.x()) < dx) &&
             (std::abs(it->y() - lp.y()) < dy) ) return true;
    } 
    return false;
}
bool TkPixelMeasurementDet::isActive ( ) const [inline, virtual]

Is this module active in reconstruction? It must be both 'setActiveThisEvent' and 'setActive'.

Implements MeasurementDet.

Definition at line 62 of file TkPixelMeasurementDet.h.

References activeThisEvent_, and activeThisPeriod_.

Referenced by fastMeasurements(), and recHits().

TkPixelMeasurementDet::RecHitContainer TkPixelMeasurementDet::recHits ( const TrajectoryStateOnSurface ts) const [virtual]

Implements MeasurementDet.

Definition at line 80 of file TkPixelMeasurementDet.cc.

References edmNew::DetSet< T >::begin(), begin, buildRecHit(), detSet_, empty, edmNew::DetSet< T >::end(), MeasurementDet::fastGeomDet(), GeomDet::geographicalId(), handle_, getHLTprescales::index, isActive(), TrajectoryStateOnSurface::localParameters(), LogDebug, edm::makeRefTo(), DetId::rawId(), query::result, edmNew::DetSet< T >::size(), and skipClusters_.

Referenced by fastMeasurements().

{
  RecHitContainer result;
  if (empty == true ) return result;
  if (isActive() == false) return result;
  const SiPixelCluster* begin=0;
  if(0!=handle_->data().size()) {
     begin = &(handle_->data().front());
  }
  result.reserve(detSet_.size());
  for ( const_iterator ci = detSet_.begin(); ci != detSet_.end(); ++ ci ) {
    
    if (ci < begin){
      edm::LogError("IndexMisMatch")<<"TkPixelMeasurementDet cannot create hit because of index mismatch.";
      return result;
    }
     unsigned int index = ci-begin;
     if (skipClusters_!=0 && skipClusters_->size()!=0 &&  index>=skipClusters_->size()){
       edm::LogError("IndexMisMatch")<<"TkPixelMeasurementDet cannot create hit because of index mismatch. i.e "<<index<<" >= "<<skipClusters_->size();
       return result;
     }
     if(0==skipClusters_ or skipClusters_->empty() or (not (*skipClusters_)[index]) ) {
       SiPixelClusterRef cluster = edmNew::makeRefTo( handle_, ci );
       result.push_back( buildRecHit( cluster, ts.localParameters() ) );
     }else{   
       LogDebug("TkPixelMeasurementDet")<<"skipping this cluster from last iteration on "<<fastGeomDet().geographicalId().rawId()<<" key: "<<index;
     }
  }
  return result;
}
void TkPixelMeasurementDet::setActive ( bool  active) [inline]

Turn on/off the module for reconstruction, for the full run or lumi (using info from DB, usually). This also resets the 'setActiveThisEvent' to true.

Definition at line 57 of file TkPixelMeasurementDet.h.

References activeThisEvent_, activeThisPeriod_, and empty.

{ activeThisPeriod_ = active; activeThisEvent_ = true; if (!active) empty = true; }
void TkPixelMeasurementDet::setActiveThisEvent ( bool  active) [inline]

Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call to 'update' or 'setEmpty'.

Definition at line 60 of file TkPixelMeasurementDet.h.

References activeThisEvent_, and empty.

{ activeThisEvent_ = active;  if (!active) empty = true; }
void TkPixelMeasurementDet::setBadRocPositions ( std::vector< LocalPoint > &  positions) [inline]

Sets the list of bad ROCs, identified by the positions of their centers in the local coordinate frame.

Definition at line 67 of file TkPixelMeasurementDet.h.

References badRocPositions_.

{ badRocPositions_.swap(positions); }
void TkPixelMeasurementDet::setClusterToSkip ( const std::vector< bool > *  skip) [inline]

Definition at line 93 of file TkPixelMeasurementDet.h.

References createPayload::skip, and skipClusters_.

Referenced by MeasurementTrackerImpl::addPixelDet().

void TkPixelMeasurementDet::setEmpty ( ) [inline]

Definition at line 37 of file TkPixelMeasurementDet.h.

References activeThisEvent_, and empty.

{empty = true; activeThisEvent_ = true; }
const PixelGeomDetUnit& TkPixelMeasurementDet::specificGeomDet ( ) const [inline]

Definition at line 49 of file TkPixelMeasurementDet.h.

References MeasurementDet::fastGeomDet().

Referenced by buildRecHit().

{return static_cast<PixelGeomDetUnit const &>(fastGeomDet());}
void TkPixelMeasurementDet::update ( const detset detSet,
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > &  h,
unsigned int  id 
) [inline]

Definition at line 27 of file TkPixelMeasurementDet.h.

References activeThisEvent_, detSet_, empty, h, handle_, and id_.

                                 { 
    detSet_ = detSet; 
    handle_ = h;
    id_ = id;
    empty = false;
    activeThisEvent_ = true;
  }

Member Data Documentation

Definition at line 79 of file TkPixelMeasurementDet.h.

Referenced by isActive(), setActive(), setActiveThisEvent(), setEmpty(), and update().

Definition at line 79 of file TkPixelMeasurementDet.h.

Referenced by isActive(), and setActive().

Definition at line 74 of file TkPixelMeasurementDet.h.

Referenced by recHits(), and update().

Definition at line 78 of file TkPixelMeasurementDet.h.

Referenced by recHits(), setActive(), setActiveThisEvent(), setEmpty(), and update().

Definition at line 73 of file TkPixelMeasurementDet.h.

Referenced by recHits(), and update().

unsigned int TkPixelMeasurementDet::id_ [private]

Definition at line 77 of file TkPixelMeasurementDet.h.

Referenced by update().

const std::vector<bool>* TkPixelMeasurementDet::skipClusters_ [private]

Definition at line 76 of file TkPixelMeasurementDet.h.

Referenced by accept(), recHits(), and setClusterToSkip().

Definition at line 72 of file TkPixelMeasurementDet.h.

Referenced by buildRecHit().