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

Read ECAL PF thresholds from DB rather than config file #22412

Merged
merged 3 commits into from Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Configuration/AlCa/python/autoCond.py
Expand Up @@ -16,7 +16,7 @@
#GlobalTag for MC production with optimistic alignment and calibrations for Run2
'run2_mc' : '100X_mcRun2_asymptotic_v2',
# GlobalTag for MC production (L1 Trigger Stage1) with starup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode
'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v3',
'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v4',
# GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode
'run2_mc_cosmics' : '100X_mcRun2cosmics_startup_deco_v2',
# GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2
Expand Down
63 changes: 63 additions & 0 deletions RecoParticleFlow/PFClusterProducer/interface/PFRecHitQTests.h
Expand Up @@ -3,6 +3,8 @@

#include <memory>
#include "RecoParticleFlow/PFClusterProducer/interface/PFRecHitQTestBase.h"
#include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
#include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
#include "Geometry/Records/interface/HcalRecNumberingRecord.h"
#include "Geometry/CaloTopology/interface/HcalTopology.h"

Expand Down Expand Up @@ -59,6 +61,67 @@ class PFRecHitQTestThreshold : public PFRecHitQTestBase {



//
// Quality test that checks threshold read from the DB
//
class PFRecHitQTestDBThreshold : public PFRecHitQTestBase {
public:
PFRecHitQTestDBThreshold():eventSetup_(nullptr){
}

PFRecHitQTestDBThreshold(const edm::ParameterSet& iConfig):
PFRecHitQTestBase(iConfig),
applySelectionsToAllCrystals_(iConfig.getParameter<bool>("applySelectionsToAllCrystals")),
eventSetup_(nullptr){
}

void beginEvent(const edm::Event& event, const edm::EventSetup& iSetup) override {
eventSetup_=&iSetup;
}

bool test(reco::PFRecHit& hit, const EcalRecHit& rh, bool& clean, bool fullReadOut) override{
if (applySelectionsToAllCrystals_) return pass(hit);
return fullReadOut or pass(hit);
}
bool test(reco::PFRecHit& hit, const HBHERecHit& rh, bool& clean) override{
return pass(hit);
}

bool test(reco::PFRecHit& hit, const HFRecHit& rh, bool& clean) override{
return pass(hit);
}
bool test(reco::PFRecHit& hit, const HORecHit& rh, bool& clean) override{
return pass(hit);
}

bool test(reco::PFRecHit& hit, const CaloTower& rh, bool& clean) override{
return pass(hit);
}

bool test(reco::PFRecHit& hit, const HGCRecHit& rh, bool& clean) override{
return pass(hit);
}

protected:

bool applySelectionsToAllCrystals_;
const edm::EventSetup * eventSetup_;


bool pass(const reco::PFRecHit& hit){

edm::ESHandle<EcalPFRecHitThresholds> ths;
(*eventSetup_).get<EcalPFRecHitThresholdsRcd>().get(ths);

float threshold = (*ths)[hit.detId()];
if (hit.energy()>threshold) return true;

return false;
}
};




//
// Quality test that checks kHCAL Severity
Expand Down
Expand Up @@ -5,6 +5,7 @@

EDM_REGISTER_PLUGINFACTORY(PFRecHitQTestFactory, "PFRecHitQTestFactory");
DEFINE_EDM_PLUGIN(PFRecHitQTestFactory, PFRecHitQTestThreshold, "PFRecHitQTestThreshold");
DEFINE_EDM_PLUGIN(PFRecHitQTestFactory, PFRecHitQTestDBThreshold, "PFRecHitQTestDBThreshold");
DEFINE_EDM_PLUGIN(PFRecHitQTestFactory, PFRecHitQTestHOThreshold, "PFRecHitQTestHOThreshold");

DEFINE_EDM_PLUGIN(PFRecHitQTestFactory, PFRecHitQTestECAL, "PFRecHitQTestECAL");
Expand Down
Expand Up @@ -19,9 +19,8 @@
srFlags = cms.InputTag(""),
qualityTests = cms.VPSet(
cms.PSet(
name = cms.string("PFRecHitQTestECALMultiThreshold"),
thresholds = particle_flow_zero_suppression_ECAL.thresholds,
applySelectionsToAllCrystals = cms.bool(True)
name = cms.string("PFRecHitQTestDBThreshold"),
applySelectionsToAllCrystals=cms.bool(True),
),
cms.PSet(
name = cms.string("PFRecHitQTestECAL"),
Expand All @@ -38,9 +37,8 @@
srFlags = cms.InputTag(""),
qualityTests = cms.VPSet(
cms.PSet(
name = cms.string("PFRecHitQTestECALMultiThreshold"),
thresholds = particle_flow_zero_suppression_ECAL.thresholds,
applySelectionsToAllCrystals = cms.bool(True)
name = cms.string("PFRecHitQTestDBThreshold"),
applySelectionsToAllCrystals=cms.bool(True),
),
cms.PSet(
name = cms.string("PFRecHitQTestECAL"),
Expand Down