CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
21 
26 
27 class HLTTrackWithHits : public HLTFilter {
28 public:
29  explicit HLTTrackWithHits(const edm::ParameterSet& iConfig) : HLTFilter(iConfig),
30  src_(iConfig.getParameter<edm::InputTag>("src")),
31  minN_(iConfig.getParameter<int>("MinN")),
32  maxN_(iConfig.getParameter<int>("MaxN")),
33  MinBPX_(iConfig.getParameter<int>("MinBPX")),
34  MinFPX_(iConfig.getParameter<int>("MinFPX")),
35  MinPXL_(iConfig.getParameter<int>("MinPXL"))
36  {
37  srcToken_ = consumes<reco::TrackCollection>(src_);
38  }
39 
41 
43  {
46  desc.add<edm::InputTag>("src",edm::InputTag(""));
47  desc.add<int>("MinN",0);
48  desc.add<int>("MaxN",99999);
49  desc.add<int>("MinBPX",0);
50  desc.add<int>("MinFPX",0);
51  desc.add<int>("MinPXL",0);
52  descriptions.add("hltTrackWithHits",desc);
53  }
54 
55 private:
56  virtual bool hltFilter(edm::Event& iEvent, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override
57  {
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  const reco::HitPattern & hits = track.hitPattern();
65  if ( MinBPX_>0 && hits.numberOfValidPixelBarrelHits() >= MinBPX_ ) { ++count; continue; }
66  if ( MinFPX_>0 && hits.numberOfValidPixelEndcapHits() >= MinFPX_ ) { ++count; continue; }
67  if ( MinPXL_>0 && hits.numberOfValidPixelHits() >= MinPXL_ ) { ++count; continue; }
68  }
69 
70  bool answer=(count>=minN_ && count<=maxN_);
71  LogDebug("HLTTrackWithHits")<<module(iEvent)<<" sees: "<<s<<" objects. Only: "<<count<<" satisfy the hit requirement. Filter answer is: "<<(answer?"true":"false")<<std::endl;
72  return answer;
73  }
74 
78 
79 };
80 
81 
82 #endif
#define LogDebug(id)
answer
Definition: submit.py:44
int i
Definition: DBlmapReader.cc:9
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int iEvent
Definition: GenABIO.cc:243
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:605
int module(edm::Event const &) const
Definition: HLTFilter.cc:53
HLTTrackWithHits(const edm::ParameterSet &iConfig)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:221
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual bool hltFilter(edm::Event &iEvent, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:609
edm::EDGetTokenT< reco::TrackCollection > srcToken_
int numberOfValidPixelHits() const
Definition: HitPattern.h:601
edm::InputTag src_