Go to the documentation of this file.00001 #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCOverlapSelector.h"
00002
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005
00006 #include "DataFormats/DetId/interface/DetId.h"
00007 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
00008 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00009 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00010 #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h"
00011
00012
00013
00014 AlignmentCSCOverlapSelector::AlignmentCSCOverlapSelector(const edm::ParameterSet &iConfig)
00015 : m_station(iConfig.getParameter<int>("station"))
00016 , m_minHitsPerChamber(iConfig.getParameter<unsigned int>("minHitsPerChamber"))
00017 {
00018 if (m_station == 0) {
00019 edm::LogInfo("AlignmentCSCOverlapSelector")
00020 << "Acceptable tracks must have " << m_minHitsPerChamber << " in two chambers on all stations." << std::endl;
00021 }
00022 else {
00023 edm::LogInfo("AlignmentCSCOverlapSelector")
00024 << "Acceptable tracks must have " << m_minHitsPerChamber << " in two chambers on station " << m_station << "." << std::endl;
00025 }
00026 }
00027
00028
00029
00030 AlignmentCSCOverlapSelector::~AlignmentCSCOverlapSelector() {}
00031
00032
00033
00034 AlignmentCSCOverlapSelector::Tracks
00035 AlignmentCSCOverlapSelector::select(const Tracks &tracks, const edm::Event &iEvent) const {
00036 Tracks result;
00037
00038 for (Tracks::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
00039 unsigned int MEminus4_even = 0;
00040 unsigned int MEminus4_odd = 0;
00041 unsigned int MEminus3_even = 0;
00042 unsigned int MEminus3_odd = 0;
00043 unsigned int MEminus2_even = 0;
00044 unsigned int MEminus2_odd = 0;
00045 unsigned int MEminus1_even = 0;
00046 unsigned int MEminus1_odd = 0;
00047
00048 unsigned int MEplus1_even = 0;
00049 unsigned int MEplus1_odd = 0;
00050 unsigned int MEplus2_even = 0;
00051 unsigned int MEplus2_odd = 0;
00052 unsigned int MEplus3_even = 0;
00053 unsigned int MEplus3_odd = 0;
00054 unsigned int MEplus4_even = 0;
00055 unsigned int MEplus4_odd = 0;
00056
00057 for (trackingRecHit_iterator hit = (*track)->recHitsBegin(); hit != (*track)->recHitsEnd(); ++hit) {
00058 DetId id = (*hit)->geographicalId();
00059 if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
00060 CSCDetId cscid(id.rawId());
00061 int station = (cscid.endcap() == 1 ? 1 : -1) * cscid.station();
00062
00063 if (station == -4) {
00064 if (cscid.chamber() % 2 == 0) MEminus4_even++;
00065 else MEminus4_odd++;
00066 }
00067 else if (station == -3) {
00068 if (cscid.chamber() % 2 == 0) MEminus3_even++;
00069 else MEminus3_odd++;
00070 }
00071 else if (station == -2) {
00072 if (cscid.chamber() % 2 == 0) MEminus2_even++;
00073 else MEminus2_odd++;
00074 }
00075 else if (station == -1) {
00076 if (cscid.chamber() % 2 == 0) MEminus1_even++;
00077 else MEminus1_odd++;
00078 }
00079
00080 else if (station == 1) {
00081 if (cscid.chamber() % 2 == 0) MEplus1_even++;
00082 else MEplus1_odd++;
00083 }
00084 else if (station == 2) {
00085 if (cscid.chamber() % 2 == 0) MEplus2_even++;
00086 else MEplus2_odd++;
00087 }
00088 else if (station == 3) {
00089 if (cscid.chamber() % 2 == 0) MEplus3_even++;
00090 else MEplus3_odd++;
00091 }
00092 else if (station == 4) {
00093 if (cscid.chamber() % 2 == 0) MEplus4_even++;
00094 else MEplus4_odd++;
00095 }
00096
00097 }
00098 }
00099
00100 if ((m_station == 0 || m_station == -4) &&
00101 (MEminus4_even >= m_minHitsPerChamber) && (MEminus4_odd >= m_minHitsPerChamber)) result.push_back(*track);
00102
00103 else if ((m_station == 0 || m_station == -3) &&
00104 (MEminus3_even >= m_minHitsPerChamber) && (MEminus3_odd >= m_minHitsPerChamber)) result.push_back(*track);
00105
00106 else if ((m_station == 0 || m_station == -2) &&
00107 (MEminus2_even >= m_minHitsPerChamber) && (MEminus2_odd >= m_minHitsPerChamber)) result.push_back(*track);
00108
00109 else if ((m_station == 0 || m_station == -1) &&
00110 (MEminus1_even >= m_minHitsPerChamber) && (MEminus1_odd >= m_minHitsPerChamber)) result.push_back(*track);
00111
00112 else if ((m_station == 0 || m_station == 1) &&
00113 (MEplus1_even >= m_minHitsPerChamber) && (MEplus1_odd >= m_minHitsPerChamber)) result.push_back(*track);
00114
00115 else if ((m_station == 0 || m_station == 2) &&
00116 (MEplus2_even >= m_minHitsPerChamber) && (MEplus2_odd >= m_minHitsPerChamber)) result.push_back(*track);
00117
00118 else if ((m_station == 0 || m_station == 3) &&
00119 (MEplus3_even >= m_minHitsPerChamber) && (MEplus3_odd >= m_minHitsPerChamber)) result.push_back(*track);
00120
00121 else if ((m_station == 0 || m_station == 4) &&
00122 (MEplus4_even >= m_minHitsPerChamber) && (MEplus4_odd >= m_minHitsPerChamber)) result.push_back(*track);
00123
00124 }
00125
00126 return result;
00127 }