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 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< DTGeometrydt_geom_
 
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
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 14 of file DTSimHitMatcher.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::discardEleHits_, 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 
13 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::ParameterSet simHitPSet_
ParameterSet const & getParameterSet(std::string const &) const
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
DTSimHitMatcher::~DTSimHitMatcher ( )
inline

Member Function Documentation

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

Definition at line 88 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::chamber_to_hits_, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, DTChamberId::station(), MuonHitHelper::toDTType(), and DTChamberId::wheel().

Referenced by chamberIdsStation(), hitStation(), and ~DTSimHitMatcher().

88  {
89  std::set<unsigned int> result;
90  for (const auto& p : chamber_to_hits_) {
91  const auto& id = p.first;
92  if (dt_type > 0) {
93  DTChamberId detId(id);
94  if (MuonHitHelper::toDTType(detId.wheel(), detId.station()) != dt_type)
95  continue;
96  }
97  result.insert(id);
98  }
99  return result;
100 }
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
static int toDTType(int wh, int st)
std::set< unsigned int > DTSimHitMatcher::chamberIdsStation ( int  station) const

Definition at line 296 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, p1, p2, p3, p4, and mps_fire::result.

Referenced by ~DTSimHitMatcher().

296  {
297  set<unsigned int> result;
298  switch (station) {
299  case 1: {
300  const auto& p1(chamberIds(MuonHitHelper::DT_MB21p));
301  const auto& p2(chamberIds(MuonHitHelper::DT_MB11p));
302  const auto& p3(chamberIds(MuonHitHelper::DT_MB01));
303  const auto& p4(chamberIds(MuonHitHelper::DT_MB11n));
304  const auto& p5(chamberIds(MuonHitHelper::DT_MB21n));
305  result.insert(p1.begin(), p1.end());
306  result.insert(p2.begin(), p2.end());
307  result.insert(p3.begin(), p3.end());
308  result.insert(p4.begin(), p4.end());
309  result.insert(p5.begin(), p5.end());
310  break;
311  }
312  case 2: {
313  const auto& p1(chamberIds(MuonHitHelper::DT_MB22p));
314  const auto& p2(chamberIds(MuonHitHelper::DT_MB12p));
315  const auto& p3(chamberIds(MuonHitHelper::DT_MB02));
316  const auto& p4(chamberIds(MuonHitHelper::DT_MB12n));
317  const auto& p5(chamberIds(MuonHitHelper::DT_MB22n));
318  result.insert(p1.begin(), p1.end());
319  result.insert(p2.begin(), p2.end());
320  result.insert(p3.begin(), p3.end());
321  result.insert(p4.begin(), p4.end());
322  result.insert(p5.begin(), p5.end());
323  break;
324  }
325  case 3: {
326  const auto& p1(chamberIds(MuonHitHelper::DT_MB23p));
327  const auto& p2(chamberIds(MuonHitHelper::DT_MB13p));
328  const auto& p3(chamberIds(MuonHitHelper::DT_MB03));
329  const auto& p4(chamberIds(MuonHitHelper::DT_MB13n));
330  const auto& p5(chamberIds(MuonHitHelper::DT_MB23n));
331  result.insert(p1.begin(), p1.end());
332  result.insert(p2.begin(), p2.end());
333  result.insert(p3.begin(), p3.end());
334  result.insert(p4.begin(), p4.end());
335  result.insert(p5.begin(), p5.end());
336  break;
337  }
338  case 4: {
339  const auto& p1(chamberIds(MuonHitHelper::DT_MB24p));
340  const auto& p2(chamberIds(MuonHitHelper::DT_MB14p));
341  const auto& p3(chamberIds(MuonHitHelper::DT_MB04));
342  const auto& p4(chamberIds(MuonHitHelper::DT_MB14n));
343  const auto& p5(chamberIds(MuonHitHelper::DT_MB24n));
344  result.insert(p1.begin(), p1.end());
345  result.insert(p2.begin(), p2.end());
346  result.insert(p3.begin(), p3.end());
347  result.insert(p4.begin(), p4.end());
348  result.insert(p5.begin(), p5.end());
349  break;
350  }
351  };
352  return result;
353 }
std::set< unsigned int > chamberIds(int type=MuonHitHelper::DT_ALL) const
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
std::set< unsigned int > DTSimHitMatcher::detIds ( int  type = MuonHitHelper::DT_ALL) const

