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

Definition at line 80 of file ClusterStorer.h.

Definition at line 75 of file ClusterStorer.h.

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

Definition at line 77 of file ClusterStorer.h.

Constructor & Destructor Documentation

helper::ClusterStorer::ClusterStorer ( )
inline

Member Function Documentation

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, diffTreeTool::index, SiStripMatchedRecHit2D::monoHit(), ProjectedSiStripRecHit2D::originalHit(), phase2OTClusterRecords_, pixelClusterRecords_, SiStripMatchedRecHit2D::stereoHit(), and stripClusterRecords_.

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

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

References pixelClusterRecords_, processClusters(), and stripClusterRecords_.

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

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

References fastPrimaryVertexProducer_cfi::clusters, end, objects.autophobj::filler, edmNew::DetSetVector< T >::FastFiller::push_back(), and helper::ClusterStorer::ClusterHitRecord< ClusterRefType >::rekey().

Referenced by processAllClusters().

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

Member Data Documentation

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

Definition at line 95 of file ClusterStorer.h.

Referenced by addCluster().

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

Definition at line 93 of file ClusterStorer.h.

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

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

Definition at line 94 of file ClusterStorer.h.

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