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.
bool hasBadComponents (const TrajectoryStateOnSurface &tsos) const
bool isActive () const
 Is this module active in reconstruction? It must be both 'setActiveThisEvent' and 'setActive'.
virtual bool measurements (const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, TempMeasurements &result) const
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 82 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 59 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 68 of file TkPixelMeasurementDet.h.

References badRocPositions_.

{ badRocPositions_.clear(); }
bool TkPixelMeasurementDet::hasBadComponents ( const TrajectoryStateOnSurface tsos) const [virtual]

Implements MeasurementDet.

Definition at line 100 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 measurements().

                                                                                    {
    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 61 of file TkPixelMeasurementDet.h.

References activeThisEvent_, and activeThisPeriod_.

Referenced by measurements(), and recHits().

bool TkPixelMeasurementDet::measurements ( const TrajectoryStateOnSurface stateOnThisDet,
const MeasurementEstimator est,
TempMeasurements result 
) const [virtual]

Implements MeasurementDet.

Definition at line 30 of file TkPixelMeasurementDet.cc.

References tracking::TempMeasurements::add(), newFWLiteAna::build, MeasurementEstimator::estimate(), F(), MeasurementDet::fastGeomDet(), MeasurementDet::geomDet(), hasBadComponents(), TrackingRecHit::inactive, isActive(), combine::missing, recHits(), and tracking::TempMeasurements::size().

                                                                           {

  if (!isActive()) {
    result.add(InvalidTransientRecHit::build(&geomDet(), TrackingRecHit::inactive), 0.F);
    return true;
  }
  
  auto oldSize = result.size();
  MeasurementDet::RecHitContainer && allHits = recHits(stateOnThisDet);
  for (auto && hit : allHits) {
    std::pair<bool,double> diffEst = est.estimate( stateOnThisDet, *hit);
    if ( diffEst.first)
      result.add(std::move(hit), diffEst.second);
  }

  if (result.size()>oldSize) return true;

  // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
  bool inac = hasBadComponents(stateOnThisDet);
  TrackingRecHit::Type type = inac ? TrackingRecHit::inactive : TrackingRecHit::missing;
  result.add(InvalidTransientRecHit::build(&fastGeomDet(), type), 0.F);
  return inac;

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

Implements MeasurementDet.

Definition at line 68 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 measurements().

{
  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 56 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 59 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 66 of file TkPixelMeasurementDet.h.

References badRocPositions_.

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

Definition at line 92 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 48 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 78 of file TkPixelMeasurementDet.h.

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

Definition at line 78 of file TkPixelMeasurementDet.h.

Referenced by isActive(), and setActive().

Definition at line 73 of file TkPixelMeasurementDet.h.

Referenced by recHits(), and update().

Definition at line 77 of file TkPixelMeasurementDet.h.

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

Definition at line 72 of file TkPixelMeasurementDet.h.

Referenced by recHits(), and update().

unsigned int TkPixelMeasurementDet::id_ [private]

Definition at line 76 of file TkPixelMeasurementDet.h.

Referenced by update().

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

Definition at line 75 of file TkPixelMeasurementDet.h.

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

Definition at line 71 of file TkPixelMeasurementDet.h.

Referenced by buildRecHit().