#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), lastId_(0) { }
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, | ||
unsigned int | cleanFrom = 0 |
||
) | const |
Definition at line 100 of file HitExtractorSTRP.cc.
References f_, edm::Event::getByLabel(), lastId_, 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); lastId_=0; f_=stripClusterRefs->end(); HitExtractor::Hits newHits; unsigned int skipped=0; unsigned int projected=0; newHits.reserve(hits.size()); TransientTrackingRecHit::ConstRecHitPointer replaceMe; for (unsigned int iH=cleanFrom;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((const 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 132 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; unsigned int cleanFrom=0; // // TIB // if (theLayer->subDetector() == GeomDetEnumerators::TIB) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *matchedHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,true,cleanFrom); } 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 if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *rphiHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false,cleanFrom); } } else { if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *rphiHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false,cleanFrom); } } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *stereoHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false,cleanFrom); } } // // TID // else if (theLayer->subDetector() == GeomDetEnumerators::TID) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); if (skipClusters) cleanFrom=result.size(); 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,cleanFrom); } if (hasRPhiHits) { edm::Handle<SiStripRecHit2DCollection> rphiHits; ev.getByLabel( theRPhiHits, rphiHits); if (skipClusters) cleanFrom=result.size(); 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,cleanFrom); } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); if (skipClusters) cleanFrom=result.size(); 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,cleanFrom); } } // // TOB // else if (theLayer->subDetector() == GeomDetEnumerators::TOB) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *matchedHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,true,cleanFrom); } 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 if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *rphiHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false,cleanFrom); } } else { if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *rphiHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false,cleanFrom); } } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); if (skipClusters) cleanFrom=result.size(); range2SeedingHits( *stereoHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); if (skipClusters) cleanedOfClusters(ev,result,false,cleanFrom); } } // // TEC // else if (theLayer->subDetector() == GeomDetEnumerators::TEC) { if (hasMatchedHits) { edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits; ev.getByLabel( theMatchedHits, matchedHits); if (skipClusters) cleanFrom=result.size(); 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,cleanFrom); } if (hasRPhiHits) { edm::Handle<SiStripRecHit2DCollection> rphiHits; ev.getByLabel( theRPhiHits, rphiHits); if (skipClusters) cleanFrom=result.size(); 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,cleanFrom); } if (hasStereoHits) { edm::Handle<SiStripRecHit2DCollection> stereoHits; ev.getByLabel( theStereoHits, stereoHits); if (skipClusters) cleanFrom=result.size(); 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,cleanFrom); } } LogDebug("HitExtractorSTRP")<<" giving: "<<result.size()<<" out"; return result; }
void HitExtractorSTRP::project | ( | TransientTrackingRecHit::ConstRecHitPointer & | ptr, |
const SiStripRecHit2D * | hit, | ||
TransientTrackingRecHit::ConstRecHitPointer & | replaceMe | ||
) | const |
Definition at line 62 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 40 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 73 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 47 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(), lastId_, and DetId::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 33 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; }
edmNew::DetSetVector<SiStripClusterRef>::const_iterator ctfseeding::HitExtractorSTRP::f_ [mutable, private] |
Definition at line 55 of file HitExtractorSTRP.h.
Referenced by cleanedOfClusters(), and skipThis().
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().
DetId ctfseeding::HitExtractorSTRP::lastId_ [mutable, private] |
Definition at line 54 of file HitExtractorSTRP.h.
Referenced by cleanedOfClusters(), and skipThis().
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().