Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds HLTPixelActivityHFSumEnergyFilter module #12483

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions HLTrigger/special/interface/HLTPixelActivityHFSumEnergyFilter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef _HLTPixelActivityHFSumEnergyFilter_H
#define _HLTPixelActivityHFSumEnergyFilter_H

// system include files
#include <memory>

// user include files
#include "HLTrigger/HLTcore/interface/HLTFilter.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
#include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
#include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

//
// class declaration
//

class HLTPixelActivityHFSumEnergyFilter : public HLTFilter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is an HLTFilter...

public:
explicit HLTPixelActivityHFSumEnergyFilter(const edm::ParameterSet&);
~HLTPixelActivityHFSumEnergyFilter();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);

private:
virtual bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override;

edm::InputTag inputTag_; // input tag identifying product containing pixel clusters
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > inputToken_;
edm::EDGetTokenT<HFRecHitCollection> HFHitsToken_;
edm::InputTag HFHits_;
double eCut_HF_;
double eMin_HF_;
double offset_;
double slope_;

};

#endif
129 changes: 129 additions & 0 deletions HLTrigger/special/src/HLTPixelActivityHFSumEnergyFilter.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDFilter.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Utilities/interface/StreamID.h"

#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"

//
// class declaration
//

class HLTPixelActivityHFSumEnergyFilter : public edm::stream::EDFilter<> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is a EDFilter -- ???

Please separate properly the .h from the .cc content.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot declare the same class twice (in the .h and .cc files) and with different signatures (inheritance, etc.).
Please fix the code !

public:
explicit HLTPixelActivityHFSumEnergyFilter(const edm::ParameterSet&);
~HLTPixelActivityHFSumEnergyFilter();
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);

private:
virtual void beginStream(edm::StreamID) override;
virtual bool filter(edm::Event&, const edm::EventSetup&) override;
virtual void endStream() override;

edm::InputTag inputTag_; // input tag identifying product containing pixel clusters
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > inputToken_;
edm::EDGetTokenT<HFRecHitCollection> HFHitsToken_;
edm::InputTag HFHits_;
double eCut_HF_;
double eMin_HF_;
double offset_;
double slope_;
};

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"

//
// constructors and destructor
//

HLTPixelActivityHFSumEnergyFilter::HLTPixelActivityHFSumEnergyFilter(const edm::ParameterSet& config)
{
inputTag_ = config.getParameter<edm::InputTag>("inputTag");
HFHits_ = config.getParameter<edm::InputTag>("HFHitCollection");
eCut_HF_ = config.getParameter<double>("eCut_HF");
eMin_HF_ = config.getParameter<double>("eMin_HF");
offset_ = config.getParameter<double>("offset");
slope_ = config.getParameter<double>("slope");

inputToken_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(inputTag_);
HFHitsToken_ = consumes<HFRecHitCollection>(HFHits_);
}

HLTPixelActivityHFSumEnergyFilter::~HLTPixelActivityHFSumEnergyFilter()
{
}

void
HLTPixelActivityHFSumEnergyFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("inputTag",edm::InputTag("hltSiPixelClusters"));
desc.add<edm::InputTag>("HFHitCollection",edm::InputTag("hltHfreco"));
desc.add<double>("eCut_HF",0);
desc.add<double>("eMin_HF",0);
desc.add<double>("offset",0);
desc.add<double>("slope",0);
descriptions.add("hltPixelActivityHFSumEnergyFilter",desc);
}

//
// member functions
//

// ------------ method called to produce the data ------------
bool HLTPixelActivityHFSumEnergyFilter::filter(edm::Event& event, const edm::EventSetup& iSetup) {

using namespace edm;
// get hold of products from Event
edm::Handle<edmNew::DetSetVector<SiPixelCluster> > clusterColl;
event.getByToken(inputToken_, clusterColl);

unsigned int clusterSize = clusterColl->dataSize();
LogDebug("") << "Number of clusters accepted: " << clusterSize;

edm::Handle<HFRecHitCollection> HFRecHitsH;
event.getByToken(HFHitsToken_,HFRecHitsH);

double sumE = 0.;
for (HFRecHitCollection::const_iterator it=HFRecHitsH->begin(); it!=HFRecHitsH->end(); it++) {
if (it->energy()>eCut_HF_) {
sumE += it->energy();
}
}

bool accept = false;
double thres = slope_ * sumE - offset_;
if(sumE > eMin_HF_ && clusterSize < thres )
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of clusterSize < thres better std::abs(clusterSize - thres) > someConfigurableValue
to check deviation from (almost) equality?

accept = true;
}

return accept;
}

// ------------ method called once each stream before processing any runs, lumis or events ------------
void
HLTPixelActivityHFSumEnergyFilter::beginStream(edm::StreamID)
{
}

// ------------ method called once each stream after processing all runs, lumis and events ------------
void
HLTPixelActivityHFSumEnergyFilter::endStream() {
}

// define as a framework module

DEFINE_FWK_MODULE(HLTPixelActivityHFSumEnergyFilter);
2 changes: 2 additions & 0 deletions HLTrigger/special/src/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "HLTrigger/special/interface/HLTRegionalEcalResonanceFilter.h"

#include "HLTrigger/special/interface/HLTPixelAsymmetryFilter.h"
#include "HLTrigger/special/interface/HLTPixelActivityHFSumEnergyFilter.h"
#include "HLTrigger/special/interface/HLTHFAsymmetryFilter.h"
#include "HLTrigger/special/interface/HLTTrackerHaloFilter.h"

Expand Down Expand Up @@ -65,5 +66,6 @@ DEFINE_FWK_MODULE(HLTEcalResonanceFilter);
DEFINE_FWK_MODULE(HLTRegionalEcalResonanceFilter);

DEFINE_FWK_MODULE(HLTPixelAsymmetryFilter);
DEFINE_FWK_MODULE(HLTPixelActivityHFSumEnergyFilter);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are already doing this at the end of the HLTPixelActivityHFSumEnergyFilter.cc file, you should not make any changes in this file.

DEFINE_FWK_MODULE(HLTHFAsymmetryFilter);
DEFINE_FWK_MODULE(HLTTrackerHaloFilter);