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