CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
helper::ClusterStorer Class Reference

#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) More...
 
void clear ()
 clear records More...
 
 ClusterStorer ()
 
void processAllClusters (edmNew::DetSetVector< SiPixelCluster > &pixelDsvToFill, edm::RefProd< edmNew::DetSetVector< SiPixelCluster > > refPixelClusters, edmNew::DetSetVector< SiStripCluster > &stripDsvToFill, edm::RefProd< edmNew::DetSetVector< SiStripCluster > > refStripClusters, edmNew::DetSetVector< Phase2TrackerCluster1D > &phase2OTDsvToFill, edm::RefProd< edmNew::DetSetVector< Phase2TrackerCluster1D > > refPhase2OTClusters)
 

Private Types

typedef ClusterHitRecord< Phase2TrackerRecHit1D::ClusterRefPhase2OTClusterHitRecord
 
typedef ClusterHitRecord< SiPixelRecHit::ClusterRefPixelClusterHitRecord
 
typedef ClusterHitRecord< SiStripRecHit2D::ClusterRefStripClusterHitRecord
 Assuming that the ClusterRef is the same for all SiStripRecHit*: More...
 

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< Phase2OTClusterHitRecordphase2OTClusterRecords_
 
std::vector< PixelClusterHitRecordpixelClusterRecords_
 
std::vector< StripClusterHitRecordstripClusterRecords_
 

Detailed Description

Definition at line 28 of file ClusterStorer.h.

Member Typedef Documentation

◆ Phase2OTClusterHitRecord

typedef ClusterHitRecord<Phase2TrackerRecHit1D::ClusterRef> helper::ClusterStorer::Phase2OTClusterHitRecord
private

Definition at line 83 of file ClusterStorer.h.

◆ PixelClusterHitRecord

typedef ClusterHitRecord<SiPixelRecHit::ClusterRef> helper::ClusterStorer::PixelClusterHitRecord
private

Definition at line 78 of file ClusterStorer.h.

◆ StripClusterHitRecord

typedef ClusterHitRecord<SiStripRecHit2D::ClusterRef> helper::ClusterStorer::StripClusterHitRecord
private

Assuming that the ClusterRef is the same for all SiStripRecHit*:

Definition at line 80 of file ClusterStorer.h.

Constructor & Destructor Documentation

◆ ClusterStorer()

helper::ClusterStorer::ClusterStorer ( )
inline

Definition at line 30 of file ClusterStorer.h.

30 {}

Member Function Documentation

◆ addCluster()

void ClusterStorer::addCluster ( TrackingRecHitCollection hits,
size_t  index 
)

add cluster of newHit to list (throws if hit is of unknown type)

Definition at line 24 of file ClusterStorer.cc.

References Exception, hfClusterShapes_cfi::hits, SiStripMatchedRecHit2D::monoHit(), ProjectedSiStripRecHit2D::originalHit(), phase2OTClusterRecords_, pixelClusterRecords_, SiStripMatchedRecHit2D::stereoHit(), and stripClusterRecords_.

Referenced by helper::MuonCollectionStoreManager::processMuon(), and helper::TrackCollectionStoreManager::processTrack().

