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 ( const edm::ParameterSet iPS,
edm::ConsumesCollector &&  iC 
)

Definition at line 5 of file CSCSimHitMatcher.cc.

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

7  : MuonSimHitMatcher(ps, std::move(iC)) {
8  simHitPSet_ = ps.getParameterSet("cscSimHit");
9  verbose_ = simHitPSet_.getParameter<int>("verbose");
10  simMuOnly_ = simHitPSet_.getParameter<bool>("simMuOnly");
11  discardEleHits_ = simHitPSet_.getParameter<bool>("discardEleHits");
12 
15 }
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
CSCSimHitMatcher::~CSCSimHitMatcher ( )
inline

Member Function Documentation

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

Referenced by ~CSCSimHitMatcher().

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

Definition at line 98 of file CSCSimHitMatcher.cc.

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

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

98  {
99  std::set<unsigned int> result;
100  for (const auto& p : chamber_to_hits_) {
101  const auto& id = p.first;
102  if (csc_type > 0) {
103  CSCDetId detId(id);
104  if (MuonHitHelper::toCSCType(detId.station(), detId.ring()) != csc_type)
105  continue;
106  }
107  result.insert(id);
108  }
109  return result;
110 }
static int toCSCType(int st, int ri)
std::map< unsigned int, edm::PSimHitContainer > chamber_to_hits_
std::set< unsigned int > CSCSimHitMatcher::chamberIdsStation ( int  station) const

Definition at line 334 of file CSCSimHitMatcher.cc.

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, and mps_fire::result.

Referenced by ~CSCSimHitMatcher().

334  {
335  set<unsigned int> result;
336  switch (station) {
337  case 1: {
338  const auto& p1(chamberIds(MuonHitHelper::CSC_ME1a));
339  const auto& p2(chamberIds(MuonHitHelper::CSC_ME1b));
340  const auto& p3(chamberIds(MuonHitHelper::CSC_ME12));
341  const auto& p4(chamberIds(MuonHitHelper::CSC_ME13));
342  result.insert(p1.begin(), p1.end());
343  result.insert(p2.begin(), p2.end());
344  result.insert(p3.begin(), p3.end());
345  result.insert(p4.begin(), p4.end());
346  break;
347  }
348  case 2: {
349  const auto& p1(chamberIds(MuonHitHelper::CSC_ME21));
350  const auto& p2(chamberIds(MuonHitHelper::CSC_ME22));
351  result.insert(p1.begin(), p1.end());
352  result.insert(p2.begin(), p2.end());
353  break;
354  }
355  case 3: {
356  const auto& p1(chamberIds(MuonHitHelper::CSC_ME31));
357  const auto& p2(chamberIds(MuonHitHelper::CSC_ME32));
358  result.insert(p1.begin(), p1.end());
359  result.insert(p2.begin(), p2.end());
360  break;
361  }
362  case 4: {
363  const auto& p1(chamberIds(MuonHitHelper::CSC_ME41));
364  const auto& p2(chamberIds(MuonHitHelper::CSC_ME42));
365  result.insert(p1.begin(), p1.end());
366  result.insert(p2.begin(), p2.end());
367  break;
368  }
369  };
370  return result;
371 }
double p4[4]
Definition: TauolaWrapper.h:92
std::set< unsigned int > chamberIds(int type=MuonHitHelper::CSC_ALL) const
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
void CSCSimHitMatcher::chamberIdsToString ( const std::set< unsigned int > &  set) const

Definition at line 326 of file CSCSimHitMatcher.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by ~CSCSimHitMatcher().

327  {
328  for (const auto& p : set) {
329  CSCDetId detId(p);
330  edm::LogInfo("CSCSimHitMatcher") << " " << detId << "\n";
331  }
332 }
std::set< unsigned int > CSCSimHitMatcher::detIds ( int  type = MuonHitHelper::CSC_ALL) const

Definition at line 84 of file CSCSimHitMatcher.cc.

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

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

84  {
85  std::set<unsigned int> result;
86  for (const auto& p : detid_to_hits_) {
87  const auto& id = p.first;
88  if (csc_type > 0) {
89  CSCDetId detId(id);
90  if (MuonHitHelper::toCSCType(detId.station(), detId.ring()) != csc_type)
91  continue;
92  }
93  result.insert(id);
94  }
95  return result;
96 }
static int toCSCType(int st, int ri)
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
bool CSCSimHitMatcher::hitStation ( int  st,
int  nlayers 
) const

