CMS 3D CMS Logo

Public Member Functions | Private Attributes

ctfseeding::HitExtractorPIX Class Reference

#include <HitExtractorPIX.h>

Inheritance diagram for ctfseeding::HitExtractorPIX:
ctfseeding::HitExtractor

List of all members.

Public Member Functions

virtual HitExtractorPIXclone () const
 HitExtractorPIX (SeedingLayer::Side &side, int idLayer, const std::string &hitProducer)
virtual HitExtractor::Hits hits (const SeedingLayer &sl, const edm::Event &, const edm::EventSetup &) const
virtual ~HitExtractorPIX ()

Private Attributes

std::string theHitProducer
int theIdLayer
SeedingLayer::Side theSide

Detailed Description

Definition at line 13 of file HitExtractorPIX.h.


Constructor & Destructor Documentation

HitExtractorPIX::HitExtractorPIX ( SeedingLayer::Side side,
int  idLayer,
const std::string &  hitProducer 
)

Definition at line 17 of file HitExtractorPIX.cc.

Referenced by clone().

  : theSide(side), theIdLayer(idLayer), theHitProducer(hitProducer)
{ }
virtual ctfseeding::HitExtractorPIX::~HitExtractorPIX ( ) [inline, virtual]

Definition at line 16 of file HitExtractorPIX.h.

{}

Member Function Documentation

virtual HitExtractorPIX* ctfseeding::HitExtractorPIX::clone ( void  ) const [inline, virtual]

Definition at line 18 of file HitExtractorPIX.h.

References HitExtractorPIX().

{ return new HitExtractorPIX(*this); }
HitExtractor::Hits HitExtractorPIX::hits ( const SeedingLayer sl,
const edm::Event ev,
const edm::EventSetup es 
) const [virtual]

Implements ctfseeding::HitExtractor.

Definition at line 22 of file HitExtractorPIX.cc.

References ctfseeding::SeedingLayer::Barrel, edmNew::DetSetVector< T >::begin(), SiPixelRecHit::cluster(), edmNew::DetSetVector< T >::end(), f, spr::find(), edm::Event::getByLabel(), keep, LogDebug, TrackerLayerIdAccessor::pixelBarrelLayer(), TrackerLayerIdAccessor::pixelForwardDisk(), ctfseeding::range2SeedingHits(), query::result, ctfseeding::HitExtractor::skipClusters, theHitProducer, theIdLayer, theSide, and ctfseeding::HitExtractor::theSkipClusters.

{
  HitExtractor::Hits result;
  TrackerLayerIdAccessor accessor;
  edm::Handle<SiPixelRecHitCollection> pixelHits;
  ev.getByLabel( theHitProducer, pixelHits);
  if (theSide==SeedingLayer::Barrel) {
    range2SeedingHits( *pixelHits, result, accessor.pixelBarrelLayer(theIdLayer), sl, es );
  } else {
    range2SeedingHits( *pixelHits, result, accessor.pixelForwardDisk(theSide,theIdLayer), sl, es );
  }


  if (skipClusters){
    LogDebug("HitExtractorPIX")<<"getting : "<<result.size()<<" pixel hits.";
    //std::cout<<" skipping"<<std::endl;
    edm::Handle<edmNew::DetSetVector<SiPixelClusterRefNew> > pixelClusterRefs;
    ev.getByLabel(theSkipClusters,pixelClusterRefs);
    std::vector<bool> keep(result.size(),true);
    HitExtractor::Hits newHits;
    uint skipped=0;
    if (result.empty()) return result;
    DetId lookup=result.front()->hit()->geographicalId();
    edmNew::DetSetVector<SiPixelClusterRefNew>::const_iterator f=pixelClusterRefs->find(lookup);
    newHits.reserve(result.size());
    for (unsigned int iH=0;iH!=result.size();++iH){
      if (result[iH]->hit()->geographicalId()!=lookup)
        {
          lookup=result[iH]->hit()->geographicalId();
          f=pixelClusterRefs->find(lookup);
        }
      if (result[iH]->hit()->isValid()){
        SiPixelRecHit * concrete = (SiPixelRecHit *) result[iH]->hit();
        if (f!=pixelClusterRefs->end() && find(f->begin(),f->end(),concrete->cluster())!=f->end()){
          //too much debug LogDebug("HitExtractorPIX")<<"skipping a pixel hit on: "<< result[iH]->hit()->geographicalId().rawId()<<" key: "<<find(f->begin(),f->end(),concrete->cluster())->key();
          skipped++;
          continue;
        }
      }
      newHits.push_back(result[iH]);
    }
    result.swap(newHits);
    LogDebug("HitExtractorPIX")<<"skipped :"<<skipped<<" pixel clusters";
  }
  LogDebug("HitExtractorPIX")<<"giving :"<<result.size()<<" rechits out";
  return result;
}

Member Data Documentation

Definition at line 23 of file HitExtractorPIX.h.

Referenced by hits().

Definition at line 22 of file HitExtractorPIX.h.

Referenced by hits().

Definition at line 21 of file HitExtractorPIX.h.

Referenced by hits().