24  {
25  TrackingRecHit &newHit = hits[index];
26  const std::type_info &hit_type = typeid(newHit);
27  if (hit_type == typeid(SiPixelRecHit)) {
28  //std::cout << "| It is a Pixel hit !!" << std::endl;
29  pixelClusterRecords_.push_back(PixelClusterHitRecord(static_cast<SiPixelRecHit &>(newHit), hits, index));
30  } else if (hit_type == typeid(SiStripRecHit1D)) {
31  //std::cout << "| It is a SiStripRecHit1D hit !!" << std::endl;
32  stripClusterRecords_.push_back(StripClusterHitRecord(static_cast<SiStripRecHit1D &>(newHit), hits, index));
33  } else if (hit_type == typeid(SiStripRecHit2D)) {
34  //std::cout << "| It is a SiStripRecHit2D hit !!" << std::endl;
35  stripClusterRecords_.push_back(StripClusterHitRecord(static_cast<SiStripRecHit2D &>(newHit), hits, index));
36  } else if (hit_type == typeid(SiStripMatchedRecHit2D)) {
37  //std::cout << "| It is a SiStripMatchedRecHit2D hit !!" << std::endl;
38  SiStripMatchedRecHit2D &mhit = static_cast<SiStripMatchedRecHit2D &>(newHit);
41  } else if (hit_type == typeid(ProjectedSiStripRecHit2D)) {
42  //std::cout << "| It is a ProjectedSiStripRecHit2D hit !!" << std::endl;
43  ProjectedSiStripRecHit2D &phit = static_cast<ProjectedSiStripRecHit2D &>(newHit);
45  } else if (hit_type == typeid(Phase2TrackerRecHit1D)) {
46  //FIXME:: this is just temporary solution for phase2,
47  //it is not really running in the phase2 tracking wf - yet...
48  phase2OTClusterRecords_.push_back(
49  Phase2OTClusterHitRecord(static_cast<Phase2TrackerRecHit1D &>(newHit), hits, index));
50  } else if (hit_type == typeid(VectorHit)) {
51  //FIXME:: this is just temporary solution for phase2,
52  //the VectorHit has 2 clusters but just a hit!
53  phase2OTClusterRecords_.push_back(Phase2OTClusterHitRecord(static_cast<VectorHit &>(newHit), hits, index));
54  } else {
55  if (hit_type == typeid(FastTrackerRecHit) || hit_type == typeid(FastProjectedTrackerRecHit) ||
56  hit_type == typeid(FastMatchedTrackerRecHit)) {
57  //std::cout << "| It is a " << hit_type.name() << " hit !!" << std::endl;
58  // FastSim hits: Do nothing instead of caring about FastSim clusters,
59  // not even sure whether these really exist.
60  // At least predecessor code in TrackSelector and MuonSelector
61  // did not treat them.
62  } else {
63  // through for unknown types
64  throw cms::Exception("UnknownHitType") << "helper::ClusterStorer::addCluster: "
65  << "Unknown hit type " << hit_type.name() << ".\n";
66  }
67  } // end 'switch' on hit type
68  }
ClusterHitRecord< SiStripRecHit2D::ClusterRef > StripClusterHitRecord
Assuming that the ClusterRef is the same for all SiStripRecHit*:
Definition: ClusterStorer.h:80
SiStripRecHit2D stereoHit() const
std::vector< Phase2OTClusterHitRecord > phase2OTClusterRecords_
Definition: ClusterStorer.h:97
ClusterHitRecord< SiPixelRecHit::ClusterRef > PixelClusterHitRecord
Definition: ClusterStorer.h:78
std::vector< PixelClusterHitRecord > pixelClusterRecords_
Definition: ClusterStorer.h:95
ClusterHitRecord< Phase2TrackerRecHit1D::ClusterRef > Phase2OTClusterHitRecord
Definition: ClusterStorer.h:83
SiStripRecHit2D originalHit() const
SiStripRecHit2D monoHit() const
Our base class.
Definition: SiPixelRecHit.h:23
std::vector< StripClusterHitRecord > stripClusterRecords_
Definition: ClusterStorer.h:96

◆ clear()

void ClusterStorer::clear ( void  )

clear records

Definition at line 71 of file ClusterStorer.cc.

References phase2OTClusterRecords_, pixelClusterRecords_, and stripClusterRecords_.

Referenced by helper::MuonCollectionStoreManager::cloneAndStore(), and helper::TrackCollectionStoreManager::cloneAndStore().

71  {
72  pixelClusterRecords_.clear();
73  stripClusterRecords_.clear();
75  }
std::vector< Phase2OTClusterHitRecord > phase2OTClusterRecords_
Definition: ClusterStorer.h:97
std::vector< PixelClusterHitRecord > pixelClusterRecords_
Definition: ClusterStorer.h:95
std::vector< StripClusterHitRecord > stripClusterRecords_
Definition: ClusterStorer.h:96

◆ processAllClusters()

void ClusterStorer::processAllClusters ( edmNew::DetSetVector< SiPixelCluster > &  pixelDsvToFill,
edm::RefProd< edmNew::DetSetVector< SiPixelCluster > >  refPixelClusters,
edmNew::DetSetVector< SiStripCluster > &  stripDsvToFill,
edm::RefProd< edmNew::DetSetVector< SiStripCluster > >  refStripClusters,
edmNew::DetSetVector< Phase2TrackerCluster1D > &  phase2OTDsvToFill,
edm::RefProd< edmNew::DetSetVector< Phase2TrackerCluster1D > >  refPhase2OTClusters 
)

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 78 of file ClusterStorer.cc.

