CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlignmentCSCOverlapSelector.cc
Go to the documentation of this file.
2 
5 
11 
12 // constructor ----------------------------------------------------------------
13 
15  : m_station(iConfig.getParameter<int>("station")),
16  m_minHitsPerChamber(iConfig.getParameter<unsigned int>("minHitsPerChamber")) {
17  if (m_station == 0) {
18  edm::LogInfo("AlignmentCSCOverlapSelector")
19  << "Acceptable tracks must have " << m_minHitsPerChamber << " in two chambers on all stations." << std::endl;
20  } else {
21  edm::LogInfo("AlignmentCSCOverlapSelector") << "Acceptable tracks must have " << m_minHitsPerChamber
22  << " in two chambers on station " << m_station << "." << std::endl;
23  }
24 }
25 
26 // destructor -----------------------------------------------------------------
27 
29 
30 // do selection ---------------------------------------------------------------
31 
33  const edm::Event &iEvent) const {
34  Tracks result;
35 
36  for (auto const &track : tracks) {
37  unsigned int MEminus4_even = 0;
38  unsigned int MEminus4_odd = 0;
39  unsigned int MEminus3_even = 0;
40  unsigned int MEminus3_odd = 0;
41  unsigned int MEminus2_even = 0;
42  unsigned int MEminus2_odd = 0;
43  unsigned int MEminus1_even = 0;
44  unsigned int MEminus1_odd = 0;
45 
46  unsigned int MEplus1_even = 0;
47  unsigned int MEplus1_odd = 0;
48  unsigned int MEplus2_even = 0;
49  unsigned int MEplus2_odd = 0;
50  unsigned int MEplus3_even = 0;
51  unsigned int MEplus3_odd = 0;
52  unsigned int MEplus4_even = 0;
53  unsigned int MEplus4_odd = 0;
54 
55  for (auto const &hit : track->recHits()) {
56  DetId id = hit->geographicalId();
57  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
58  CSCDetId cscid(id.rawId());
59  int station = (cscid.endcap() == 1 ? 1 : -1) * cscid.station();
60 
61  if (station == -4) {
62  if (cscid.chamber() % 2 == 0)
63  MEminus4_even++;
64  else
65  MEminus4_odd++;
66  } else if (station == -3) {
67  if (cscid.chamber() % 2 == 0)
68  MEminus3_even++;
69  else
70  MEminus3_odd++;
71  } else if (station == -2) {
72  if (cscid.chamber() % 2 == 0)
73  MEminus2_even++;
74  else
75  MEminus2_odd++;
76  } else if (station == -1) {
77  if (cscid.chamber() % 2 == 0)
78  MEminus1_even++;
79  else
80  MEminus1_odd++;
81  }
82 
83  else if (station == 1) {
84  if (cscid.chamber() % 2 == 0)
85  MEplus1_even++;
86  else
87  MEplus1_odd++;
88  } else if (station == 2) {
89  if (cscid.chamber() % 2 == 0)
90  MEplus2_even++;
91  else
92  MEplus2_odd++;
93  } else if (station == 3) {
94  if (cscid.chamber() % 2 == 0)
95  MEplus3_even++;
96  else
97  MEplus3_odd++;
98  } else if (station == 4) {
99  if (cscid.chamber() % 2 == 0)
100  MEplus4_even++;
101  else
102  MEplus4_odd++;
103  }
104 
105  } // end if it's a CSC hit
106  } // end loop over hits
107 
108  if ((m_station == 0 || m_station == -4) && (MEminus4_even >= m_minHitsPerChamber) &&
109  (MEminus4_odd >= m_minHitsPerChamber))
110  result.push_back(track);
111 
112  else if ((m_station == 0 || m_station == -3) && (MEminus3_even >= m_minHitsPerChamber) &&
113  (MEminus3_odd >= m_minHitsPerChamber))
114  result.push_back(track);
115 
116  else if ((m_station == 0 || m_station == -2) && (MEminus2_even >= m_minHitsPerChamber) &&
117  (MEminus2_odd >= m_minHitsPerChamber))
118  result.push_back(track);
119 
120  else if ((m_station == 0 || m_station == -1) && (MEminus1_even >= m_minHitsPerChamber) &&
121  (MEminus1_odd >= m_minHitsPerChamber))
122  result.push_back(track);
123 
124  else if ((m_station == 0 || m_station == 1) && (MEplus1_even >= m_minHitsPerChamber) &&
125  (MEplus1_odd >= m_minHitsPerChamber))
126  result.push_back(track);
127 
128  else if ((m_station == 0 || m_station == 2) && (MEplus2_even >= m_minHitsPerChamber) &&
129  (MEplus2_odd >= m_minHitsPerChamber))
130  result.push_back(track);
131 
132  else if ((m_station == 0 || m_station == 3) && (MEplus3_even >= m_minHitsPerChamber) &&
133  (MEplus3_odd >= m_minHitsPerChamber))
134  result.push_back(track);
135 
136  else if ((m_station == 0 || m_station == 4) && (MEplus4_even >= m_minHitsPerChamber) &&
137  (MEplus4_odd >= m_minHitsPerChamber))
138  result.push_back(track);
139 
140  } // end loop over tracks
141 
142  return result;
143 }
int chamber() const
Definition: CSCDetId.h:62
std::vector< const reco::Track * > Tracks
auto const & tracks
cannot be loose
tuple result
Definition: mps_fire.py:311
int endcap() const
Definition: CSCDetId.h:85
int iEvent
Definition: GenABIO.cc:224
AlignmentCSCOverlapSelector(const edm::ParameterSet &iConfig)
constructor
Log< level::Info, false > LogInfo
Definition: DetId.h:17
Tracks select(const Tracks &tracks, const edm::Event &iEvent) const
select tracks
int station() const
Definition: CSCDetId.h:79
static constexpr int CSC
Definition: MuonSubdetId.h:12