CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
ClusterRemovalRefSetter Class Reference

#include <ClusterRemovalRefSetter.h>

Public Member Functions

 ClusterRemovalRefSetter (const edm::Event &iEvent, const edm::InputTag tag)
 
void reKey (TrackingRecHit *hit) const
 

Private Types

typedef
OmniClusterRef::ClusterPixelRef 
ClusterPixelRef
 
typedef
OmniClusterRef::ClusterRegionalRef 
ClusterRegionalRef
 
typedef
OmniClusterRef::ClusterStripRef 
ClusterStripRef
 

Private Member Functions

void reKeyPixel (OmniClusterRef &clusRef) const
 
void reKeyStrip (OmniClusterRef &clusRef) const
 

Private Attributes

const reco::ClusterRemovalInfocri_
 

Detailed Description

Definition at line 20 of file ClusterRemovalRefSetter.h.

Member Typedef Documentation

Definition at line 25 of file ClusterRemovalRefSetter.h.

Definition at line 27 of file ClusterRemovalRefSetter.h.

Definition at line 26 of file ClusterRemovalRefSetter.h.

Constructor & Destructor Documentation

ClusterRemovalRefSetter::ClusterRemovalRefSetter ( const edm::Event iEvent,
const edm::InputTag  tag 
)

Definition at line 4 of file ClusterRemovalRefSetter.cc.

References cri_, and edm::Event::getByLabel().

