Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:13

0001 
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0005 #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCOverlapSelector.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 private:
0034   container all_, selected_;
0035   AlignmentCSCOverlapSelector theSelector;
0036 };
0037 
0038 typedef ObjectSelector<CSCOverlapConfigSelector> AlignmentCSCOverlapSelectorModule;
0039 
0040 DEFINE_FWK_MODULE(AlignmentCSCOverlapSelectorModule);