CMS 3D CMS Logo

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

#include <GEMHitAssociator.h>

Public Types

typedef edm::DetSetVector< GEMDigiSimLinkDigiSimLinks
 
typedef edm::DetSet< GEMDigiSimLinkLayerLinks
 
typedef std::pair< uint32_t, EncodedEventIdSimHitIdpr
 

Public Member Functions

std::vector< SimHitIdprassociateRecHit (const GEMRecHit *gemrechit) const
 
 GEMHitAssociator (const edm::Event &e, const edm::EventSetup &eventSetup, const edm::ParameterSet &conf)
 
 GEMHitAssociator (const edm::ParameterSet &, edm::ConsumesCollector &&ic)
 
void initEvent (const edm::Event &, const edm::EventSetup &)
 
 ~GEMHitAssociator ()
 

Private Attributes

std::map< unsigned int, edm::PSimHitContainer_SimHitMap
 
bool crossingframe
 
edm::InputTag GEMdigisimlinkTag
 
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > GEMdigisimlinkToken_
 
edm::InputTag GEMsimhitsTag
 
edm::EDGetTokenT< edm::PSimHitContainerGEMsimhitsToken_
 
edm::InputTag GEMsimhitsXFTag
 
edm::EDGetTokenT< CrossingFrame< PSimHit > > GEMsimhitsXFToken_
 
const DigiSimLinkstheDigiSimLinks
 
bool useGEMs_
 

Detailed Description

Definition at line 33 of file GEMHitAssociator.h.

Member Typedef Documentation

◆ DigiSimLinks

Definition at line 35 of file GEMHitAssociator.h.

◆ LayerLinks

Definition at line 36 of file GEMHitAssociator.h.

◆ SimHitIdpr

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

Definition at line 37 of file GEMHitAssociator.h.

Constructor & Destructor Documentation

◆ GEMHitAssociator() [1/2]

GEMHitAssociator::GEMHitAssociator ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  ic 
)

Definition at line 7 of file GEMHitAssociator.cc.

8  : GEMdigisimlinkTag(conf.getParameter<edm::InputTag>("GEMdigisimlinkTag")),
9  // CrossingFrame used or not ?
10  crossingframe(conf.getParameter<bool>("crossingframe")),
11  useGEMs_(conf.getParameter<bool>("useGEMs")),
12  GEMsimhitsTag(conf.getParameter<edm::InputTag>("GEMsimhitsTag")),
13  GEMsimhitsXFTag(conf.getParameter<edm::InputTag>("GEMsimhitsXFTag")) {
14  if (crossingframe) {
16  } else if (!GEMsimhitsTag.label().empty()) {
18  }
19 
21 }

References crossingframe, GEMdigisimlinkTag, GEMdigisimlinkToken_, GEMsimhitsTag, GEMsimhitsToken_, GEMsimhitsXFTag, GEMsimhitsXFToken_, and edm::InputTag::label().

◆ GEMHitAssociator() [2/2]

GEMHitAssociator::GEMHitAssociator ( const edm::Event e,
const edm::EventSetup eventSetup,
const edm::ParameterSet conf 
)

Definition at line 23 of file GEMHitAssociator.cc.

26  : GEMdigisimlinkTag(conf.getParameter<edm::InputTag>("GEMdigisimlinkTag")),
27  // CrossingFrame used or not ?
28  crossingframe(conf.getParameter<bool>("crossingframe")),
29  useGEMs_(conf.getParameter<bool>("useGEMs")),
30  GEMsimhitsTag(conf.getParameter<edm::InputTag>("GEMsimhitsTag")),
31  GEMsimhitsXFTag(conf.getParameter<edm::InputTag>("GEMsimhitsXFTag")) {
32  initEvent(e, eventSetup);
33 }

References MillePedeFileConverter_cfg::e, and initEvent().

◆ ~GEMHitAssociator()

GEMHitAssociator::~GEMHitAssociator ( )
inline

Definition at line 46 of file GEMHitAssociator.h.

46 {}

Member Function Documentation

◆ associateRecHit()

std::vector< GEMHitAssociator::SimHitIdpr > GEMHitAssociator::associateRecHit ( const GEMRecHit gemrechit) const

Definition at line 71 of file GEMHitAssociator.cc.

