File indexing completed on 2024-04-06 11:56:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "FWCore/Framework/interface/ConsumesCollector.h"
0016 #include "FWCore/Framework/interface/MakerMacros.h"
0017 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0018 #include "Alignment/CommonAlignmentProducer/interface/AlignmentMuonSelector.h"
0019 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0020
0021
0022
0023
0024
0025
0026 struct MuonConfigSelector {
0027 typedef std::vector<const reco::Muon *> container;
0028 typedef container::const_iterator const_iterator;
0029 typedef reco::MuonCollection collection;
0030
0031 MuonConfigSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC) : theSelector(cfg) {}
0032
0033 const_iterator begin() const { return selected_.begin(); }
0034 const_iterator end() const { return selected_.end(); }
0035 size_t size() const { return selected_.size(); }
0036
0037 void select(const edm::Handle<reco::MuonCollection> &c, const edm::Event &evt, const edm::EventSetup & ) {
0038 all_.clear();
0039 selected_.clear();
0040 for (collection::const_iterator i = c.product()->begin(), iE = c.product()->end(); i != iE; ++i) {
0041 all_.push_back(&*i);
0042 }
0043 selected_ = theSelector.select(all_, evt);
0044 }
0045
0046 private:
0047 container all_, selected_;
0048 AlignmentMuonSelector theSelector;
0049 };
0050
0051 typedef ObjectSelector<MuonConfigSelector> AlignmentMuonSelectorModule;
0052
0053 DEFINE_FWK_MODULE(AlignmentMuonSelectorModule);