Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-27 18:27:37

0001 #include "Validation/MuonGEMDigis/interface/GEMDigiMatcher.h"
0002 
0003 using namespace std;
0004 
0005 GEMDigiMatcher::GEMDigiMatcher(const edm::ParameterSet& pset, edm::ConsumesCollector&& iC) {
0006   const auto& gemSimLink = pset.getParameterSet("gemSimLink");
0007   simMuOnly_ = gemSimLink.getParameter<bool>("simMuOnly");
0008   discardEleHits_ = gemSimLink.getParameter<bool>("discardEleHits");
0009   verboseSimLink_ = gemSimLink.getParameter<int>("verbose");
0010 
0011   const auto& gemDigi = pset.getParameterSet("gemStripDigi");
0012   minBXDigi_ = gemDigi.getParameter<int>("minBX");
0013   maxBXDigi_ = gemDigi.getParameter<int>("maxBX");
0014   matchDeltaStrip_ = gemDigi.getParameter<int>("matchDeltaStrip");
0015   verboseDigi_ = gemDigi.getParameter<int>("verbose");
0016   matchToSimLink_ = gemDigi.getParameter<bool>("matchToSimLink");
0017 
0018   const auto& gemPad = pset.getParameterSet("gemPadDigi");
0019   minBXPad_ = gemPad.getParameter<int>("minBX");
0020   maxBXPad_ = gemPad.getParameter<int>("maxBX");
0021   verbosePad_ = gemPad.getParameter<int>("verbose");
0022 
0023   const auto& gemCluster = pset.getParameterSet("gemPadCluster");
0024   minBXCluster_ = gemCluster.getParameter<int>("minBX");
0025   maxBXCluster_ = gemCluster.getParameter<int>("maxBX");
0026   verboseCluster_ = gemCluster.getParameter<int>("verbose");
0027 
0028   const auto& gemCoPad = pset.getParameterSet("gemCoPadDigi");
0029   minBXCoPad_ = gemCoPad.getParameter<int>("minBX");
0030   maxBXCoPad_ = gemCoPad.getParameter<int>("maxBX");
0031   verboseCoPad_ = gemCoPad.getParameter<int>("verbose");
0032 
0033   // make a new simhits matcher
0034   muonSimHitMatcher_.reset(new GEMSimHitMatcher(pset, std::move(iC)));
0035 
0036   if (matchToSimLink_)
0037     gemSimLinkToken_ =
0038         iC.consumes<edm::DetSetVector<GEMDigiSimLink>>(gemSimLink.getParameter<edm::InputTag>("inputTag"));
0039   gemDigiToken_ = iC.consumes<GEMDigiCollection>(gemDigi.getParameter<edm::InputTag>("inputTag"));
0040   gemPadToken_ = iC.consumes<GEMPadDigiCollection>(gemPad.getParameter<edm::InputTag>("inputTag"));
0041   gemClusterToken_ = iC.consumes<GEMPadDigiClusterCollection>(gemCluster.getParameter<edm::InputTag>("inputTag"));
0042   gemCoPadToken_ = iC.consumes<GEMCoPadDigiCollection>(gemCoPad.getParameter<edm::InputTag>("inputTag"));
0043 
0044   geomToken_ = iC.esConsumes<GEMGeometry, MuonGeometryRecord>();
0045 }
0046 
0047 void GEMDigiMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0048   muonSimHitMatcher_->init(iEvent, iSetup);
0049 
0050   if (matchToSimLink_)
0051     iEvent.getByToken(gemSimLinkToken_, gemDigisSLH_);
0052   iEvent.getByToken(gemDigiToken_, gemDigisH_);
0053   iEvent.getByToken(gemPadToken_, gemPadsH_);
0054   iEvent.getByToken(gemClusterToken_, gemClustersH_);
0055   iEvent.getByToken(gemCoPadToken_, gemCoPadsH_);
0056 
0057   const auto gemH = iSetup.getHandle(geomToken_);
0058   if (!gemH.isValid()) {
0059     gemGeometry_ = nullptr;
0060     edm::LogError("GEMDigiMatcher") << "Failed to initialize GEM geometry.";
0061   }
0062   gemGeometry_ = gemH.product();
0063 }
0064 
0065 /// do the matching
0066 void GEMDigiMatcher::match(const SimTrack& t, const SimVertex& v) {
0067   // match simhits first
0068   muonSimHitMatcher_->match(t, v);
0069 
0070   // get the digi collections
0071   const GEMDigiCollection& gemDigis = *gemDigisH_.product();
0072   const GEMPadDigiCollection& gemPads = *gemPadsH_.product();
0073   const GEMPadDigiClusterCollection& gemClusters = *gemClustersH_.product();
0074   const GEMCoPadDigiCollection& gemCoPads = *gemCoPadsH_.product();
0075 
0076   clear();
0077 
0078   // hard cut on non-GEM muons
0079   if (std::abs(t.momentum().eta()) < 1.55)
0080     return;
0081 
0082   // now match the digis
0083   if (matchToSimLink_) {
0084     const edm::DetSetVector<GEMDigiSimLink>& gemDigisSL = *gemDigisSLH_.product();
0085     matchDigisSLToSimTrack(gemDigisSL);
0086   }
0087   matchDigisToSimTrack(gemDigis);
0088   matchPadsToSimTrack(gemPads);
0089   matchClustersToSimTrack(gemClusters);
0090   matchCoPadsToSimTrack(gemCoPads);
0091 }
0092 
0093 void GEMDigiMatcher::matchDigisSLToSimTrack(const edm::DetSetVector<GEMDigiSimLink>& digisSL) {
0094   if (verboseSimLink_)
0095     edm::LogInfo("GEMDigiMatcher") << "Matching simtrack to GEM simlinks" << endl;
0096 
0097   // loop on the simlinks
0098   for (auto itsimlink = digisSL.begin(); itsimlink != digisSL.end(); itsimlink++) {
0099     GEMDetId p_id(itsimlink->id);
0100     for (auto sl = itsimlink->data.begin(); sl != itsimlink->data.end(); ++sl) {
0101       // ignore simlinks in non-matched chambers
0102       const auto& detids(muonSimHitMatcher_->detIds());
0103       if (detids.find(p_id.rawId()) == detids.end())
0104         continue;
0105 
0106       // no simhits in this chamber!
0107       if (muonSimHitMatcher_->hitsInDetId(p_id.rawId()).empty())
0108         continue;
0109 
0110       if (verboseSimLink_)
0111         edm::LogInfo("GEMDigiMatcher") << "GEMDigiSimLink " << p_id << " " << sl->getStrip() << " " << sl->getBx()
0112                                        << " " << sl->getTrackId() << std::endl;
0113 
0114       // consider only the muon hits
0115       if (simMuOnly_ && std::abs(sl->getParticleType()) != 13)
0116         continue;
0117 
0118       // discard electron hits in the GEM chambers
0119       if (discardEleHits_ && std::abs(sl->getParticleType()) == 11)
0120         continue;
0121 
0122       // loop on the matched simhits
0123       for (const auto& simhit : muonSimHitMatcher_->hitsInDetId(p_id.rawId())) {
0124         // check if the simhit properties agree
0125         if (simhit.trackId() == sl->getTrackId() and simhit.particleType() == sl->getParticleType()) {
0126           detid_to_simLinks_[p_id.rawId()].push_back(*sl);
0127           if (verboseSimLink_)
0128             edm::LogInfo("GEMDigiMatcher") << "...was matched!" << endl;
0129           break;
0130         }
0131       }
0132     }
0133   }
0134 }
0135 
0136 void GEMDigiMatcher::matchDigisToSimTrack(const GEMDigiCollection& digis) {
0137   if (verboseDigi_)
0138     edm::LogInfo("GEMDigiMatcher") << "Matching simtrack to GEM digis" << endl;
0139   for (auto id : muonSimHitMatcher_->detIds()) {
0140     GEMDetId p_id(id);
0141     const auto& hit_strips = muonSimHitMatcher_->hitStripsInDetId(id, matchDeltaStrip_);
0142     const auto& digis_in_det = digis.get(p_id);
0143 
0144     for (auto d = digis_in_det.first; d != digis_in_det.second; ++d) {
0145       bool isMatched = false;
0146 
0147       // check that the digi is within BX range
0148       if (d->bx() < minBXDigi_ || d->bx() > maxBXDigi_)
0149         continue;
0150 
0151       if (verboseDigi_)
0152         edm::LogInfo("GEMDigiMatcher") << "GEMDigi " << p_id << " " << *d << endl;
0153 
0154       // GEN-SIM-DIGI-RAW monte carlo
0155       if (matchToSimLink_) {
0156         // check that the digi matches to at least one GEMDigiSimLink
0157         for (const auto& sl : detid_to_simLinks_[p_id.rawId()]) {
0158           if (sl.getStrip() == d->strip() and sl.getBx() == d->bx()) {
0159             isMatched = true;
0160             break;
0161           }
0162         }
0163       }
0164       // GEN-SIM-RAW monte carlo
0165       else {
0166         // check that it matches a strip that was hit by SimHits from our track
0167         if (hit_strips.find(d->strip()) != hit_strips.end()) {
0168           isMatched = true;
0169         }
0170       }
0171       if (isMatched) {
0172         detid_to_digis_[p_id.rawId()].push_back(*d);
0173         chamber_to_digis_[p_id.chamberId().rawId()].push_back(*d);
0174         superchamber_to_digis_[p_id.superChamberId().rawId()].push_back(*d);
0175         if (verboseDigi_)
0176           edm::LogInfo("GEMDigiMatcher") << "...was matched!" << endl;
0177       }
0178     }
0179   }
0180 }
0181 void GEMDigiMatcher::matchPadsToSimTrack(const GEMPadDigiCollection& pads) {
0182   for (auto it = pads.begin(); it != pads.end(); ++it) {
0183     const GEMDetId& p_id = (*it).first;
0184     const auto& padsvec = (*it).second;
0185 
0186     for (auto pad = padsvec.first; pad != padsvec.second; ++pad) {
0187       // check that the pad BX is within the range
0188       if (pad->bx() < minBXPad_ || pad->bx() > maxBXPad_)
0189         continue;
0190 
0191       if (verbosePad_)
0192         edm::LogInfo("GEMDigiMatcher") << "GEMPad " << p_id << " " << *pad << endl;
0193 
0194       auto digivec = detid_to_digis_[p_id.rawId()];
0195       /*
0196         For GE1/1 and ME0 (and obsolete 8-partition GE2/1) geometries, the matching
0197         is pretty simple. Each simhit is converted to a digi. Two digis in neighboring
0198         strips are ed together into a pad. So for these geometries you just need
0199         to match pads to simtracks that are in the same eta partition (detid) as the
0200         simhit is in.  By convention, all pads in the 16-partition GE2/1 geometry are
0201         assigned to odd partition numbers. For the 16-partition GE2/1 geometry, you may
0202         have a track with simhits in eta partition 1 and 2 on the same strip and only
0203         produce 1 pad associated to eta partition 1. Therefore, for pads with odd
0204         partition number N, you need to consider the digis in the even partition number
0205         N+1.
0206       */
0207       if (p_id.roll() % 2 == 1 && p_id.isGE21() && pad->nPartitions() == GEMPadDigi::GE21SplitStrip) {
0208         // make the GEMDetId for the neighboring partition
0209         GEMDetId p_id2(p_id.region(), p_id.ring(), p_id.station(), p_id.layer(), p_id.chamber(), p_id.roll() + 1);
0210 
0211         // make a temporary container for its digis
0212         auto digivec2 = detid_to_digis_[p_id2.rawId()];
0213 
0214         // now add it to the container for the digis in the odd partition number
0215         digivec.insert(digivec.end(), digivec2.begin(), digivec2.end());
0216       }
0217       for (const auto& digi : digivec) {
0218         // for 8-partition geometries, the pad number equals the strip number divided by two
0219         const bool match8Partition(digi.strip() / 2 == pad->pad());
0220 
0221         // for 16-partition geometries, the pad number is the strip number itself
0222         const bool match16Partition(digi.strip() == pad->pad());
0223 
0224         // now consider the different cases separately
0225         const bool matchGE0(p_id.isME0() and match8Partition);
0226         const bool matchGE11(p_id.isGE11() and match8Partition);
0227         const bool matchGE21_8(p_id.isGE21() and pad->nPartitions() == GEMPadDigi::GE21 and match8Partition);
0228         const bool matchGE21_16(p_id.isGE21() and pad->nPartitions() == GEMPadDigi::GE21SplitStrip and
0229                                 match16Partition);
0230 
0231         // OR them together
0232         if (matchGE0 or matchGE11 or matchGE21_8 or matchGE21_16) {
0233           detid_to_pads_[p_id.rawId()].push_back(*pad);
0234           chamber_to_pads_[p_id.chamberId().rawId()].push_back(*pad);
0235           superchamber_to_pads_[p_id.superChamberId().rawId()].push_back(*pad);
0236           if (verbosePad_)
0237             edm::LogInfo("GEMDigiMatcher") << "...was matched!" << endl;
0238           break;
0239         }
0240       }
0241     }
0242   }
0243 }
0244 
0245 void GEMDigiMatcher::matchClustersToSimTrack(const GEMPadDigiClusterCollection& clusters) {
0246   for (auto it = clusters.begin(); it != clusters.end(); ++it) {
0247     const GEMDetId p_id = (*it).first;
0248     const auto clvec = (*it).second;
0249     for (auto cluster = clvec.first; cluster != clvec.second; ++cluster) {
0250       bool isMatched = false;
0251 
0252       // check that the cluster BX is within the range
0253       if (cluster->bx() < minBXCluster_ || cluster->bx() > maxBXCluster_)
0254         continue;
0255 
0256       if (verboseCluster_)
0257         edm::LogInfo("GEMDigiMatcher") << "GEMCluster " << p_id << " " << *cluster << endl;
0258 
0259       // check that at least one pad was hit by the track
0260       for (const auto& p : cluster->pads()) {
0261         for (const auto& pad : detid_to_pads_[p_id.rawId()]) {
0262           if (pad.pad() == p) {
0263             isMatched = true;
0264           }
0265         }
0266       }
0267       if (isMatched) {
0268         detid_to_clusters_[p_id.rawId()].push_back(*cluster);
0269         chamber_to_clusters_[p_id.chamberId().rawId()].push_back(*cluster);
0270         superchamber_to_clusters_[p_id.superChamberId().rawId()].push_back(*cluster);
0271         if (verboseCluster_)
0272           edm::LogInfo("GEMDigiMatcher") << "...was matched!" << endl;
0273       }
0274     }
0275   }
0276 }
0277 
0278 void GEMDigiMatcher::matchCoPadsToSimTrack(const GEMCoPadDigiCollection& co_pads) {
0279   // loop on the GEM detids
0280   for (auto d : superChamberIdsPad()) {
0281     GEMDetId id(d);
0282 
0283     const auto& co_pads_in_det = co_pads.get(id);
0284     for (auto copad = co_pads_in_det.first; copad != co_pads_in_det.second; ++copad) {
0285       // check that the cluster BX is within the range
0286       if (copad->bx(1) < minBXCoPad_ || copad->bx(1) > maxBXCoPad_)
0287         continue;
0288 
0289       if (verboseCoPad_)
0290         edm::LogInfo("GEMDigiMatcher") << "GEMCoPadDigi: " << id << " " << *copad << endl;
0291 
0292       bool isMatchedL1 = false;
0293       bool isMatchedL2 = false;
0294       GEMDetId gemL1_id(id.region(), 1, id.station(), 1, id.chamber(), copad->roll());
0295       GEMDetId gemL2_id(id.region(), 1, id.station(), 2, id.chamber(), 0);
0296 
0297       // first pad is tightly matched
0298       for (const auto& p : padsInDetId(gemL1_id.rawId())) {
0299         if (p == copad->first()) {
0300           isMatchedL1 = true;
0301         }
0302       }
0303 
0304       // second pad can only be loosely matched
0305       for (const auto& p : padsInChamber(gemL2_id.rawId())) {
0306         if (p == copad->second()) {
0307           isMatchedL2 = true;
0308         }
0309       }
0310       if (isMatchedL1 and isMatchedL2) {
0311         superchamber_to_copads_[id.rawId()].push_back(*copad);
0312         if (verboseCoPad_)
0313           edm::LogInfo("GEMDigiMatcher") << "...was matched! " << endl;
0314       }
0315     }
0316   }
0317 }
0318 
0319 std::set<unsigned int> GEMDigiMatcher::detIdsSimLink(int gem_type) const {
0320   return selectDetIds(detid_to_simLinks_, gem_type);
0321 }
0322 
0323 std::set<unsigned int> GEMDigiMatcher::detIdsDigi(int gem_type) const {
0324   return selectDetIds(detid_to_digis_, gem_type);
0325 }
0326 
0327 std::set<unsigned int> GEMDigiMatcher::detIdsPad(int gem_type) const { return selectDetIds(detid_to_pads_, gem_type); }
0328 
0329 std::set<unsigned int> GEMDigiMatcher::detIdsCluster(int gem_type) const {
0330   return selectDetIds(detid_to_clusters_, gem_type);
0331 }
0332 
0333 std::set<unsigned int> GEMDigiMatcher::chamberIdsDigi(int gem_type) const {
0334   return selectDetIds(chamber_to_digis_, gem_type);
0335 }
0336 
0337 std::set<unsigned int> GEMDigiMatcher::chamberIdsPad(int gem_type) const {
0338   return selectDetIds(chamber_to_pads_, gem_type);
0339 }
0340 
0341 std::set<unsigned int> GEMDigiMatcher::chamberIdsCluster(int gem_type) const {
0342   return selectDetIds(chamber_to_clusters_, gem_type);
0343 }
0344 
0345 std::set<unsigned int> GEMDigiMatcher::superChamberIdsDigi(int gem_type) const {
0346   return selectDetIds(superchamber_to_digis_, gem_type);
0347 }
0348 
0349 std::set<unsigned int> GEMDigiMatcher::superChamberIdsPad(int gem_type) const {
0350   return selectDetIds(superchamber_to_pads_, gem_type);
0351 }
0352 
0353 std::set<unsigned int> GEMDigiMatcher::superChamberIdsCluster(int gem_type) const {
0354   return selectDetIds(superchamber_to_clusters_, gem_type);
0355 }
0356 
0357 std::set<unsigned int> GEMDigiMatcher::superChamberIdsCoPad(int gem_type) const {
0358   return selectDetIds(superchamber_to_copads_, gem_type);
0359 }
0360 
0361 const GEMDigiContainer& GEMDigiMatcher::digisInDetId(unsigned int detid) const {
0362   if (detid_to_digis_.find(detid) == detid_to_digis_.end())
0363     return no_gem_digis_;
0364   return detid_to_digis_.at(detid);
0365 }
0366 
0367 const GEMDigiContainer& GEMDigiMatcher::digisInChamber(unsigned int detid) const {
0368   if (chamber_to_digis_.find(detid) == chamber_to_digis_.end())
0369     return no_gem_digis_;
0370   return chamber_to_digis_.at(detid);
0371 }
0372 
0373 const GEMDigiContainer& GEMDigiMatcher::digisInSuperChamber(unsigned int detid) const {
0374   if (superchamber_to_digis_.find(detid) == superchamber_to_digis_.end())
0375     return no_gem_digis_;
0376   return superchamber_to_digis_.at(detid);
0377 }
0378 
0379 const GEMPadDigiContainer& GEMDigiMatcher::padsInDetId(unsigned int detid) const {
0380   if (detid_to_pads_.find(detid) == detid_to_pads_.end())
0381     return no_gem_pads_;
0382   return detid_to_pads_.at(detid);
0383 }
0384 
0385 const GEMPadDigiContainer& GEMDigiMatcher::padsInChamber(unsigned int detid) const {
0386   if (chamber_to_pads_.find(detid) == chamber_to_pads_.end())
0387     return no_gem_pads_;
0388   return chamber_to_pads_.at(detid);
0389 }
0390 
0391 const GEMPadDigiContainer& GEMDigiMatcher::padsInSuperChamber(unsigned int detid) const {
0392   if (superchamber_to_pads_.find(detid) == superchamber_to_pads_.end())
0393     return no_gem_pads_;
0394   return superchamber_to_pads_.at(detid);
0395 }
0396 
0397 const GEMPadDigiClusterContainer& GEMDigiMatcher::clustersInDetId(unsigned int detid) const {
0398   if (detid_to_clusters_.find(detid) == detid_to_clusters_.end())
0399     return no_gem_clusters_;
0400   return detid_to_clusters_.at(detid);
0401 }
0402 
0403 const GEMPadDigiClusterContainer& GEMDigiMatcher::clustersInChamber(unsigned int detid) const {
0404   if (chamber_to_clusters_.find(detid) == chamber_to_clusters_.end())
0405     return no_gem_clusters_;
0406   return chamber_to_clusters_.at(detid);
0407 }
0408 
0409 const GEMPadDigiClusterContainer& GEMDigiMatcher::clustersInSuperChamber(unsigned int detid) const {
0410   if (superchamber_to_clusters_.find(detid) == superchamber_to_clusters_.end())
0411     return no_gem_clusters_;
0412   return superchamber_to_clusters_.at(detid);
0413 }
0414 
0415 const GEMCoPadDigiContainer& GEMDigiMatcher::coPadsInSuperChamber(unsigned int detid) const {
0416   if (superchamber_to_copads_.find(detid) == superchamber_to_copads_.end())
0417     return no_gem_copads_;
0418   return superchamber_to_copads_.at(detid);
0419 }
0420 
0421 int GEMDigiMatcher::nLayersWithDigisInSuperChamber(unsigned int detid) const {
0422   set<int> layers;
0423   GEMDetId sch_id(detid);
0424   for (int iLayer = 1; iLayer <= 2; iLayer++) {
0425     GEMDetId ch_id(sch_id.region(), sch_id.ring(), sch_id.station(), iLayer, sch_id.chamber(), 0);
0426     // get the digis in this chamber
0427     const auto& digis = digisInChamber(ch_id.rawId());
0428     // at least one digi in this layer!
0429     if (!digis.empty()) {
0430       layers.insert(iLayer);
0431     }
0432   }
0433   return layers.size();
0434 }
0435 
0436 int GEMDigiMatcher::nLayersWithPadsInSuperChamber(unsigned int detid) const {
0437   set<int> layers;
0438   GEMDetId sch_id(detid);
0439   for (int iLayer = 1; iLayer <= 2; iLayer++) {
0440     GEMDetId ch_id(sch_id.region(), sch_id.ring(), sch_id.station(), iLayer, sch_id.chamber(), 0);
0441     // get the pads in this chamber
0442     const auto& pads = padsInChamber(ch_id.rawId());
0443     // at least one digi in this layer!
0444     if (!pads.empty()) {
0445       layers.insert(iLayer);
0446     }
0447   }
0448   return layers.size();
0449 }
0450 
0451 int GEMDigiMatcher::nLayersWithClustersInSuperChamber(unsigned int detid) const {
0452   set<int> layers;
0453   GEMDetId sch_id(detid);
0454   for (int iLayer = 1; iLayer <= 2; iLayer++) {
0455     GEMDetId ch_id(sch_id.region(), sch_id.ring(), sch_id.station(), iLayer, sch_id.chamber(), 0);
0456     // get the pads in this chamber
0457     const auto& clusters = clustersInChamber(ch_id.rawId());
0458     // at least one digi in this layer!
0459     if (!clusters.empty()) {
0460       layers.insert(iLayer);
0461     }
0462   }
0463   return layers.size();
0464 }
0465 
0466 int GEMDigiMatcher::nPads() const {
0467   int n = 0;
0468   const auto& ids = superChamberIdsPad();
0469   for (const auto& id : ids) {
0470     n += padsInSuperChamber(id).size();
0471   }
0472   return n;
0473 }
0474 
0475 int GEMDigiMatcher::nCoPads() const {
0476   int n = 0;
0477   const auto& ids = superChamberIdsCoPad();
0478   for (const auto& id : ids) {
0479     n += coPadsInSuperChamber(id).size();
0480   }
0481   return n;
0482 }
0483 
0484 std::set<int> GEMDigiMatcher::stripNumbersInDetId(unsigned int detid) const {
0485   set<int> result;
0486   const auto& digis = digisInDetId(detid);
0487   for (const auto& d : digis) {
0488     result.insert(d.strip());
0489   }
0490   return result;
0491 }
0492 
0493 std::set<int> GEMDigiMatcher::padNumbersInDetId(unsigned int detid) const {
0494   set<int> result;
0495   const auto& digis = padsInDetId(detid);
0496   for (const auto& d : digis) {
0497     result.insert(d.pad());
0498   }
0499   return result;
0500 }
0501 
0502 std::set<int> GEMDigiMatcher::partitionNumbers() const {
0503   std::set<int> result;
0504 
0505   const auto& detids = detIdsDigi();
0506   for (const auto& id : detids) {
0507     const GEMDetId& idd(id);
0508     result.insert(idd.roll());
0509   }
0510   return result;
0511 }
0512 
0513 std::set<int> GEMDigiMatcher::partitionNumbersWithCoPads() const {
0514   std::set<int> result;
0515 
0516   const auto& detids = superChamberIdsCoPad();
0517   for (const auto& id : detids) {
0518     const GEMDetId& idd(id);
0519     result.insert(idd.roll());
0520   }
0521   return result;
0522 }
0523 
0524 GlobalPoint GEMDigiMatcher::getGlobalPointDigi(unsigned int rawId, const GEMDigi& d) const {
0525   GEMDetId gem_id(rawId);
0526   const LocalPoint& gem_lp = gemGeometry_->etaPartition(gem_id)->centreOfStrip(d.strip());
0527   const GlobalPoint& gem_gp = gemGeometry_->idToDet(gem_id)->surface().toGlobal(gem_lp);
0528   return gem_gp;
0529 }
0530 
0531 GlobalPoint GEMDigiMatcher::getGlobalPointPad(unsigned int rawId, const GEMPadDigi& tp) const {
0532   GEMDetId gem_id(rawId);
0533   const LocalPoint& gem_lp = gemGeometry_->etaPartition(gem_id)->centreOfPad(tp.pad());
0534   const GlobalPoint& gem_gp = gemGeometry_->idToDet(gem_id)->surface().toGlobal(gem_lp);
0535   return gem_gp;
0536 }
0537 
0538 void GEMDigiMatcher::clear() {
0539   detid_to_simLinks_.clear();
0540 
0541   detid_to_digis_.clear();
0542   chamber_to_digis_.clear();
0543   superchamber_to_digis_.clear();
0544 
0545   detid_to_pads_.clear();
0546   chamber_to_pads_.clear();
0547   superchamber_to_pads_.clear();
0548 
0549   detid_to_clusters_.clear();
0550   chamber_to_clusters_.clear();
0551   superchamber_to_clusters_.clear();
0552 
0553   superchamber_to_copads_.clear();
0554 }