Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-02-05 23:50:57

0001 #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCOverlapSelector.h"
0002 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0003 #include "FWCore/Framework/interface/ConsumesCollector.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0006 
0007 // the following include is necessary to clone all track branches
0008 // including recoTrackExtras and TrackingRecHitsOwned.
0009 // if you remove it the code will compile, but the cloned
0010 // tracks have only the recoTracks branch!
0011 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
0012 
0013 struct CSCOverlapConfigSelector {
0014   typedef std::vector<const reco::Track *> container;
0015   typedef container::const_iterator const_iterator;
0016   typedef reco::TrackCollection collection;
0017 
0018   CSCOverlapConfigSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC) : theSelector(cfg) {}
0019 
0020   const_iterator begin() const { return selected_.begin(); }
0021   const_iterator end() const { return selected_.end(); }
0022   size_t size() const { return selected_.size(); }
0023 
0024   void select(const edm::Handle<reco::TrackCollection> &c, const edm::Event &evt, const edm::EventSetup & /*dummy*/) {
0025     all_.clear();
0026     selected_.clear();
0027     for (collection::const_iterator i = c.product()->begin(), iE = c.product()->end(); i != iE; ++i) {
0028       all_.push_back(&*i);
0029     }
0030     selected_ = theSelector.select(all_, evt);  // might add dummy...
0031   }
0032 
0033   static void fillPSetDescription(edm::ParameterSetDescription &desc) {
0034     AlignmentCSCOverlapSelector::fillPSetDescription(desc);
0035   }
0036 
0037 private:
0038   container all_, selected_;
0039   AlignmentCSCOverlapSelector theSelector;
0040 };
0041 
0042 typedef ObjectSelector<CSCOverlapConfigSelector> AlignmentCSCOverlapSelectorModule;
0043 
0044 DEFINE_FWK_MODULE(AlignmentCSCOverlapSelectorModule);