CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlignmentCSCTrackSelector.cc
Go to the documentation of this file.
2 
5 
7 
12 
13 // constructor ----------------------------------------------------------------
14 
16  : m_src(cfg.getParameter<edm::InputTag>("src")),
17  m_stationA(cfg.getParameter<int>("stationA")),
18  m_stationB(cfg.getParameter<int>("stationB")),
19  m_minHitsDT(cfg.getParameter<int>("minHitsDT")),
20  m_minHitsPerStation(cfg.getParameter<int>("minHitsPerStation")),
21  m_maxHitsPerStation(cfg.getParameter<int>("maxHitsPerStation")) {}
22 
23 // destructor -----------------------------------------------------------------
24 
26 
27 // do selection ---------------------------------------------------------------
28 
30  Tracks result;
31 
32  for (auto const& track : tracks) {
33  int hitsOnStationA = 0;
34  int hitsOnStationB = 0;
35 
36  for (auto const& hit : track->recHits()) {
37  DetId id = hit->geographicalId();
38 
39  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT) {
40  if (m_stationA == 0)
41  hitsOnStationA++;
42  if (m_stationB == 0)
43  hitsOnStationB++;
44  } else if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
45  CSCDetId cscid(id.rawId());
46  int station = (cscid.endcap() == 1 ? 1 : -1) * cscid.station();
47 
48  if (station == m_stationA)
49  hitsOnStationA++;
50  if (station == m_stationB)
51  hitsOnStationB++;
52 
53  } // end if CSC
54  } // end loop over hits
55 
56  bool stationAokay;
57  if (m_stationA == 0)
58  stationAokay = (m_minHitsDT <= hitsOnStationA);
59  else
60  stationAokay = (m_minHitsPerStation <= hitsOnStationA && hitsOnStationA <= m_maxHitsPerStation);
61 
62  bool stationBokay;
63  if (m_stationB == 0)
64  stationBokay = (m_minHitsDT <= hitsOnStationB);
65  else
66  stationBokay = (m_minHitsPerStation <= hitsOnStationB && hitsOnStationB <= m_maxHitsPerStation);
67 
68  if (stationAokay && stationBokay) {
69  result.push_back(track);
70  }
71  } // end loop over tracks
72 
73  return result;
74 }
tuple cfg
Definition: looper.py:296
auto const & tracks
cannot be loose
tuple result
Definition: mps_fire.py:311
int endcap() const
Definition: CSCDetId.h:85
std::vector< const reco::Track * > Tracks
Definition: DetId.h:17
AlignmentCSCTrackSelector(const edm::ParameterSet &cfg)
constructor
Tracks select(const Tracks &tracks, const edm::Event &evt) const
select tracks
int station() const
Definition: CSCDetId.h:79
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12