Definition at line 121 of file CSCSimHitMatcher.cc.

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

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

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

Definition at line 270 of file CSCSimHitMatcher.cc.

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

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

271  {
272  set<int> result;
273  const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid);
274  CSCDetId id(detid);
275  int max_nstrips = dynamic_cast<const CSCGeometry*>(geometry_)
276  ->layer(id)
277  ->geometry()
278  ->numberOfStrips();
279  for (const auto& h : simhits) {
280  const LocalPoint& lp = h.entryPoint();
281  int central_strip = dynamic_cast<const CSCGeometry*>(geometry_)
282  ->layer(id)
283  ->geometry()
284  ->nearestStrip(lp);
285  int smin = central_strip - margin_n_strips;
286  smin = (smin > 0) ? smin : 1;
287  int smax = central_strip + margin_n_strips;
288  smax = (smax <= max_nstrips) ? smax : max_nstrips;
289  for (int ss = smin; ss <= smax; ++ss) result.insert(ss);
290  }
291  return result;
292 }
const TrackingGeometry * geometry_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
std::set< int > CSCSimHitMatcher::hitWiregroupsInDetId ( unsigned int  detid,
int  margin_n_wg = 0 
) const

Definition at line 294 of file CSCSimHitMatcher.cc.

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

Referenced by ~CSCSimHitMatcher().

295  {
296  set<int> result;
297  const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid);
298  CSCDetId id(detid);
299  int max_n_wg = dynamic_cast<const CSCGeometry*>(geometry_)
300  ->layer(id)
301  ->geometry()
302  ->numberOfWireGroups();
303  for (const auto& h : simhits) {
304  const LocalPoint& lp = h.entryPoint();
305  const auto& layer_geo =
306  dynamic_cast<const CSCGeometry*>(geometry_)->layer(id)->geometry();
307  int central_wg = layer_geo->wireGroup(layer_geo->nearestWire(lp));
308  int wg_min = central_wg - margin_n_wg;
309  wg_min = (wg_min > 0) ? wg_min : 1;
310  int wg_max = central_wg + margin_n_wg;
311  wg_max = (wg_max <= max_n_wg) ? wg_max : max_n_wg;
312  for (int wg = wg_min; wg <= wg_max; ++wg) result.insert(wg);
313  }
314  return result;
315 }
const TrackingGeometry * geometry_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
void CSCSimHitMatcher::init ( const edm::Event e,
const edm::EventSetup eventSetup 
)

initialize the event

Definition at line 18 of file CSCSimHitMatcher.cc.

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

Referenced by ~CSCSimHitMatcher().

19  {
20  iSetup.get<MuonGeometryRecord>().get(csc_geom_);
21  if (csc_geom_.isValid()) {
22  geometry_ = &*csc_geom_;
23  } else {
24  hasGeometry_ = false;
25  edm::LogWarning("CSCSimHitMatcher")
26  << "+++ Info: CSC geometry is unavailable. +++\n";
27  }
29 }
const TrackingGeometry * geometry_
int iEvent
Definition: GenABIO.cc:224
edm::ESHandle< CSCGeometry > csc_geom_
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
bool isValid() const
Definition: ESHandle.h:44
float CSCSimHitMatcher::LocalBendingInChamber ( unsigned int  detid) const

Definition at line 159 of file CSCSimHitMatcher.cc.

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

Referenced by ~CSCSimHitMatcher().

