Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6983 from mark-grimes/change6967CutEquality
Small change to #6967 (Upgrade time cuts)
- Loading branch information
Showing
5 changed files
with
345 additions
and
3 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
RecoParticleFlow/PFClusterProducer/plugins/PFClusterTimeSelector.cc
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,85 @@ | ||
#include "RecoParticleFlow/PFClusterProducer/plugins/PFClusterTimeSelector.h" | ||
#include <memory> | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
|
||
|
||
using namespace std; | ||
using namespace edm; | ||
|
||
|
||
PFClusterTimeSelector::PFClusterTimeSelector(const edm::ParameterSet& iConfig): | ||
clusters_(consumes<reco::PFClusterCollection>(iConfig.getParameter<edm::InputTag>("src"))) | ||
{ | ||
|
||
std::vector<edm::ParameterSet> cuts = iConfig.getParameter<std::vector<edm::ParameterSet> >("cuts"); | ||
for (const auto& cut :cuts ) { | ||
CutInfo info; | ||
info.depth = cut.getParameter<double>("depth"); | ||
info.minE = cut.getParameter<double>("minEnergy"); | ||
info.maxE = cut.getParameter<double>("maxEnergy"); | ||
info.minTime = cut.getParameter<double>("minTime"); | ||
info.maxTime = cut.getParameter<double>("maxTime"); | ||
info.endcap = cut.getParameter<bool>("endcap"); | ||
cutInfo_.push_back(info); | ||
} | ||
|
||
|
||
produces<reco::PFClusterCollection>(); | ||
produces<reco::PFClusterCollection>("OOT"); | ||
} | ||
|
||
|
||
void PFClusterTimeSelector::produce(edm::Event& iEvent, | ||
const edm::EventSetup& iSetup) { | ||
|
||
edm::Handle<reco::PFClusterCollection> clusters; | ||
iEvent.getByToken(clusters_,clusters); | ||
std::auto_ptr<reco::PFClusterCollection> out(new reco::PFClusterCollection); | ||
std::auto_ptr<reco::PFClusterCollection> outOOT(new reco::PFClusterCollection); | ||
|
||
for(const auto& cluster : *clusters ) { | ||
const double energy = cluster.energy(); | ||
const double time = cluster.time(); | ||
const double depth = cluster.depth(); | ||
const PFLayer::Layer layer = cluster.layer(); | ||
for (const auto& info : cutInfo_) { | ||
if (energy<info.minE || energy>=info.maxE) | ||
continue; | ||
if (depth<0.9*info.depth || depth>1.1*info.depth) | ||
continue; | ||
if ((info.endcap && (layer==PFLayer::ECAL_BARREL || layer==PFLayer::HCAL_BARREL1 || layer==PFLayer::HCAL_BARREL2))|| | ||
(((!info.endcap) && (layer==PFLayer::ECAL_ENDCAP || layer==PFLayer::HCAL_ENDCAP)))) | ||
continue; | ||
|
||
if (time>info.minTime && time<info.maxTime) | ||
out->push_back(cluster); | ||
else | ||
outOOT->push_back(cluster); | ||
|
||
break; | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
iEvent.put( out); | ||
iEvent.put( outOOT,"OOT"); | ||
|
||
} | ||
|
||
PFClusterTimeSelector::~PFClusterTimeSelector() {} | ||
|
||
// ------------ method called once each job just before starting event loop ------------ | ||
void | ||
PFClusterTimeSelector::beginRun(const edm::Run& run, | ||
const EventSetup& es) { | ||
|
||
|
||
} | ||
|
||
|
50 changes: 50 additions & 0 deletions
50
RecoParticleFlow/PFClusterProducer/plugins/PFClusterTimeSelector.h
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,50 @@ | ||
#ifndef RecoParticleFlow_PFClusterProducer_PFClusterTimeSelector_h_ | ||
#define RecoParticleFlow_PFClusterProducer_PFClusterTimeSelector_h_ | ||
|
||
// system include files | ||
#include <memory> | ||
#include <vector> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EDProducer.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "DataFormats/ParticleFlowReco/interface/PFCluster.h" | ||
#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h" | ||
|
||
class PFClusterTimeSelector : public edm::EDProducer { | ||
public: | ||
explicit PFClusterTimeSelector(const edm::ParameterSet&); | ||
~PFClusterTimeSelector(); | ||
|
||
virtual void beginRun(const edm::Run& run, const edm::EventSetup & es); | ||
|
||
void produce(edm::Event& iEvent, | ||
const edm::EventSetup& iSetup); | ||
|
||
|
||
protected: | ||
|
||
struct CutInfo { | ||
double depth; | ||
double minE; | ||
double maxE; | ||
double minTime; | ||
double maxTime; | ||
bool endcap; | ||
|
||
}; | ||
|
||
// ----------access to event data | ||
edm::EDGetTokenT<reco::PFClusterCollection> clusters_; | ||
std::vector<CutInfo> cutInfo_; | ||
|
||
}; | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE(PFClusterTimeSelector); | ||
|
||
#endif |
207 changes: 207 additions & 0 deletions
207
RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHBHETimeSelected_cfi.py
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,207 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
particleFlowClusterHBHETimeSelected = cms.EDProducer( | ||
"PFClusterTimeSelector", | ||
src = cms.InputTag('particleFlowClusterHBHE'), | ||
|
||
cuts = cms.VPSet( | ||
cms.PSet( | ||
depth=cms.double(1.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-22.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(2.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-22.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(3.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-20.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(1.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-20.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(2.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-15.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(3.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-15.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(1.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-10.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(2.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-8.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(3.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(False), | ||
minTime = cms.double(-8.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(1.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-20.), | ||
maxTime = cms.double(10.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(2.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-15.), | ||
maxTime = cms.double(10.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(3.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(10.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(4.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(5.0), | ||
minEnergy = cms.double(0.0), | ||
maxEnergy = cms.double(2.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(5.) | ||
), | ||
|
||
cms.PSet( | ||
depth=cms.double(1.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-15.), | ||
maxTime = cms.double(10.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(2.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(10.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(3.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(10.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(4.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(5.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(5.0), | ||
minEnergy = cms.double(2.0), | ||
maxEnergy = cms.double(5.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-12.), | ||
maxTime = cms.double(5.) | ||
), | ||
|
||
cms.PSet( | ||
depth=cms.double(1.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-25.), | ||
maxTime = cms.double(35.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(2.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-25.), | ||
maxTime = cms.double(35.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(3.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-25.), | ||
maxTime = cms.double(35.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(4.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-25.), | ||
maxTime = cms.double(35.) | ||
), | ||
cms.PSet( | ||
depth=cms.double(5.0), | ||
minEnergy = cms.double(5.0), | ||
maxEnergy = cms.double(1000000.0), | ||
endcap = cms.bool(True), | ||
minTime = cms.double(-25.), | ||
maxTime = cms.double(25.) | ||
) | ||
) | ||
|
||
|
||
|
||
) | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHCAL_cfi.py
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
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