References phase2OTClusterRecords_, pixelClusterRecords_, and stripClusterRecords_.

Referenced by helper::MuonCollectionStoreManager::cloneAndStore(), and helper::TrackCollectionStoreManager::cloneAndStore().

84  {
85  if (!pixelClusterRecords_.empty()) {
86  this->processClusters<SiPixelRecHit, SiPixelCluster>(pixelClusterRecords_, pixelDsvToFill, refPixelClusters);
87  }
88  if (!stripClusterRecords_.empty()) {
89  // All we need from the HitType 'SiStripRecHit2D' is the
90  // typedef for 'SiStripRecHit2D::ClusterRef'.
91  // The fact that rekey<SiStripRecHit2D> is called is irrelevant since
92  // ClusterHitRecord<typename SiStripRecHit2D::ClusterRef>::rekey<RecHitType>
93  // is specialised such that 'RecHitType' is not used...
94  this->processClusters<SiStripRecHit2D, SiStripCluster>(stripClusterRecords_, stripDsvToFill, refStripClusters);
95  }
96  if (!phase2OTClusterRecords_.empty()) {
97  this->processClusters<Phase2TrackerRecHit1D, Phase2TrackerCluster1D>(
98  phase2OTClusterRecords_, phase2OTDsvToFill, refPhase2OTClusters);
99  }
100  }
std::vector< Phase2OTClusterHitRecord > phase2OTClusterRecords_
Definition: ClusterStorer.h:97
std::vector< PixelClusterHitRecord > pixelClusterRecords_
Definition: ClusterStorer.h:95
std::vector< StripClusterHitRecord > stripClusterRecords_
Definition: ClusterStorer.h:96

◆ processClusters()

template<typename HitType , typename ClusterType >
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 104 of file ClusterStorer.cc.

References bsc_activity_cfg::clusters, trigObjTnPSource_cfi::filler, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and jetUpdater_cfi::sort.

106  {
107  std::sort(clusterRecords.begin(), clusterRecords.end()); // this sorts them by detid
108  typedef typename std::vector<ClusterHitRecord<typename HitType::ClusterRef> >::iterator RIT;
109  RIT it = clusterRecords.begin(), end = clusterRecords.end();
110  size_t clusters = 0;
111  while (it != end) {
112  RIT it2 = it;
113  uint32_t detid = it->detid();
114 
115  // first isolate all clusters on the same detid
116  while ((it2 != end) && (it2->detid() == detid)) {
117  ++it2;
118  }
119  // now [it, it2] bracket one detid
120 
121  // then prepare to copy the clusters
122  typename edmNew::DetSetVector<ClusterType>::FastFiller filler(dsvToFill, detid);
123  typename HitType::ClusterRef lastRef, newRef;
124  for (; it != it2; ++it) { // loop on the detid
125  // first check if we need to clone the hit
126  if (it->clusterRef() != lastRef) {
127  lastRef = it->clusterRef();
128  // clone cluster
129  filler.push_back(*lastRef);
130  // make new ref
131  newRef = typename HitType::ClusterRef(refprod, clusters++);
132  }
133  it->template rekey<HitType>(newRef);
134  } // end of the loop on a single detid
135 
136  } // end of the loop on all clusters
137  }

Member Data Documentation

◆ phase2OTClusterRecords_

std::vector<Phase2OTClusterHitRecord> helper::ClusterStorer::phase2OTClusterRecords_
private

Definition at line 97 of file ClusterStorer.h.

Referenced by addCluster(), clear(), and processAllClusters().

◆ pixelClusterRecords_

std::vector<PixelClusterHitRecord> helper::ClusterStorer::pixelClusterRecords_
private

Definition at line 95 of file ClusterStorer.h.

Referenced by addCluster(), clear(), and processAllClusters().

◆ stripClusterRecords_

std::vector<StripClusterHitRecord> helper::ClusterStorer::stripClusterRecords_
private

Definition at line 96 of file ClusterStorer.h.

Referenced by addCluster(), clear(), and processAllClusters().