CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PixelClusterShapeSeedComparitor Class Reference

Inheritance diagram for PixelClusterShapeSeedComparitor:
SeedComparitor

List of all members.

Public Member Functions

virtual bool compatible (const SeedingHitSet &hits, const TrackingRegion &region) const
virtual bool compatible (const TrajectorySeed &seed) const
virtual bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &helixStateAtVertex, const FastHelix &helix, const TrackingRegion &region) const
virtual bool compatible (const SeedingHitSet &hits, const GlobalTrajectoryParameters &straightLineStateAtVertex, const TrackingRegion &region) const
virtual bool compatible (const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit) const
virtual void init (const edm::EventSetup &es)
 PixelClusterShapeSeedComparitor (const edm::ParameterSet &cfg)
virtual ~PixelClusterShapeSeedComparitor ()

Private Member Functions

bool compatibleHit (const TransientTrackingRecHit &hit, const GlobalVector &direction) const

Private Attributes

bool filterAtHelixStage_
edm::ESHandle
< ClusterShapeHitFilter
filterHandle_
std::string filterName_
bool filterPixelHits_
bool filterStripHits_

Detailed Description

Definition at line 17 of file ClusterShapeSeedComparitor.cc.


Constructor & Destructor Documentation

PixelClusterShapeSeedComparitor::PixelClusterShapeSeedComparitor ( const edm::ParameterSet cfg)

Definition at line 44 of file ClusterShapeSeedComparitor.cc.

                                                                                           :
    filterName_(cfg.getParameter<std::string>("ClusterShapeHitFilterName")),
    filterAtHelixStage_(cfg.getParameter<bool>("FilterAtHelixStage")),
    filterPixelHits_(cfg.getParameter<bool>("FilterPixelHits")),
    filterStripHits_(cfg.getParameter<bool>("FilterStripHits"))
{
}
PixelClusterShapeSeedComparitor::~PixelClusterShapeSeedComparitor ( ) [virtual]

Definition at line 52 of file ClusterShapeSeedComparitor.cc.

{
}

Member Function Documentation

virtual bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const TrackingRegion region 
) const [inline, virtual]

Implements SeedComparitor.

Definition at line 22 of file ClusterShapeSeedComparitor.cc.

{ return true; }
bool PixelClusterShapeSeedComparitor::compatible ( const TrajectoryStateOnSurface tsos,
const TransientTrackingRecHit::ConstRecHitPointer hit 
) const [virtual]

Implements SeedComparitor.

Definition at line 63 of file ClusterShapeSeedComparitor.cc.

References compatibleHit(), filterAtHelixStage_, TrajectoryStateOnSurface::globalDirection(), and TrajectoryStateOnSurface::isValid().

{
    if (filterAtHelixStage_) return true;
    assert(hit->isValid() && tsos.isValid());
    return compatibleHit(*hit, tsos.globalDirection());
}
bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const GlobalTrajectoryParameters straightLineStateAtVertex,
const TrackingRegion region 
) const [virtual]

Implements SeedComparitor.

Definition at line 72 of file ClusterShapeSeedComparitor.cc.

{ 
    return true; 
}
bool PixelClusterShapeSeedComparitor::compatible ( const SeedingHitSet hits,
const GlobalTrajectoryParameters helixStateAtVertex,
const FastHelix helix,
const TrackingRegion region 
) const [virtual]

Implements SeedComparitor.

Definition at line 80 of file ClusterShapeSeedComparitor.cc.

