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)
 

Private Types

typedef ClusterHitRecord< Phase2TrackerRecHit1D::CluRefPhase2OTClusterHitRecord
 
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 27 of file ClusterStorer.h.

Member Typedef Documentation

◆ Phase2OTClusterHitRecord

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

Definition at line 80 of file ClusterStorer.h.

◆ PixelClusterHitRecord

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

Definition at line 75 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 77 of file ClusterStorer.h.

Constructor & Destructor Documentation

◆ ClusterStorer()

helper::ClusterStorer::ClusterStorer ( )
inline

Definition at line 29 of file ClusterStorer.h.

29 {}

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

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

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

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

◆ clear()

void ClusterStorer::clear ( void  )

◆ processAllClusters()

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

76  {
77  if (!pixelClusterRecords_.empty()) {
78  this->processClusters<SiPixelRecHit, SiPixelCluster>(pixelClusterRecords_, pixelDsvToFill, refPixelClusters);
79  }
80  if (!stripClusterRecords_.empty()) {
81  // All we need from the HitType 'SiStripRecHit2D' is the
82  // typedef for 'SiStripRecHit2D::ClusterRef'.
83  // The fact that rekey<SiStripRecHit2D> is called is irrelevant since
84  // ClusterHitRecord<typename SiStripRecHit2D::ClusterRef>::rekey<RecHitType>
85  // is specialised such that 'RecHitType' is not used...
86  this->processClusters<SiStripRecHit2D, SiStripCluster>(stripClusterRecords_, stripDsvToFill, refStripClusters);
87  }
88  }

References pixelClusterRecords_, and stripClusterRecords_.

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

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

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

References bsc_activity_cfg::clusters, end, and trigObjTnPSource_cfi::filler.

Member Data Documentation

◆ phase2OTClusterRecords_

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

Definition at line 94 of file ClusterStorer.h.

Referenced by addCluster().

◆ pixelClusterRecords_

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

Definition at line 92 of file ClusterStorer.h.

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

◆ stripClusterRecords_

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

Definition at line 93 of file ClusterStorer.h.

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

FastMatchedTrackerRecHit
Definition: FastMatchedTrackerRecHit.h:7
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
helper::ClusterStorer::StripClusterHitRecord
ClusterHitRecord< SiStripRecHit2D::ClusterRef > StripClusterHitRecord
Assuming that the ClusterRef is the same for all SiStripRecHit*:
Definition: ClusterStorer.h:77
FastTrackerRecHit
Definition: FastTrackerRecHit.h:40
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
ProjectedSiStripRecHit2D
Definition: ProjectedSiStripRecHit2D.h:8
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
end
#define end
Definition: vmac.h:39
helper::ClusterStorer::PixelClusterHitRecord
ClusterHitRecord< SiPixelRecHit::ClusterRef > PixelClusterHitRecord
Definition: ClusterStorer.h:75
FastProjectedTrackerRecHit
Definition: FastProjectedTrackerRecHit.h:8
SiStripMatchedRecHit2D::stereoHit
SiStripRecHit2D stereoHit() const
Definition: SiStripMatchedRecHit2D.h:25
ProjectedSiStripRecHit2D::originalHit
SiStripRecHit2D originalHit() const
Definition: ProjectedSiStripRecHit2D.h:56
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
helper::ClusterStorer::Phase2OTClusterHitRecord
ClusterHitRecord< Phase2TrackerRecHit1D::CluRef > Phase2OTClusterHitRecord
Definition: ClusterStorer.h:80
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
SiStripMatchedRecHit2D::monoHit
SiStripRecHit2D monoHit() const
Definition: SiStripMatchedRecHit2D.h:26
helper::ClusterStorer::pixelClusterRecords_
std::vector< PixelClusterHitRecord > pixelClusterRecords_
Definition: ClusterStorer.h:92
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
helper::ClusterStorer::phase2OTClusterRecords_
std::vector< Phase2OTClusterHitRecord > phase2OTClusterRecords_
Definition: ClusterStorer.h:94
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
Exception
Definition: hltDiff.cc:246
helper::ClusterStorer::stripClusterRecords_
std::vector< StripClusterHitRecord > stripClusterRecords_
Definition: ClusterStorer.h:93
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:236
Phase2TrackerRecHit1D
Definition: Phase2TrackerRecHit1D.h:10