test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 {
18  if (m_station == 0) {
19  edm::LogInfo("AlignmentCSCOverlapSelector")
20  << "Acceptable tracks must have " << m_minHitsPerChamber << " in two chambers on all stations." << std::endl;
21  }
22  else {
23  edm::LogInfo("AlignmentCSCOverlapSelector")
24  << "Acceptable tracks must have " << m_minHitsPerChamber << " in two chambers on station " << m_station << "." << std::endl;
25  }
26 }
27 
28 // destructor -----------------------------------------------------------------
29 
31 
32 // do selection ---------------------------------------------------------------
33 
36  Tracks result;
37 
38  for (Tracks::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
39  unsigned int MEminus4_even = 0;
40  unsigned int MEminus4_odd = 0;
41  unsigned int MEminus3_even = 0;
42  unsigned int MEminus3_odd = 0;
43  unsigned int MEminus2_even = 0;
44  unsigned int MEminus2_odd = 0;
45  unsigned int MEminus1_even = 0;
46  unsigned int MEminus1_odd = 0;
47 
48  unsigned int MEplus1_even = 0;
49  unsigned int MEplus1_odd = 0;
50  unsigned int MEplus2_even = 0;
51  unsigned int MEplus2_odd = 0;
52  unsigned int MEplus3_even = 0;
53  unsigned int MEplus3_odd = 0;
54  unsigned int MEplus4_even = 0;
55  unsigned int MEplus4_odd = 0;
56 
57  for (trackingRecHit_iterator hit = (*track)->recHitsBegin(); hit != (*track)->recHitsEnd(); ++hit) {
58  DetId id = (*hit)->geographicalId();
59  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
60  CSCDetId cscid(id.rawId());
61  int station = (cscid.endcap() == 1 ? 1 : -1) * cscid.station();
62 
63  if (station == -4) {
64  if (cscid.chamber() % 2 == 0) MEminus4_even++;
65  else MEminus4_odd++;
66  }
67  else if (station == -3) {
68  if (cscid.chamber() % 2 == 0) MEminus3_even++;
69  else MEminus3_odd++;
70  }
71  else if (station == -2) {
72  if (cscid.chamber() % 2 == 0) MEminus2_even++;
73  else MEminus2_odd++;
74  }
75  else if (station == -1) {
76  if (cscid.chamber() % 2 == 0) MEminus1_even++;
77  else MEminus1_odd++;
78  }
79 
80  else if (station == 1) {
81  if (cscid.chamber() % 2 == 0) MEplus1_even++;
82  else MEplus1_odd++;
83  }
84  else if (station == 2) {
85  if (cscid.chamber() % 2 == 0) MEplus2_even++;
86  else MEplus2_odd++;
87  }
88  else if (station == 3) {
89  if (cscid.chamber() % 2 == 0) MEplus3_even++;
90  else MEplus3_odd++;
91  }
92  else if (station == 4) {
93  if (cscid.chamber() % 2 == 0) MEplus4_even++;
94  else MEplus4_odd++;
95  }
96 
97  } // end if it's a CSC hit
98  } // end loop over hits
99 
100  if ((m_station == 0 || m_station == -4) &&
101  (MEminus4_even >= m_minHitsPerChamber) && (MEminus4_odd >= m_minHitsPerChamber)) result.push_back(*track);
102 
103  else if ((m_station == 0 || m_station == -3) &&
104  (MEminus3_even >= m_minHitsPerChamber) && (MEminus3_odd >= m_minHitsPerChamber)) result.push_back(*track);
105 
106  else if ((m_station == 0 || m_station == -2) &&
107  (MEminus2_even >= m_minHitsPerChamber) && (MEminus2_odd >= m_minHitsPerChamber)) result.push_back(*track);
108 
109  else if ((m_station == 0 || m_station == -1) &&
110  (MEminus1_even >= m_minHitsPerChamber) && (MEminus1_odd >= m_minHitsPerChamber)) result.push_back(*track);
111 
112  else if ((m_station == 0 || m_station == 1) &&
113  (MEplus1_even >= m_minHitsPerChamber) && (MEplus1_odd >= m_minHitsPerChamber)) result.push_back(*track);
114 
115  else if ((m_station == 0 || m_station == 2) &&
116  (MEplus2_even >= m_minHitsPerChamber) && (MEplus2_odd >= m_minHitsPerChamber)) result.push_back(*track);
117 
118  else if ((m_station == 0 || m_station == 3) &&
119  (MEplus3_even >= m_minHitsPerChamber) && (MEplus3_odd >= m_minHitsPerChamber)) result.push_back(*track);
120 
121  else if ((m_station == 0 || m_station == 4) &&
122  (MEplus4_even >= m_minHitsPerChamber) && (MEplus4_odd >= m_minHitsPerChamber)) result.push_back(*track);
123 
124  } // end loop over tracks
125 
126  return result;
127 }
int chamber() const
Definition: CSCDetId.h:68
tuple result
Definition: mps_fire.py:83
int endcap() const
Definition: CSCDetId.h:93
int iEvent
Definition: GenABIO.cc:230
static const int CSC
Definition: MuonSubdetId.h:13
AlignmentCSCOverlapSelector(const edm::ParameterSet &iConfig)
constructor
std::vector< const reco::Track * > Tracks
Definition: DetId.h:18
tuple tracks
Definition: testEve_cfg.py:39
Tracks select(const Tracks &tracks, const edm::Event &iEvent) const
select tracks
int station() const
Definition: CSCDetId.h:86
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection