CMS 3D CMS Logo

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

#include <RPCSimHitMatcher.h>

Inheritance diagram for RPCSimHitMatcher:
MuonSimHitMatcher

Public Member Functions

std::set< unsigned int > chamberIds (int type=MuonHitHelper::RPC_ALL) const
 
std::set< unsigned int > detIds (int type=MuonHitHelper::RPC_ALL) const
 
bool hitStation (int st) 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...
 
int nStations () const
 
 RPCSimHitMatcher (const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
 
float simHitsMeanStrip (const edm::PSimHitContainer &sim_hits) const
 
 ~RPCSimHitMatcher ()
 
- 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 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

edm::ESHandle< RPCGeometryrpc_geom_
 

Additional Inherited Members

- Protected Member Functions inherited from MuonSimHitMatcher
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 RPC SimHit to SimTrack

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

Definition at line 14 of file RPCSimHitMatcher.h.

Constructor & Destructor Documentation

◆ RPCSimHitMatcher()

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

◆ ~RPCSimHitMatcher()

RPCSimHitMatcher::~RPCSimHitMatcher ( )
inline

Definition at line 20 of file RPCSimHitMatcher.h.

20 {}

Member Function Documentation

◆ chamberIds()

std::set< unsigned int > RPCSimHitMatcher::chamberIds ( int  type = MuonHitHelper::RPC_ALL) const

Definition at line 92 of file RPCSimHitMatcher.cc.

92  {
93  std::set<unsigned int> result;
94  for (const auto& p : chamber_to_hits_) {
95  const auto& id = p.first;
96  if (type > 0) {
97  RPCDetId detId(id);
98  if (MuonHitHelper::toRPCType(detId.region(), detId.station(), detId.ring()) != type)
99  continue;
100  }
101  result.insert(id);
102  }
103  return result;
104 }

References MuonSimHitMatcher::chamber_to_hits_, AlCaHLTBitMon_ParallelJobs::p, RPCDetId::region(), mps_fire::result, RPCDetId::ring(), RPCDetId::station(), and MuonHitHelper::toRPCType().

Referenced by hitStation(), and match().

◆ detIds()

std::set< unsigned int > RPCSimHitMatcher::detIds ( int  type = MuonHitHelper::RPC_ALL) const

Definition at line 78 of file RPCSimHitMatcher.cc.

78  {
79  std::set<unsigned int> result;
80  for (const auto& p : detid_to_hits_) {
81  const auto& id = p.first;
82  if (type > 0) {
83  RPCDetId detId(id);
84  if (MuonHitHelper::toRPCType(detId.region(), detId.station(), detId.ring()) != type)
85  continue;
86  }
87  result.insert(id);
88  }
89  return result;
90 }

References MuonSimHitMatcher::detid_to_hits_, AlCaHLTBitMon_ParallelJobs::p, RPCDetId::region(), mps_fire::result, RPCDetId::ring(), RPCDetId::station(), and MuonHitHelper::toRPCType().

Referenced by match().

◆ hitStation()

bool RPCSimHitMatcher::hitStation ( int  st) const

Definition at line 106 of file RPCSimHitMatcher.cc.

106  {
107  int nst = 0;
108  for (const auto& ddt : chamberIds(0)) {
109  const RPCDetId id(ddt);
110  if (id.station() != st)
111  continue;
112  ++nst;
113  }
114  return nst;
115 }

References chamberIds(), triggerObjects_cff::id, and relativeConstraints::station.

Referenced by nStations().

◆ hitStripsInDetId()

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

Definition at line 136 of file RPCSimHitMatcher.cc.

136  {
137  set<int> result;
138  RPCDetId id(detid);
139  for (const auto& roll : dynamic_cast<const RPCGeometry*>(geometry_)->chamber(id)->rolls()) {
140  int max_nstrips = roll->nstrips();
141  for (const auto& h : MuonSimHitMatcher::hitsInDetId(roll->id().rawId())) {
142  const LocalPoint& lp = h.entryPoint();
143  int central_strip = static_cast<int>(roll->topology().channel(lp));
144  int smin = central_strip - margin_n_strips;
145  smin = (smin > 0) ? smin : 1;
146  int smax = central_strip + margin_n_strips;
147  smax = (smax <= max_nstrips) ? smax : max_nstrips;
148  for (int ss = smin; ss <= smax; ++ss)
149  result.insert(ss);
150  }
151  }
152  return result;
153 }

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

Referenced by match().

◆ init()

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

initialize the event

Definition at line 17 of file RPCSimHitMatcher.cc.

17  {
18  iSetup.get<MuonGeometryRecord>().get(rpc_geom_);
19  if (rpc_geom_.isValid()) {
20  geometry_ = &*rpc_geom_;
21  } else {
22  hasGeometry_ = false;
23  edm::LogWarning("RPCSimHitMatcher") << "+++ Info: RPC geometry is unavailable. +++\n";
24  }
26 }

References MuonSimHitMatcher::geometry_, edm::EventSetup::get(), get, MuonSimHitMatcher::hasGeometry_, iEvent, MuonSimHitMatcher::init(), edm::ESHandleBase::isValid(), and rpc_geom_.

◆ match()

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

do the matching

Definition at line 29 of file RPCSimHitMatcher.cc.

29  {
30  // instantiates the track ids and simhits
32 
33  if (hasGeometry_) {
35 
36  if (verbose_) {
37  edm::LogInfo("RPCSimHitMatcher") << "nSimHits " << simHits_.size() << " nTrackIds " << track_ids_.size() << endl;
38  edm::LogInfo("RPCSimHitMatcher") << "detids RPC " << detIds().size() << endl;
39 
40  const auto& ch_ids = chamberIds();
41  for (const auto& id : ch_ids) {
42  const auto& simhits = MuonSimHitMatcher::hitsInChamber(id);
43  const auto& simhits_gp = simHitsMeanPosition(simhits);
44  edm::LogInfo("RPCSimHitMatcher") << "RPCDetId " << RPCDetId(id) << ": nHits " << simhits.size() << " eta "
45  << simhits_gp.eta() << " phi " << simhits_gp.phi() << " nCh "
46  << chamber_to_hits_[id].size() << endl;
47  const auto& strips = hitStripsInDetId(id);
48  edm::LogInfo("RPCSimHitMatcher") << "nStrips " << strips.size() << endl;
49  edm::LogInfo("RPCSimHitMatcher") << "strips : ";
50  for (const auto& p : strips) {
51  edm::LogInfo("RPCSimHitMatcher") << p;
52  }
53  }
54  }
55  }
56 }

References MuonSimHitMatcher::chamber_to_hits_, chamberIds(), detIds(), MuonSimHitMatcher::hasGeometry_, MuonSimHitMatcher::hitsInChamber(), hitStripsInDetId(), triggerObjects_cff::id, MuonSimHitMatcher::match(), matchSimHitsToSimTrack(), AlCaHLTBitMon_ParallelJobs::p, HLTBitAnalyser_cfi::simhits, MuonSimHitMatcher::simHits_, MuonSimHitMatcher::simHitsMeanPosition(), DigiDM_cff::strips, HLT_2018_cff::track, MuonSimHitMatcher::track_ids_, MuonSimHitMatcher::verbose_, and bphysicsOniaDQM_cfi::vertex.

◆ matchSimHitsToSimTrack()

void RPCSimHitMatcher::matchSimHitsToSimTrack ( )
private

Definition at line 58 of file RPCSimHitMatcher.cc.

58  {
59  for (const auto& track_id : track_ids_) {
60  for (const auto& h : simHits_) {
61  if (h.trackId() != track_id)
62  continue;
63  int pdgid = h.particleType();
64  if (simMuOnly_ && std::abs(pdgid) != 13)
65  continue;
66  // discard electron hits in the RPC chambers
67  if (discardEleHits_ && pdgid == 11)
68  continue;
69 
70  const RPCDetId& layer_id(h.detUnitId());
71  detid_to_hits_[h.detUnitId()].push_back(h);
72  hits_.push_back(h);
73  chamber_to_hits_[layer_id.chamberId().rawId()].push_back(h);
74  }
75  }
76 }

References funct::abs(), MuonSimHitMatcher::chamber_to_hits_, MuonSimHitMatcher::detid_to_hits_, MuonSimHitMatcher::discardEleHits_, MuonSimHitMatcher::hits_, EgammaValidation_cff::pdgid, MuonSimHitMatcher::simHits_, MuonSimHitMatcher::simMuOnly_, and MuonSimHitMatcher::track_ids_.

Referenced by match().

◆ nStations()

int RPCSimHitMatcher::nStations ( ) const

Definition at line 117 of file RPCSimHitMatcher.cc.

117 { return (hitStation(1) + hitStation(2) + hitStation(3) + hitStation(4)); }

References hitStation().

◆ simHitsMeanStrip()

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

Definition at line 119 of file RPCSimHitMatcher.cc.

119  {
120  if (sim_hits.empty())
121  return -1.f;
122 
123  float sums = 0.f;
124  size_t n = 0;
125  for (const auto& h : sim_hits) {
126  const LocalPoint& lp = h.entryPoint();
127  const auto& d = h.detUnitId();
128  sums += dynamic_cast<const RPCGeometry*>(geometry_)->roll(d)->strip(lp);
129  ++n;
130  }
131  if (n == 0)
132  return -1.f;
133  return sums / n;
134 }

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

Member Data Documentation

◆ rpc_geom_

edm::ESHandle<RPCGeometry> RPCSimHitMatcher::rpc_geom_
private

Definition at line 47 of file RPCSimHitMatcher.h.

Referenced by init().

dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
MuonSimHitMatcher::geometry_
const TrackingGeometry * geometry_
Definition: MuonSimHitMatcher.h:81
relativeConstraints.station
station
Definition: relativeConstraints.py:67
MuonSimHitMatcher::verbose_
bool verbose_
Definition: MuonSimHitMatcher.h:78
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RPCDetId
Definition: RPCDetId.h:16
edm::LogInfo
Definition: MessageLogger.h:254
MuonSimHitMatcher::detid_to_hits_
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
Definition: MuonSimHitMatcher.h:103
MuonSimHitMatcher::simHitsMeanPosition
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
Definition: MuonSimHitMatcher.cc:99
MuonSimHitMatcher::simHits_
edm::PSimHitContainer simHits_
Definition: MuonSimHitMatcher.h:94
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
h
RPCSimHitMatcher::chamberIds
std::set< unsigned int > chamberIds(int type=MuonHitHelper::RPC_ALL) const
Definition: RPCSimHitMatcher.cc:92
MuonSimHitMatcher::simHitPSet_
edm::ParameterSet simHitPSet_
Definition: MuonSimHitMatcher.h:106
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
Point3DBase< float, LocalTag >
MuonSimHitMatcher::track_ids_
std::vector< unsigned > track_ids_
Definition: MuonSimHitMatcher.h:96
edm::LogWarning
Definition: MessageLogger.h:141
MuonSimHitMatcher::discardEleHits_
bool discardEleHits_
Definition: MuonSimHitMatcher.h:77
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
HLTBitAnalyser_cfi.simhits
simhits
SIM objects.
Definition: HLTBitAnalyser_cfi.py:21
MuonSimHitMatcher::match
void match(const SimTrack &t, const SimVertex &v)
do the matching
Definition: MuonSimHitMatcher.cc:26
RPCSimHitMatcher::hitStripsInDetId
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
Definition: RPCSimHitMatcher.cc:136
MuonHitHelper::toRPCType
static int toRPCType(int re, int st, int ri)
Definition: MuonHitHelper.cc:60
MuonSimHitMatcher::hasGeometry_
bool hasGeometry_
Definition: MuonSimHitMatcher.h:79
iEvent
int iEvent
Definition: GenABIO.cc:224
RPCSimHitMatcher::rpc_geom_
edm::ESHandle< RPCGeometry > rpc_geom_
Definition: RPCSimHitMatcher.h:47
MuonSimHitMatcher::chamber_to_hits_
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
Definition: MuonSimHitMatcher.h:104
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
MuonSimHitMatcher::simHitInput_
edm::EDGetTokenT< edm::PSimHitContainer > simHitInput_
Definition: MuonSimHitMatcher.h:85
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
MuonSimHitMatcher::hitsInDetId
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
Definition: MuonSimHitMatcher.cc:87
type
type
Definition: HCALResponse.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
RPCSimHitMatcher::matchSimHitsToSimTrack
void matchSimHitsToSimTrack()
Definition: RPCSimHitMatcher.cc:58
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
RPCSimHitMatcher::hitStation
bool hitStation(int st) const
Definition: RPCSimHitMatcher.cc:106
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
MuonSimHitMatcher::simMuOnly_
bool simMuOnly_
Definition: MuonSimHitMatcher.h:76
MuonSimHitMatcher::hitsInChamber
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
Definition: MuonSimHitMatcher.cc:93
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:303
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:102
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
RPCSimHitMatcher::detIds
std::set< unsigned int > detIds(int type=MuonHitHelper::RPC_ALL) const
Definition: RPCSimHitMatcher.cc:78
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
MuonSimHitMatcher::MuonSimHitMatcher
MuonSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
Definition: MuonSimHitMatcher.cc:7