Skip to content

Commit

Permalink
Use range-based for-loop. And, some clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
hatakeyamak committed Mar 4, 2020
1 parent 8c80609 commit 29da198
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Expand Up @@ -178,7 +178,7 @@ def customiseFor29049(process) :
if hasattr(pset_navi, "sigmaCut"): delattr(pset_navi,'sigmaCut')
if hasattr(pset_navi, "timeResolutionCalc"): delattr(pset_navi,'timeResolutionCalc')
pset_navi.name = cms.string("PFRecHitHCALDenseIdNavigator")
pset_navi.detectorEnums = cms.vint32(1,2)
pset_navi.hcalEnums = cms.vint32(1,2)

listHltPFRecHitHF=['hltParticleFlowRecHitHF',
'hltParticleFlowRecHitHFForEgammaUnseeded']
Expand All @@ -189,7 +189,7 @@ def customiseFor29049(process) :
if hasattr(pset_navi, "barrel"): delattr(pset_navi,'barrel')
if hasattr(pset_navi, "endcap"): delattr(pset_navi,'endcap')
pset_navi.name = cms.string("PFRecHitHCALDenseIdNavigator")
pset_navi.detectorEnums = cms.vint32(4)
pset_navi.hcalEnums = cms.vint32(4)

return process

Expand Down
Expand Up @@ -31,7 +31,7 @@ class PFHCALDenseIdNavigator : public PFRecHitNavigatorBase {
}

PFHCALDenseIdNavigator(const edm::ParameterSet& iConfig) {
vdetectorEnum_ = iConfig.getParameter<std::vector<int>>("detectorEnums");
vhcalEnum_ = iConfig.getParameter<std::vector<int>>("hcalEnums");
}

void init(const edm::EventSetup& iSetup) override {
Expand All @@ -52,12 +52,12 @@ class PFHCALDenseIdNavigator : public PFRecHitNavigatorBase {
std::vector<DetId> vecHcal;
std::vector<unsigned int> vDenseIdHcal;
neighboursHcal_.clear();
for (unsigned i = 0; i < vdetectorEnum_.size(); ++i) {
std::vector<DetId> vecDetIds(caloGeom.getValidDetIds(DetId::Hcal, vdetectorEnum_.at(i)));
for (auto hcalSubdet : vhcalEnum_) {
std::vector<DetId> vecDetIds(caloGeom.getValidDetIds(DetId::Hcal, hcalSubdet));
vecHcal.insert(vecHcal.end(), vecDetIds.begin(), vecDetIds.end());
}
for (unsigned i = 0; i < vecHcal.size(); ++i) {
vDenseIdHcal.push_back(topology_.get()->detId2denseId(vecHcal.at(i)));
for (auto hDetId : vecHcal) {
vDenseIdHcal.push_back(topology_.get()->detId2denseId(hDetId));
}
std::sort(vDenseIdHcal.begin(), vDenseIdHcal.end());

Expand All @@ -66,7 +66,7 @@ class PFHCALDenseIdNavigator : public PFRecHitNavigatorBase {
denseIdHcalMin_ = *min_element(vDenseIdHcal.begin(), vDenseIdHcal.end());
neighboursHcal_.resize(denseIdHcalMax_ - denseIdHcalMin_ + 1);

for (unsigned i = 0; i < vDenseIdHcal.size(); ++i) {
for (auto denseid : vDenseIdHcal) {
DetId N(0);
DetId E(0);
DetId S(0);
Expand All @@ -78,7 +78,7 @@ class PFHCALDenseIdNavigator : public PFRecHitNavigatorBase {
std::vector<DetId> neighbours(9, DetId(0));

// the centre
unsigned denseid_c = vDenseIdHcal.at(i);
unsigned denseid_c = denseid;
DetId detid_c = topology_.get()->denseId2detId(denseid_c);
CaloNavigator<DET> navigator(detid_c, topology_.get());

Expand Down Expand Up @@ -183,7 +183,7 @@ class PFHCALDenseIdNavigator : public PFRecHitNavigatorBase {
protected:
edm::ESWatcher<HcalRecNumberingRecord> theRecNumberWatcher_;
std::unique_ptr<const TOPO> topology_;
std::vector<int> vdetectorEnum_;
std::vector<int> vhcalEnum_;
std::vector<std::vector<DetId>> neighboursHcal_;
unsigned int denseIdHcalMax_;
unsigned int denseIdHcalMin_;
Expand Down
@@ -1,16 +1,14 @@
import FWCore.ParameterSet.Config as cms
from RecoParticleFlow.PFClusterProducer.particleFlowCaloResolution_cfi import _timeResolutionHCAL

_thresholdsHB = cms.vdouble(0.8, 0.8, 0.8, 0.8)
_thresholdsHE = cms.vdouble(0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8)
_thresholdsHBphase1 = cms.vdouble(0.1, 0.2, 0.3, 0.3)
_thresholdsHEphase1 = cms.vdouble(0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2)


particleFlowRecHitHBHE = cms.EDProducer("PFRecHitProducer",
navigator = cms.PSet(
name = cms.string("PFRecHitHCALDenseIdNavigator"),
detectorEnums = cms.vint32(1,2)
hcalEnums = cms.vint32(1,2)
),
producers = cms.VPSet(
cms.PSet(
Expand Down
@@ -1,12 +1,10 @@
import FWCore.ParameterSet.Config as cms

#HB HE HO rec hits

particleFlowRecHitHF = cms.EDProducer("PFRecHitProducer",

navigator = cms.PSet(
name = cms.string("PFRecHitHCALDenseIdNavigator"),
detectorEnums = cms.vint32(4)
hcalEnums = cms.vint32(4)
),
producers = cms.VPSet(
cms.PSet(
Expand Down
@@ -1,8 +1,9 @@
import FWCore.ParameterSet.Config as cms

particleFlowRecHitHO = cms.EDProducer("PFRecHitProducer",
navigator = cms.PSet(
name = cms.string("PFRecHitHCALDenseIdNavigator"),
detectorEnums = cms.vint32(3)
hcalEnums = cms.vint32(3)
),
producers = cms.VPSet(
cms.PSet(
Expand Down

0 comments on commit 29da198

Please sign in to comment.