#include <ClusterStorer.h>
Classes | |
class | ClusterHitRecord |
A struct for clusters associated to hits. More... | |
Public Member Functions | |
void | addCluster (TrackingRecHitCollection &hits, size_t index) |
add cluster of newHit to list (throws if hit is of unknown type) | |
void | clear () |
clear records | |
ClusterStorer () | |
void | processAllClusters (edmNew::DetSetVector< SiPixelCluster > &pixelDsvToFill, edm::RefProd< edmNew::DetSetVector< SiPixelCluster > > refPixelClusters, edmNew::DetSetVector< SiStripCluster > &stripDsvToFill, edm::RefProd< edmNew::DetSetVector< SiStripCluster > > refStripClusters) |
Private Types | |
typedef ClusterHitRecord < SiPixelRecHit::ClusterRef > | PixelClusterHitRecord |
typedef ClusterHitRecord < SiStripRecHit2D::ClusterRef > | StripClusterHitRecord |
Assuming that the ClusterRef is the same for all SiStripRecHit*: | |
Private Member Functions | |
template<typename HitType , typename ClusterType > | |
void | processClusters (std::vector< ClusterHitRecord< typename HitType::ClusterRef > > &clusterRecords, edmNew::DetSetVector< ClusterType > &dsvToFill, edm::RefProd< edmNew::DetSetVector< ClusterType > > &refprod) |
Private Attributes | |
std::vector < PixelClusterHitRecord > | pixelClusterRecords_ |
std::vector < StripClusterHitRecord > | stripClusterRecords_ |
Definition at line 26 of file ClusterStorer.h.
typedef ClusterHitRecord<SiPixelRecHit::ClusterRef> helper::ClusterStorer::PixelClusterHitRecord [private] |
Definition at line 74 of file ClusterStorer.h.
typedef ClusterHitRecord<SiStripRecHit2D::ClusterRef> helper::ClusterStorer::StripClusterHitRecord [private] |
Assuming that the ClusterRef is the same for all SiStripRecHit*:
Definition at line 76 of file ClusterStorer.h.
helper::ClusterStorer::ClusterStorer | ( | ) | [inline] |
Definition at line 28 of file ClusterStorer.h.
{}
void ClusterStorer::addCluster | ( | TrackingRecHitCollection & | hits, |
size_t | index | ||
) |
add cluster of newHit to list (throws if hit is of unknown type)
Definition at line 22 of file ClusterStorer.cc.
References Exception, getHLTprescales::index, ProjectedSiStripRecHit2D::originalHit(), pixelClusterRecords_, and stripClusterRecords_.
Referenced by helper::MuonCollectionStoreManager::processMuon(), and helper::TrackCollectionStoreManager::processTrack().
{ TrackingRecHit &newHit = hits[index]; const std::type_info &hit_type = typeid(newHit); if (hit_type == typeid(SiPixelRecHit)) { //std::cout << "| It is a Pixel hit !!" << std::endl; pixelClusterRecords_.push_back(PixelClusterHitRecord(static_cast<SiPixelRecHit&>(newHit), hits, index)); } else if (hit_type == typeid(SiStripRecHit1D)) { //std::cout << "| It is a SiStripRecHit1D hit !!" << std::endl; stripClusterRecords_.push_back(StripClusterHitRecord(static_cast<SiStripRecHit1D&>(newHit), hits, index)); } else if (hit_type == typeid(SiStripRecHit2D)) { //std::cout << "| It is a SiStripRecHit2D hit !!" << std::endl; stripClusterRecords_.push_back(StripClusterHitRecord(static_cast<SiStripRecHit2D&>(newHit), hits, index)); } else if (hit_type == typeid(SiStripMatchedRecHit2D)) { //std::cout << "| It is a SiStripMatchedRecHit2D hit !!" << std::endl; SiStripMatchedRecHit2D &mhit = static_cast<SiStripMatchedRecHit2D&>(newHit); stripClusterRecords_.push_back(StripClusterHitRecord(mhit.monoHit(), hits, index)); stripClusterRecords_.push_back(StripClusterHitRecord(mhit.stereoHit(), hits, index)); } else if (hit_type == typeid(ProjectedSiStripRecHit2D)) { //std::cout << "| It is a ProjectedSiStripRecHit2D hit !!" << std::endl; ProjectedSiStripRecHit2D &phit = static_cast<ProjectedSiStripRecHit2D&>(newHit); stripClusterRecords_.push_back(StripClusterHitRecord(phit.originalHit(), hits, index)); } else { if (hit_type == typeid(SiTrackerGSMatchedRecHit2D) || hit_type == typeid(SiTrackerGSRecHit2D)) { //std::cout << "| It is a " << hit_type.name() << " hit !!" << std::endl; // FastSim hits: Do nothing instead of caring about FastSim clusters, // not even sure whether these really exist. // At least predecessor code in TrackSelector and MuonSelector // did not treat them. } else { // through for unknown types throw cms::Exception("UnknownHitType") << "helper::ClusterStorer::addCluster: " << "Unknown hit type " << hit_type.name() << ".\n"; } } // end 'switch' on hit type }
void ClusterStorer::clear | ( | void | ) |
clear records
Definition at line 66 of file ClusterStorer.cc.
References pixelClusterRecords_, and stripClusterRecords_.
Referenced by helper::TrackCollectionStoreManager::cloneAndStore(), and helper::MuonCollectionStoreManager::cloneAndStore().
{ pixelClusterRecords_.clear(); stripClusterRecords_.clear(); }
void ClusterStorer::processAllClusters | ( | edmNew::DetSetVector< SiPixelCluster > & | pixelDsvToFill, |
edm::RefProd< edmNew::DetSetVector< SiPixelCluster > > | refPixelClusters, | ||
edmNew::DetSetVector< SiStripCluster > & | stripDsvToFill, | ||
edm::RefProd< edmNew::DetSetVector< SiStripCluster > > | refStripClusters | ||
) |
Processes all the clusters of the tracks (after the tracks have been dealt with), need Refs to products (i.e. full collections) in the event.
Definition at line 74 of file ClusterStorer.cc.
References pixelClusterRecords_, and stripClusterRecords_.
Referenced by helper::MuonCollectionStoreManager::cloneAndStore(), and helper::TrackCollectionStoreManager::cloneAndStore().
{ if (!pixelClusterRecords_.empty()) { this->processClusters<SiPixelRecHit, SiPixelCluster> (pixelClusterRecords_, pixelDsvToFill, refPixelClusters); } if (!stripClusterRecords_.empty()) { // All we need from the HitType 'SiStripRecHit2D' is the // typedef for 'SiStripRecHit2D::ClusterRef'. // The fact that rekey<SiStripRecHit2D> is called is irrelevant since // ClusterHitRecord<typename SiStripRecHit2D::ClusterRef>::rekey<RecHitType> // is specialised such that 'RecHitType' is not used... this->processClusters<SiStripRecHit2D, SiStripCluster> (stripClusterRecords_, stripDsvToFill, refStripClusters); } }
void ClusterStorer::processClusters | ( | std::vector< ClusterHitRecord< typename HitType::ClusterRef > > & | clusterRecords, |
edmNew::DetSetVector< ClusterType > & | dsvToFill, | ||
edm::RefProd< edmNew::DetSetVector< ClusterType > > & | refprod | ||
) | [private] |
Processes all the clusters of a specific type (after the tracks have been dealt with)
Definition at line 97 of file ClusterStorer.cc.
References cond::rpcobgas::detid, end, edmNew::DetSetVector< T >::FastFiller::push_back(), and python::multivaluedict::sort().
{ std::sort(clusterRecords.begin(), clusterRecords.end()); // this sorts them by detid typedef typename std::vector<ClusterHitRecord<typename HitType::ClusterRef> >::const_iterator RIT; RIT it = clusterRecords.begin(), end = clusterRecords.end(); size_t clusters = 0; while (it != end) { RIT it2 = it; uint32_t detid = it->detid(); // first isolate all clusters on the same detid while ( (it2 != end) && (it2->detid() == detid)) { ++it2; } // now [it, it2] bracket one detid // then prepare to copy the clusters typename edmNew::DetSetVector<ClusterType>::FastFiller filler(dsvToFill, detid); typename HitType::ClusterRef lastRef, newRef; for ( ; it != it2; ++it) { // loop on the detid // first check if we need to clone the hit if (it->clusterRef() != lastRef) { lastRef = it->clusterRef(); // clone cluster filler.push_back( *lastRef ); // make new ref newRef = typename HitType::ClusterRef( refprod, clusters++ ); } it->template rekey<HitType>(newRef); } // end of the loop on a single detid } // end of the loop on all clusters }
std::vector<PixelClusterHitRecord> helper::ClusterStorer::pixelClusterRecords_ [private] |
Definition at line 89 of file ClusterStorer.h.
Referenced by addCluster(), clear(), and processAllClusters().
std::vector<StripClusterHitRecord> helper::ClusterStorer::stripClusterRecords_ [private] |
Definition at line 90 of file ClusterStorer.h.
Referenced by addCluster(), clear(), and processAllClusters().