CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
CSCHitAssociator Class Reference

#include <CSCHitAssociator.h>

Public Types

typedef edm::DetSetVector< StripDigiSimLinkDigiSimLinks
 
typedef edm::DetSet< StripDigiSimLinkLayerLinks
 
typedef std::pair< uint32_t, EncodedEventIdSimHitIdpr
 
typedef edm::DetSetVector< StripDigiSimLinkWireDigiSimLinks
 

Public Member Functions

std::vector< SimHitIdprassociateCSCHitId (const CSCRecHit2D *) const
 
std::vector< SimHitIdprassociateHitId (const TrackingRecHit &) const
 
 CSCHitAssociator (const edm::Event &, const edm::EventSetup &, const edm::ParameterSet &)
 
 CSCHitAssociator (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
void initEvent (const edm::Event &, const edm::EventSetup &)
 

Private Attributes

const CSCGeometrycscgeom
 
edm::InputTag linksTag
 
const DigiSimLinkstheDigiSimLinks
 

Detailed Description

Definition at line 24 of file CSCHitAssociator.h.

Member Typedef Documentation

◆ DigiSimLinks

Definition at line 26 of file CSCHitAssociator.h.

◆ LayerLinks

Definition at line 28 of file CSCHitAssociator.h.

◆ SimHitIdpr

typedef std::pair<uint32_t, EncodedEventId> CSCHitAssociator::SimHitIdpr

Definition at line 29 of file CSCHitAssociator.h.

◆ WireDigiSimLinks

Definition at line 27 of file CSCHitAssociator.h.

Constructor & Destructor Documentation

◆ CSCHitAssociator() [1/2]

CSCHitAssociator::CSCHitAssociator ( const edm::Event event,
const edm::EventSetup setup,
const edm::ParameterSet conf 
)

Definition at line 8 of file CSCHitAssociator.cc.

9  : theDigiSimLinks(nullptr), linksTag(conf.getParameter<edm::InputTag>("CSClinksTag")) {
11 }

References initEvent(), and singleTopDQM_cfi::setup.

◆ CSCHitAssociator() [2/2]

CSCHitAssociator::CSCHitAssociator ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC 
)

Definition at line 13 of file CSCHitAssociator.cc.

14  : theDigiSimLinks(nullptr), linksTag(conf.getParameter<edm::InputTag>("CSClinksTag")) {
16 }

References linksTag.

Member Function Documentation

◆ associateCSCHitId()

std::vector< CSCHitAssociator::SimHitIdpr > CSCHitAssociator::associateCSCHitId ( const CSCRecHit2D cscrechit) const

Definition at line 30 of file CSCHitAssociator.cc.

30  {
31  std::vector<SimHitIdpr> simtrackids;
32 
33  unsigned int detId = cscrechit->geographicalId().rawId();
34  int nchannels = cscrechit->nStrips();
35  const CSCLayerGeometry *laygeom = cscgeom->layer(cscrechit->cscDetId())->geometry();
36 
38 
39  if (layerLinks != theDigiSimLinks->end()) {
40  for (int idigi = 0; idigi < nchannels; ++idigi) {
41  // strip and readout channel numbers may differ in ME1/1A
42  int istrip = cscrechit->channels(idigi);
43  int channel = laygeom->channel(istrip);
44 
45  for (LayerLinks::const_iterator link = layerLinks->begin(); link != layerLinks->end(); ++link) {
46  int ch = static_cast<int>(link->channel());
47  if (ch == channel) {
48  SimHitIdpr currentId(link->SimTrackId(), link->eventId());
49  if (find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
50  simtrackids.push_back(currentId);
51  }
52  }
53  }
54 
55  } else
56  LogTrace("CSCHitAssociator") << "*** WARNING in CSCHitAssociator::associateCSCHitId - CSC layer " << detId
57  << " has no DigiSimLinks !" << std::endl;
58 
59  return simtrackids;
60 }

References CSCLayerGeometry::channel(), CSCRecHit2D::channels(), CSCRecHit2D::cscDetId(), cscgeom, edm::DetSetVector< T >::end(), spr::find(), edm::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), geometry, CSCGeometry::layer(), MainPageGenerator::link, LogTrace, CSCRecHit2D::nStrips(), DetId::rawId(), and theDigiSimLinks.

Referenced by MuonAssociatorByHitsHelper::getMatchedIds().

◆ associateHitId()

std::vector< CSCHitAssociator::SimHitIdpr > CSCHitAssociator::associateHitId ( const TrackingRecHit hit) const

Definition at line 62 of file CSCHitAssociator.cc.