71  {
72  std::vector<SimHitIdpr> matched;
73 
74  if (useGEMs_) {
75  if (gemrechit) {
76  GEMDetId gemDetId = gemrechit->gemId();
77  int fstrip = gemrechit->firstClusterStrip();
78  int cls = gemrechit->clusterSize();
79  // int bx = gemrechit->BunchX();
80 
81  DigiSimLinks::const_iterator layerLinks = theDigiSimLinks->find(gemDetId);
82 
83  if (layerLinks != theDigiSimLinks->end()) {
84  for (int i = fstrip; i < (fstrip + cls); ++i) {
85  for (LayerLinks::const_iterator itlink = layerLinks->begin(); itlink != layerLinks->end(); ++itlink) {
86  int ch = static_cast<int>(itlink->getStrip());
87  if (ch != i)
88  continue;
89 
90  SimHitIdpr currentId(itlink->getTrackId(), itlink->getEventId());
91  if (find(matched.begin(), matched.end(), currentId) == matched.end())
92  matched.push_back(currentId);
93  }
94  }
95 
96  } else
97  edm::LogWarning("GEMHitAssociator")
98  << "*** WARNING in GEMHitAssociator: GEM layer " << gemDetId << " has no DigiSimLinks !" << std::endl;
99 
100  } else
101  edm::LogWarning("GEMHitAssociator") << "*** WARNING in GEMHitAssociator::associateRecHit, null "
102  "dynamic_cast !";
103  }
104 
105  return matched;
106 }

References GEMRecHit::clusterSize(), edm::DetSetVector< T >::end(), spr::find(), edm::DetSetVector< T >::find(), GEMRecHit::firstClusterStrip(), GEMRecHit::gemId(), mps_fire::i, muonTagProbeFilters_cff::matched, theDigiSimLinks, and useGEMs_.

Referenced by MuonAssociatorByHitsHelper::getMatchedIds().

◆ initEvent()

void GEMHitAssociator::initEvent ( const edm::Event e,
const edm::EventSetup eventSetup 
)

Definition at line 35 of file GEMHitAssociator.cc.

35  {
36  if (useGEMs_) {
37  if (crossingframe) {
39  LogTrace("GEMHitAssociator") << "getting CrossingFrame<PSimHit> collection - " << GEMsimhitsXFTag;
40  e.getByLabel(GEMsimhitsXFTag, cf);
41 
42  std::unique_ptr<MixCollection<PSimHit>> GEMsimhits(new MixCollection<PSimHit>(cf.product()));
43  LogTrace("GEMHitAssociator") << "... size = " << GEMsimhits->size();
44 
45  // MixCollection<PSimHit> & simHits = *hits;
46 
47  for (MixCollection<PSimHit>::MixItr hitItr = GEMsimhits->begin(); hitItr != GEMsimhits->end(); ++hitItr) {
48  _SimHitMap[hitItr->detUnitId()].push_back(*hitItr);
49  }
50 
51  } else if (!GEMsimhitsTag.label().empty()) {
53  LogTrace("GEMHitAssociator") << "getting PSimHit collection - " << GEMsimhitsTag;
54  e.getByLabel(GEMsimhitsTag, GEMsimhits);
55  LogTrace("GEMHitAssociator") << "... size = " << GEMsimhits->size();
56 
57  // arrange the hits by detUnit
58  for (edm::PSimHitContainer::const_iterator hitItr = GEMsimhits->begin(); hitItr != GEMsimhits->end(); ++hitItr) {
59  _SimHitMap[hitItr->detUnitId()].push_back(*hitItr);
60  }
61  }
62 
64  LogTrace("GEMHitAssociator") << "getting GEM Strip DigiSimLink collection - " << GEMdigisimlinkTag;
65  e.getByLabel(GEMdigisimlinkTag, digiSimLinks);
66  theDigiSimLinks = digiSimLinks.product();
67  }
68 }

References _SimHitMap, crossingframe, TTClusterAssociation_cfi::digiSimLinks, MillePedeFileConverter_cfg::e, GEMdigisimlinkTag, GEMsimhitsTag, GEMsimhitsXFTag, edm::InputTag::label(), LogTrace, edm::Handle< T >::product(), theDigiSimLinks, and useGEMs_.

Referenced by GEMHitAssociator().

Member Data Documentation

◆ _SimHitMap

std::map<unsigned int, edm::PSimHitContainer> GEMHitAssociator::_SimHitMap
private

Definition at line 63 of file GEMHitAssociator.h.

