Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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