4  {
6  iEvent.getByLabel(tag, hCRI);
7  cri_ = &*hCRI;
8 
9  //std::cout << "Rekeying PIXEL ProdID " << cri_->pixelNewRefProd().id() << " => " << cri_->pixelRefProd().id() << std::endl;
10  //std::cout << "Rekeying STRIP ProdID " << cri_->stripNewRefProd().id() << " => " << cri_->stripRefProd().id() << std::endl;
11 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const reco::ClusterRemovalInfo * cri_

Member Function Documentation

void ClusterRemovalRefSetter::reKey ( TrackingRecHit hit) const

Definition at line 13 of file ClusterRemovalRefSetter.cc.

References cri_, cond::rpcobgas::detid, edm::hlt::Exception, TrackingRecHit::geographicalId(), reco::ClusterRemovalInfo::hasPixel(), reco::ClusterRemovalInfo::hasStrip(), TrackingRecHit::isValid(), ProjectedSiStripRecHit2D::originalHit(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, reKeyPixel(), reKeyStrip(), and DetId::subdetId().

Referenced by SeedCombiner::produce(), cms::TrackListMerger::produce(), cms::SimpleTrackListMerger::produce(), and KfTrackProducerBase::putInEvt().

13  {
14  if (!hit->isValid()) return;
15  DetId detid = hit->geographicalId();
16  uint32_t subdet = detid.subdetId();
17  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
18  if (!cri_->hasPixel()) return;
19  reKeyPixel(reinterpret_cast<SiPixelRecHit *>(hit)->omniCluster());
20  } else {
21  if (!cri_->hasStrip()) return;
22  const std::type_info &type = typeid(*hit);
23  if (type == typeid(SiStripRecHit2D)) {
24  reKeyStrip(reinterpret_cast<SiStripRecHit2D *>(hit)->omniCluster());
25  } else if (type == typeid(SiStripRecHit1D)) {
26  reKeyStrip(reinterpret_cast<SiStripRecHit1D *>(hit)->omniCluster());
27  } else if (type == typeid(SiStripMatchedRecHit2D)) {
28  SiStripMatchedRecHit2D *mhit = reinterpret_cast<SiStripMatchedRecHit2D *>(hit);
29  reKeyStrip(mhit->monoClusterRef());
30  reKeyStrip(mhit->stereoClusterRef());
31  } else if (type == typeid(ProjectedSiStripRecHit2D)) {
32  ProjectedSiStripRecHit2D *phit = reinterpret_cast<ProjectedSiStripRecHit2D *>(hit);
33  reKeyStrip(phit->originalHit().omniCluster());
34  } else throw cms::Exception("Unknown RecHit Type") << "RecHit of type " << type.name() << " not supported. (use c++filt to demangle the name)";
35  }
36 }
type
Definition: HCALResponse.h:22
void reKeyPixel(OmniClusterRef &clusRef) const
void reKeyStrip(OmniClusterRef &clusRef) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
bool isValid() const
DetId geographicalId() const
const reco::ClusterRemovalInfo * cri_
const SiStripRecHit2D & originalHit() const
void ClusterRemovalRefSetter::reKeyPixel ( OmniClusterRef clusRef) const
private

Definition at line 39 of file ClusterRemovalRefSetter.cc.

References cri_, edm::hlt::Exception, OmniClusterRef::id(), edm::RefProd< T >::id(), errorMatrix2Lands::indices, OmniClusterRef::key(), reco::ClusterRemovalInfo::pixelIndices(), reco::ClusterRemovalInfo::pixelNewRefProd(), and reco::ClusterRemovalInfo::pixelRefProd().

Referenced by reKey().

39  {
40  // "newRef" as it refs to the "new"(=cleaned) collection, instead of the old one
43 
44  if (newRef.id() != cri_->pixelNewRefProd().id()) {
45  throw cms::Exception("Inconsistent Data") << "ClusterRemovalRefSetter: " <<
46  "Existing pixel cluster refers to product ID " << newRef.id() <<
47  " while the ClusterRemovalInfo expects as *new* cluster collection the ID " << cri_->pixelNewRefProd().id() << "\n";
48  }
49  size_t newIndex = newRef.key();
50  assert(newIndex < indices.size());
51  size_t oldIndex = indices[newIndex];
52  ClusterPixelRef oldRef(cri_->pixelRefProd(), oldIndex);
53  newRef = OmniClusterRef(oldRef);
54 }
const SiPixelClusterRefProd & pixelRefProd() const
const SiPixelClusterRefProd & pixelNewRefProd() const
Indices
Definition: EdmEventSize.cc:30
OmniClusterRef::ClusterPixelRef ClusterPixelRef
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:140
const reco::ClusterRemovalInfo * cri_
void ClusterRemovalRefSetter::reKeyStrip ( OmniClusterRef clusRef) const
private

Definition at line 57 of file ClusterRemovalRefSetter.cc.

References cri_, edm::hlt::Exception, OmniClusterRef::id(), edm::RefProd< T >::id(), errorMatrix2Lands::indices, OmniClusterRef::key(), reco::ClusterRemovalInfo::stripIndices(), reco::ClusterRemovalInfo::stripNewRefProd(), and reco::ClusterRemovalInfo::stripRefProd().

Referenced by reKey().

57  {
58  // "newRef" as it refs to the "new"(=cleaned) collection, instead of the old one
61 
62  if (newRef.id() != cri_->stripNewRefProd().id()) { // this is a cfg error in the tracking configuration, much more likely
63  throw cms::Exception("Inconsistent Data") << "ClusterRemovalRefSetter: " <<
64  "Existing strip cluster refers to product ID " << newRef.id() <<
65  " while the ClusterRemovalInfo expects as *new* cluster collection the ID " << cri_->stripNewRefProd().id() << "\n";
66  }
67 
68  size_t newIndex = newRef.key();
69  assert(newIndex < indices.size());
70  size_t oldIndex = indices[newIndex];
71  ClusterStripRef oldRef(cri_->stripRefProd(), oldIndex);
72  newRef = OmniClusterRef(oldRef);
73 }
OmniClusterRef::ClusterStripRef ClusterStripRef
const SiStripClusterRefProd & stripRefProd() const
Indices
Definition: EdmEventSize.cc:30
const SiStripClusterRefProd & stripNewRefProd() const
ProductID id() const
Accessor for product ID.
Definition: RefProd.h:140
const reco::ClusterRemovalInfo * cri_

Member Data Documentation

const reco::ClusterRemovalInfo* ClusterRemovalRefSetter::cri_
private

Definition at line 33 of file ClusterRemovalRefSetter.h.

Referenced by ClusterRemovalRefSetter(), reKey(), reKeyPixel(), and reKeyStrip().