Referenced by initEvent().

◆ crossingframe

bool GEMHitAssociator::crossingframe
private

Definition at line 54 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator(), and initEvent().

◆ GEMdigisimlinkTag

edm::InputTag GEMHitAssociator::GEMdigisimlinkTag
private

Definition at line 52 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator(), and initEvent().

◆ GEMdigisimlinkToken_

edm::EDGetTokenT<edm::DetSetVector<GEMDigiSimLink> > GEMHitAssociator::GEMdigisimlinkToken_
private

Definition at line 61 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator().

◆ GEMsimhitsTag

edm::InputTag GEMHitAssociator::GEMsimhitsTag
private

Definition at line 56 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator(), and initEvent().

◆ GEMsimhitsToken_

edm::EDGetTokenT<edm::PSimHitContainer> GEMHitAssociator::GEMsimhitsToken_
private

Definition at line 60 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator().

◆ GEMsimhitsXFTag

edm::InputTag GEMHitAssociator::GEMsimhitsXFTag
private

Definition at line 57 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator(), and initEvent().

◆ GEMsimhitsXFToken_

edm::EDGetTokenT<CrossingFrame<PSimHit> > GEMHitAssociator::GEMsimhitsXFToken_
private

Definition at line 59 of file GEMHitAssociator.h.

Referenced by GEMHitAssociator().

◆ theDigiSimLinks

const DigiSimLinks* GEMHitAssociator::theDigiSimLinks
private

Definition at line 51 of file GEMHitAssociator.h.

Referenced by associateRecHit(), and initEvent().

◆ useGEMs_

bool GEMHitAssociator::useGEMs_
private

Definition at line 55 of file GEMHitAssociator.h.

Referenced by associateRecHit(), and initEvent().

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
edm::DetSetVector
Definition: DetSetVector.h:61
mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
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
GEMHitAssociator::_SimHitMap
std::map< unsigned int, edm::PSimHitContainer > _SimHitMap
Definition: GEMHitAssociator.h:63
GEMHitAssociator::GEMsimhitsToken_
edm::EDGetTokenT< edm::PSimHitContainer > GEMsimhitsToken_
Definition: GEMHitAssociator.h:60
GEMHitAssociator::initEvent
void initEvent(const edm::Event &, const edm::EventSetup &)
Definition: GEMHitAssociator.cc:35
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
GEMHitAssociator::useGEMs_
bool useGEMs_
Definition: GEMHitAssociator.h:55
MixCollection::MixItr
Definition: MixCollection.h:61
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GEMHitAssociator::GEMsimhitsXFToken_
edm::EDGetTokenT< CrossingFrame< PSimHit > > GEMsimhitsXFToken_
Definition: GEMHitAssociator.h:59
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CrossingFrame
Definition: CrossingFrame.h:37
TTClusterAssociation_cfi.digiSimLinks
digiSimLinks
Definition: TTClusterAssociation_cfi.py:8
GEMHitAssociator::GEMdigisimlinkToken_
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > GEMdigisimlinkToken_
Definition: GEMHitAssociator.h:61
MixCollection
Definition: MixCollection.h:10
GEMHitAssociator::crossingframe
bool crossingframe
Definition: GEMHitAssociator.h:54
GEMHitAssociator::GEMsimhitsTag
edm::InputTag GEMsimhitsTag
Definition: GEMHitAssociator.h:56
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
GEMDetId
Definition: GEMDetId.h:18
GEMRecHit::firstClusterStrip
int firstClusterStrip() const
Definition: GEMRecHit.h:69
edm::DetSetVector::find
iterator find(det_id_type id)
Definition: DetSetVector.h:264
GEMHitAssociator::GEMsimhitsXFTag
edm::InputTag GEMsimhitsXFTag
Definition: GEMHitAssociator.h:57
GEMRecHit::gemId
GEMDetId gemId() const
Return the gemId.
Definition: GEMRecHit.h:65
GEMRecHit::clusterSize
int clusterSize() const
Definition: GEMRecHit.h:71
GEMHitAssociator::GEMdigisimlinkTag
edm::InputTag GEMdigisimlinkTag
Definition: GEMHitAssociator.h:52
GEMHitAssociator::theDigiSimLinks
const DigiSimLinks * theDigiSimLinks
Definition: GEMHitAssociator.h:51
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::DetSet< GEMDigiSimLink >::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31