Definition at line 74 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::detid_to_hits_, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, DTChamberId::station(), MuonHitHelper::toDTType(), and DTChamberId::wheel().

Referenced by match(), and ~DTSimHitMatcher().

74  {
75  std::set<unsigned int> result;
76  for (const auto& p : detid_to_hits_) {
77  const auto& id = p.first;
78  if (dt_type > 0) {
79  DTWireId detId(id);
80  if (MuonHitHelper::toDTType(detId.wheel(), detId.station()) != dt_type)
81  continue;
82  }
83  result.insert(id);
84  }
85  return result;
86 }
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
static int toDTType(int wh, int st)
void DTSimHitMatcher::dtChamberIdsToString ( const std::set< unsigned int > &  set) const

Definition at line 289 of file DTSimHitMatcher.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by ~DTSimHitMatcher().

289  {
290  for (const auto& p : set) {
291  DTChamberId detId(p);
292  edm::LogInfo("DTSimHitMatcher") << " " << detId << "\n";
293  }
294 }
const edm::PSimHitContainer & DTSimHitMatcher::hitsInChamber ( unsigned int  detid) const

Definition at line 136 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::chamber_to_hits_, triggerObjects_cff::id, MuonHitHelper::isDT(), and MuonSimHitMatcher::no_hits_.

Referenced by ~DTSimHitMatcher().

136  {
137  if (!MuonHitHelper::isDT(detid))
138  return no_hits_;
139 
140  const DTWireId id(detid);
141  if (chamber_to_hits_.find(id.chamberId().rawId()) == chamber_to_hits_.end())
142  return no_hits_;
143  return chamber_to_hits_.at(id.chamberId().rawId());
144 }
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_
const edm::PSimHitContainer & DTSimHitMatcher::hitsInLayer ( unsigned int  detid) const

Definition at line 116 of file DTSimHitMatcher.cc.

References triggerObjects_cff::id, MuonHitHelper::isDT(), layer_to_hits_, and MuonSimHitMatcher::no_hits_.

Referenced by nCellsWithHitsInLayer(), and ~DTSimHitMatcher().

116  {
117  if (!MuonHitHelper::isDT(detid))
118  return no_hits_;
119 
120  const DTWireId id(detid);
121  if (layer_to_hits_.find(id.layerId().rawId()) == layer_to_hits_.end())
122  return no_hits_;
123  return layer_to_hits_.at(id.layerId().rawId());
124 }
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_
const edm::PSimHitContainer & DTSimHitMatcher::hitsInSuperLayer ( unsigned int  detid) const

Definition at line 126 of file DTSimHitMatcher.cc.

References triggerObjects_cff::id, MuonHitHelper::isDT(), MuonSimHitMatcher::no_hits_, and superlayer_to_hits_.

Referenced by nLayersWithHitsInSuperLayer(), and ~DTSimHitMatcher().

126  {
127  if (!MuonHitHelper::isDT(detid))
128  return no_hits_;
129 
130  const DTWireId id(detid);
131  if (superlayer_to_hits_.find(id.superlayerId().rawId()) == superlayer_to_hits_.end())
132  return no_hits_;
133  return superlayer_to_hits_.at(id.superlayerId().rawId());
134 }
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_
bool DTSimHitMatcher::hitStation ( int  st,
int  nsuperlayers,
int  nlayers 
) const

Definition at line 146 of file DTSimHitMatcher.cc.

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

Referenced by nStations(), and ~DTSimHitMatcher().

