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)
 
 ClusterRemovalRefSetter (const edm::Event &iEvent, const edm::EDGetTokenT< reco::ClusterRemovalInfo > &token)
 
void reKey (TrackingRecHit *hit) const
 

Private Types

typedef
OmniClusterRef::ClusterPixelRef 
ClusterPixelRef
 
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 21 of file ClusterRemovalRefSetter.h.

Member Typedef Documentation

Definition at line 29 of file ClusterRemovalRefSetter.h.

Definition at line 30 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:390
const reco::ClusterRemovalInfo * cri_
ClusterRemovalRefSetter::ClusterRemovalRefSetter ( const edm::Event iEvent,
const edm::EDGetTokenT< reco::ClusterRemovalInfo > &  token 
)

Definition at line 13 of file ClusterRemovalRefSetter.cc.

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

14  {
16  iEvent.getByToken(token, hCRI);
17  cri_ = &*hCRI;
18 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
const reco::ClusterRemovalInfo * cri_

Member Function Documentation

void ClusterRemovalRefSetter::reKey ( TrackingRecHit hit) const

Definition at line 20 of file ClusterRemovalRefSetter.cc.

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

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

20  {
21  if (!hit->isValid()) return;
22  DetId detid = hit->geographicalId();
23  uint32_t subdet = detid.subdetId();
24  if ((subdet == PixelSubdetector::PixelBarrel) || (subdet == PixelSubdetector::PixelEndcap)) {
25  if (!cri_->hasPixel()) return;
26  reKeyPixel(reinterpret_cast<SiPixelRecHit *>(hit)->omniCluster());
27  } else {
28  if (!cri_->hasStrip()) return;
29  const std::type_info &type = typeid(*hit);
30  if (type == typeid(SiStripRecHit2D)) {
31  reKeyStrip(reinterpret_cast<SiStripRecHit2D *>(hit)->omniCluster());
32  } else if (type == typeid(SiStripRecHit1D)) {
33  reKeyStrip(reinterpret_cast<SiStripRecHit1D *>(hit)->omniCluster());
34  } else if (type == typeid(SiStripMatchedRecHit2D)) {
35  SiStripMatchedRecHit2D *mhit = reinterpret_cast<SiStripMatchedRecHit2D *>(hit);
36  reKeyStrip(mhit->monoClusterRef());
37  reKeyStrip(mhit->stereoClusterRef());
38  } else if (type == typeid(ProjectedSiStripRecHit2D)) {
39  ProjectedSiStripRecHit2D *phit = reinterpret_cast<ProjectedSiStripRecHit2D *>(hit);
40  reKeyStrip(phit->originalHit().omniCluster());
41  } else throw cms::Exception("Unknown RecHit Type") << "RecHit of type " << type.name() << " not supported. (use c++filt to demangle the name)";
42  }
43 }
type
Definition: HCALResponse.h:21
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:37
Definition: DetId.h:18
bool isValid() const
DetId geographicalId() const
const reco::ClusterRemovalInfo * cri_
void ClusterRemovalRefSetter::reKeyPixel ( OmniClusterRef clusRef) const
private

Definition at line 46 of file ClusterRemovalRefSetter.cc.

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

Referenced by reKey().

46  {
47  // "newRef" as it refs to the "new"(=cleaned) collection, instead of the old one
49  const ClusterRemovalInfo::Indices &indices = cri_->pixelIndices();
50 
51  if (newRef.id() != cri_->pixelNewRefProd().id()) {
52  throw cms::Exception("Inconsistent Data") << "ClusterRemovalRefSetter: " <<
53  "Existing pixel cluster refers to product ID " << newRef.id() <<
54  " while the ClusterRemovalInfo expects as *new* cluster collection the ID " << cri_->pixelNewRefProd().id() << "\n";
55  }
56  size_t newIndex = newRef.key();
57  assert(newIndex < indices.size());
58  size_t oldIndex = indices[newIndex];
59  ClusterPixelRef oldRef(cri_->pixelRefProd(), oldIndex);
60  newRef = OmniClusterRef(oldRef);
61 }
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 64 of file ClusterRemovalRefSetter.cc.

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

Referenced by reKey().

64  {
65  // "newRef" as it refs to the "new"(=cleaned) collection, instead of the old one
67  const ClusterRemovalInfo::Indices &indices = cri_->stripIndices();
68 
69  if (newRef.id() != cri_->stripNewRefProd().id()) { // this is a cfg error in the tracking configuration, much more likely
70  throw cms::Exception("Inconsistent Data") << "ClusterRemovalRefSetter: " <<
71  "Existing strip cluster refers to product ID " << newRef.id() <<
72  " while the ClusterRemovalInfo expects as *new* cluster collection the ID " << cri_->stripNewRefProd().id() << "\n";
73  }
74 
75  size_t newIndex = newRef.key();
76  assert(newIndex < indices.size());
77  size_t oldIndex = indices[newIndex];
78  ClusterStripRef oldRef(cri_->stripRefProd(), oldIndex);
79  newRef = OmniClusterRef(oldRef);
80 }
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 35 of file ClusterRemovalRefSetter.h.

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