62  {
63  std::vector<SimHitIdpr> simtrackids;
64 
65  const TrackingRecHit *hitp = &hit;
66  const CSCRecHit2D *cscrechit = dynamic_cast<const CSCRecHit2D *>(hitp);
67 
68  if (cscrechit) {
69  unsigned int detId = cscrechit->geographicalId().rawId();
70  int nchannels = cscrechit->nStrips();
71  const CSCLayerGeometry *laygeom = cscgeom->layer(cscrechit->cscDetId())->geometry();
72 
74 
75  if (layerLinks != theDigiSimLinks->end()) {
76  for (int idigi = 0; idigi < nchannels; ++idigi) {
77  // strip and readout channel numbers may differ in ME1/1A
78  int istrip = cscrechit->channels(idigi);
79  int channel = laygeom->channel(istrip);
80 
81  for (LayerLinks::const_iterator link = layerLinks->begin(); link != layerLinks->end(); ++link) {
82  int ch = static_cast<int>(link->channel());
83  if (ch == channel) {
84  SimHitIdpr currentId(link->SimTrackId(), link->eventId());
85  if (find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
86  simtrackids.push_back(currentId);
87  }
88  }
89  }
90 
91  } else
92  LogTrace("CSCHitAssociator") << "*** WARNING in CSCHitAssociator::associateHitId - CSC layer " << detId
93  << " has no DigiSimLinks !" << std::endl;
94 
95  } else
96  LogTrace("CSCHitAssociator") << "*** WARNING in CSCHitAssociator::associateHitId, null dynamic_cast "
97  "!";
98 
99  return simtrackids;
100 }

References CSCLayerGeometry::channel(), CSCRecHit2D::channels(), CSCRecHit2D::cscDetId(), cscgeom, edm::DetSetVector< T >::end(), spr::find(), edm::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), geometry, CSCGeometry::layer(), MainPageGenerator::link, LogTrace, CSCRecHit2D::nStrips(), DetId::rawId(), and theDigiSimLinks.

◆ initEvent()

void CSCHitAssociator::initEvent ( const edm::Event event,
const edm::EventSetup setup 
)

Definition at line 18 of file CSCHitAssociator.cc.

18  {
20  LogTrace("CSCHitAssociator") << "getting CSC Strip DigiSimLink collection - " << linksTag;
21  event.getByLabel(linksTag, digiSimLinks);
22  theDigiSimLinks = digiSimLinks.product();
23 
24  // get CSC Geometry to use CSCLayer methods
26  setup.get<MuonGeometryRecord>().get(mugeom);
27  cscgeom = &*mugeom;
28 }

References cscgeom, TTClusterAssociation_cfi::digiSimLinks, get, linksTag, LogTrace, singleTopDQM_cfi::setup, and theDigiSimLinks.

Referenced by CSCHitAssociator().

Member Data Documentation

◆ cscgeom

const CSCGeometry* CSCHitAssociator::cscgeom
private

Definition at line 44 of file CSCHitAssociator.h.

Referenced by associateCSCHitId(), associateHitId(), and initEvent().

◆ linksTag

edm::InputTag CSCHitAssociator::linksTag
private

Definition at line 42 of file CSCHitAssociator.h.

Referenced by CSCHitAssociator(), and initEvent().

◆ theDigiSimLinks

const DigiSimLinks* CSCHitAssociator::theDigiSimLinks
private

Definition at line 40 of file CSCHitAssociator.h.

Referenced by associateCSCHitId(), associateHitId(), and initEvent().

geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
SimHitIdpr
std::pair< uint32_t, EncodedEventId > SimHitIdpr
Definition: TrackerHitAssociator.h:54
CSCHitAssociator::DigiSimLinks
edm::DetSetVector< StripDigiSimLink > DigiSimLinks
Definition: CSCHitAssociator.h:26
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CSCRecHit2D::cscDetId
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:58
TTClusterAssociation_cfi.digiSimLinks
digiSimLinks
Definition: TTClusterAssociation_cfi.py:8
CSCHitAssociator::theDigiSimLinks
const DigiSimLinks * theDigiSimLinks
Definition: CSCHitAssociator.h:40
CSCLayerGeometry
Definition: CSCLayerGeometry.h:25
edm::ESHandle< CSCGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
CSCHitAssociator::cscgeom
const CSCGeometry * cscgeom
Definition: CSCHitAssociator.h:44
CSCHitAssociator::initEvent
void initEvent(const edm::Event &, const edm::EventSetup &)
Definition: CSCHitAssociator.cc:18
CSCRecHit2D
Definition: CSCRecHit2D.h:18
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
edm::DetSetVector::find
iterator find(det_id_type id)
Definition: DetSetVector.h:264
CSCHitAssociator::linksTag
edm::InputTag linksTag
Definition: CSCHitAssociator.h:42
get
#define get
TrackingRecHit
Definition: TrackingRecHit.h:21
CSCRecHit2D::channels
int channels(unsigned int i) const
Extracting strip channel numbers comprising the rechit - low.
Definition: CSCRecHit2D.h:61
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CSCGeometry::layer
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCLayerGeometry::channel
int channel(int strip) const
Definition: CSCLayerGeometry.h:112
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
CSCRecHit2D::nStrips
unsigned int nStrips() const
Definition: CSCRecHit2D.h:62
event
Definition: event.py:1
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::DetSet< StripDigiSimLink >::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31