159  {
160  const CSCDetId cscid(detid);
161  if (nLayersWithHitsInChamber(detid) < 6) return -100;
162  float phi_layer1 = -10;
163  float phi_layer6 = 10;
164 
165  if (cscid.station() == 1 and (cscid.ring() == 1 or cscid.ring() == 4)) {
166  // phi in layer 1
167  const CSCDetId cscid1a(cscid.endcap(), cscid.station(), 4, cscid.chamber(),
168  1);
169  const CSCDetId cscid1b(cscid.endcap(), cscid.station(), 1, cscid.chamber(),
170  1);
171  const edm::PSimHitContainer& hits1a =
172  MuonSimHitMatcher::hitsInDetId(cscid1a.rawId());
173  const edm::PSimHitContainer& hits1b =
174  MuonSimHitMatcher::hitsInDetId(cscid1b.rawId());
175  const GlobalPoint& gp1a =
177  const GlobalPoint& gp1b =
179  if (!hits1a.empty() and !hits1b.empty())
180  phi_layer1 = (gp1a.phi() + gp1b.phi()) / 2.0;
181  else if (!hits1a.empty())
182  phi_layer1 = gp1a.phi();
183  else if (!hits1b.empty())
184  phi_layer1 = gp1b.phi();
185 
186  // phi in layer 6
187  const CSCDetId cscid6a(cscid.endcap(), cscid.station(), 4, cscid.chamber(),
188  6);
189  const CSCDetId cscid6b(cscid.endcap(), cscid.station(), 1, cscid.chamber(),
190  6);
191  const edm::PSimHitContainer& hits6a =
192  MuonSimHitMatcher::hitsInDetId(cscid6a.rawId());
193  const edm::PSimHitContainer& hits6b =
194  MuonSimHitMatcher::hitsInDetId(cscid6b.rawId());
195  const GlobalPoint& gp6a =
197  const GlobalPoint& gp6b =
199  if (!hits6a.empty() and !hits6b.empty())
200  phi_layer6 = (gp6a.phi() + gp6b.phi()) / 2.0;
201  else if (!hits6a.empty())
202  phi_layer6 = gp6a.phi();
203  else if (!hits6b.empty())
204  phi_layer6 = gp6b.phi();
205 
206  } else {
207  // phi in layer 1
208  const CSCDetId cscid1(cscid.endcap(), cscid.station(), cscid.ring(),
209  cscid.chamber(), 1);
210  const GlobalPoint& gp1 =
212  phi_layer1 = gp1.phi();
213 
214  // phi in layer 6
215  const CSCDetId cscid6(cscid.endcap(), cscid.station(), cscid.ring(),
216  cscid.chamber(), 6);
217  const GlobalPoint& gp6 =
219  phi_layer6 = gp6.phi();
220  }
221  return deltaPhi(phi_layer6, phi_layer1);
222 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
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
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
int nLayersWithHitsInChamber(unsigned int) const
std::vector< PSimHit > PSimHitContainer
void CSCSimHitMatcher::match ( const SimTrack t,
const SimVertex v 
)

do the matching

Definition at line 32 of file CSCSimHitMatcher.cc.

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(), MuonSimHitMatcher::simHitsMeanPosition(), CSCDetId::station(), RecoTauPiZeroBuilderPlugins_cfi::strips, MuonSimHitMatcher::track_ids_, and MuonSimHitMatcher::verbose_.

Referenced by ~CSCSimHitMatcher().

32  {
33  // instantiates the track ids and simhits
35 
36  if (hasGeometry_) {
38 
39  if (verbose_) {
40  edm::LogInfo("CSCSimHitMatcher")
41  << "nTrackIds " << track_ids_.size() << " nSelectedCSCSimHits "
42  << hits_.size() << endl;
43  edm::LogInfo("CSCSimHitMatcher")
44  << "detids CSC " << detIds(0).size() << endl;
45 
46  for (const auto& id : detIds(0)) {
47  const auto& simhits = hitsInDetId(id);
48  const auto& simhits_gp = simHitsMeanPosition(simhits);
49  const auto& strips = hitStripsInDetId(id);
50  CSCDetId cscid(id);
51  if (cscid.station() == 1 and (cscid.ring() == 1 or cscid.ring() == 4)) {
52  edm::LogInfo("CSCSimHitMatcher")
53  << "cscdetid " << CSCDetId(id) << ": " << simhits.size() << " "
54  << simhits_gp.phi() << " " << detid_to_hits_[id].size() << endl;
55  edm::LogInfo("CSCSimHitMatcher")
56  << "nStrip " << strips.size() << endl;
57  edm::LogInfo("CSCSimHitMatcher") << "strips : ";
58  for (const auto& p : strips) {
59  edm::LogInfo("CSCSimHitMatcher") << p;
60  }
61  }
62  }
63  }
64  }
65 }
edm::PSimHitContainer hits_
std::map< unsigned int, edm::PSimHitContainer > detid_to_hits_
std::set< unsigned int > detIds(int type=MuonHitHelper::CSC_ALL) const
std::vector< unsigned > track_ids_
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
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
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
void match(const SimTrack &t, const SimVertex &v)
do the matching
void CSCSimHitMatcher::matchSimHitsToSimTrack ( )
private

Definition at line 67 of file CSCSimHitMatcher.cc.

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

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

67  {
68  for (const auto& track_id : track_ids_) {
69  for (const auto& h : simHits_) {
70  if (h.trackId() != track_id) continue;
71  int pdgid = h.particleType();
72  if (simMuOnly_ && std::abs(pdgid) != 13) continue;
73  // discard electron hits in the CSC chambers
74  if (discardEleHits_ && pdgid == 11) continue;
75 
76  const CSCDetId& layer_id(h.detUnitId());
77  hits_.push_back(h);
78  detid_to_hits_[h.detUnitId()].push_back(h);
79  chamber_to_hits_[layer_id.chamberId().rawId()].push_back(h);
80  }
81  }
82 }
edm::PSimHitContainer hits_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
int CSCSimHitMatcher::nCoincidenceChambers ( int  min_n_layers = 4) const

Definition at line 317 of file CSCSimHitMatcher.cc.

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

Referenced by ~CSCSimHitMatcher().

317  {
318  int result = 0;
319  const auto& chamber_ids = chamberIds(0);
320  for (const auto& id : chamber_ids) {
321  if (nLayersWithHitsInChamber(id) >= min_n_layers) result += 1;
322  }
323  return result;
324 }
std::set< unsigned int > chamberIds(int type=MuonHitHelper::CSC_ALL) const
int nLayersWithHitsInChamber(unsigned int) const
int CSCSimHitMatcher::nLayersWithHitsInChamber ( unsigned int  detid) const

Definition at line 112 of file CSCSimHitMatcher.cc.

References h, and MuonSimHitMatcher::hitsInChamber().

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

112  {
113  set<int> layers_with_hits;
114  for (const auto& h : MuonSimHitMatcher::hitsInChamber(detid)) {
115  const CSCDetId& idd(h.detUnitId());
116  layers_with_hits.insert(idd.layer());
117  }
118  return layers_with_hits.size();
119 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
int CSCSimHitMatcher::nStations ( int  nl = 4) const

Definition at line 154 of file CSCSimHitMatcher.cc.

References hitStation().

Referenced by ~CSCSimHitMatcher().

154  {
155  return (hitStation(1, nlayers) + hitStation(2, nlayers) +
157 }
bool hitStation(int, int) const
GlobalPoint CSCSimHitMatcher::simHitPositionKeyLayer ( unsigned int  chamberid) const

Referenced by ~CSCSimHitMatcher().

GlobalPoint CSCSimHitMatcher::simHitsMeanPositionStation ( int  n) const

Referenced by ~CSCSimHitMatcher().

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

Definition at line 224 of file CSCSimHitMatcher.cc.

References edmIntegrityCheck::d, f, MuonSimHitMatcher::geometry_, h, gen::n, and alignCSCRings::s.

Referenced by ~CSCSimHitMatcher().

225  {
226  if (sim_hits.empty()) return -1.f;
227 
228  float sums = 0.f;
229  size_t n = 0;
230  for (const auto& h : sim_hits) {
231  const LocalPoint& lp = h.entryPoint();
232  float s;
233  const auto& d = h.detUnitId();
234  s = dynamic_cast<const CSCGeometry*>(geometry_)
235  ->layer(d)
236  ->geometry()
237  ->strip(lp);
238  // convert to half-strip:
239  s *= 2.;
240  sums += s;
241  ++n;
242  }
243  if (n == 0) return -1.f;
244  return sums / n;
245 }
const TrackingGeometry * geometry_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double f[11][100]
float CSCSimHitMatcher::simHitsMeanWG ( const edm::PSimHitContainer sim_hits) const

Definition at line 247 of file CSCSimHitMatcher.cc.

References edmIntegrityCheck::d, f, geometry, MuonSimHitMatcher::geometry_, h, gen::n, and alignCSCRings::s.

Referenced by ~CSCSimHitMatcher().

248  {
249  if (sim_hits.empty()) return -1.f;
250 
251  float sums = 0.f;
252  size_t n = 0;
253  for (const auto& h : sim_hits) {
254  const LocalPoint& lp = h.entryPoint();
255  float s;
256  const auto& d = h.detUnitId();
257  // find nearest wire
258  const auto& layerG(
259  dynamic_cast<const CSCGeometry*>(geometry_)->layer(d)->geometry());
260  int nearestWire(layerG->nearestWire(lp));
261  // then find the corresponding wire group
262  s = layerG->wireGroup(nearestWire);
263  sums += s;
264  ++n;
265  }
266  if (n == 0) return -1.f;
267  return sums / n;
268 }
const TrackingGeometry * geometry_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double f[11][100]
ESHandle< TrackerGeometry > geometry

Member Data Documentation

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

Definition at line 76 of file CSCSimHitMatcher.h.

Referenced by init().