CMS 3D CMS Logo

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

#include <CSCSimHitMatcher.h>

Inheritance diagram for CSCSimHitMatcher:
MuonSimHitMatcher

Public Member Functions

void camberIdsToString (const std::set< unsigned int > &) const
 
std::set< unsigned int > chamberIds (int type=MuonHitHelper::CSC_ALL) const
 
std::set< unsigned int > chamberIdsStation (int station) const
 
void chamberIdsToString (const std::set< unsigned int > &set) const
 
 CSCSimHitMatcher (const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
 
std::set< unsigned int > detIds (int type=MuonHitHelper::CSC_ALL) const
 
bool hitStation (int, int) const
 
std::set< int > hitStripsInDetId (unsigned int, int margin_n_strips=0) const
 
std::set< int > hitWiregroupsInDetId (unsigned int, int margin_n_wg=0) const
 
void init (const edm::Event &e, const edm::EventSetup &eventSetup)
 initialize the event More...
 
float LocalBendingInChamber (unsigned int detid) const
 
void match (const SimTrack &t, const SimVertex &v)
 do the matching More...
 
int nCoincidenceChambers (int min_n_layers=4) const
 
int nLayersWithHitsInChamber (unsigned int) const
 
int nStations (int nl=4) const
 
GlobalPoint simHitPositionKeyLayer (unsigned int chamberid) const
 
GlobalPoint simHitsMeanPositionStation (int n) const
 
float simHitsMeanStrip (const edm::PSimHitContainer &sim_hits) const
 
float simHitsMeanWG (const edm::PSimHitContainer &sim_hits) const
 
 ~CSCSimHitMatcher ()
 
- 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< CSCGeometrycsc_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 CSC SimHit to SimTrack

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

Definition at line 14 of file CSCSimHitMatcher.h.

Constructor & Destructor Documentation

◆ CSCSimHitMatcher()

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

◆ ~CSCSimHitMatcher()

CSCSimHitMatcher::~CSCSimHitMatcher ( )
inline

Definition at line 20 of file CSCSimHitMatcher.h.

20 {}

Member Function Documentation

◆ camberIdsToString()

void CSCSimHitMatcher::camberIdsToString ( const std::set< unsigned int > &  ) const

◆ chamberIds()

std::set< unsigned int > CSCSimHitMatcher::chamberIds ( int  type = MuonHitHelper::CSC_ALL) const

Definition at line 93 of file CSCSimHitMatcher.cc.

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

References MuonSimHitMatcher::chamber_to_hits_, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, CSCDetId::ring(), CSCDetId::station(), and MuonHitHelper::toCSCType().

Referenced by chamberIdsStation(), hitStation(), and nCoincidenceChambers().

◆ chamberIdsStation()

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

Definition at line 305 of file CSCSimHitMatcher.cc.

305  {
306  set<unsigned int> result;
307  switch (station) {
308  case 1: {
309  const auto& p1(chamberIds(MuonHitHelper::CSC_ME1a));
310  const auto& p2(chamberIds(MuonHitHelper::CSC_ME1b));
311  const auto& p3(chamberIds(MuonHitHelper::CSC_ME12));
312  const auto& p4(chamberIds(MuonHitHelper::CSC_ME13));
313  result.insert(p1.begin(), p1.end());
314  result.insert(p2.begin(), p2.end());
315  result.insert(p3.begin(), p3.end());
316  result.insert(p4.begin(), p4.end());
317  break;
318  }
319  case 2: {
320  const auto& p1(chamberIds(MuonHitHelper::CSC_ME21));
321  const auto& p2(chamberIds(MuonHitHelper::CSC_ME22));
322  result.insert(p1.begin(), p1.end());
323  result.insert(p2.begin(), p2.end());
324  break;
325  }
326  case 3: {
327  const auto& p1(chamberIds(MuonHitHelper::CSC_ME31));
328  const auto& p2(chamberIds(MuonHitHelper::CSC_ME32));
329  result.insert(p1.begin(), p1.end());
330  result.insert(p2.begin(), p2.end());
331  break;
332  }
333  case 4: {
334  const auto& p1(chamberIds(MuonHitHelper::CSC_ME41));
335  const auto& p2(chamberIds(MuonHitHelper::CSC_ME42));
336  result.insert(p1.begin(), p1.end());
337  result.insert(p2.begin(), p2.end());
338  break;
339  }
340  };
341  return result;
342 }

References chamberIds(), MuonHitHelper::CSC_ME12, MuonHitHelper::CSC_ME13, MuonHitHelper::CSC_ME1a, MuonHitHelper::CSC_ME1b, MuonHitHelper::CSC_ME21, MuonHitHelper::CSC_ME22, MuonHitHelper::CSC_ME31, MuonHitHelper::CSC_ME32, MuonHitHelper::CSC_ME41, MuonHitHelper::CSC_ME42, p1, p2, p3, p4, mps_fire::result, and relativeConstraints::station.

◆ chamberIdsToString()

void CSCSimHitMatcher::chamberIdsToString ( const std::set< unsigned int > &  set) const

Definition at line 298 of file CSCSimHitMatcher.cc.

298  {
299  for (const auto& p : set) {
300  CSCDetId detId(p);
301  edm::LogInfo("CSCSimHitMatcher") << " " << detId << "\n";
302  }
303 }

References AlCaHLTBitMon_ParallelJobs::p.

◆ detIds()

std::set< unsigned int > CSCSimHitMatcher::detIds ( int  type = MuonHitHelper::CSC_ALL) const

Definition at line 79 of file CSCSimHitMatcher.cc.

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

References MuonSimHitMatcher::detid_to_hits_, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, CSCDetId::ring(), CSCDetId::station(), and MuonHitHelper::toCSCType().

Referenced by match().

◆ hitStation()

bool CSCSimHitMatcher::hitStation ( int  st,
int  nlayers 
) const

Definition at line 116 of file CSCSimHitMatcher.cc.

116  {
117  int nst = 0;
118  for (const auto& ddt : chamberIds()) {
119  const CSCDetId id(ddt);
120  int ri(id.ring());
121  if (id.station() != st)
122  continue;
123 
124  // ME1/a case - check the ME1/b chamber
125  if (st == 1 and ri == 4) {
126  CSCDetId idME1b(id.endcap(), id.station(), 1, id.chamber(), 0);
127  const int nl1a(nLayersWithHitsInChamber(id.rawId()));
128  const int nl1b(nLayersWithHitsInChamber(idME1b.rawId()));
129  if (nl1a + nl1b < nlayers)
130  continue;
131  ++nst;
132  }
133  // ME1/b case - check the ME1/a chamber
134  else if (st == 1 and ri == 1) {
135  CSCDetId idME1a(id.endcap(), id.station(), 4, id.chamber(), 0);
136  const int nl1a(nLayersWithHitsInChamber(idME1a.rawId()));
137  const int nl1b(nLayersWithHitsInChamber(id.rawId()));
138  if (nl1a + nl1b < nlayers)
139  continue;
140  ++nst;
141  }
142  // default case
143  else {
144  const int nl(nLayersWithHitsInChamber(id.rawId()));
145  if (nl < nlayers)
146  continue;
147  ++nst;
148  }
149  }
150  return nst;
151 }

References relativeConstraints::chamber, chamberIds(), makeMuonMisalignmentScenario::endcap, triggerObjects_cff::id, nlayers, nLayersWithHitsInChamber(), DetId::rawId(), relativeConstraints::ring, and relativeConstraints::station.

Referenced by nStations().

◆ hitStripsInDetId()

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

Definition at line 251 of file CSCSimHitMatcher.cc.

251  {
252  set<int> result;
253  const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid);
254  CSCDetId id(detid);
255  int max_nstrips = dynamic_cast<const CSCGeometry*>(geometry_)->layer(id)->geometry()->numberOfStrips();
256  for (const auto& h : simhits) {
257  const LocalPoint& lp = h.entryPoint();
258  int central_strip = dynamic_cast<const CSCGeometry*>(geometry_)->layer(id)->geometry()->nearestStrip(lp);
259  int smin = central_strip - margin_n_strips;
260  smin = (smin > 0) ? smin : 1;
261  int smax = central_strip + margin_n_strips;
262  smax = (smax <= max_nstrips) ? smax : max_nstrips;
263  for (int ss = smin; ss <= smax; ++ss)
264  result.insert(ss);
265  }
266  return result;
267 }

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

