CMS 3D CMS Logo

HLTTrackWithHits.h
Go to the documentation of this file.
1 #ifndef HLTrigger_HLTTrackWithHits_H
2 
8 // system include files
9 #include <memory>
10 
11 // user include files
14 
17 
19 
24 
25 class HLTTrackWithHits : public HLTFilter {
26 public:
27  explicit HLTTrackWithHits(const edm::ParameterSet& iConfig)
28  : HLTFilter(iConfig),
29  src_(iConfig.getParameter<edm::InputTag>("src")),
30  minN_(iConfig.getParameter<int>("MinN")),
31  maxN_(iConfig.getParameter<int>("MaxN")),
32  MinBPX_(iConfig.getParameter<int>("MinBPX")),
33  MinFPX_(iConfig.getParameter<int>("MinFPX")),
34  MinPXL_(iConfig.getParameter<int>("MinPXL")),
35  MinPT_(iConfig.getParameter<double>("MinPT")) {
36  srcToken_ = consumes<reco::TrackCollection>(src_);
37  }
38 
39  ~HLTTrackWithHits() override {}
40 
41  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
44  desc.add<edm::InputTag>("src", edm::InputTag(""));
45  desc.add<int>("MinN", 0);
46  desc.add<int>("MaxN", 99999);
47  desc.add<int>("MinBPX", 0);
48  desc.add<int>("MinFPX", 0);
49  desc.add<int>("MinPXL", 0);
50  desc.add<double>("MinPT", 0.);
51  descriptions.add("hltTrackWithHits", desc);
52  }
53 
54 private:
56  const edm::EventSetup&,
57  trigger::TriggerFilterObjectWithRefs& filterproduct) const override {
59  iEvent.getByToken(srcToken_, oHandle);
60  int s = oHandle->size();
61  int count = 0;
62  for (int i = 0; i != s; ++i) {
63  const reco::Track& track = (*oHandle)[i];
64  if (track.pt() < MinPT_)
65  continue;
66  const reco::HitPattern& hits = track.hitPattern();
67  if (MinBPX_ > 0 && hits.numberOfValidPixelBarrelHits() >= MinBPX_) {
68  ++count;
69  continue;
70  }
71  if (MinFPX_ > 0 && hits.numberOfValidPixelEndcapHits() >= MinFPX_) {
72  ++count;
73  continue;
74  }
75  if (MinPXL_ > 0 && hits.numberOfValidPixelHits() >= MinPXL_) {
76  ++count;
77  continue;
78  }
79  }
80 
81  bool answer = (count >= minN_ && count <= maxN_);
82  LogDebug("HLTTrackWithHits") << module(iEvent) << " sees: " << s << " objects. Only: " << count
83  << " satisfy the hit requirement. Filter answer is: " << (answer ? "true" : "false")
84  << std::endl;
85  return answer;
86  }
87 
91  double MinPT_;
92 };
93 
94 #endif
trigger::TriggerFilterObjectWithRefs
Definition: TriggerFilterObjectWithRefs.h:35
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HLTTrackWithHits::HLTTrackWithHits
HLTTrackWithHits(const edm::ParameterSet &iConfig)
Definition: HLTTrackWithHits.h:27
HLTTrackWithHits::MinFPX_
int MinFPX_
Definition: HLTTrackWithHits.h:90
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDFilter.h
TriggerFilterObjectWithRefs.h
HLTTrackWithHits::maxN_
int maxN_
Definition: HLTTrackWithHits.h:90
edm::Handle< reco::TrackCollection >
HLTTrackWithHits
Definition: HLTTrackWithHits.h:25
HLTFilter
Definition: HLTFilter.h:28
MakerMacros.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
reco::HitPattern
Definition: HitPattern.h:147
Track.h
HLTTrackWithHits::srcToken_
edm::EDGetTokenT< reco::TrackCollection > srcToken_
Definition: HLTTrackWithHits.h:89
TrackFwd.h
HLTTrackWithHits::~HLTTrackWithHits
~HLTTrackWithHits() override
Definition: HLTTrackWithHits.h:39
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLTTrackWithHits::src_
edm::InputTag src_
Definition: HLTTrackWithHits.h:88
HLTFilter.h
reco::Track
Definition: Track.h:27
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HLTTrackWithHits::MinPT_
double MinPT_
Definition: HLTTrackWithHits.h:91
HLTTrackWithHits::MinPXL_
int MinPXL_
Definition: HLTTrackWithHits.h:90
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HLTTrackWithHits::hltFilter
bool hltFilter(edm::Event &iEvent, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
Definition: HLTTrackWithHits.h:55
HLTTrackWithHits::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTTrackWithHits.h:41
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HLTTrackWithHits::minN_
int minN_
Definition: HLTTrackWithHits.h:90
Frameworkfwd.h
HLTFilter::makeHLTFilterDescription
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:25
HLTFilter::module
int module(edm::Event const &) const
Definition: HLTFilter.cc:47
ParameterSet.h
edm::Event
Definition: Event.h:73
HLTTrackWithHits::MinBPX_
int MinBPX_
Definition: HLTTrackWithHits.h:90
edm::InputTag
Definition: InputTag.h:15