146  {
147  int nst = 0;
148  for (const auto& ddt : chamberIds()) {
149  const DTChamberId id(ddt);
150  if (id.station() != st)
151  continue;
152 
153  // require at least 1 superlayer
154  const int nsl(nSuperLayersWithHitsInChamber(id.rawId()));
155  if (nsl < nsuperlayers)
156  continue;
157 
158  // require at least 3 layers hit per chamber
159  const int nl(nLayersWithHitsInChamber(id.rawId()));
160  if (nl < nlayers)
161  continue;
162  ++nst;
163  }
164  return nst;
165 }
std::set< unsigned int > chamberIds(int type=MuonHitHelper::DT_ALL) const
int nLayersWithHitsInChamber(unsigned int) const
int nSuperLayersWithHitsInChamber(unsigned int) const
std::set< unsigned int > DTSimHitMatcher::hitWiresInDTChamberId ( unsigned int  detid,
int  margin_n_wires = 0 
) const

Definition at line 277 of file DTSimHitMatcher.cc.

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

Referenced by ~DTSimHitMatcher().

277  {
278  set<unsigned int> result;
279  const auto& superLayers(dynamic_cast<const DTGeometry*>(geometry_)->chamber(DTChamberId(detid))->superLayers());
280  for (const auto& sl : superLayers) {
281  if (verbose_)
282  edm::LogInfo("DTSimHitMatcher") << "hitWiresInDTChamberId::sl id " << sl->id() << endl;
283  const auto& p(hitWiresInDTSuperLayerId(sl->id().rawId(), margin_n_wires));
284  result.insert(p.begin(), p.end());
285  }
286  return result;
287 }
const TrackingGeometry * geometry_
std::set< unsigned int > hitWiresInDTSuperLayerId(unsigned int, int margin_n_wires=0) const
std::set< unsigned int > DTSimHitMatcher::hitWiresInDTLayerId ( unsigned int  detid,
int  margin_n_wires = 0 
) const

Definition at line 239 of file DTSimHitMatcher.cc.

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

Referenced by hitWiresInDTSuperLayerId(), and ~DTSimHitMatcher().

