CMS 3D CMS Logo

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 }
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
MessageLogger.h
relativeConstraints.station
station
Definition: relativeConstraints.py:67
AlignmentCSCOverlapSelector::select
Tracks select(const Tracks &tracks, const edm::Event &iEvent) const
select tracks
Definition: AlignmentCSCOverlapSelector.cc:32
AlignmentCSCOverlapSelector::m_station
int m_station
Definition: AlignmentCSCOverlapSelector.h:28
TrackingRecHitFwd.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CSCDetId.h
DetId
Definition: DetId.h:17
TrackingRecHit.h
edm::ParameterSet
Definition: ParameterSet.h:47
AlignmentCSCOverlapSelector.h
AlignmentCSCOverlapSelector::m_minHitsPerChamber
unsigned int m_minHitsPerChamber
Definition: AlignmentCSCOverlapSelector.h:29
AlignmentCSCOverlapSelector::AlignmentCSCOverlapSelector
AlignmentCSCOverlapSelector(const edm::ParameterSet &iConfig)
constructor
Definition: AlignmentCSCOverlapSelector.cc:14
AlignmentCSCOverlapSelector::~AlignmentCSCOverlapSelector
~AlignmentCSCOverlapSelector()
destructor
Definition: AlignmentCSCOverlapSelector.cc:28
CSCDetId
Definition: CSCDetId.h:26
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
MuonSubdetId.h
AlignmentCSCOverlapSelector::Tracks
std::vector< const reco::Track * > Tracks
Definition: AlignmentCSCOverlapSelector.h:16
DetId.h
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
mps_fire.result
result
Definition: mps_fire.py:311
DetId::Muon
Definition: DetId.h:26
ParameterSet.h
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
edm::Event
Definition: Event.h:73
hit
Definition: SiStripHitEffFromCalibTree.cc:88