Referenced by match().

◆ hitWiregroupsInDetId()

std::set< int > CSCSimHitMatcher::hitWiregroupsInDetId ( unsigned int  detid,
int  margin_n_wg = 0 
) const

Definition at line 269 of file CSCSimHitMatcher.cc.

269  {
270  set<int> result;
271  const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid);
272  CSCDetId id(detid);
273  int max_n_wg = dynamic_cast<const CSCGeometry*>(geometry_)->layer(id)->geometry()->numberOfWireGroups();
274  for (const auto& h : simhits) {
275  const LocalPoint& lp = h.entryPoint();
276  const auto& layer_geo = dynamic_cast<const CSCGeometry*>(geometry_)->layer(id)->geometry();
277  int central_wg = layer_geo->wireGroup(layer_geo->nearestWire(lp));
278  int wg_min = central_wg - margin_n_wg;
279  wg_min = (wg_min > 0) ? wg_min : 1;
280  int wg_max = central_wg + margin_n_wg;
281  wg_max = (wg_max <= max_n_wg) ? wg_max : max_n_wg;
282  for (int wg = wg_min; wg <= wg_max; ++wg)
283  result.insert(wg);
284  }
285  return result;
286 }

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

◆ init()

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

initialize the event

Definition at line 16 of file CSCSimHitMatcher.cc.

