File indexing completed on 2024-04-06 12:19:33
0001 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
0002 #include <iostream>
0003
0004 #include <memory>
0005
0006
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 #include "FWCore/Framework/interface/global/EDFilter.h"
0009
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014
0015 class CSCTFFilter : public edm::global::EDFilter<> {
0016 public:
0017 explicit CSCTFFilter(const edm::ParameterSet&);
0018
0019 private:
0020 bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
0021
0022
0023 std::vector<unsigned> modes;
0024 edm::EDGetTokenT<L1CSCTrackCollection> token_;
0025 };
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 CSCTFFilter::CSCTFFilter(const edm::ParameterSet& iConfig) {
0039
0040 modes = iConfig.getUntrackedParameter<std::vector<unsigned> >("modes");
0041 token_ = consumes(iConfig.getUntrackedParameter<edm::InputTag>("inputTag"));
0042 }
0043
0044
0045
0046
0047
0048 bool CSCTFFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0049 using namespace edm;
0050 using namespace std;
0051
0052 edm::Handle<L1CSCTrackCollection> trackFinderTracks = iEvent.getHandle(token_);
0053
0054 for (auto BaseTFTrk = trackFinderTracks->begin(); BaseTFTrk != trackFinderTracks->end(); BaseTFTrk++) {
0055 for (auto mode = modes.begin(); mode != modes.end(); mode++) {
0056 if (BaseTFTrk->first.mode() == (*mode)) {
0057
0058 return true;
0059 }
0060 }
0061 }
0062 return false;
0063 }
0064
0065
0066 DEFINE_FWK_MODULE(CSCTFFilter);