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
Add filter to count pixel tracks for beta star 90m run #23437
Merged
+84
−0
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include "HLTrigger/HLTcore/interface/HLTFilter.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "DataFormats/TrackReco/interface/Track.h" | ||
// | ||
// class declaration | ||
// | ||
|
||
class HLTPixelTrackFilter : public HLTFilter { | ||
public: | ||
explicit HLTPixelTrackFilter(const edm::ParameterSet&); | ||
~HLTPixelTrackFilter() override; | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
|
||
private: | ||
bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; | ||
// int countLayersWithClusters(edm::Handle<edmNew::DetSetVector<SiPixelCluster> > & clusterCol,const TrackerTopology& tTopo); | ||
|
||
edm::InputTag inputTag_; // input tag identifying product containing pixel clusters | ||
unsigned int min_pixelTracks_; // minimum number of clusters | ||
unsigned int max_pixelTracks_; // maximum number of clusters | ||
edm::EDGetTokenT<reco::TrackCollection> inputToken_; | ||
|
||
}; | ||
|
||
#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 | ||
// | ||
|
||
HLTPixelTrackFilter::HLTPixelTrackFilter(const edm::ParameterSet& config) : HLTFilter(config), | ||
inputTag_ (config.getParameter<edm::InputTag>("pixelTracks")), | ||
min_pixelTracks_ (config.getParameter<unsigned int>("maxPixelTracks")), | ||
max_pixelTracks_ (config.getParameter<unsigned int>("minPixelTracks")) | ||
{ | ||
inputToken_ = consumes< reco::TrackCollection >(inputTag_); | ||
LogDebug("") << "Using the " << inputTag_ << " input collection"; | ||
LogDebug("") << "Requesting at least " << min_pixelTracks_ << " PixelTracks"; | ||
if(max_pixelTracks_ > 0) | ||
LogDebug("") << "...but no more than " << max_pixelTracks_ << " PixelTracks"; | ||
} | ||
|
||
HLTPixelTrackFilter::~HLTPixelTrackFilter() = default; | ||
|
||
void | ||
HLTPixelTrackFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
makeHLTFilterDescription(desc); | ||
desc.add<edm::InputTag>("pixelTracks",edm::InputTag("hltPixelTracks")); | ||
desc.add<unsigned int>("minPixelTracks",0); | ||
desc.add<unsigned int>("maxPixelTracks",0); | ||
descriptions.add("hltPixelTrackFilter",desc); | ||
|
||
} | ||
|
||
// | ||
// member functions | ||
// | ||
// ------------ method called to produce the data ------------ | ||
bool HLTPixelTrackFilter::hltFilter(edm::Event& event, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs & filterproduct) const | ||
{ | ||
// All HLT filters must create and fill an HLT filter object, | ||
// recording any reconstructed physics objects satisfying (or not) | ||
// this HLT filter, and place it in the Event. | ||
|
||
// The filter object | ||
if (saveTags()) filterproduct.addCollectionTag(inputTag_); | ||
|
||
// get hold of products from Event | ||
edm::Handle< reco::TrackCollection> trackColl; | ||
event.getByToken(inputToken_, trackColl); | ||
|
||
unsigned int numTracks = trackColl->size(); | ||
LogDebug("") << "Number of tracks accepted: " << numTracks; | ||
bool accept = (numTracks >= min_pixelTracks_); | ||
if(max_pixelTracks_ > 0) | ||
accept &= (numTracks <= max_pixelTracks_); | ||
std::cout << numTracks << std::endl; | ||
// return with final filter decision | ||
return accept; | ||
} | ||
|
||
// define as a framework module | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE(HLTPixelTrackFilter); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
cout
, please use aLogDeug
orLogInfo
.