16  {
17  iSetup.get<MuonGeometryRecord>().get(csc_geom_);
18  if (csc_geom_.isValid()) {
19  geometry_ = &*csc_geom_;
20  } else {
21  hasGeometry_ = false;
22  edm::LogWarning("CSCSimHitMatcher") << "+++ Info: CSC geometry is unavailable. +++\n";
23  }
25 }

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

◆ LocalBendingInChamber()

float CSCSimHitMatcher::LocalBendingInChamber ( unsigned int  detid) const

Definition at line 157 of file CSCSimHitMatcher.cc.

157  {
158  const CSCDetId cscid(detid);
159  if (nLayersWithHitsInChamber(detid) < 6)
160  return -100;
161  float phi_layer1 = -10;
162  float phi_layer6 = 10;
163 
164  if (cscid.station() == 1 and (cscid.ring() == 1 or cscid.ring() == 4)) {
165  // phi in layer 1
166  const CSCDetId cscid1a(cscid.endcap(), cscid.station(), 4, cscid.chamber(), 1);
167  const CSCDetId cscid1b(cscid.endcap(), cscid.station(), 1, cscid.chamber(), 1);
168  const edm::PSimHitContainer& hits1a = MuonSimHitMatcher::hitsInDetId(cscid1a.rawId());
169  const edm::PSimHitContainer& hits1b = MuonSimHitMatcher::hitsInDetId(cscid1b.rawId());
170  const GlobalPoint& gp1a = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1a.rawId()));
171  const GlobalPoint& gp1b = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1b.rawId()));
172  if (!hits1a.empty() and !hits1b.empty())
173  phi_layer1 = (gp1a.phi() + gp1b.phi()) / 2.0;
174  else if (!hits1a.empty())
175  phi_layer1 = gp1a.phi();
176  else if (!hits1b.empty())
177  phi_layer1 = gp1b.phi();
178 
179  // phi in layer 6
180  const CSCDetId cscid6a(cscid.endcap(), cscid.station(), 4, cscid.chamber(), 6);
181  const CSCDetId cscid6b(cscid.endcap(), cscid.station(), 1, cscid.chamber(), 6);
182  const edm::PSimHitContainer& hits6a = MuonSimHitMatcher::hitsInDetId(cscid6a.rawId());
183  const edm::PSimHitContainer& hits6b = MuonSimHitMatcher::hitsInDetId(cscid6b.rawId());
184  const GlobalPoint& gp6a = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6a.rawId()));
185  const GlobalPoint& gp6b = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6b.rawId()));
186  if (!hits6a.empty() and !hits6b.empty())
187  phi_layer6 = (gp6a.phi() + gp6b.phi()) / 2.0;
188  else if (!hits6a.empty())
189  phi_layer6 = gp6a.phi();
190  else if (!hits6b.empty())
191  phi_layer6 = gp6b.phi();
192 
193  } else {
194  // phi in layer 1
195  const CSCDetId cscid1(cscid.endcap(), cscid.station(), cscid.ring(), cscid.chamber(), 1);
196  const GlobalPoint& gp1 = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1.rawId()));
197  phi_layer1 = gp1.phi();
198 
199  // phi in layer 6
200  const CSCDetId cscid6(cscid.endcap(), cscid.station(), cscid.ring(), cscid.chamber(), 6);
201  const GlobalPoint& gp6 = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6.rawId()));
202  phi_layer6 = gp6.phi();
203  }
204  return deltaPhi(phi_layer6, phi_layer1);
205 }

References CSCDetId::chamber(), SiPixelRawToDigiRegional_cfi::deltaPhi, CSCDetId::endcap(), MuonSimHitMatcher::hitsInDetId(), nLayersWithHitsInChamber(), or, PV3DBase< T, PVType, FrameType >::phi(), CSCDetId::ring(), MuonSimHitMatcher::simHitsMeanPosition(), and CSCDetId::station().

◆ match()

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

do the matching

