Skip to content

Commit

Permalink
Merge pull request #6983 from mark-grimes/change6967CutEquality
Browse files Browse the repository at this point in the history
Small change to #6967 (Upgrade time cuts)
  • Loading branch information
cmsbuild committed Dec 19, 2014
2 parents cc15253 + c811626 commit c61f793
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 3 deletions.
@@ -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 RecoParticleFlow/PFClusterProducer/plugins/PFClusterTimeSelector.h
@@ -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
@@ -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.)
)
)



)


@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms

particleFlowClusterHCAL = cms.EDProducer('PFMultiDepthClusterProducer',
clustersSource = cms.InputTag("particleFlowClusterHBHE"),
clustersSource = cms.InputTag("particleFlowClusterHBHETimeSelected"),
pfClusterBuilder =cms.PSet(
algoName = cms.string("PFMultiDepthClusterizer"),
nSigmaEta = cms.double(2.),
Expand Down
Expand Up @@ -19,7 +19,7 @@


from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import *
#from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHEMaxSampleTimeSelected_cfi import *
from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHETimeSelected_cfi import *
from RecoParticleFlow.PFClusterProducer.particleFlowClusterHF_cfi import *

from RecoParticleFlow.PFClusterProducer.particleFlowClusterHCAL_cfi import *
Expand Down Expand Up @@ -84,7 +84,7 @@


#pfClusteringHBHEHF = cms.Sequence(towerMakerPF*particleFlowRecHitHCAL*particleFlowClusterHCAL+particleFlowClusterHFHAD+particleFlowClusterHFEM)
pfClusteringHBHEHF = cms.Sequence(offlinePrimaryVertices*particleFlowRecHitHBHE*particleFlowRecHitHF*particleFlowClusterHBHE*particleFlowClusterHF*particleFlowClusterHCAL)
pfClusteringHBHEHF = cms.Sequence(offlinePrimaryVertices*particleFlowRecHitHBHE*particleFlowRecHitHF*particleFlowClusterHBHE*particleFlowClusterHBHETimeSelected+particleFlowClusterHF*particleFlowClusterHCAL)
pfClusteringHO = cms.Sequence(particleFlowRecHitHO*particleFlowClusterHO)


Expand Down

0 comments on commit c61f793

Please sign in to comment.