CMS 3D CMS Logo

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

#include <ME0SimHitMatcher.h>

Inheritance diagram for ME0SimHitMatcher:
MuonSimHitMatcher

Public Member Functions

std::set< unsigned int > chamberIds () const
 
std::set< unsigned int > detIds () const
 
std::set< int > hitPadsInDetId (unsigned int) const
 
std::set< int > hitPartitions () const
 
const edm::PSimHitContainerhitsInSuperChamber (unsigned int) const
 
std::set< int > hitStripsInDetId (unsigned int, int margin_n_strips=0) const
 
void init (const edm::Event &e, const edm::EventSetup &eventSetup)
 initialize the event More...
 
void match (const SimTrack &t, const SimVertex &v)
 do the matching More...
 
 ME0SimHitMatcher (const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
 
int nCoincidenceChambers (int min_n_layers=4) const
 
int nLayersWithHitsInSuperChamber (unsigned int) const
 
int nPadsWithHits () const
 
float simHitsMeanStrip (const edm::PSimHitContainer &sim_hits) const
 
std::set< unsigned int > superChamberIds () const
 
std::set< unsigned int > superChamberIdsCoincidences (int min_n_layers=4) const
 
 ~ME0SimHitMatcher ()
 
- Public Member Functions inherited from MuonSimHitMatcher
std::set< unsigned int > chamberIds (int type=0) const
 
std::set< unsigned int > detIds (int type=0) const
 
const TrackingGeometrygeometry ()
 
const edm::PSimHitContainerhitsInChamber (unsigned int) const
 
const edm::PSimHitContainerhitsInDetId (unsigned int) const
 
void init (const edm::Event &e, const edm::EventSetup &eventSetup)
 initialize the event More...
 
void match (const SimTrack &t, const SimVertex &v)
 do the matching More...
 
 MuonSimHitMatcher (const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
 
const edm::PSimHitContainersimHits (int) const
 
GlobalVector simHitsMeanMomentum (const edm::PSimHitContainer &sim_hits) const
 
GlobalPoint simHitsMeanPosition (const edm::PSimHitContainer &sim_hits) const
 
GlobalPoint simHitsMeanPositionStation (int n) const
 
 ~MuonSimHitMatcher ()
 

Private Member Functions

void matchSimHitsToSimTrack ()
 

Private Attributes

std::map< unsigned int, std::set< int > > detids_to_copads_
 
std::map< unsigned int, std::set< int > > detids_to_pads_
 
edm::ESGetToken< ME0Geometry, MuonGeometryRecordgeomToken_
 
std::map< unsigned int, edm::PSimHitContainersuperChamber_to_hits_
 

Additional Inherited Members

- Protected Member Functions inherited from MuonSimHitMatcher
void clear ()
 
std::vector< unsigned int > getIdsOfSimTrackShower (unsigned trk_id, const edm::SimTrackContainer &simTracks, const edm::SimVertexContainer &simVertices)
 
- Protected Attributes inherited from MuonSimHitMatcher
std::map< unsigned int, edm::PSimHitContainerchamber_to_hits_
 
std::map< unsigned int, edm::PSimHitContainerdetid_to_hits_
 
bool discardEleHits_
 
const TrackingGeometrygeometry_
 
bool hasGeometry_
 
edm::PSimHitContainer hits_
 
edm::PSimHitContainer no_hits_
 
edm::EDGetTokenT< edm::PSimHitContainersimHitInput_
 
edm::ParameterSet simHitPSet_
 
edm::PSimHitContainer simHits_
 
edm::Handle< edm::PSimHitContainersimHitsH_
 
bool simMuOnly_
 
edm::EDGetTokenT< edm::SimTrackContainersimTrackInput_
 
edm::SimTrackContainer simTracks_
 
edm::Handle< edm::SimTrackContainersimTracksH_
 
edm::EDGetTokenT< edm::SimVertexContainersimVertexInput_
 
edm::SimVertexContainer simVertices_
 
edm::Handle< edm::SimVertexContainersimVerticesH_
 
std::vector< unsigned > track_ids_
 
std::map< unsigned int, unsigned int > trkid_to_index_
 
bool verbose_
 
bool verboseSimTrack_
 

Detailed Description

Description: Matching of ME0 SimHit to SimTrack

Author: Sven Dildick (TAMU), Tao Huang (TAMU)

Definition at line 16 of file ME0SimHitMatcher.h.

Constructor & Destructor Documentation

◆ ME0SimHitMatcher()

ME0SimHitMatcher::ME0SimHitMatcher ( const edm::ParameterSet iPS,
edm::ConsumesCollector &&  iC 
)

◆ ~ME0SimHitMatcher()

ME0SimHitMatcher::~ME0SimHitMatcher ( )
inline

Definition at line 22 of file ME0SimHitMatcher.h.

22 {}

Member Function Documentation

◆ chamberIds()

std::set< unsigned int > ME0SimHitMatcher::chamberIds ( ) const

Definition at line 92 of file ME0SimHitMatcher.cc.

92  {
93  std::set<unsigned int> result;
94  for (const auto& p : chamber_to_hits_)
95  result.insert(p.first);
96  return result;
97 }

References MuonSimHitMatcher::chamber_to_hits_, AlCaHLTBitMon_ParallelJobs::p, and mps_fire::result.

◆ detIds()

std::set< unsigned int > ME0SimHitMatcher::detIds ( void  ) const

Definition at line 85 of file ME0SimHitMatcher.cc.

85  {
86  std::set<unsigned int> result;
87  for (const auto& p : detid_to_hits_)
88  result.insert(p.first);
89  return result;
90 }

References MuonSimHitMatcher::detid_to_hits_, AlCaHLTBitMon_ParallelJobs::p, and mps_fire::result.

Referenced by hitPartitions(), match(), matchSimHitsToSimTrack(), and nPadsWithHits().

◆ hitPadsInDetId()

std::set< int > ME0SimHitMatcher::hitPadsInDetId ( unsigned int  detid) const

Definition at line 175 of file ME0SimHitMatcher.cc.

175  {
176  set<int> none;
177  if (detids_to_pads_.find(detid) == detids_to_pads_.end())
178  return none;
179  return detids_to_pads_.at(detid);
180 }

References detids_to_pads_, and none.

Referenced by nPadsWithHits().

◆ hitPartitions()

std::set< int > ME0SimHitMatcher::hitPartitions ( ) const

Definition at line 182 of file ME0SimHitMatcher.cc.

182  {
183  std::set<int> result;
184 
185  const auto& detids = detIds();
186  for (const auto& id : detids) {
187  ME0DetId idd(id);
188  result.insert(idd.roll());
189  }
190  return result;
191 }

References detIds(), mps_fire::result, and ME0DetId::roll().

◆ hitsInSuperChamber()

const edm::PSimHitContainer & ME0SimHitMatcher::hitsInSuperChamber ( unsigned int  detid) const

Definition at line 106 of file ME0SimHitMatcher.cc.

106  {
107  if (superChamber_to_hits_.find(detid) == superChamber_to_hits_.end())
108  return no_hits_;
109  return superChamber_to_hits_.at(detid);
110 }

References MuonSimHitMatcher::no_hits_, and superChamber_to_hits_.

Referenced by nLayersWithHitsInSuperChamber().

◆ hitStripsInDetId()

std::set< int > ME0SimHitMatcher::hitStripsInDetId ( unsigned int  detid,
int  margin_n_strips = 0 
) const

Definition at line 156 of file ME0SimHitMatcher.cc.

156  {
157  set<int> result;
158  const auto& simhits = hitsInDetId(detid);
159  ME0DetId id(detid);
160  int max_nstrips = dynamic_cast<const ME0Geometry*>(geometry_)->etaPartition(id)->nstrips();
161  for (const auto& h : simhits) {
162  const LocalPoint& lp = h.entryPoint();
163  int central_strip =
164  1 + static_cast<int>(dynamic_cast<const ME0Geometry*>(geometry_)->etaPartition(id)->topology().channel(lp));
165  int smin = central_strip - margin_n_strips;
166  smin = (smin > 0) ? smin : 1;
167  int smax = central_strip + margin_n_strips;
168  smax = (smax <= max_nstrips) ? smax : max_nstrips;
169  for (int ss = smin; ss <= smax; ++ss)
170  result.insert(ss);
171  }
172  return result;
173 }

References MuonSimHitMatcher::geometry_, MuonSimHitMatcher::hitsInDetId(), triggerObjects_cff::id, mps_fire::result, HLTBitAnalyser_cfi::simhits, and contentValuesCheck::ss.

Referenced by match().

◆ init()

void ME0SimHitMatcher::init ( const edm::Event e,
const edm::EventSetup eventSetup 
)

initialize the event

Definition at line 17 of file ME0SimHitMatcher.cc.

17  {
18  geometry_ = &iSetup.getData(geomToken_);
20 }

References MuonSimHitMatcher::geometry_, geomToken_, edm::EventSetup::getData(), iEvent, and MuonSimHitMatcher::init().

◆ match()

void ME0SimHitMatcher::match ( const SimTrack t,
const SimVertex v 
)

do the matching

Definition at line 23 of file ME0SimHitMatcher.cc.

23  {
24  // instantiates the track ids and simhits
26 
28 
29  if (verbose_) {
30  edm::LogInfo("ME0SimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedME0SimHits " << hits_.size();
31  edm::LogInfo("ME0SimHitMatcher") << "detids ME0 " << detIds().size();
32 
33  const auto& me0_ch_ids = detIds();
34  for (const auto& id : me0_ch_ids) {
35  const auto& me0_simhits = MuonSimHitMatcher::hitsInChamber(id);
36  const auto& me0_simhits_gp = simHitsMeanPosition(me0_simhits);
37  edm::LogInfo("ME0SimHitMatcher") << "me0chid " << ME0DetId(id) << ": nHits " << me0_simhits.size() << " phi "
38  << me0_simhits_gp.phi() << " nCh " << chamber_to_hits_[id].size();
39  const auto& strips = hitStripsInDetId(id);
40  edm::LogInfo("ME0SimHitMatcher") << "nStrip " << strips.size();
41  edm::LogInfo("ME0SimHitMatcher") << "strips : ";
42  for (const auto& p : strips) {
43  edm::LogInfo("ME0SimHitMatcher") << p;
44  }
45  }
46  }
47 }

References MuonSimHitMatcher::chamber_to_hits_, detIds(), MuonSimHitMatcher::hits_, MuonSimHitMatcher::hitsInChamber(), hitStripsInDetId(), triggerObjects_cff::id, MuonSimHitMatcher::match(), matchSimHitsToSimTrack(), AlCaHLTBitMon_ParallelJobs::p, MuonSimHitMatcher::simHitsMeanPosition(), DigiDM_cff::strips, HLT_FULL_cff::track, MuonSimHitMatcher::track_ids_, MuonSimHitMatcher::verbose_, and bphysicsOniaDQM_cfi::vertex.

◆ matchSimHitsToSimTrack()

void ME0SimHitMatcher::matchSimHitsToSimTrack ( )
private

Definition at line 49 of file ME0SimHitMatcher.cc.

49  {
50  for (const auto& track_id : track_ids_) {
51  for (const auto& h : simHits_) {
52  if (h.trackId() != track_id)
53  continue;
54  int pdgid = h.particleType();
55  if (simMuOnly_ && std::abs(pdgid) != 13)
56  continue;
57  // discard electron hits in the ME0 chambers
58  if (discardEleHits_ && std::abs(pdgid) == 11)
59  continue;
60 
61  const ME0DetId& layer_id(h.detUnitId());
62  detid_to_hits_[h.detUnitId()].push_back(h);
63  hits_.push_back(h);
64  chamber_to_hits_[layer_id.layerId().rawId()].push_back(h);
65  superChamber_to_hits_[layer_id.chamberId().rawId()].push_back(h);
66  }
67  }
68 
69  // find pads with hits
70  const auto& detids = detIds();
71  for (const auto& d : detids) {
72  ME0DetId id(d);
73  const auto& hits = hitsInDetId(d);
74  const auto& roll = dynamic_cast<const ME0Geometry*>(geometry_)->etaPartition(id);
75  // int max_npads = roll->npads();
76  set<int> pads;
77  for (const auto& h : hits) {
78  const LocalPoint& lp = h.entryPoint();
79  pads.insert(1 + static_cast<int>(roll->padTopology().channel(lp)));
80  }
81  detids_to_pads_[d] = pads;
82  }
83 }

References funct::abs(), MuonSimHitMatcher::chamber_to_hits_, ztail::d, MuonSimHitMatcher::detid_to_hits_, detIds(), detids_to_pads_, MuonSimHitMatcher::discardEleHits_, MuonSimHitMatcher::geometry_, hfClusterShapes_cfi::hits, MuonSimHitMatcher::hits_, MuonSimHitMatcher::hitsInDetId(), triggerObjects_cff::id, EgammaValidation_cff::pdgid, MuonSimHitMatcher::simHits_, MuonSimHitMatcher::simMuOnly_, superChamber_to_hits_, and MuonSimHitMatcher::track_ids_.

Referenced by match().

◆ nCoincidenceChambers()

int ME0SimHitMatcher::nCoincidenceChambers ( int  min_n_layers = 4) const

Definition at line 133 of file ME0SimHitMatcher.cc.

133  {
134  return superChamberIdsCoincidences(min_n_layers).size();
135 }

References superChamberIdsCoincidences().

◆ nLayersWithHitsInSuperChamber()

int ME0SimHitMatcher::nLayersWithHitsInSuperChamber ( unsigned int  detid) const

Definition at line 112 of file ME0SimHitMatcher.cc.

112  {
113  set<int> layers_with_hits;
114  const auto& hits = hitsInSuperChamber(detid);
115  for (const auto& h : hits) {
116  const ME0DetId& idd(h.detUnitId());
117  layers_with_hits.insert(idd.layer());
118  }
119  return layers_with_hits.size();
120 }

References hfClusterShapes_cfi::hits, and hitsInSuperChamber().

Referenced by superChamberIdsCoincidences().

◆ nPadsWithHits()

int ME0SimHitMatcher::nPadsWithHits ( ) const

Definition at line 193 of file ME0SimHitMatcher.cc.

193  {
194  int result = 0;
195  const auto& pad_ids = detIds();
196  for (const auto& id : pad_ids) {
197  result += hitPadsInDetId(id).size();
198  }
199  return result;
200 }

References detIds(), hitPadsInDetId(), and mps_fire::result.

◆ simHitsMeanStrip()

float ME0SimHitMatcher::simHitsMeanStrip ( const edm::PSimHitContainer sim_hits) const

Definition at line 137 of file ME0SimHitMatcher.cc.

137  {
138  if (sim_hits.empty())
139  return -1.f;
140 
141  float sums = 0.f;
142  size_t n = 0;
143  for (const auto& h : sim_hits) {
144  const LocalPoint& lp = h.entryPoint();
145  float s;
146  const auto& d = h.detUnitId();
147  s = dynamic_cast<const ME0Geometry*>(geometry_)->etaPartition(d)->strip(lp);
148  sums += s;
149  ++n;
150  }
151  if (n == 0)
152  return -1.f;
153  return sums / n;
154 }

References ztail::d, f, MuonSimHitMatcher::geometry_, dqmiodumpmetadata::n, and alignCSCRings::s.

◆ superChamberIds()

std::set< unsigned int > ME0SimHitMatcher::superChamberIds ( ) const

Definition at line 99 of file ME0SimHitMatcher.cc.

99  {
100  std::set<unsigned int> result;
101  for (const auto& p : superChamber_to_hits_)
102  result.insert(p.first);
103  return result;
104 }

References AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and superChamber_to_hits_.

Referenced by superChamberIdsCoincidences().

◆ superChamberIdsCoincidences()

std::set< unsigned int > ME0SimHitMatcher::superChamberIdsCoincidences ( int  min_n_layers = 4) const

Definition at line 122 of file ME0SimHitMatcher.cc.

122  {
123  set<unsigned int> result;
124  // loop over the super chamber Ids
125  for (const auto& p : superChamberIds()) {
126  if (nLayersWithHitsInSuperChamber(p) >= min_n_layers) {
127  result.insert(p);
128  }
129  }
130  return result;
131 }

References nLayersWithHitsInSuperChamber(), AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and superChamberIds().

Referenced by nCoincidenceChambers().

Member Data Documentation

◆ detids_to_copads_

std::map<unsigned int, std::set<int> > ME0SimHitMatcher::detids_to_copads_
private

Definition at line 73 of file ME0SimHitMatcher.h.

◆ detids_to_pads_

std::map<unsigned int, std::set<int> > ME0SimHitMatcher::detids_to_pads_
private

Definition at line 70 of file ME0SimHitMatcher.h.

Referenced by hitPadsInDetId(), and matchSimHitsToSimTrack().

◆ geomToken_

edm::ESGetToken<ME0Geometry, MuonGeometryRecord> ME0SimHitMatcher::geomToken_
private

Definition at line 67 of file ME0SimHitMatcher.h.

Referenced by init(), and ME0SimHitMatcher().

◆ superChamber_to_hits_

std::map<unsigned int, edm::PSimHitContainer> ME0SimHitMatcher::superChamber_to_hits_
private

Definition at line 75 of file ME0SimHitMatcher.h.

Referenced by hitsInSuperChamber(), matchSimHitsToSimTrack(), and superChamberIds().

HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
ME0SimHitMatcher::superChamberIdsCoincidences
std::set< unsigned int > superChamberIdsCoincidences(int min_n_layers=4) const
Definition: ME0SimHitMatcher.cc:122
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
MuonSimHitMatcher::geometry_
const TrackingGeometry * geometry_
Definition: MuonSimHitMatcher.h:84
MuonSimHitMatcher::verbose_
bool verbose_
Definition: MuonSimHitMatcher.h:81
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ME0Geometry
Definition: ME0Geometry.h:12
MuonSimHitMatcher::detid_to_hits_
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
Definition: MuonSimHitMatcher.h:106
MuonSimHitMatcher::simHitsMeanPosition
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
Definition: MuonSimHitMatcher.cc:99
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
ME0SimHitMatcher::superChamberIds
std::set< unsigned int > superChamberIds() const
Definition: ME0SimHitMatcher.cc:99
MuonSimHitMatcher::simHits_
edm::PSimHitContainer simHits_
Definition: MuonSimHitMatcher.h:97
none
Definition: EcalBoundaryInfoCalculator.h:24
ME0SimHitMatcher::hitStripsInDetId
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
Definition: ME0SimHitMatcher.cc:156
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
h
MuonSimHitMatcher::simHitPSet_
edm::ParameterSet simHitPSet_
Definition: MuonSimHitMatcher.h:109
ME0SimHitMatcher::hitsInSuperChamber
const edm::PSimHitContainer & hitsInSuperChamber(unsigned int) const
Definition: ME0SimHitMatcher.cc:106
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
Point3DBase< float, LocalTag >
MuonSimHitMatcher::track_ids_
std::vector< unsigned > track_ids_
Definition: MuonSimHitMatcher.h:99
MuonSimHitMatcher::no_hits_
edm::PSimHitContainer no_hits_
Definition: MuonSimHitMatcher.h:102
ME0SimHitMatcher::superChamber_to_hits_
std::map< unsigned int, edm::PSimHitContainer > superChamber_to_hits_
Definition: ME0SimHitMatcher.h:75
ME0SimHitMatcher::geomToken_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geomToken_
Definition: ME0SimHitMatcher.h:67
MuonSimHitMatcher::discardEleHits_
bool discardEleHits_
Definition: MuonSimHitMatcher.h:80
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
HLTBitAnalyser_cfi.simhits
simhits
SIM objects.
Definition: HLTBitAnalyser_cfi.py:21
ME0SimHitMatcher::hitPadsInDetId
std::set< int > hitPadsInDetId(unsigned int) const
Definition: ME0SimHitMatcher.cc:175
MuonSimHitMatcher::match
void match(const SimTrack &t, const SimVertex &v)
do the matching
Definition: MuonSimHitMatcher.cc:26
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonSimHitMatcher::chamber_to_hits_
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
Definition: MuonSimHitMatcher.h:107
ME0DetId
Definition: ME0DetId.h:16
MuonSimHitMatcher::simHitInput_
edm::EDGetTokenT< edm::PSimHitContainer > simHitInput_
Definition: MuonSimHitMatcher.h:88
MuonSimHitMatcher::hitsInDetId
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
Definition: MuonSimHitMatcher.cc:87
eostools.move
def move(src, dest)
Definition: eostools.py:511
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ME0SimHitMatcher::matchSimHitsToSimTrack
void matchSimHitsToSimTrack()
Definition: ME0SimHitMatcher.cc:49
ME0SimHitMatcher::nLayersWithHitsInSuperChamber
int nLayersWithHitsInSuperChamber(unsigned int) const
Definition: ME0SimHitMatcher.cc:112
ME0SimHitMatcher::detids_to_pads_
std::map< unsigned int, std::set< int > > detids_to_pads_
Definition: ME0SimHitMatcher.h:70
MuonSimHitMatcher::simMuOnly_
bool simMuOnly_
Definition: MuonSimHitMatcher.h:79
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MuonSimHitMatcher::hitsInChamber
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
Definition: MuonSimHitMatcher.cc:93
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
MuonSimHitMatcher::hits_
edm::PSimHitContainer hits_
Definition: MuonSimHitMatcher.h:105
EgammaValidation_cff.pdgid
pdgid
Definition: EgammaValidation_cff.py:30
MuonSimHitMatcher::init
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
Definition: MuonSimHitMatcher.cc:17
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
DigiDM_cff.strips
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers....
Definition: DigiDM_cff.py:32
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
ME0SimHitMatcher::detIds
std::set< unsigned int > detIds() const
Definition: ME0SimHitMatcher.cc:85
MuonSimHitMatcher::MuonSimHitMatcher
MuonSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
Definition: MuonSimHitMatcher.cc:7