CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HitExtractorPIX.cc
Go to the documentation of this file.
1 #include "HitExtractorPIX.h"
4 
7 
10 
11 using namespace ctfseeding;
12 using namespace std;
13 
15  SeedingLayer::Side & side, int idLayer, const std::string & hitProducer, edm::ConsumesCollector& iC)
16  : theHitProducer(iC.consumes<SiPixelRecHitCollection>(hitProducer)), theSide(side), theIdLayer(idLayer)
17 { }
18 
21 }
22 
24 {
26  TrackerLayerIdAccessor accessor;
28  ev.getByToken( theHitProducer, pixelHits);
30  range2SeedingHits( *pixelHits, result, accessor.pixelBarrelLayer(theIdLayer), ttrhBuilder, es );
31  } else {
32  range2SeedingHits( *pixelHits, result, accessor.pixelForwardDisk(theSide,theIdLayer), ttrhBuilder, es );
33  }
34 
35 
36  if (skipClusters){
37  LogDebug("HitExtractorPIX")<<"getting : "<<result.size()<<" pixel hits.";
38  //std::cout<<" skipping"<<std::endl;
39  edm::Handle<SkipClustersCollection> pixelClusterMask;
40  ev.getByToken(theSkipClusters,pixelClusterMask);
41  std::vector<bool> keep(result.size(),true);
42  HitExtractor::Hits newHits;
43  unsigned int skipped=0;
44  if (result.empty()) return result;
45  newHits.reserve(result.size());
46  for (unsigned int iH=0;iH!=result.size();++iH){
47  if (result[iH]->hit()->isValid()){
48  SiPixelRecHit * concrete = (SiPixelRecHit *) result[iH]->hit();
49  assert(pixelClusterMask->refProd().id() == concrete->cluster().id());
50  if(pixelClusterMask->mask(concrete->cluster().key())) {
51  //too much debug LogDebug("HitExtractorPIX")<<"skipping a pixel hit on: "<< result[iH]->hit()->geographicalId().rawId()<<" key: "<<find(f->begin(),f->end(),concrete->cluster())->key();
52  skipped++;
53  continue;
54  }
55  }
56  newHits.push_back(result[iH]);
57  }
58  result.swap(newHits);
59  LogDebug("HitExtractorPIX")<<"skipped :"<<skipped<<" pixel clusters";
60  }
61  LogDebug("HitExtractorPIX")<<"giving :"<<result.size()<<" rechits out";
62  return result;
63 }
#define LogDebug(id)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
void useSkipClusters_(const edm::InputTag &m, edm::ConsumesCollector &iC) override
std::pair< DetId, DetIdPXFSameDiskComparator > pixelForwardDisk(int side, int disk)
edm::EDGetTokenT< SiPixelRecHitCollection > theHitProducer
const int keep
SeedingLayer::Side theSide
tuple result
Definition: query.py:137
void range2SeedingHits(DSTV const &dstv, HitExtractor::Hits &v, std::pair< A, B > const &sel, const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::EventSetup &es)
Definition: HitExtractor.h:51
virtual HitExtractor::Hits hits(const TransientTrackingRecHitBuilder &ttrhBuilder, const edm::Event &, const edm::EventSetup &) const
std::pair< DetId, DetIdPXBSameLayerComparator > pixelBarrelLayer(int layer)
edm::EDGetTokenT< SkipClustersCollection > theSkipClusters
HitExtractorPIX(SeedingLayer::Side &side, int idLayer, const std::string &hitProducer, edm::ConsumesCollector &iC)
Pixel Reconstructed Hit.
std::vector< TransientTrackingRecHit::ConstRecHitPointer > Hits
Definition: HitExtractor.h:20