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  }
38 
40 
41 private:
43  {
45  iEvent.getByLabel(src_, oHandle);
46  int s=oHandle->size();
47  int count=0;
48  for (int i=0;i!=s;++i){
49  const reco::Track & track = (*oHandle)[i];
50  const reco::HitPattern & hits = track.hitPattern();
51  if ( MinBPX_>0 && hits.numberOfValidPixelBarrelHits() >= MinBPX_ ) { ++count; continue; }
52  if ( MinFPX_>0 && hits.numberOfValidPixelEndcapHits() >= MinFPX_ ) { ++count; continue; }
53  if ( MinPXL_>0 && hits.numberOfValidPixelHits() >= MinPXL_ ) { ++count; continue; }
54  }
55 
56  bool answer=(count>=minN_ && count<=maxN_);
57  LogDebug("HLTTrackWithHits")<<module()<<" sees: "<<s<<" objects. Only: "<<count<<" satisfy the hit requirement. Filter answer is: "<<(answer?"true":"false")<<std::endl;
58  return answer;
59  }
60 
63 };
64 
65 
66 #endif
#define LogDebug(id)
answer
Definition: submit.py:44
int i
Definition: DBlmapReader.cc:9
virtual bool hltFilter(edm::Event &iEvent, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
int iEvent
Definition: GenABIO.cc:243
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:586
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:223
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:590
int numberOfValidPixelHits() const
Definition: HitPattern.h:582
edm::InputTag src_
int module() const
Definition: HLTFilter.cc:56