CMS 3D CMS Logo

HLTPixelActivityHFSumEnergyFilter.cc
Go to the documentation of this file.
2 
6 
7 //
8 // constructors and destructor
9 //
10 
12  inputTag_ (config.getParameter<edm::InputTag>("inputTag")),
13  HFHits_ (config.getParameter<edm::InputTag>("HFHitCollection")),
14  eCut_HF_ (config.getParameter<double>("eCut_HF")),
15  eMin_HF_ (config.getParameter<double>("eMin_HF")),
16  offset_ (config.getParameter<double>("offset")),
17  slope_ (config.getParameter<double>("slope"))
18 {
19  inputToken_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(inputTag_);
20  HFHitsToken_ = consumes<HFRecHitCollection>(HFHits_);
21 
22  LogDebug("") << "Using the " << inputTag_ << " input collection";
23 }
24 
26 
27 void
30  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltSiPixelClusters"));
31  desc.add<edm::InputTag>("HFHitCollection",edm::InputTag("hltHfreco"));
32  desc.add<double>("eCut_HF",0);
33  desc.add<double>("eMin_HF",10000.);
34  desc.add<double>("offset",-1000.);
35  desc.add<double>("slope",0.5);
36  descriptions.add("hltPixelActivityHFSumEnergyFilter",desc);
37 }
38 
39 //
40 // member functions
41 //
42 
43 // ------------ method called to produce the data ------------
45 {
46 
47  // get hold of products from Event
49  iEvent.getByToken(inputToken_, clusterColl);
50 
51  unsigned int clusterSize = clusterColl->dataSize();
52  LogDebug("") << "Number of clusters: " << clusterSize;
53 
55  iEvent.getByToken(HFHitsToken_,HFRecHitsH);
56 
57  double sumE = 0.;
58 
59  for (auto const & it : *HFRecHitsH) {
60  if (it.energy()>eCut_HF_) {
61  sumE += it.energy();
62  }
63  }
64 
65  bool accept = false;
66 
67  double thres = offset_ + slope_ * sumE;
68  double diff = clusterSize - thres; //diff = clustersize - (correlation line + offset)
69  if(sumE>eMin_HF_ && diff < 0.) accept = true;
70 
71  // return with final filter decision
72  return accept;
73 }
74 
75 // declare this class as a framework plugin
#define LogDebug(id)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Definition: config.py:1
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
edm::EDGetTokenT< HFRecHitCollection > HFHitsToken_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > inputToken_
HLTPixelActivityHFSumEnergyFilter(const edm::ParameterSet &)
HLT enums.
bool filter(edm::Event &iEvent, const edm::EventSetup &iSetup) override