CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< SiPixelRecHit::ClusterRef > 
PixelClusterHitRecord
 
typedef ClusterHitRecord
< SiStripRecHit2D::ClusterRef > 
StripClusterHitRecord
 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
< PixelClusterHitRecord
pixelClusterRecords_
 
std::vector
< StripClusterHitRecord
stripClusterRecords_
 

Detailed Description

Definition at line 26 of file ClusterStorer.h.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

helper::ClusterStorer::ClusterStorer ( )
inline

Definition at line 28 of file ClusterStorer.h.

28 {}

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

References edm::hlt::Exception, getHLTprescales::index, ProjectedSiStripRecHit2D::originalHit(), pixelClusterRecords_, and stripClusterRecords_.

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

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),
29  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),
33  hits, index));
34  } else if (hit_type == typeid(SiStripRecHit2D)) {
35  //std::cout << "| It is a SiStripRecHit2D hit !!" << std::endl;
36  stripClusterRecords_.push_back(StripClusterHitRecord(static_cast<SiStripRecHit2D&>(newHit),
37  hits, index));
38  } else if (hit_type == typeid(SiStripMatchedRecHit2D)) {
39  //std::cout << "| It is a SiStripMatchedRecHit2D hit !!" << std::endl;
40  SiStripMatchedRecHit2D &mhit = static_cast<SiStripMatchedRecHit2D&>(newHit);
41  stripClusterRecords_.push_back(StripClusterHitRecord(mhit.monoHit(), hits, index));
42  stripClusterRecords_.push_back(StripClusterHitRecord(mhit.stereoHit(), hits, index));
43  } else if (hit_type == typeid(ProjectedSiStripRecHit2D)) {
44  //std::cout << "| It is a ProjectedSiStripRecHit2D hit !!" << std::endl;
45  ProjectedSiStripRecHit2D &phit = static_cast<ProjectedSiStripRecHit2D&>(newHit);
47  } else {
48  if (hit_type == typeid(SiTrackerGSMatchedRecHit2D)
49  || hit_type == typeid(SiTrackerGSRecHit2D)) {
50  //std::cout << "| It is a " << hit_type.name() << " hit !!" << std::endl;
51  // FastSim hits: Do nothing instead of caring about FastSim clusters,
52  // not even sure whether these really exist.
53  // At least predecessor code in TrackSelector and MuonSelector
54  // did not treat them.
55  } else {
56  // through for unknown types
57  throw cms::Exception("UnknownHitType") << "helper::ClusterStorer::addCluster: "
58  << "Unknown hit type " << hit_type.name()
59  << ".\n";
60  }
61  } // end 'switch' on hit type
62 
63  }
ClusterHitRecord< SiStripRecHit2D::ClusterRef > StripClusterHitRecord
Assuming that the ClusterRef is the same for all SiStripRecHit*:
Definition: ClusterStorer.h:76
ClusterHitRecord< SiPixelRecHit::ClusterRef > PixelClusterHitRecord
Definition: ClusterStorer.h:74
std::vector< PixelClusterHitRecord > pixelClusterRecords_
Definition: ClusterStorer.h:89
const SiStripRecHit2D & originalHit() const
Pixel Reconstructed Hit.
std::vector< StripClusterHitRecord > stripClusterRecords_
Definition: ClusterStorer.h:90
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 74 of file ClusterStorer.cc.

References pixelClusterRecords_, and stripClusterRecords_.

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

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

References cond::rpcobgas::detid, end, edmNew::DetSetVector< T >::FastFiller::push_back(), and python.multivaluedict::sort().

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

Member Data Documentation

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().