#include <SiStripRecHitConverterAlgorithm.h>
Definition at line 21 of file SiStripRecHitConverterAlgorithm.h.
Definition at line 58 of file SiStripRecHitConverterAlgorithm.h.
SiStripRecHitConverterAlgorithm::SiStripRecHitConverterAlgorithm | ( | const edm::ParameterSet & | conf | ) |
Definition at line 18 of file SiStripRecHitConverterAlgorithm.cc.
: useQuality(conf.getParameter<bool>("useSiStripQuality")), maskBad128StripBlocks( conf.existsAs<bool>("MaskBadAPVFibers") && conf.getParameter<bool>("MaskBadAPVFibers")), tracker_cache_id(0), cpe_cache_id(0), quality_cache_id(0), cpeTag(conf.getParameter<edm::ESInputTag>("StripCPE")), matcherTag(conf.getParameter<edm::ESInputTag>("Matcher")), qualityTag(conf.getParameter<edm::ESInputTag>("siStripQualityLabel")) {}
void SiStripRecHitConverterAlgorithm::fillBad128StripBlocks | ( | const uint32_t | detid, |
bool | bad128StripBlocks[6] | ||
) | const [private] |
Definition at line 359 of file SiStripRecHitConverterAlgorithm.cc.
References j, maskBad128StripBlocks, and quality.
Referenced by run().
{ if(maskBad128StripBlocks) { short badApvs = quality->getBadApvs(detid); short badFibers = quality->getBadFibers(detid); for (int j = 0; j < 6; j++) { bad128StripBlocks[j] = (badApvs & (1 << j)); } for (int j = 0; j < 3; j++) { if (badFibers & (1 << j)) { bad128StripBlocks[2*j+0] = true; bad128StripBlocks[2*j+1] = true; } } } }
void SiStripRecHitConverterAlgorithm::initialize | ( | const edm::EventSetup & | es | ) |
Definition at line 30 of file SiStripRecHitConverterAlgorithm.cc.
References cpe_cache_id, cpeTag, edm::EventSetup::get(), matcher, matcherTag, parameterestimator, quality, quality_cache_id, qualityTag, tracker, tracker_cache_id, and useQuality.
Referenced by SiStripRecHitConverter::produce().
{ uint32_t tk_cache_id = es.get<TrackerDigiGeometryRecord>().cacheIdentifier(); uint32_t c_cache_id = es.get<TkStripCPERecord>().cacheIdentifier(); uint32_t q_cache_id = es.get<SiStripQualityRcd>().cacheIdentifier(); if(tk_cache_id != tracker_cache_id) { es.get<TrackerDigiGeometryRecord>().get(tracker); tracker_cache_id = tk_cache_id; } if(c_cache_id != cpe_cache_id) { es.get<TkStripCPERecord>().get(matcherTag, matcher); es.get<TkStripCPERecord>().get(cpeTag, parameterestimator); cpe_cache_id = c_cache_id; } if( useQuality && q_cache_id!=quality_cache_id) { es.get<SiStripQualityRcd>().get(qualityTag, quality); quality_cache_id = q_cache_id; } }
bool SiStripRecHitConverterAlgorithm::isMasked | ( | const SiStripCluster & | cluster, |
bool | bad128StripBlocks[6] | ||
) | const [inline, private] |
Definition at line 378 of file SiStripRecHitConverterAlgorithm.cc.
References SiStripCluster::amplitudes(), SiStripCluster::barycenter(), SiStripCluster::firstStrip(), and maskBad128StripBlocks.
Referenced by run().
{ if(maskBad128StripBlocks) { if ( bad128StripBlocks[cluster.firstStrip() >> 7] ) { if ( bad128StripBlocks[(cluster.firstStrip()+cluster.amplitudes().size()) >> 7] || bad128StripBlocks[static_cast<int32_t>(cluster.barycenter()-0.499999) >> 7] ) { return true; } } else { if ( bad128StripBlocks[(cluster.firstStrip()+cluster.amplitudes().size()) >> 7] && bad128StripBlocks[static_cast<int32_t>(cluster.barycenter()-0.499999) >> 7] ) { return true; } } } return false; }
void SiStripRecHitConverterAlgorithm::match | ( | products & | output, |
LocalVector | trackdirection | ||
) | const [private] |
Definition at line 206 of file SiStripRecHitConverterAlgorithm.cc.
References edmNew::DetSet< T >::begin(), edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::clear(), filterCSVwithJSON::copy, edmNew::DetSet< T >::detId(), edmNew::DetSet< T >::empty(), edmNew::DetSet< T >::end(), edm::OwnVector< T, P >::end(), SiStripRecHitConverterAlgorithm::products::matched, matcher, StripSubdetector::partnerDetId(), edmNew::DetSetVector< T >::FastFiller::resize(), SiStripRecHitConverterAlgorithm::products::rphi, SiStripRecHitConverterAlgorithm::products::rphiUnmatched, edmNew::DetSet< T >::size(), edm::OwnVector< T, P >::size(), python::multivaluedict::sort(), SiStripRecHitConverterAlgorithm::products::stereo, SiStripRecHitConverterAlgorithm::products::stereoUnmatched, and tracker.
Referenced by run().
{ int nmatch=0; edm::OwnVector<SiStripMatchedRecHit2D> collectorMatched; // gp/FIXME: avoid this // Remember the ends of the collections, as we will use them a lot SiStripRecHit2DCollection::const_iterator edStereoDet = output.stereo->end(); SiStripRecHit2DCollection::const_iterator edRPhiDet = output.rphi->end(); // two work vectors for bookeeping clusters used by the stereo part of the matched hits std::vector<SiStripRecHit2D::ClusterRef::key_type> matchedSteroClusters; std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> matchedSteroClustersRegional; for (SiStripRecHit2DCollection::const_iterator itRPhiDet = output.rphi->begin(); itRPhiDet != edRPhiDet; ++itRPhiDet) { edmNew::DetSet<SiStripRecHit2D> rphiHits = *itRPhiDet; StripSubdetector specDetId(rphiHits.detId()); uint32_t partnerId = specDetId.partnerDetId(); // if not part of a glued pair if (partnerId == 0) { // I must copy these as unmatched if (!rphiHits.empty()) { SiStripRecHit2DCollection::FastFiller filler(*output.rphiUnmatched, rphiHits.detId()); filler.resize(rphiHits.size()); std::copy(rphiHits.begin(), rphiHits.end(), filler.begin()); } continue; } SiStripRecHit2DCollection::const_iterator itStereoDet = output.stereo->find(partnerId); // if the partner is not found (which probably can happen if it's empty) if (itStereoDet == edStereoDet) { // I must copy these as unmatched if (!rphiHits.empty()) { SiStripRecHit2DCollection::FastFiller filler(*output.rphiUnmatched, rphiHits.detId()); filler.resize(rphiHits.size()); std::copy(rphiHits.begin(), rphiHits.end(), filler.begin()); } continue; } edmNew::DetSet<SiStripRecHit2D> stereoHits = *itStereoDet; // Get ready for making glued hits const GluedGeomDet* gluedDet = (const GluedGeomDet*)tracker->idToDet(DetId(specDetId.glued())); typedef SiStripMatchedRecHit2DCollection::FastFiller Collector; Collector collector(*output.matched, specDetId.glued()); // Prepare also the list for unmatched rphi hits SiStripRecHit2DCollection::FastFiller fillerRphiUnm(*output.rphiUnmatched, rphiHits.detId()); // a list of clusters used by the matched part of the stereo hits in this detector matchedSteroClusters.clear(); // at the beginning, empty matchedSteroClustersRegional.clear(); // I need two because the refs can be different bool regional = false; // I also want to remember if they come from standard or HLT reco #ifdef DOUBLE_MATCH CollectorHelper chelper(collector, collectorMatched, fillerRphiUnm, matchedSteroClusters,matchedSteroClustersRegional ); matcher->doubleMatch(rphiHits.begin(), rphiHits.end(), stereoHits.begin(),stereoHits.end(),gluedDet,trackdirection,chelper); regional = chelper.regional; nmatch+=chelper.nmatch; #else // Make simple collection of this (gp:FIXME: why do we need it?) SiStripRecHitMatcher::SimpleHitCollection stereoSimpleHits; // gp:FIXME: use std::transform stereoSimpleHits.reserve(stereoHits.size()); for (edmNew::DetSet<SiStripRecHit2D>::const_iterator it = stereoHits.begin(), ed = stereoHits.end(); it != ed; ++it) { stereoSimpleHits.push_back(&*it); } for (edmNew::DetSet<SiStripRecHit2D>::const_iterator it = rphiHits.begin(), ed = rphiHits.end(); it != ed; ++it) { matcher->match(&(*it),stereoSimpleHits.begin(),stereoSimpleHits.end(),collectorMatched,gluedDet,trackdirection); if (collectorMatched.size()>0){ nmatch+=collectorMatched.size(); for (edm::OwnVector<SiStripMatchedRecHit2D>::const_iterator itm = collectorMatched.begin(), edm = collectorMatched.end(); itm != edm; ++itm) { collector.push_back(*itm); // mark the stereo hit cluster as used, so that the hit won't go in the unmatched stereo ones if (itm->stereoHit().cluster().isNonnull()) { matchedSteroClusters.push_back(itm->stereoClusterRef().key()); } else { matchedSteroClustersRegional.push_back(itm->stereoClusterRef().key()); regional = true; } } collectorMatched.clear(); } else { // store a copy of this rphi hit as an unmatched rphi hit fillerRphiUnm.push_back(*it); } } #endif // discard matched hits if the collection is empty if (collector.empty()) collector.abort(); // discard unmatched rphi hits if there are none if (fillerRphiUnm.empty()) fillerRphiUnm.abort(); // now look for unmatched stereo hits SiStripRecHit2DCollection::FastFiller fillerStereoUnm(*output.stereoUnmatched, stereoHits.detId()); if (!regional) { std::sort(matchedSteroClusters.begin(), matchedSteroClusters.end()); for (edmNew::DetSet<SiStripRecHit2D>::const_iterator it = stereoHits.begin(), ed = stereoHits.end(); it != ed; ++it) { if (!std::binary_search(matchedSteroClusters.begin(), matchedSteroClusters.end(), it->cluster().key())) { fillerStereoUnm.push_back(*it); } } } else { std::sort(matchedSteroClustersRegional.begin(), matchedSteroClustersRegional.end()); for (edmNew::DetSet<SiStripRecHit2D>::const_iterator it = stereoHits.begin(), ed = stereoHits.end(); it != ed; ++it) { if (!std::binary_search(matchedSteroClustersRegional.begin(), matchedSteroClustersRegional.end(), it->cluster_regional().key())) { fillerStereoUnm.push_back(*it); } } } if (fillerStereoUnm.empty()) fillerStereoUnm.abort(); } for (SiStripRecHit2DCollection::const_iterator itStereoDet = output.stereo->begin(); itStereoDet != edStereoDet; ++itStereoDet) { edmNew::DetSet<SiStripRecHit2D> stereoHits = *itStereoDet; StripSubdetector specDetId(stereoHits.detId()); uint32_t partnerId = specDetId.partnerDetId(); if (partnerId == 0) continue; SiStripRecHit2DCollection::const_iterator itRPhiDet = output.rphi->find(partnerId); if (itRPhiDet == edRPhiDet) { if (!stereoHits.empty()) { SiStripRecHit2DCollection::FastFiller filler(*output.stereoUnmatched, stereoHits.detId()); filler.resize(stereoHits.size()); std::copy(stereoHits.begin(), stereoHits.end(), filler.begin()); } } } edm::LogInfo("SiStripRecHitConverter") << "found\n" << nmatch << " matched RecHits\n"; }
void SiStripRecHitConverterAlgorithm::run | ( | edm::Handle< edmNew::DetSetVector< SiStripCluster > > | input, |
products & | output | ||
) |
Definition at line 52 of file SiStripRecHitConverterAlgorithm.cc.
References LaserDQM_cfg::input.
Referenced by SiStripRecHitConverter::produce().
{ run(input, output, LocalVector(0.,0.,0.)); }
void SiStripRecHitConverterAlgorithm::run | ( | edm::Handle< edm::RefGetter< SiStripCluster > > | refGetterhandle, |
edm::Handle< edm::LazyGetter< SiStripCluster > > | lazyGetterhandle, | ||
products & | output | ||
) |
Definition at line 88 of file SiStripRecHitConverterAlgorithm.cc.
References edm::RegionIndex< T >::begin(), edm::RefGetter< T >::end(), fillBad128StripBlocks(), edm::RegionIndex< T >::finish(), i, isMasked(), edm::makeRefToLazyGetter(), match(), parameterestimator, Parameters::parameters, SiStripRecHitConverterAlgorithm::products::rphi, edm::RegionIndex< T >::start(), dqm_diff::start, SiStripRecHitConverterAlgorithm::products::stereo, StripSubdetector::stereo(), tracker, and useModule().
{ bool bad128StripBlocks[6]; bool goodDet=true; DetId lastId(0); std::auto_ptr<Collector> collector(new Collector(*output.stereo, lastId)); edm::RefGetter<SiStripCluster>::const_iterator iregion = refGetterhandle->begin(); for(;iregion!=refGetterhandle->end();++iregion) { const edm::RegionIndex<SiStripCluster>& region = *iregion; const uint32_t start = region.start(); const uint32_t finish = region.finish(); for (uint32_t i = start; i < finish; i++) { edm::RegionIndex<SiStripCluster>::const_iterator icluster = region.begin()+(i-start); DetId detId(icluster->geographicalId()); if(detId != lastId) { if(collector->empty()) collector->abort(); lastId = detId; goodDet = useModule(detId); if(goodDet) { fillBad128StripBlocks(detId, bad128StripBlocks); collector = StripSubdetector(detId).stereo() ? std::auto_ptr<Collector>(new Collector(*output.stereo, detId)) : std::auto_ptr<Collector>(new Collector(*output.rphi, detId)); } } if( !goodDet || isMasked(*icluster, bad128StripBlocks)) continue; StripClusterParameterEstimator::LocalValues parameters = parameterestimator->localParameters(*icluster,*(tracker->idToDetUnit(detId))); collector->push_back(SiStripRecHit2D( parameters.first, parameters.second, detId, makeRefToLazyGetter(lazyGetterhandle,i) )); } if(collector->empty()) collector->abort(); } match(output,LocalVector(0.,0.,0.)); }
void SiStripRecHitConverterAlgorithm::run | ( | edm::Handle< edmNew::DetSetVector< SiStripCluster > > | input, |
products & | output, | ||
LocalVector | trackdirection | ||
) |
Definition at line 56 of file SiStripRecHitConverterAlgorithm.cc.
References edmNew::DetSetVector< T >::FastFiller::abort(), edmNew::DetSetVector< T >::FastFiller::empty(), fillBad128StripBlocks(), isMasked(), edmNew::makeRefTo(), match(), parameterestimator, Parameters::parameters, edmNew::DetSetVector< T >::FastFiller::push_back(), SiStripRecHitConverterAlgorithm::products::rphi, SiStripRecHitConverterAlgorithm::products::stereo, StripSubdetector::stereo(), tracker, and useModule().
{ edmNew::DetSetVector<SiStripCluster>::const_iterator dse = inputhandle->end(); for (edmNew::DetSetVector<SiStripCluster>::const_iterator DS = inputhandle->begin(); DS != dse; ++DS ) { edmNew::det_id_type id = (*DS).id(); if(!useModule(id)) continue; Collector collector = StripSubdetector(id).stereo() ? Collector(*output.stereo, id) : Collector(*output.rphi, id); bool bad128StripBlocks[6]; fillBad128StripBlocks( id, bad128StripBlocks); GeomDetUnit const & du = *(tracker->idToDetUnit(id)); edmNew::DetSet<SiStripCluster>::const_iterator cle = (*DS).end(); for(edmNew::DetSet<SiStripCluster>::const_iterator cluster = (*DS).begin(); cluster != cle; ++cluster ) { if(isMasked(*cluster,bad128StripBlocks)) continue; StripClusterParameterEstimator::LocalValues parameters = parameterestimator->localParameters(*cluster,du); collector.push_back(SiStripRecHit2D( parameters.first, parameters.second, id, edmNew::makeRefTo(inputhandle,cluster) )); } if (collector.empty()) collector.abort(); } match(output,trackdirection); }
bool SiStripRecHitConverterAlgorithm::useModule | ( | const uint32_t | id | ) | const [inline, private] |
Definition at line 398 of file SiStripRecHitConverterAlgorithm.cc.
References quality, tracker, and useQuality.
Referenced by run().
{ const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tracker->idToDetUnit(id); if(stripdet==0) edm::LogWarning("SiStripRecHitConverter") << "Detid=" << id << " not found"; return stripdet!=0 && (!useQuality || quality->IsModuleUsable(id)); }
uint32_t SiStripRecHitConverterAlgorithm::cpe_cache_id [private] |
Definition at line 51 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize().
Definition at line 52 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize().
bool SiStripRecHitConverterAlgorithm::maskBad128StripBlocks [private] |
Definition at line 50 of file SiStripRecHitConverterAlgorithm.h.
Referenced by fillBad128StripBlocks(), and isMasked().
Definition at line 55 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize(), and match().
Definition at line 52 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize().
edm::ESHandle<StripClusterParameterEstimator> SiStripRecHitConverterAlgorithm::parameterestimator [private] |
Definition at line 54 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize(), and run().
Definition at line 56 of file SiStripRecHitConverterAlgorithm.h.
Referenced by fillBad128StripBlocks(), initialize(), and useModule().
uint32_t SiStripRecHitConverterAlgorithm::quality_cache_id [private] |
Definition at line 51 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize().
Definition at line 52 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize().
Definition at line 53 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize(), match(), run(), and useModule().
uint32_t SiStripRecHitConverterAlgorithm::tracker_cache_id [private] |
Definition at line 51 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize().
bool SiStripRecHitConverterAlgorithm::useQuality [private] |
Definition at line 50 of file SiStripRecHitConverterAlgorithm.h.
Referenced by initialize(), and useModule().