Definition at line 28 of file CSCSimHitMatcher.cc.

28  {
29  // instantiates the track ids and simhits
31 
32  if (hasGeometry_) {
34 
35  if (verbose_) {
36  edm::LogInfo("CSCSimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedCSCSimHits " << hits_.size()
37  << endl;
38  edm::LogInfo("CSCSimHitMatcher") << "detids CSC " << detIds(0).size() << endl;
39 
40  for (const auto& id : detIds(0)) {
41  const auto& simhits = hitsInDetId(id);
42  const auto& simhits_gp = simHitsMeanPosition(simhits);
43  const auto& strips = hitStripsInDetId(id);
44  CSCDetId cscid(id);
45  if (cscid.station() == 1 and (cscid.ring() == 1 or cscid.ring() == 4)) {
46  edm::LogInfo("CSCSimHitMatcher") << "cscdetid " << CSCDetId(id) << ": " << simhits.size() << " "
47  << simhits_gp.phi() << " " << detid_to_hits_[id].size() << endl;
48  edm::LogInfo("CSCSimHitMatcher") << "nStrip " << strips.size() << endl;
49  edm::LogInfo("CSCSimHitMatcher") << "strips : ";
50  for (const auto& p : strips) {
51  edm::LogInfo("CSCSimHitMatcher") << p;
52  }
53  }
54  }
55  }
56  }
57 }

References MuonSimHitMatcher::detid_to_hits_, detIds(), MuonSimHitMatcher::hasGeometry_, MuonSimHitMatcher::hits_, MuonSimHitMatcher::hitsInDetId(), hitStripsInDetId(), triggerObjects_cff::id, MuonSimHitMatcher::match(), matchSimHitsToSimTrack(), or, AlCaHLTBitMon_ParallelJobs::p, CSCDetId::ring(), HLTBitAnalyser_cfi::simhits, MuonSimHitMatcher::simHitsMeanPosition(), CSCDetId::station(), DigiDM_cff::strips, HLT_2018_cff::track, MuonSimHitMatcher::track_ids_, MuonSimHitMatcher::verbose_, and bphysicsOniaDQM_cfi::vertex.

◆ matchSimHitsToSimTrack()

void CSCSimHitMatcher::matchSimHitsToSimTrack ( )
private

Definition at line 59 of file CSCSimHitMatcher.cc.

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

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().

◆ nCoincidenceChambers()

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

Definition at line 288 of file CSCSimHitMatcher.cc.

288  {
289  int result = 0;
290  const auto& chamber_ids = chamberIds(0);
291  for (const auto& id : chamber_ids) {
292  if (nLayersWithHitsInChamber(id) >= min_n_layers)
293  result += 1;
294  }
295  return result;
296 }

References chamberIds(), nLayersWithHitsInChamber(), and mps_fire::result.

◆ nLayersWithHitsInChamber()

int CSCSimHitMatcher::nLayersWithHitsInChamber ( unsigned int  detid) const

Definition at line 107 of file CSCSimHitMatcher.cc.

107  {
108  set<int> layers_with_hits;
109  for (const auto& h : MuonSimHitMatcher::hitsInChamber(detid)) {
110  const CSCDetId& idd(h.detUnitId());
111  layers_with_hits.insert(idd.layer());
112  }
113  return layers_with_hits.size();
114 }

References MuonSimHitMatcher::hitsInChamber().

Referenced by hitStation(), LocalBendingInChamber(), and nCoincidenceChambers().

◆ nStations()

int CSCSimHitMatcher::nStations ( int  nl = 4) const

Definition at line 153 of file CSCSimHitMatcher.cc.

153  {
154  return (hitStation(1, nlayers) + hitStation(2, nlayers) + hitStation(3, nlayers) + hitStation(4, nlayers));
155 }

References hitStation(), and nlayers.

◆ simHitPositionKeyLayer()

GlobalPoint CSCSimHitMatcher::simHitPositionKeyLayer ( unsigned int  chamberid) const

◆ simHitsMeanPositionStation()

GlobalPoint CSCSimHitMatcher::simHitsMeanPositionStation ( int  n) const

◆ simHitsMeanStrip()

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

Definition at line 207 of file CSCSimHitMatcher.cc.

207  {
208  if (sim_hits.empty())
209  return -1.f;
210 
211  float sums = 0.f;
212  size_t n = 0;
213  for (const auto& h : sim_hits) {
214  const LocalPoint& lp = h.entryPoint();
215  float s;
216  const auto& d = h.detUnitId();
217  s = dynamic_cast<const CSCGeometry*>(geometry_)->layer(d)->geometry()->strip(lp);
218  // convert to half-strip:
219  s *= 2.;
220  sums += s;
221  ++n;
222  }
223  if (n == 0)
224  return -1.f;
225  return sums / n;
226 }

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

◆ simHitsMeanWG()

float CSCSimHitMatcher::simHitsMeanWG ( const edm::PSimHitContainer sim_hits) const

Definition at line 228 of file CSCSimHitMatcher.cc.

228  {
229  if (sim_hits.empty())
230  return -1.f;
231 
232  float sums = 0.f;
233  size_t n = 0;
234  for (const auto& h : sim_hits) {
235  const LocalPoint& lp = h.entryPoint();
236  float s;
237  const auto& d = h.detUnitId();
238  // find nearest wire
239  const auto& layerG(dynamic_cast<const CSCGeometry*>(geometry_)->layer(d)->geometry());
240  int nearestWire(layerG->nearestWire(lp));
241  // then find the corresponding wire group
242  s = layerG->wireGroup(nearestWire);
243  sums += s;
244  ++n;
245  }
246  if (n == 0)
247  return -1.f;
248  return sums / n;
249 }

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

Member Data Documentation

◆ csc_geom_

edm::ESHandle<CSCGeometry> CSCSimHitMatcher::csc_geom_
private

Definition at line 76 of file CSCSimHitMatcher.h.

Referenced by init().

geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
CSCSimHitMatcher::csc_geom_
edm::ESHandle< CSCGeometry > csc_geom_
Definition: CSCSimHitMatcher.h:76
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
MuonHitHelper::CSC_ME42
Definition: MuonHitHelper.h:26
MuonHitHelper::CSC_ME1a
Definition: MuonHitHelper.h:17
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
CSCSimHitMatcher::hitStripsInDetId
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
Definition: CSCSimHitMatcher.cc:251
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
MuonSimHitMatcher::simHits_
edm::PSimHitContainer simHits_
Definition: MuonSimHitMatcher.h:94
CSCSimHitMatcher::detIds
std::set< unsigned int > detIds(int type=MuonHitHelper::CSC_ALL) const
Definition: CSCSimHitMatcher.cc:79
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
h
MuonHitHelper::CSC_ME41
Definition: MuonHitHelper.h:25
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
MuonHitHelper::CSC_ME13
Definition: MuonHitHelper.h:20
MuonSimHitMatcher::simHitPSet_
edm::ParameterSet simHitPSet_
Definition: MuonSimHitMatcher.h:106
p2
double p2[4]
Definition: TauolaWrapper.h:90
MuonHitHelper::CSC_ME12
Definition: MuonHitHelper.h:19
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
CSCDetId
Definition: CSCDetId.h:26
MuonHitHelper::CSC_ME22
Definition: MuonHitHelper.h:22
MuonSimHitMatcher::hasGeometry_
bool hasGeometry_
Definition: MuonSimHitMatcher.h:79
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonHitHelper::CSC_ME21
Definition: MuonHitHelper.h:21
CSCSimHitMatcher::matchSimHitsToSimTrack
void matchSimHitsToSimTrack()
Definition: CSCSimHitMatcher.cc:59
p4
double p4[4]
Definition: TauolaWrapper.h:92
p1
double p1[4]
Definition: TauolaWrapper.h:89
MuonHitHelper::CSC_ME31
Definition: MuonHitHelper.h:23
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
MuonHitHelper::CSC_ME1b
Definition: MuonHitHelper.h:18
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:31
CSCSimHitMatcher::hitStation
bool hitStation(int, int) const
Definition: CSCSimHitMatcher.cc:116
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
MuonSimHitMatcher::simMuOnly_
bool simMuOnly_
Definition: MuonSimHitMatcher.h:76
p3
double p3[4]
Definition: TauolaWrapper.h:91
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
MuonHitHelper::toCSCType
static int toCSCType(int st, int ri)
Definition: MuonHitHelper.cc:195
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
CSCSimHitMatcher::chamberIds
std::set< unsigned int > chamberIds(int type=MuonHitHelper::CSC_ALL) const
Definition: CSCSimHitMatcher.cc:93
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
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
CSCSimHitMatcher::nLayersWithHitsInChamber
int nLayersWithHitsInChamber(unsigned int) const
Definition: CSCSimHitMatcher.cc:107
nlayers
Definition: HIMultiTrackSelector.h:48
MuonSimHitMatcher::MuonSimHitMatcher
MuonSimHitMatcher(const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
Definition: MuonSimHitMatcher.cc:7
MuonHitHelper::CSC_ME32
Definition: MuonHitHelper.h:24