#include <HitExtractorSTRP.h>
Definition at line 16 of file HitExtractorSTRP.h.
Definition at line 19 of file HitExtractorSTRP.h.
HitExtractorSTRP::HitExtractorSTRP | ( | const DetLayer * | detLayer, |
SeedingLayer::Side & | side, | ||
int | idLayer | ||
) |
Definition at line 25 of file HitExtractorSTRP.cc.
Referenced by clone().
: theLayer(detLayer), theSide(side), theIdLayer(idLayer), hasMatchedHits(false), hasRPhiHits(false), hasStereoHits(false), hasRingSelector(false), theMinRing(1), theMaxRing(0), hasSimpleRphiHitsCleaner(true) { }
virtual ctfseeding::HitExtractorSTRP::~HitExtractorSTRP | ( | ) | [inline, virtual] |
Definition at line 22 of file HitExtractorSTRP.h.
{}
void HitExtractorSTRP::cleanedOfClusters | ( | const edm::Event & | ev, |
HitExtractor::Hits & | hits, | ||
bool | matched | ||
) | const |
Definition at line 101 of file HitExtractorSTRP.cc.
References edm::Event::getByLabel(), LogDebug, skipThis(), and ctfseeding::HitExtractor::theSkipClusters.
Referenced by hits().
{ LogDebug("HitExtractorPIX")<<"getting: "<<hits.size()<<" in input."; edm::Handle<edmNew::DetSetVector<SiStripClusterRef> > stripClusterRefs; ev.getByLabel(theSkipClusters,stripClusterRefs); HitExtractor::Hits newHits; uint skipped=0; uint projected=0; newHits.reserve(hits.size()); TransientTrackingRecHit::ConstRecHitPointer replaceMe; for (unsigned int iH=0;iH!=hits.size();++iH){ replaceMe=hits[iH]; if (matched && skipThis(hits[iH],stripClusterRefs,replaceMe)){ LogDebug("HitExtractorSTRP")<<"skipping a matched hit on :"<<hits[iH]->hit()->geographicalId().rawId(); skipped++; continue; } if (!matched && skipThis((SiStripRecHit2D*) hits[iH]->hit(),stripClusterRefs)){ LogDebug("HitExtractorSTRP")<<"skipping a hit on :"<<hits[iH]->hit()->geographicalId().rawId()<<" key: "; skipped++; continue; } if (replaceMe!=hits[iH]) projected++; newHits.push_back(replaceMe); } LogDebug("HitExtractorPIX")<<"skipped :"<<skipped<<" strip rechits because of clusters and projected: "<<projected; hits.swap(newHits); }
virtual HitExtractorSTRP* ctfseeding::HitExtractorSTRP::clone | ( | void | ) | const [inline, virtual] |
Definition at line 25 of file HitExtractorSTRP.h.
References HitExtractorSTRP().
{ return new HitExtractorSTRP(*this); }
HitExtractor::Hits HitExtractorSTRP::hits | ( | const SeedingLayer & | sl, |
const edm::Event & | ev, | ||
const edm::EventSetup & | es | ||
) | const [virtual] |
Implements ctfseeding::HitExtractor.
Definition at line 130 of file HitExtractorSTRP.cc.
References TransientTrackingRecHitBuilder::build(), cleanedOfClusters(), end, edm::Event::getByLabel(), hasMatchedHits, hasRPhiHits, hasSimpleRphiHitsCleaner, hasStereoHits, ctfseeding::SeedingLayer::hitBuilder(), LogDebug, ctfseeding::range2SeedingHits(), query::result, relativeConstraints::ring, ringRange(), ctfseeding::HitExtractor::skipClusters, TrackerLayerIdAccessor::stripTECDisk(), TrackerLayerIdAccessor::stripTIBLayer(), TrackerLayerIdAccessor::stripTIDDisk(), TrackerLayerIdAccessor::stripTOBLayer(), DetLayer::subDetector(), sistripsummary::TEC, theIdLayer, theLayer, theMatchedHits, theRPhiHits, theSide, theSLayer, theStereoHits, sistripsummary::TIB, sistripsummary::TID, and sistripsummary::TOB.
{ HitExtractor::Hits result; TrackerLayerIdAccessor accessor; theSLayer=&sl; // // TIB // if (theLayer->subDetector() == GeomDetEnumerators::TIB) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); range2SeedingHits( *matchedHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,true); } if (hasRPhiHits) { edm::Handle<SiStripRecHit2DCollection> rphiHits; ev.getByLabel( theRPhiHits, rphiHits); if (hasMatchedHits){ if (!hasSimpleRphiHitsCleaner){ // this is a brutal "cleaning". Add something smarter in the future range2SeedingHits( *rphiHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false); } } else { range2SeedingHits( *rphiHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false); } } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); range2SeedingHits( *stereoHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false); } } // // TID // else if (theLayer->subDetector() == GeomDetEnumerators::TID) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); std::pair<DetId,DetIdTIDSameDiskComparator> getter = accessor.stripTIDDisk(theSide,theIdLayer); SiStripMatchedRecHit2DCollection::Range range = matchedHits->equal_range(getter.first, getter.second); for (SiStripMatchedRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { int ring = TIDDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; for (SiStripMatchedRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } } if (skipClusters) cleanedOfClusters(ev,result,true); } if (hasRPhiHits) { edm::Handle<SiStripRecHit2DCollection> rphiHits; ev.getByLabel( theRPhiHits, rphiHits); std::pair<DetId,DetIdTIDSameDiskComparator> getter = accessor.stripTIDDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = rphiHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { int ring = TIDDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; if ((SiStripDetId(it->detId()).partnerDetId() != 0) && hasSimpleRphiHitsCleaner) continue; // this is a brutal "cleaning". Add something smarter in the future for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } } if (skipClusters) cleanedOfClusters(ev,result,false); } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); std::pair<DetId,DetIdTIDSameDiskComparator> getter = accessor.stripTIDDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = stereoHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { int ring = TIDDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } } if (skipClusters) cleanedOfClusters(ev,result,false); } } // // TOB // else if (theLayer->subDetector() == GeomDetEnumerators::TOB) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); range2SeedingHits( *matchedHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,true); } if (hasRPhiHits) { edm::Handle<SiStripRecHit2DCollection> rphiHits; ev.getByLabel( theRPhiHits, rphiHits); if (hasMatchedHits){ if (!hasSimpleRphiHitsCleaner){ // this is a brutal "cleaning". Add something smarter in the future range2SeedingHits( *rphiHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false); } } else { range2SeedingHits( *rphiHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false); } } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); range2SeedingHits( *stereoHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false); } } // // TEC // else if (theLayer->subDetector() == GeomDetEnumerators::TEC) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); std::pair<DetId,DetIdTECSameDiskComparator> getter = accessor.stripTECDisk(theSide,theIdLayer); SiStripMatchedRecHit2DCollection::Range range = matchedHits->equal_range(getter.first, getter.second); for (SiStripMatchedRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { int ring = TECDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; for (SiStripMatchedRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } } if (skipClusters) cleanedOfClusters(ev,result,true); } if (hasRPhiHits) { edm::Handle<SiStripRecHit2DCollection> rphiHits; ev.getByLabel( theRPhiHits, rphiHits); std::pair<DetId,DetIdTECSameDiskComparator> getter = accessor.stripTECDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = rphiHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { int ring = TECDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; if ((SiStripDetId(it->detId()).partnerDetId() != 0) && hasSimpleRphiHitsCleaner) continue; // this is a brutal "cleaning". Add something smarter in the future for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } } if (skipClusters) cleanedOfClusters(ev,result,false); } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); std::pair<DetId,DetIdTECSameDiskComparator> getter = accessor.stripTECDisk(theSide,theIdLayer); SiStripRecHit2DCollection::Range range = stereoHits->equal_range(getter.first, getter.second); for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) { int ring = TECDetId( it->detId() ).ring(); if (!ringRange(ring)) continue; for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) { result.push_back( sl.hitBuilder()->build(hit) ); } } if (skipClusters) cleanedOfClusters(ev,result,false); } } LogDebug("HitExtractorSTRP")<<" giving: "<<result.size()<<" out"; return result; }
void HitExtractorSTRP::project | ( | TransientTrackingRecHit::ConstRecHitPointer & | ptr, |
const SiStripRecHit2D * | hit, | ||
TransientTrackingRecHit::ConstRecHitPointer & | replaceMe | ||
) | const |
Definition at line 63 of file HitExtractorSTRP.cc.
References TransientTrackingRecHitBuilder::build(), failProjection, ctfseeding::SeedingLayer::hitBuilder(), LogDebug, TrackingRecHitProjector< ResultingHit >::project(), and theSLayer.
Referenced by skipThis().
{ if (failProjection) {replaceMe=0; return;} TrackingRecHitProjector<ProjectedRecHit2D> proj; TransientTrackingRecHit::RecHitPointer sHit=theSLayer->hitBuilder()->build(hit); replaceMe=proj.project( *sHit, *ptr->det()); if (!replaceMe) LogDebug("HitExtractorSTRP")<<"projection failed."; }
bool HitExtractorSTRP::ringRange | ( | int | ring | ) | const [private] |
Definition at line 39 of file HitExtractorSTRP.cc.
References hasRingSelector, theMaxRing, and theMinRing.
Referenced by hits().
{ if (!hasRingSelector) return true; else if ( ring >= theMinRing && ring <= theMaxRing) return true; else return false; }
void ctfseeding::HitExtractorSTRP::setNoProjection | ( | ) | const [inline] |
Definition at line 40 of file HitExtractorSTRP.h.
References failProjection.
{failProjection=true;};
bool HitExtractorSTRP::skipThis | ( | TransientTrackingRecHit::ConstRecHitPointer & | ptr, |
edm::Handle< edmNew::DetSetVector< SiStripClusterRef > > & | stripClusterRefs, | ||
TransientTrackingRecHit::ConstRecHitPointer & | replaceMe | ||
) | const |
Definition at line 74 of file HitExtractorSTRP.cc.
References SiStripRecHit2D::cluster(), LogDebug, SiStripMatchedRecHit2D::monoHit(), project(), and SiStripMatchedRecHit2D::stereoHit().
Referenced by cleanedOfClusters().
{ const SiStripMatchedRecHit2D * hit = (SiStripMatchedRecHit2D *) ptr->hit(); bool rejectSt=false,rejectMono=false; if (skipThis(hit->stereoHit(),stripClusterRefs)) rejectSt=true; if (skipThis(hit->monoHit(),stripClusterRefs)) rejectMono=true; if (rejectSt&&rejectMono){ //only skip if both hits are done return true; } else{ if (rejectSt) project(ptr,hit->stereoHit(),replaceMe); else if (rejectMono) project(ptr,hit->monoHit(),replaceMe); if (!replaceMe) return true; //means that the projection failed, and needs to be skipped if (rejectSt) LogDebug("HitExtractorSTRP")<<"a matched hit is partially masked, and the mono hit got projected onto: "<<replaceMe->hit()->geographicalId().rawId()<<" key: "<<hit->monoHit()->cluster().key(); else if (rejectMono) LogDebug("HitExtractorSTRP")<<"a matched hit is partially masked, and the stereo hit got projected onto: "<<replaceMe->hit()->geographicalId().rawId()<<" key: "<<hit->stereoHit()->cluster().key(); return false; //means the projection succeeded or nothing to be masked, no need to skip and replaceMe is going to be used anyways. } return false; }
bool HitExtractorSTRP::skipThis | ( | const SiStripRecHit2D * | hit, |
edm::Handle< edmNew::DetSetVector< SiStripClusterRef > > & | stripClusterRefs | ||
) | const |
Definition at line 46 of file HitExtractorSTRP.cc.
References edmNew::DetSetVector< T >::begin(), SiStripRecHit2D::cluster(), edmNew::DetSetVector< T >::end(), f, spr::find(), edmNew::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), and DetId::rawId().
{ static DetId lastId=hit->geographicalId(); static edmNew::DetSetVector<SiStripClusterRef>::const_iterator f=stripClusterRefs->find(lastId.rawId()); if (hit->geographicalId()!=lastId){ lastId=hit->geographicalId(); f=stripClusterRefs->find(lastId.rawId()); } if (f==stripClusterRefs->end()) return false; if (!hit->isValid()) return false; bool skipping=(find(f->begin(),f->end(),hit->cluster())!=f->end()); //if (skipping) LogDebug("HitExtractorSTRP")<<"skipping a hit on :"<<hit->geographicalId().rawId()<<" key: "<<hit->cluster().key(); return skipping; }
void ctfseeding::HitExtractorSTRP::useMatchedHits | ( | const edm::InputTag & | m | ) | [inline] |
Definition at line 27 of file HitExtractorSTRP.h.
References hasMatchedHits, m, and theMatchedHits.
{ hasMatchedHits = true; theMatchedHits = m; }
void HitExtractorSTRP::useRingSelector | ( | int | minRing, |
int | maxRing | ||
) |
Definition at line 32 of file HitExtractorSTRP.cc.
References hasRingSelector, theMaxRing, and theMinRing.
{ hasRingSelector=true; theMinRing=minRing; theMaxRing=maxRing; }
void ctfseeding::HitExtractorSTRP::useRPhiHits | ( | const edm::InputTag & | m | ) | [inline] |
Definition at line 28 of file HitExtractorSTRP.h.
References hasRPhiHits, m, and theRPhiHits.
{ hasRPhiHits = true; theRPhiHits = m; }
void ctfseeding::HitExtractorSTRP::useSimpleRphiHitsCleaner | ( | bool | use | ) | [inline] |
Definition at line 31 of file HitExtractorSTRP.h.
References hasSimpleRphiHitsCleaner.
{hasSimpleRphiHitsCleaner = use;}
void ctfseeding::HitExtractorSTRP::useStereoHits | ( | const edm::InputTag & | m | ) | [inline] |
Definition at line 29 of file HitExtractorSTRP.h.
References hasStereoHits, m, and theStereoHits.
{ hasStereoHits = true; theStereoHits = m; }
bool ctfseeding::HitExtractorSTRP::failProjection [mutable, private] |
Definition at line 53 of file HitExtractorSTRP.h.
Referenced by project(), and setNoProjection().
bool ctfseeding::HitExtractorSTRP::hasMatchedHits [private] |
Definition at line 48 of file HitExtractorSTRP.h.
Referenced by hits(), and useMatchedHits().
bool ctfseeding::HitExtractorSTRP::hasRingSelector [private] |
Definition at line 51 of file HitExtractorSTRP.h.
Referenced by ringRange(), and useRingSelector().
bool ctfseeding::HitExtractorSTRP::hasRPhiHits [private] |
Definition at line 49 of file HitExtractorSTRP.h.
Referenced by hits(), and useRPhiHits().
bool ctfseeding::HitExtractorSTRP::hasSimpleRphiHitsCleaner [private] |
Definition at line 52 of file HitExtractorSTRP.h.
Referenced by hits(), and useSimpleRphiHitsCleaner().
bool ctfseeding::HitExtractorSTRP::hasStereoHits [private] |
Definition at line 50 of file HitExtractorSTRP.h.
Referenced by hits(), and useStereoHits().
int ctfseeding::HitExtractorSTRP::theIdLayer [private] |
Definition at line 47 of file HitExtractorSTRP.h.
Referenced by hits().
const DetLayer* ctfseeding::HitExtractorSTRP::theLayer [private] |
Definition at line 44 of file HitExtractorSTRP.h.
Referenced by hits().
Definition at line 48 of file HitExtractorSTRP.h.
Referenced by hits(), and useMatchedHits().
int ctfseeding::HitExtractorSTRP::theMaxRing [private] |
Definition at line 51 of file HitExtractorSTRP.h.
Referenced by ringRange(), and useRingSelector().
int ctfseeding::HitExtractorSTRP::theMinRing [private] |
Definition at line 51 of file HitExtractorSTRP.h.
Referenced by ringRange(), and useRingSelector().
Definition at line 49 of file HitExtractorSTRP.h.
Referenced by hits(), and useRPhiHits().
Definition at line 45 of file HitExtractorSTRP.h.
Referenced by hits().
const SeedingLayer* ctfseeding::HitExtractorSTRP::theSLayer [mutable, private] |
Definition at line 46 of file HitExtractorSTRP.h.
Definition at line 50 of file HitExtractorSTRP.h.
Referenced by hits(), and useStereoHits().