References FastHelix::circle(), compatibleHit(), filterAtHelixStage_, TransientTrackingRecHit::globalPosition(), i, GlobalTrajectoryParameters::momentum(), n, perp2(), pos, GlobalTrajectoryParameters::position(), SeedingHitSet::size(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

{ 
    if (!filterAtHelixStage_) return true;
    float xc = helix.circle().x0(), yc = helix.circle().y0();

    GlobalPoint  vertex = helixStateAtVertex.position();
    GlobalVector momvtx = helixStateAtVertex.momentum();
    float x0 = vertex.x(), y0 = vertex.y();
    for (unsigned int i = 0, n = hits.size(); i < n; ++i) {
        const TransientTrackingRecHit &hit = *hits[i];
        GlobalPoint pos = hit.globalPosition();
        float x1 = pos.x(), y1 = pos.y(), dx1 = x1 - xc, dy1 = y1 - yc;

        // now figure out the proper tangent vector
        float perpx = -dy1, perpy = dx1;
        if (perpx * (x1-x0) + perpy * (y1 - y0) < 0) {
            perpy = -perpy; perpx = -perpx;
        }
       
        // now normalize (perpx, perpy, 1.0) to momentum (px, py, pz)
        float perp2 = perpx*perpx + perpy*perpy; 
        float pmom2 = momvtx.x()*momvtx.x() + momvtx.y()*momvtx.y(), momz2 = momvtx.z()*momvtx.z(), mom2 = pmom2 + momz2;
        float perpscale = sqrt(pmom2/mom2 / perp2), zscale = sqrt((1-pmom2/mom2));
        GlobalVector gdir(perpx*perpscale, perpy*perpscale, (momvtx.z() > 0 ? zscale : -zscale));

        if (!compatibleHit(hit, gdir)) {
            return false; // not yet
        }
    }
    return true; 
}
virtual bool PixelClusterShapeSeedComparitor::compatible ( const TrajectorySeed seed) const [inline, virtual]

Implements SeedComparitor.

Definition at line 23 of file ClusterShapeSeedComparitor.cc.

{ return true; }
bool PixelClusterShapeSeedComparitor::compatibleHit ( const TransientTrackingRecHit hit,
const GlobalVector direction 
) const [private]

Definition at line 116 of file ClusterShapeSeedComparitor.cc.

References Exception, filterHandle_, filterPixelHits_, filterStripHits_, TrackingRecHit::geographicalId(), TransientTrackingRecHit::hit(), ProjectedSiStripRecHit2D::originalHit(), and DetId::subdetId().

Referenced by compatible().

{
    if (hit.geographicalId().subdetId() <= 2) {
        if (!filterPixelHits_) return true;    
        const SiPixelRecHit *pixhit = dynamic_cast<const SiPixelRecHit *>(hit.hit());
        if (pixhit == 0) throw cms::Exception("LogicError", "Found a valid hit on the pixel detector which is not a SiPixelRecHit\n");
        //printf("Cheching hi hit on detid %10d, local direction is x = %9.6f, y = %9.6f, z = %9.6f\n", hit.geographicalId().rawId(), direction.x(), direction.y(), direction.z());
        return filterHandle_->isCompatible(*pixhit, direction);
    } else {
        if (!filterStripHits_) return true;
        const std::type_info &tid = typeid(*hit.hit());
        if (tid == typeid(SiStripMatchedRecHit2D)) {
            const SiStripMatchedRecHit2D* matchedHit = dynamic_cast<const SiStripMatchedRecHit2D *>(hit.hit());
            assert(matchedHit != 0);
            return (filterHandle_->isCompatible(DetId(matchedHit->monoId()), matchedHit->monoCluster(), direction) &&
                    filterHandle_->isCompatible(DetId(matchedHit->stereoId()), matchedHit->stereoCluster(), direction));
        } else if (tid == typeid(SiStripRecHit2D)) {
            const SiStripRecHit2D* recHit = dynamic_cast<const SiStripRecHit2D *>(hit.hit());
            assert(recHit != 0);
            return filterHandle_->isCompatible(*recHit, direction);
        } else if (tid == typeid(ProjectedSiStripRecHit2D)) {
            const ProjectedSiStripRecHit2D* precHit = dynamic_cast<const ProjectedSiStripRecHit2D *>(hit.hit());
            assert(precHit != 0);
            return filterHandle_->isCompatible(precHit->originalHit(), direction);
        } else {
            //printf("Questo e' un %s, che ci fo?\n", tid.name());
            return true;
        }
    }
}
void PixelClusterShapeSeedComparitor::init ( const edm::EventSetup es) [virtual]

Member Data Documentation

Definition at line 39 of file ClusterShapeSeedComparitor.cc.

Referenced by compatible().

Definition at line 38 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit(), and init().

Definition at line 37 of file ClusterShapeSeedComparitor.cc.

Referenced by init().

Definition at line 40 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().

Definition at line 40 of file ClusterShapeSeedComparitor.cc.

Referenced by compatibleHit().