CMS 3D CMS Logo

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