239  {
240  set<unsigned int> result;
241  if (MuonHitHelper::isDT(detid)) {
242  DTLayerId id(detid);
243  int max_nwires = dynamic_cast<const DTGeometry*>(geometry_)->layer(id)->specificTopology().channels();
244  for (int wn = 0; wn <= max_nwires; ++wn) {
245  DTWireId wid(id, wn);
246  for (const auto& h : MuonSimHitMatcher::hitsInDetId(wid.rawId())) {
247  if (verbose_)
248  edm::LogInfo("DTSimHitMatcher") << "central DTWireId " << wid << " simhit " << h << endl;
249  int smin = wn - margin_n_wires;
250  smin = (smin > 0) ? smin : 1;
251  int smax = wn + margin_n_wires;
252  smax = (smax <= max_nwires) ? smax : max_nwires;
253  for (int ss = smin; ss <= smax; ++ss) {
254  DTWireId widd(id, ss);
255  if (verbose_)
256  edm::LogInfo("DTSimHitMatcher") << "\tadding DTWireId to collection " << widd << endl;
257  result.insert(widd.rawId());
258  }
259  }
260  }
261  }
262  return result;
263 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const TrackingGeometry * geometry_
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
std::set< unsigned int > DTSimHitMatcher::hitWiresInDTSuperLayerId ( unsigned int  detid,
int  margin_n_wires = 0 
) const

Definition at line 265 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::geometry_, hitWiresInDTLayerId(), cmsLHEtoEOSManager::l, hgcalTopologyTester_cfi::layers, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and MuonSimHitMatcher::verbose_.

Referenced by hitWiresInDTChamberId(), and ~DTSimHitMatcher().

265  {
266  set<unsigned int> result;
267  const auto& layers(dynamic_cast<const DTGeometry*>(geometry_)->superLayer(DTSuperLayerId(detid))->layers());
268  for (const auto& l : layers) {
269  if (verbose_)
270  edm::LogInfo("DTSimHitMatcher") << "hitWiresInDTSuperLayerId::l id " << l->id() << endl;
271  const auto& p(hitWiresInDTLayerId(l->id().rawId(), margin_n_wires));
272  result.insert(p.begin(), p.end());
273  }
274  return result;
275 }
const TrackingGeometry * geometry_
std::set< unsigned int > hitWiresInDTLayerId(unsigned int, int margin_n_wires=0) const
void DTSimHitMatcher::init ( const edm::Event e,
const edm::EventSetup eventSetup 
)

initialize the event

Definition at line 16 of file DTSimHitMatcher.cc.

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

Referenced by ~DTSimHitMatcher().

16  {
17  iSetup.get<MuonGeometryRecord>().get(dt_geom_);
18  if (dt_geom_.isValid()) {
19  geometry_ = &*dt_geom_;
20  } else {
21  hasGeometry_ = false;
22  edm::LogWarning("DTSimHitMatcher") << "+++ Info: DT geometry is unavailable. +++\n";
23  }
25 }
const TrackingGeometry * geometry_
int iEvent
Definition: GenABIO.cc:224
edm::ESHandle< DTGeometry > dt_geom_
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
bool isValid() const
Definition: ESHandle.h:44
std::set< unsigned int > DTSimHitMatcher::layerIds ( ) const

Definition at line 102 of file DTSimHitMatcher.cc.

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

Referenced by ~DTSimHitMatcher().

102  {
103  std::set<unsigned int> result;
104  for (const auto& p : layer_to_hits_)
105  result.insert(p.first);
106  return result;
107 }
std::map< unsigned int, edm::PSimHitContainer > layer_to_hits_
void DTSimHitMatcher::match ( const SimTrack t,
const SimVertex v 
)

do the matching

Definition at line 28 of file DTSimHitMatcher.cc.

References MuonSimHitMatcher::chamber_to_hits_, detIds(), MuonSimHitMatcher::hasGeometry_, MuonSimHitMatcher::hits_, MuonSimHitMatcher::hitsInDetId(), triggerObjects_cff::id, MuonSimHitMatcher::match(), matchSimHitsToSimTrack(), MuonSimHitMatcher::simHitsMeanPosition(), MuonSimHitMatcher::track_ids_, and MuonSimHitMatcher::verbose_.

Referenced by ~DTSimHitMatcher().

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

Definition at line 52 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(), and ~DTSimHitMatcher().

52  {
53  for (const auto& track_id : track_ids_) {
54  for (const auto& h : simHits_) {
55  if (h.trackId() != track_id)
56  continue;
57  int pdgid = h.particleType();
58  if (simMuOnly_ && std::abs(pdgid) != 13)
59  continue;
60  // discard electron hits in the DT chambers
61  if (discardEleHits_ && pdgid == 11)
62  continue;
63 
64  const DTWireId layer_id(h.detUnitId());
65  detid_to_hits_[h.detUnitId()].push_back(h);
66  hits_.push_back(h);
67  layer_to_hits_[layer_id.layerId().rawId()].push_back(h);
68  superlayer_to_hits_[layer_id.superlayerId().rawId()].push_back(h);
69  chamber_to_hits_[layer_id.chamberId().rawId()].push_back(h);
70  }
71  }
72 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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_
std::map< unsigned int, edm::PSimHitContainer > layer_to_hits_
int DTSimHitMatcher::nCellsWithHitsInLayer ( unsigned int  detid) const

Definition at line 172 of file DTSimHitMatcher.cc.

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

Referenced by ~DTSimHitMatcher().

172  {
173  set<int> layers_with_hits;
174  const auto& hits = hitsInLayer(detid);
175  for (const auto& h : hits) {
176  if (MuonHitHelper::isDT(detid)) {
177  const DTWireId idd(h.detUnitId());
178  layers_with_hits.insert(idd.wire());
179  }
180  }
181  return layers_with_hits.size();
182 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInLayer(unsigned int) const
int DTSimHitMatcher::nLayersWithHitsInChamber ( unsigned int  detid) const

Definition at line 208 of file DTSimHitMatcher.cc.

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

Referenced by hitStation(), and ~DTSimHitMatcher().

208  {
209  int nLayers = 0;
210  const auto& superLayers(dynamic_cast<const DTGeometry*>(geometry_)->chamber(DTChamberId(detid))->superLayers());
211  for (const auto& sl : superLayers) {
212  nLayers += nLayersWithHitsInSuperLayer(sl->id().rawId());
213  }
214  return nLayers;
215 }
constexpr int nLayers
Definition: Common.h:13
const TrackingGeometry * geometry_
int nLayersWithHitsInSuperLayer(unsigned int) const
int DTSimHitMatcher::nLayersWithHitsInSuperLayer ( unsigned int  detid) const

Definition at line 184 of file DTSimHitMatcher.cc.

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

Referenced by nLayersWithHitsInChamber(), and ~DTSimHitMatcher().

184  {
185  set<int> layers_with_hits;
186  const auto& hits = hitsInSuperLayer(detid);
187  for (const auto& h : hits) {
188  if (MuonHitHelper::isDT(detid)) {
189  const DTLayerId idd(h.detUnitId());
190  layers_with_hits.insert(idd.layer());
191  }
192  }
193  return layers_with_hits.size();
194 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInSuperLayer(unsigned int) const
int DTSimHitMatcher::nStations ( int  nsl = 1,
int  nl = 3 
) const

Definition at line 167 of file DTSimHitMatcher.cc.

References hitStation().

Referenced by ~DTSimHitMatcher().

167  {
168  return (hitStation(1, nsuperlayers, nlayers) + hitStation(2, nsuperlayers, nlayers) +
169  hitStation(3, nsuperlayers, nlayers) + hitStation(4, nsuperlayers, nlayers));
170 }
bool hitStation(int, int, int) const
int DTSimHitMatcher::nSuperLayersWithHitsInChamber ( unsigned int  detid) const

Definition at line 196 of file DTSimHitMatcher.cc.

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

Referenced by hitStation(), and ~DTSimHitMatcher().

196  {
197  set<int> sl_with_hits;
198  const auto& hits = MuonSimHitMatcher::hitsInChamber(detid);
199  for (const auto& h : hits) {
200  if (MuonHitHelper::isDT(detid)) {
201  const DTSuperLayerId idd(h.detUnitId());
202  sl_with_hits.insert(idd.superLayer());
203  }
204  }
205  return sl_with_hits.size();
206 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
GlobalPoint DTSimHitMatcher::simHitsMeanPositionStation ( int  n) const

Referenced by ~DTSimHitMatcher().

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

Definition at line 216 of file DTSimHitMatcher.cc.

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

Referenced by ~DTSimHitMatcher().

216  {
217  if (sim_hits.empty())
218  return -1.f;
219 
220  float sums = 0.f;
221  size_t n = 0;
222  for (const auto& h : sim_hits) {
223  const LocalPoint& lp = h.entryPoint();
224  float s;
225  const auto& d = h.detUnitId();
226  if (MuonHitHelper::isDT(d)) {
227  // find nearest wire
228  s = dynamic_cast<const DTGeometry*>(geometry_)->layer(DTLayerId(d))->specificTopology().channel(lp);
229  } else
230  continue;
231  sums += s;
232  ++n;
233  }
234  if (n == 0)
235  return -1.f;
236  return sums / n;
237 }
static bool isDT(unsigned int detId)
check detid type
Definition: MuonHitHelper.cc:3
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const TrackingGeometry * geometry_
double f[11][100]
d
Definition: ztail.py:151
std::set< unsigned int > DTSimHitMatcher::superlayerIds ( ) const

Definition at line 109 of file DTSimHitMatcher.cc.

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

Referenced by ~DTSimHitMatcher().

109  {
110  std::set<unsigned int> result;
111  for (const auto& p : superlayer_to_hits_)
112  result.insert(p.first);
113  return result;
114 }
std::map< unsigned int, edm::PSimHitContainer > superlayer_to_hits_

Member Data Documentation

edm::ESHandle<DTGeometry> DTSimHitMatcher::dt_geom_
private

Definition at line 76 of file DTSimHitMatcher.h.

Referenced by init().

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

Definition at line 73 of file DTSimHitMatcher.h.

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

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

Definition at line 74 of file DTSimHitMatcher.h.

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