CMS 3D CMS Logo

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

#include <DTSimHitMatcher.h>

Inheritance diagram for DTSimHitMatcher:
MuonSimHitMatcher

Public Member Functions

std::set< unsigned int > chamberIds (int type=MuonHitHelper::DT_ALL) const
 
std::set< unsigned int > chamberIdsStation (int station) const
 
std::set< unsigned int > detIds (int type=MuonHitHelper::DT_ALL) const
 
void dtChamberIdsToString (const std::set< unsigned int > &) const
 
 DTSimHitMatcher (const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
 
const edm::PSimHitContainerhitsInChamber (unsigned int) const
 
const edm::PSimHitContainerhitsInLayer (unsigned int) const
 
const edm::PSimHitContainerhitsInSuperLayer (unsigned int) const
 
bool hitStation (int, int, int) const
 
std::set< unsigned int > hitWiresInDTChamberId (unsigned int, int margin_n_wires=0) const
 
std::set< unsigned int > hitWiresInDTLayerId (unsigned int, int margin_n_wires=0) const
 
std::set< unsigned int > hitWiresInDTSuperLayerId (unsigned int, int margin_n_wires=0) const
 
void init (const edm::Event &e, const edm::EventSetup &eventSetup)
 initialize the event More...
 
std::set< unsigned int > layerIds () const
 
void match (const SimTrack &t, const SimVertex &v)
 do the matching More...
 
int nCellsWithHitsInLayer (unsigned int) const
 
int nLayersWithHitsInChamber (unsigned int) const
 
int nLayersWithHitsInSuperLayer (unsigned int) const
 
int nStations (int nsl=1, int nl=3) const
 
int nSuperLayersWithHitsInChamber (unsigned int) const
 
GlobalPoint simHitsMeanPositionStation (int n) const
 
float simHitsMeanWire (const edm::PSimHitContainer &sim_hits) const
 
std::set< unsigned int > superlayerIds () const
 
 ~DTSimHitMatcher ()
 
- 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

edm::ESGetToken< DTGeometry, MuonGeometryRecordgeomToken_
 
std::map< unsigned int, edm::PSimHitContainerlayer_to_hits_
 
std::map< unsigned int, edm::PSimHitContainersuperlayer_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 DT SimHit to SimTrack

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

Definition at line 16 of file DTSimHitMatcher.h.

Constructor & Destructor Documentation

◆ DTSimHitMatcher()

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

Definition at line 5 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::discardEleHits_, geomToken_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), MuonSimHitMatcher::simHitInput_, MuonSimHitMatcher::simHitPSet_, MuonSimHitMatcher::simMuOnly_, and MuonSimHitMatcher::verbose_.

