CMS 3D CMS Logo

CSCStubMatcher.h
Go to the documentation of this file.
1 #ifndef Validation_MuonCSCDigis_CSCStubMatcher_h
2 #define Validation_MuonCSCDigis_CSCStubMatcher_h
3 
13 
18 
19 typedef std::vector<CSCALCTDigi> CSCALCTDigiContainer;
20 typedef std::vector<CSCCLCTDigi> CSCCLCTDigiContainer;
21 typedef std::vector<CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiContainer;
22 
24 public:
26 
28 
30  void init(const edm::Event& e, const edm::EventSetup& eventSetup);
31 
33  void match(const SimTrack& t, const SimVertex& v);
34 
36  std::set<unsigned int> chamberIdsAllCLCT(int csc_type = MuonHitHelper::CSC_ALL) const;
37  std::set<unsigned int> chamberIdsAllALCT(int csc_type = MuonHitHelper::CSC_ALL) const;
38  std::set<unsigned int> chamberIdsAllLCT(int csc_type = MuonHitHelper::CSC_ALL) const;
39  std::set<unsigned int> chamberIdsAllMPLCT(int csc_type = MuonHitHelper::CSC_ALL) const;
40 
42  std::set<unsigned int> chamberIdsCLCT(int csc_type = MuonHitHelper::CSC_ALL) const;
43  std::set<unsigned int> chamberIdsALCT(int csc_type = MuonHitHelper::CSC_ALL) const;
44  std::set<unsigned int> chamberIdsLCT(int csc_type = MuonHitHelper::CSC_ALL) const;
45  std::set<unsigned int> chamberIdsMPLCT(int csc_type = MuonHitHelper::CSC_ALL) const;
46 
48  const CSCCLCTDigiContainer& allCLCTsInChamber(unsigned int) const;
49  const CSCALCTDigiContainer& allALCTsInChamber(unsigned int) const;
50  const CSCCorrelatedLCTDigiContainer& allLCTsInChamber(unsigned int) const;
51  const CSCCorrelatedLCTDigiContainer& allMPLCTsInChamber(unsigned int) const;
52 
54  const CSCCLCTDigiContainer& clctsInChamber(unsigned int) const;
55  const CSCALCTDigiContainer& alctsInChamber(unsigned int) const;
56  const CSCCorrelatedLCTDigiContainer& lctsInChamber(unsigned int) const;
57  const CSCCorrelatedLCTDigiContainer& mplctsInChamber(unsigned int) const;
58 
60  std::map<unsigned int, CSCCLCTDigiContainer> clcts() const { return chamber_to_clcts_; }
61  std::map<unsigned int, CSCALCTDigiContainer> alcts() const { return chamber_to_alcts_; }
62  std::map<unsigned int, CSCCorrelatedLCTDigiContainer> lcts() const { return chamber_to_lcts_; }
63  std::map<unsigned int, CSCCorrelatedLCTDigiContainer> mplcts() const { return chamber_to_mplcts_; }
64 
66  CSCCLCTDigi bestClctInChamber(unsigned int) const;
67  CSCALCTDigi bestAlctInChamber(unsigned int) const;
68  CSCCorrelatedLCTDigi bestLctInChamber(unsigned int) const;
69  CSCCorrelatedLCTDigi bestMplctInChamber(unsigned int) const;
70 
71  //z position of certain layer
72  float zpositionOfLayer(unsigned int detid, int layer) const;
73 
75  int nChambersWithCLCT(int min_quality = 0) const;
76  int nChambersWithALCT(int min_quality = 0) const;
77  int nChambersWithLCT(int min_quality = 0) const;
78  int nChambersWithMPLCT(int min_quality = 0) const;
79 
80  bool lctInChamber(const CSCDetId& id, const CSCCorrelatedLCTDigi& lct) const;
81 
82  // get the position of an LCT in global coordinates
83  GlobalPoint getGlobalPosition(unsigned int rawId, const CSCCorrelatedLCTDigi& lct) const;
84 
85  std::shared_ptr<CSCDigiMatcher> cscDigiMatcher() { return cscDigiMatcher_; }
86  std::shared_ptr<GEMDigiMatcher> gemDigiMatcher() { return gemDigiMatcher_; }
87 
88 private:
93 
94  void clear();
95 
96  void addGhostLCTs(const CSCCorrelatedLCTDigi& lct11,
97  const CSCCorrelatedLCTDigi& lct22,
98  CSCCorrelatedLCTDigiContainer& lctcontainer) const;
99 
104 
109 
114 
115  std::shared_ptr<CSCDigiMatcher> cscDigiMatcher_;
116  std::shared_ptr<GEMDigiMatcher> gemDigiMatcher_;
117 
120 
121  // all stubs (not necessarily matching) in crossed chambers with digis
122  std::map<unsigned int, CSCCLCTDigiContainer> chamber_to_clcts_all_;
123  std::map<unsigned int, CSCALCTDigiContainer> chamber_to_alcts_all_;
124  std::map<unsigned int, CSCCorrelatedLCTDigiContainer> chamber_to_lcts_all_;
125  std::map<unsigned int, CSCCorrelatedLCTDigiContainer> chamber_to_mplcts_all_;
126 
127  // all matching stubs in crossed chambers with digis
128  std::map<unsigned int, CSCCLCTDigiContainer> chamber_to_clcts_;
129  std::map<unsigned int, CSCALCTDigiContainer> chamber_to_alcts_;
130  std::map<unsigned int, CSCCorrelatedLCTDigiContainer> chamber_to_lcts_;
131  std::map<unsigned int, CSCCorrelatedLCTDigiContainer> chamber_to_mplcts_;
132 
133  template <class D>
134  std::set<unsigned int> selectDetIds(D&, int) const;
135 
137  bool useGEMs_;
138 
140 
146 
151 
156 
161 };
162 
163 template <class D>
164 std::set<unsigned int> CSCStubMatcher::selectDetIds(D& digis, int csc_type) const {
165  std::set<unsigned int> result;
166  for (auto& p : digis) {
167  auto id = p.first;
168  if (csc_type > 0) {
169  CSCDetId detId(id);
170  if (MuonHitHelper::toCSCType(detId.station(), detId.ring()) != csc_type)
171  continue;
172  }
173  result.insert(p.first);
174  }
175  return result;
176 }
177 
178 #endif
static int toCSCType(int st, int ri)
std::map< unsigned int, CSCCorrelatedLCTDigiContainer > mplcts() const
std::set< unsigned int > chamberIdsAllALCT(int csc_type=MuonHitHelper::CSC_ALL) const
std::vector< CSCCLCTDigi > CSCCLCTDigiContainer
std::map< unsigned int, CSCALCTDigiContainer > alcts() const
std::map< unsigned int, CSCCorrelatedLCTDigiContainer > chamber_to_mplcts_all_
const CSCCLCTDigiContainer & allCLCTsInChamber(unsigned int) const
all stubs (not necessarily matching) from a particular crossed chamber
int nChambersWithALCT(int min_quality=0) const
CSCCorrelatedLCTDigiContainer no_mplcts_
bool lctInChamber(const CSCDetId &id, const CSCCorrelatedLCTDigi &lct) const
int nChambersWithLCT(int min_quality=0) const
std::set< unsigned int > chamberIdsMPLCT(int csc_type=MuonHitHelper::CSC_ALL) const
edm::InputTag clctInputTag_
int nChambersWithCLCT(int min_quality=0) const
How many CSC chambers with matching stubs of some minimal quality did this SimTrack hit...
edm::EDGetTokenT< CSCCLCTDigiCollection > clctToken_
const CSCALCTDigiContainer & allALCTsInChamber(unsigned int) const
CSCStubMatcher(edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
std::set< unsigned int > chamberIdsAllLCT(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< unsigned int > chamberIdsALCT(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< unsigned int > selectDetIds(D &, int) const
void matchMPLCTsToSimTrack(const CSCCorrelatedLCTDigiCollection &)
std::set< unsigned int > chamberIdsAllCLCT(int csc_type=MuonHitHelper::CSC_ALL) const
crossed chamber detIds with not necessarily matching stubs
GlobalPoint getGlobalPosition(unsigned int rawId, const CSCCorrelatedLCTDigi &lct) const
const CSCCorrelatedLCTDigiContainer & allMPLCTsInChamber(unsigned int) const
std::vector< CSCCorrelatedLCTDigi > CSCCorrelatedLCTDigiContainer
edm::Handle< CSCCorrelatedLCTDigiCollection > lctsH_
std::shared_ptr< CSCDigiMatcher > cscDigiMatcher_
std::map< unsigned int, CSCCorrelatedLCTDigiContainer > chamber_to_lcts_
const CSCGeometry * cscGeometry_
CSCCorrelatedLCTDigi bestLctInChamber(unsigned int) const
std::shared_ptr< GEMDigiMatcher > gemDigiMatcher()
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > mplctToken_
CSCCorrelatedLCTDigi bestMplctInChamber(unsigned int) const
float zpositionOfLayer(unsigned int detid, int layer) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::map< unsigned int, CSCCorrelatedLCTDigiContainer > chamber_to_mplcts_
int nChambersWithMPLCT(int min_quality=0) const
std::vector< CSCALCTDigi > CSCALCTDigiContainer
std::map< unsigned int, CSCCLCTDigiContainer > clcts() const
all matching lcts
edm::Handle< CSCCLCTDigiCollection > clctsH_
CSCCLCTDigi bestClctInChamber(unsigned int) const
best matching from a particular crossed chamber
std::set< unsigned int > chamberIdsLCT(int csc_type=MuonHitHelper::CSC_ALL) const
const CSCCLCTDigiContainer & clctsInChamber(unsigned int) const
all matching from a particular crossed chamber
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lctToken_
std::map< unsigned int, CSCALCTDigiContainer > chamber_to_alcts_
std::map< unsigned int, CSCCorrelatedLCTDigiContainer > chamber_to_lcts_all_
void matchLCTsToSimTrack(const CSCCorrelatedLCTDigiCollection &)
const CSCALCTDigiContainer & alctsInChamber(unsigned int) const
edm::EDGetTokenT< CSCALCTDigiCollection > alctToken_
edm::InputTag mplctInputTag_
edm::Handle< CSCALCTDigiCollection > alctsH_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
std::map< unsigned int, CSCCLCTDigiContainer > chamber_to_clcts_all_
const CSCCorrelatedLCTDigiContainer & mplctsInChamber(unsigned int) const
void matchALCTsToSimTrack(const CSCALCTDigiCollection &)
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
int station() const
Definition: CSCDetId.h:79
void matchCLCTsToSimTrack(const CSCCLCTDigiCollection &)
std::map< unsigned int, CSCCLCTDigiContainer > chamber_to_clcts_
CSCCorrelatedLCTDigiContainer no_lcts_
std::shared_ptr< GEMDigiMatcher > gemDigiMatcher_
edm::Handle< CSCCorrelatedLCTDigiCollection > mplctsH_
const CSCCorrelatedLCTDigiContainer & lctsInChamber(unsigned int) const
edm::InputTag alctInputTag_
CSCALCTDigi bestAlctInChamber(unsigned int) const
edm::InputTag lctInputTag_
std::set< unsigned int > chamberIdsAllMPLCT(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< unsigned int > chamberIdsCLCT(int csc_type=MuonHitHelper::CSC_ALL) const
chamber detIds with matching stubs
CSCALCTDigiContainer no_alcts_
std::map< unsigned int, CSCALCTDigiContainer > chamber_to_alcts_all_
void match(const SimTrack &t, const SimVertex &v)
do the matching
int ring() const
Definition: CSCDetId.h:68
std::shared_ptr< CSCDigiMatcher > cscDigiMatcher()
CSCCLCTDigiContainer no_clcts_
const CSCCorrelatedLCTDigiContainer & allLCTsInChamber(unsigned int) const
std::map< unsigned int, CSCCorrelatedLCTDigiContainer > lcts() const
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
void addGhostLCTs(const CSCCorrelatedLCTDigi &lct11, const CSCCorrelatedLCTDigi &lct22, CSCCorrelatedLCTDigiContainer &lctcontainer) const