File indexing completed on 2024-04-06 12:11:01
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "EventFilter/SiStripChannelChargeFilter/interface/TrackMTCCFilter.h"
0010 #include "DataFormats/Common/interface/Handle.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "DataFormats/TrackReco/interface/Track.h"
0013 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0014
0015 namespace cms {
0016
0017 TrackMTCCFilter::TrackMTCCFilter(const edm::ParameterSet& ps) {
0018 TrackProducer = ps.getParameter<std::string>("TrackProducer");
0019 TrackLabel = ps.getParameter<std::string>("TrackLabel");
0020 MinNrOfTracks = ps.getParameter<int>("MinNrOfTracks");
0021 produces<int>();
0022 edm::LogInfo("TrackMTCCFilter") << "TrackProducer = " << TrackProducer;
0023 edm::LogInfo("TrackMTCCFilter") << "TrackLabel = " << TrackLabel;
0024 edm::LogInfo("TrackMTCCFilter") << "MinNrOfTracks = " << MinNrOfTracks;
0025 }
0026
0027 bool TrackMTCCFilter::filter(edm::Event& e, edm::EventSetup const& c) {
0028 bool decision = false;
0029
0030
0031 edm::Handle<reco::TrackCollection> trackCollection;
0032 e.getByLabel(TrackProducer, TrackLabel, trackCollection);
0033
0034 unsigned int nroftracks = trackCollection->size();
0035
0036 if (nroftracks >= MinNrOfTracks)
0037 decision = true;
0038
0039 e.put(std::make_unique<int>(decision));
0040 return decision;
0041 }
0042
0043 }