6  : MuonSimHitMatcher(ps, std::move(iC)) {
7  simHitPSet_ = ps.getParameterSet("dtSimHit");
8  verbose_ = simHitPSet_.getParameter<int>("verbose");
9  simMuOnly_ = simHitPSet_.getParameter<bool>("simMuOnly");
10  discardEleHits_ = simHitPSet_.getParameter<bool>("discardEleHits");
11 
14 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterSet const & getParameterSet(std::string const &) const
edm::ParameterSet simHitPSet_
edm::EDGetTokenT< edm::PSimHitContainer > simHitInput_
MuonSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
std::vector< PSimHit > PSimHitContainer
def move(src, dest)
Definition: eostools.py:511
edm::ESGetToken< DTGeometry, MuonGeometryRecord > geomToken_

◆ ~DTSimHitMatcher()

DTSimHitMatcher::~DTSimHitMatcher ( )
inline

Definition at line 22 of file DTSimHitMatcher.h.

22 {}

Member Function Documentation

◆ chamberIds()

std::set< unsigned int > DTSimHitMatcher::chamberIds ( int  type = MuonHitHelper::DT_ALL) const

Definition at line 80 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::chamber_to_hits_, hcalRecHitTable_cff::detId, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and MuonHitHelper::toDTType().

Referenced by chamberIdsStation(), and hitStation().

80  {
81  std::set<unsigned int> result;
82  for (const auto& p : chamber_to_hits_) {
83  const auto& id = p.first;
84  if (dt_type > 0) {
85  DTChamberId detId(id);
86  if (MuonHitHelper::toDTType(detId.wheel(), detId.station()) != dt_type)
87  continue;
88  }
89  result.insert(id);
90  }
91  return result;
92 }
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
static int toDTType(int wh, int st)

◆ chamberIdsStation()

std::set< unsigned int > DTSimHitMatcher::chamberIdsStation ( int  station) const

Definition at line 288 of file DTSimHitMatcher.cc.

References chamberIds(), MuonHitHelper::DT_MB01, MuonHitHelper::DT_MB02, MuonHitHelper::DT_MB03, MuonHitHelper::DT_MB04, MuonHitHelper::DT_MB11n, MuonHitHelper::DT_MB11p, MuonHitHelper::DT_MB12n, MuonHitHelper::DT_MB12p, MuonHitHelper::DT_MB13n, MuonHitHelper::DT_MB13p, MuonHitHelper::DT_MB14n, MuonHitHelper::DT_MB14p, MuonHitHelper::DT_MB21n, MuonHitHelper::DT_MB21p, MuonHitHelper::DT_MB22n, MuonHitHelper::DT_MB22p, MuonHitHelper::DT_MB23n, MuonHitHelper::DT_MB23p, MuonHitHelper::DT_MB24n, MuonHitHelper::DT_MB24p, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, chargedHadronTrackResolutionFilter_cfi::p3, mps_fire::result, and relativeConstraints::station.

288  {
289  set<unsigned int> result;
290  switch (station) {
291  case 1: {
292  const auto& p1(chamberIds(MuonHitHelper::DT_MB21p));
293  const auto& p2(chamberIds(MuonHitHelper::DT_MB11p));
294  const auto& p3(chamberIds(MuonHitHelper::DT_MB01));
295  const auto& p4(chamberIds(MuonHitHelper::DT_MB11n));
296  const auto& p5(chamberIds(MuonHitHelper::DT_MB21n));
297  result.insert(p1.begin(), p1.end());
298  result.insert(p2.begin(), p2.end());
299  result.insert(p3.begin(), p3.end());
300  result.insert(p4.begin(), p4.end());
301  result.insert(p5.begin(), p5.end());
302  break;
303  }
304  case 2: {
305  const auto& p1(chamberIds(MuonHitHelper::DT_MB22p));
306  const auto& p2(chamberIds(MuonHitHelper::DT_MB12p));
307  const auto& p3(chamberIds(MuonHitHelper::DT_MB02));
308  const auto& p4(chamberIds(MuonHitHelper::DT_MB12n));
309  const auto& p5(chamberIds(MuonHitHelper::DT_MB22n));
310  result.insert(p1.begin(), p1.end());
311  result.insert(p2.begin(), p2.end());
312  result.insert(p3.begin(), p3.end());
313  result.insert(p4.begin(), p4.end());
314  result.insert(p5.begin(), p5.end());
315  break;
316  }
317  case 3: {
318  const auto& p1(chamberIds(MuonHitHelper::DT_MB23p));
319  const auto& p2(chamberIds(MuonHitHelper::DT_MB13p));
320  const auto& p3(chamberIds(MuonHitHelper::DT_MB03));
321  const auto& p4(chamberIds(MuonHitHelper::DT_MB13n));
322  const auto& p5(chamberIds(MuonHitHelper::DT_MB23n));
323  result.insert(p1.begin(), p1.end());
324  result.insert(p2.begin(), p2.end());
325  result.insert(p3.begin(), p3.end());
326  result.insert(p4.begin(), p4.end());
327  result.insert(p5.begin(), p5.end());
328  break;
329  }
330  case 4: {
331  const auto& p1(chamberIds(MuonHitHelper::DT_MB24p));
332  const auto& p2(chamberIds(MuonHitHelper::DT_MB14p));
333  const auto& p3(chamberIds(MuonHitHelper::DT_MB04));
334  const auto& p4(chamberIds(MuonHitHelper::DT_MB14n));
335  const auto& p5(chamberIds(MuonHitHelper::DT_MB24n));
336  result.insert(p1.begin(), p1.end());
337  result.insert(p2.begin(), p2.end());
338  result.insert(p3.begin(), p3.end());
339  result.insert(p4.begin(), p4.end());
340  result.insert(p5.begin(), p5.end());
341  break;
342  }
343  };
344  return result;
345 }
std::set< unsigned int > chamberIds(int type=MuonHitHelper::DT_ALL) const

◆ detIds()

std::set< unsigned int > DTSimHitMatcher::detIds ( int  type = MuonHitHelper::DT_ALL) const

Definition at line 66 of file DTSimHitMatcher.cc.

References hcalRecHitTable_cff::detId, MuonSimHitMatcher::detid_to_hits_, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and MuonHitHelper::toDTType().

Referenced by match().

66  {
67  std::set<unsigned int> result;
68  for (const auto& p : detid_to_hits_) {
69  const auto& id = p.first;
70  if (dt_type > 0) {
71  DTWireId detId(id);
72  if (MuonHitHelper::toDTType(detId.wheel(), detId.station()) != dt_type)
73  continue;
74  }
75  result.insert(id);
76  }
77  return result;
78 }
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
static int toDTType(int wh, int st)

◆ dtChamberIdsToString()

void DTSimHitMatcher::dtChamberIdsToString ( const std::set< unsigned int > &  set) const

Definition at line 281 of file DTSimHitMatcher.cc.

References hcalRecHitTable_cff::detId, and AlCaHLTBitMon_ParallelJobs::p.

281  {
282  for (const auto& p : set) {
284  edm::LogInfo("DTSimHitMatcher") << " " << detId << "\n";
285  }
286 }
Log< level::Info, false > LogInfo

◆ hitsInChamber()

const edm::PSimHitContainer & DTSimHitMatcher::hitsInChamber ( unsigned int  detid) const

Definition at line 128 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::chamber_to_hits_, l1ctLayer2EG_cff::id, MuonHitHelper::isDT(), MuonSimHitMatcher::no_hits_, and nano_mu_digi_cff::rawId.

128  {
129  if (!MuonHitHelper::isDT(detid))
130  return no_hits_;
131 
132  const DTWireId id(detid);
133  if (chamber_to_hits_.find(id.chamberId().rawId()) == chamber_to_hits_.end())
134  return no_hits_;
135  return chamber_to_hits_.at(id.chamberId().rawId());
136 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
edm::PSimHitContainer no_hits_

◆ hitsInLayer()

const edm::PSimHitContainer & DTSimHitMatcher::hitsInLayer ( unsigned int  detid) const

Definition at line 108 of file DTSimHitMatcher.cc.

References l1ctLayer2EG_cff::id, MuonHitHelper::isDT(), layer_to_hits_, MuonSimHitMatcher::no_hits_, and nano_mu_digi_cff::rawId.

Referenced by nCellsWithHitsInLayer().

108  {
109  if (!MuonHitHelper::isDT(detid))
110  return no_hits_;
111 
112  const DTWireId id(detid);
113  if (layer_to_hits_.find(id.layerId().rawId()) == layer_to_hits_.end())
114  return no_hits_;
115  return layer_to_hits_.at(id.layerId().rawId());
116 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
edm::PSimHitContainer no_hits_
std::map< unsigned int, edm::PSimHitContainer > layer_to_hits_

◆ hitsInSuperLayer()

const edm::PSimHitContainer & DTSimHitMatcher::hitsInSuperLayer ( unsigned int  detid) const

Definition at line 118 of file DTSimHitMatcher.cc.

References l1ctLayer2EG_cff::id, MuonHitHelper::isDT(), MuonSimHitMatcher::no_hits_, nano_mu_digi_cff::rawId, and superlayer_to_hits_.

Referenced by nLayersWithHitsInSuperLayer().

118  {
119  if (!MuonHitHelper::isDT(detid))
120  return no_hits_;
121 
122  const DTWireId id(detid);
123  if (superlayer_to_hits_.find(id.superlayerId().rawId()) == superlayer_to_hits_.end())
124  return no_hits_;
125  return superlayer_to_hits_.at(id.superlayerId().rawId());
126 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
edm::PSimHitContainer no_hits_
std::map< unsigned int, edm::PSimHitContainer > superlayer_to_hits_

◆ hitStation()

bool DTSimHitMatcher::hitStation ( int  st,
int  nsuperlayers,
int  nlayers 
) const

Definition at line 138 of file DTSimHitMatcher.cc.

References chamberIds(), l1ctLayer2EG_cff::id, nlayers, nLayersWithHitsInChamber(), nSuperLayersWithHitsInChamber(), nano_mu_digi_cff::rawId, and relativeConstraints::station.

Referenced by nStations().

138  {
139  int nst = 0;
140  for (const auto& ddt : chamberIds()) {
141  const DTChamberId id(ddt);
142  if (id.station() != st)
143  continue;
144 
145  // require at least 1 superlayer
146  const int nsl(nSuperLayersWithHitsInChamber(id.rawId()));
147  if (nsl < nsuperlayers)
148  continue;
149 
150  // require at least 3 layers hit per chamber
151  const int nl(nLayersWithHitsInChamber(id.rawId()));
152  if (nl < nlayers)
153  continue;
154  ++nst;
155  }
156  return nst;
157 }
int nLayersWithHitsInChamber(unsigned int) const
int nSuperLayersWithHitsInChamber(unsigned int) const
std::set< unsigned int > chamberIds(int type=MuonHitHelper::DT_ALL) const

◆ hitWiresInDTChamberId()

std::set< unsigned int > DTSimHitMatcher::hitWiresInDTChamberId ( unsigned int  detid,
int  margin_n_wires = 0 
) const

Definition at line 269 of file DTSimHitMatcher.cc.

References relativeConstraints::chamber, MuonSimHitMatcher::geometry_, hitWiresInDTSuperLayerId(), AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and MuonSimHitMatcher::verbose_.

269  {
270  set<unsigned int> result;
271  const auto& superLayers(dynamic_cast<const DTGeometry*>(geometry_)->chamber(DTChamberId(detid))->superLayers());
272  for (const auto& sl : superLayers) {
273  if (verbose_)
274  edm::LogInfo("DTSimHitMatcher") << "hitWiresInDTChamberId::sl id " << sl->id();
275  const auto& p(hitWiresInDTSuperLayerId(sl->id().rawId(), margin_n_wires));
276  result.insert(p.begin(), p.end());
277  }
278  return result;
279 }
const TrackingGeometry * geometry_
Log< level::Info, false > LogInfo
std::set< unsigned int > hitWiresInDTSuperLayerId(unsigned int, int margin_n_wires=0) const

◆ hitWiresInDTLayerId()

std::set< unsigned int > DTSimHitMatcher::hitWiresInDTLayerId ( unsigned int  detid,
int  margin_n_wires = 0 
) const

Definition at line 231 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::geometry_, h, MuonSimHitMatcher::hitsInDetId(), l1ctLayer2EG_cff::id, MuonHitHelper::isDT(), nano_mu_digi_cff::layer, DetId::rawId(), mps_fire::result, contentValuesCheck::ss, and MuonSimHitMatcher::verbose_.

Referenced by hitWiresInDTSuperLayerId().

231  {
232  set<unsigned int> result;
233  if (MuonHitHelper::isDT(detid)) {
234  DTLayerId id(detid);
235  int max_nwires = dynamic_cast<const DTGeometry*>(geometry_)->layer(id)->specificTopology().channels();
236  for (int wn = 0; wn <= max_nwires; ++wn) {
237  DTWireId wid(id, wn);
238  for (const auto& h : MuonSimHitMatcher::hitsInDetId(wid.rawId())) {
239  if (verbose_)
240  edm::LogInfo("DTSimHitMatcher") << "central DTWireId " << wid << " simhit " << h;
241  int smin = wn - margin_n_wires;
242  smin = (smin > 0) ? smin : 1;
243  int smax = wn + margin_n_wires;
244  smax = (smax <= max_nwires) ? smax : max_nwires;
245  for (int ss = smin; ss <= smax; ++ss) {
246  DTWireId widd(id, ss);
247  if (verbose_)
248  edm::LogInfo("DTSimHitMatcher") << "\tadding DTWireId to collection " << widd;
249  result.insert(widd.rawId());
250  }
251  }
252  }
253  }
254  return result;
255 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
const TrackingGeometry * geometry_
Log< level::Info, false > LogInfo
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ hitWiresInDTSuperLayerId()

std::set< unsigned int > DTSimHitMatcher::hitWiresInDTSuperLayerId ( unsigned int  detid,
int  margin_n_wires = 0 
) const

Definition at line 257 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::geometry_, hitWiresInDTLayerId(), MainPageGenerator::l, hgcalTBTopologyTester_cfi::layers, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, nano_mu_digi_cff::superLayer, and MuonSimHitMatcher::verbose_.

Referenced by hitWiresInDTChamberId().

257  {
258  set<unsigned int> result;
259  const auto& layers(dynamic_cast<const DTGeometry*>(geometry_)->superLayer(DTSuperLayerId(detid))->layers());
260  for (const auto& l : layers) {
261  if (verbose_)
262  edm::LogInfo("DTSimHitMatcher") << "hitWiresInDTSuperLayerId::l id " << l->id();
263  const auto& p(hitWiresInDTLayerId(l->id().rawId(), margin_n_wires));
264  result.insert(p.begin(), p.end());
265  }
266  return result;
267 }
const TrackingGeometry * geometry_
std::set< unsigned int > hitWiresInDTLayerId(unsigned int, int margin_n_wires=0) const
Log< level::Info, false > LogInfo

◆ init()

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

initialize the event

Definition at line 17 of file DTSimHitMatcher.cc.

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

17  {
18  geometry_ = &iSetup.getData(geomToken_);
20 }
const TrackingGeometry * geometry_
int iEvent
Definition: GenABIO.cc:224
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
edm::ESGetToken< DTGeometry, MuonGeometryRecord > geomToken_

◆ layerIds()

std::set< unsigned int > DTSimHitMatcher::layerIds ( ) const

Definition at line 94 of file DTSimHitMatcher.cc.

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

94  {
95  std::set<unsigned int> result;
96  for (const auto& p : layer_to_hits_)
97  result.insert(p.first);
98  return result;
99 }
std::map< unsigned int, edm::PSimHitContainer > layer_to_hits_

◆ match()

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

do the matching

Definition at line 23 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::chamber_to_hits_, detIds(), MuonSimHitMatcher::hits_, MuonSimHitMatcher::hitsInDetId(), l1ctLayer2EG_cff::id, MuonSimHitMatcher::match(), matchSimHitsToSimTrack(), MuonSimHitMatcher::simHitsMeanPosition(), HLT_2024v14_cff::track, MuonSimHitMatcher::track_ids_, MuonSimHitMatcher::verbose_, and bphysicsOniaDQM_cfi::vertex.

23  {
24  // instantiates the track ids and simhits
26 
28 
29  if (verbose_) {
30  edm::LogInfo("DTSimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedDTSimHits " << hits_.size();
31  edm::LogInfo("DTSimHitMatcher") << "detids DT " << detIds(0).size();
32 
33  const auto& dt_det_ids = detIds(0);
34  for (const auto& id : dt_det_ids) {
35  const auto& dt_simhits = MuonSimHitMatcher::hitsInDetId(id);
36  const auto& dt_simhits_gp = simHitsMeanPosition(dt_simhits);
37  edm::LogInfo("DTSimHitMatcher") << "DTWireId " << DTWireId(id) << ": nHits " << dt_simhits.size() << " eta "
38  << dt_simhits_gp.eta() << " phi " << dt_simhits_gp.phi() << " nCh "
39  << chamber_to_hits_[id].size();
40  }
41  }
42 }
edm::PSimHitContainer hits_
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
void matchSimHitsToSimTrack()
std::vector< unsigned > track_ids_
std::set< unsigned int > detIds(int type=MuonHitHelper::DT_ALL) const
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
Log< level::Info, false > LogInfo
void match(const SimTrack &t, const SimVertex &v)
do the matching
const edm::PSimHitContainer & hitsInDetId(unsigned int) const

◆ matchSimHitsToSimTrack()

void DTSimHitMatcher::matchSimHitsToSimTrack ( )
private

Definition at line 44 of file DTSimHitMatcher.cc.

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

Referenced by match().

44  {
45  for (const auto& track_id : track_ids_) {
46  for (const auto& h : simHits_) {
47  if (h.trackId() != track_id)
48  continue;
49  int pdgid = h.particleType();
50  if (simMuOnly_ && std::abs(pdgid) != 13)
51  continue;
52  // discard electron hits in the DT chambers
53  if (discardEleHits_ && std::abs(pdgid) == 11)
54  continue;
55 
56  const DTWireId layer_id(h.detUnitId());
57  detid_to_hits_[h.detUnitId()].push_back(h);
58  hits_.push_back(h);
59  layer_to_hits_[layer_id.layerId().rawId()].push_back(h);
60  superlayer_to_hits_[layer_id.superlayerId().rawId()].push_back(h);
61  chamber_to_hits_[layer_id.chamberId().rawId()].push_back(h);
62  }
63  }
64 }
edm::PSimHitContainer hits_
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
std::vector< unsigned > track_ids_
edm::PSimHitContainer simHits_
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< unsigned int, edm::PSimHitContainer > superlayer_to_hits_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::map< unsigned int, edm::PSimHitContainer > layer_to_hits_

◆ nCellsWithHitsInLayer()

int DTSimHitMatcher::nCellsWithHitsInLayer ( unsigned int  detid) const

Definition at line 164 of file DTSimHitMatcher.cc.

References h, hfClusterShapes_cfi::hits, hitsInLayer(), and MuonHitHelper::isDT().

164  {
165  set<int> layers_with_hits;
166  const auto& hits = hitsInLayer(detid);
167  for (const auto& h : hits) {
168  if (MuonHitHelper::isDT(detid)) {
169  const DTWireId idd(h.detUnitId());
170  layers_with_hits.insert(idd.wire());
171  }
172  }
173  return layers_with_hits.size();
174 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
const edm::PSimHitContainer & hitsInLayer(unsigned int) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ nLayersWithHitsInChamber()

int DTSimHitMatcher::nLayersWithHitsInChamber ( unsigned int  detid) const

Definition at line 200 of file DTSimHitMatcher.cc.

References relativeConstraints::chamber, MuonSimHitMatcher::geometry_, MuonTCMETValueMapProducer_cff::nLayers, and nLayersWithHitsInSuperLayer().

Referenced by hitStation().

200  {
201  int nLayers = 0;
202  const auto& superLayers(dynamic_cast<const DTGeometry*>(geometry_)->chamber(DTChamberId(detid))->superLayers());
203  for (const auto& sl : superLayers) {
204  nLayers += nLayersWithHitsInSuperLayer(sl->id().rawId());
205  }
206  return nLayers;
207 }
const TrackingGeometry * geometry_
int nLayersWithHitsInSuperLayer(unsigned int) const

◆ nLayersWithHitsInSuperLayer()

int DTSimHitMatcher::nLayersWithHitsInSuperLayer ( unsigned int  detid) const

Definition at line 176 of file DTSimHitMatcher.cc.

References h, hfClusterShapes_cfi::hits, hitsInSuperLayer(), and MuonHitHelper::isDT().

Referenced by nLayersWithHitsInChamber().

176  {
177  set<int> layers_with_hits;
178  const auto& hits = hitsInSuperLayer(detid);
179  for (const auto& h : hits) {
180  if (MuonHitHelper::isDT(detid)) {
181  const DTLayerId idd(h.detUnitId());
182  layers_with_hits.insert(idd.layer());
183  }
184  }
185  return layers_with_hits.size();
186 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
const edm::PSimHitContainer & hitsInSuperLayer(unsigned int) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ nStations()

int DTSimHitMatcher::nStations ( int  nsl = 1,
int  nl = 3 
) const

Definition at line 159 of file DTSimHitMatcher.cc.

References hitStation(), and nlayers.

159  {
160  return (hitStation(1, nsuperlayers, nlayers) + hitStation(2, nsuperlayers, nlayers) +
161  hitStation(3, nsuperlayers, nlayers) + hitStation(4, nsuperlayers, nlayers));
162 }
bool hitStation(int, int, int) const

◆ nSuperLayersWithHitsInChamber()

int DTSimHitMatcher::nSuperLayersWithHitsInChamber ( unsigned int  detid) const

Definition at line 188 of file DTSimHitMatcher.cc.

References h, hfClusterShapes_cfi::hits, MuonSimHitMatcher::hitsInChamber(), and MuonHitHelper::isDT().

Referenced by hitStation().

188  {
189  set<int> sl_with_hits;
190  const auto& hits = MuonSimHitMatcher::hitsInChamber(detid);
191  for (const auto& h : hits) {
192  if (MuonHitHelper::isDT(detid)) {
193  const DTSuperLayerId idd(h.detUnitId());
194  sl_with_hits.insert(idd.superLayer());
195  }
196  }
197  return sl_with_hits.size();
198 }
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ simHitsMeanPositionStation()

GlobalPoint DTSimHitMatcher::simHitsMeanPositionStation ( int  n) const

◆ simHitsMeanWire()

float DTSimHitMatcher::simHitsMeanWire ( const edm::PSimHitContainer sim_hits) const

Definition at line 208 of file DTSimHitMatcher.cc.

References ztail::d, f, MuonSimHitMatcher::geometry_, h, MuonHitHelper::isDT(), nano_mu_digi_cff::layer, dqmiodumpmetadata::n, and alignCSCRings::s.

208  {
209  if (sim_hits.empty())
210  return -1.f;
211 
212  float sums = 0.f;
213  size_t n = 0;
214  for (const auto& h : sim_hits) {
215  const LocalPoint& lp = h.entryPoint();
216  float s;
217  const auto& d = h.detUnitId();
218  if (MuonHitHelper::isDT(d)) {
219  // find nearest wire
220  s = dynamic_cast<const DTGeometry*>(geometry_)->layer(DTLayerId(d))->specificTopology().channel(lp);
221  } else
222  continue;
223  sums += s;
224  ++n;
225  }
226  if (n == 0)
227  return -1.f;
228  return sums / n;
229 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
const TrackingGeometry * geometry_
double f[11][100]
d
Definition: ztail.py:151
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ superlayerIds()

std::set< unsigned int > DTSimHitMatcher::superlayerIds ( ) const

Definition at line 101 of file DTSimHitMatcher.cc.

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

101  {
102  std::set<unsigned int> result;
103  for (const auto& p : superlayer_to_hits_)
104  result.insert(p.first);
105  return result;
106 }
std::map< unsigned int, edm::PSimHitContainer > superlayer_to_hits_

Member Data Documentation

◆ geomToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTSimHitMatcher::geomToken_
private

Definition at line 78 of file DTSimHitMatcher.h.

Referenced by DTSimHitMatcher(), and init().

◆ layer_to_hits_

std::map<unsigned int, edm::PSimHitContainer> DTSimHitMatcher::layer_to_hits_
private

Definition at line 75 of file DTSimHitMatcher.h.

Referenced by hitsInLayer(), layerIds(), and matchSimHitsToSimTrack().

◆ superlayer_to_hits_

std::map<unsigned int, edm::PSimHitContainer> DTSimHitMatcher::superlayer_to_hits_
private

Definition at line 76 of file DTSimHitMatcher.h.

Referenced by hitsInSuperLayer(), matchSimHitsToSimTrack(), and superlayerIds().