Skip to content

Commit

Permalink
Partial revert of cms-sw#47079: do not use ifValue switches in fillDe…
Browse files Browse the repository at this point in the history
…scriptions affecting confDB parsing
  • Loading branch information
mmusich committed Jan 15, 2025
1 parent 68318d6 commit e214fa7
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@
),
)

## remove uneeded paraemters sets because setNoiseFlags is False
for param in ['PETstat', 'S8S1stat', 'S9S1stat']:
if hasattr(_phase1_hfrecoNoise, param):
delattr(_phase1_hfrecoNoise, param)
if hasattr(_phase1_hfrecoMBNZS, param):
delattr(_phase1_hfrecoMBNZS, param)

_phase1_seqALCARECOHcalCalMinBias = seqALCARECOHcalCalMinBias.copy()
_phase1_seqALCARECOHcalCalMinBias.insert(0,hfprerecoMBNZS)
_phase1_seqALCARECOHcalCalMinBias.insert(0,hfprerecoNoise)
Expand Down
11 changes: 11 additions & 0 deletions HLTrigger/Configuration/python/HLT_75e33/modules/hltHfreco_cfi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import FWCore.ParameterSet.Config as cms

hltHfreco = cms.EDProducer("HFPhase1Reconstructor",
HFStripFilter = cms.PSet(
gap = cms.int32(2),
lstrips = cms.int32(2),
maxStripTime = cms.double(10.0),
maxThreshold = cms.double(100.0),
seedHitIetaMax = cms.int32(35),
stripThreshold = cms.double(40.0),
timeMax = cms.double(6.0),
verboseLevel = cms.untracked.int32(10),
wedgeCut = cms.double(0.05)
),
PETstat = cms.PSet(
HcalAcceptSeverityLevel = cms.int32(9),
longETParams = cms.vdouble(
Expand Down
10 changes: 10 additions & 0 deletions HLTrigger/Configuration/python/HLT_75e33/modules/hltHoreco_cfi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import FWCore.ParameterSet.Config as cms

hltHoreco = cms.EDProducer("HcalHitReconstructor",
HFInWindowStat = cms.PSet(),
PETstat = cms.PSet(),
S8S1stat = cms.PSet(),
S9S1stat = cms.PSet(),
Subdetector = cms.string('HO'),
correctForPhaseContainment = cms.bool(True),
correctForTimeslew = cms.bool(True),
Expand All @@ -9,13 +13,19 @@
dataOOTCorrectionCategory = cms.string('Data'),
dataOOTCorrectionName = cms.string(''),
digiLabel = cms.InputTag("hltHcalDigis"),
digiTimeFromDB = cms.bool(True),
digistat = cms.PSet(),
dropZSmarkedPassed = cms.bool(True),
firstAuxTS = cms.int32(4),
firstSample = cms.int32(4),
hfTimingTrustParameters = cms.PSet(),
mcOOTCorrectionCategory = cms.string('MC'),
mcOOTCorrectionName = cms.string(''),
recoParamsFromDB = cms.bool(True),
samplesToAdd = cms.int32(4),
saturationParameters = cms.PSet(
maxADCvalue = cms.int32(127)
),
setNegativeFlags = cms.bool(False),
setNoiseFlags = cms.bool(False),
setSaturationFlags = cms.bool(False),
Expand Down
27 changes: 0 additions & 27 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,42 +92,15 @@ def customizeHLTfor47079(process):
del filt.filterParams.pvSrc # Remove the pvSrc parameter

for prod in producers_by_type(process, 'HcalHitReconstructor'):
# Remove "digiTimeFromDB" if "Subdetector" is not "HF"
if hasattr(prod, 'Subdetector') and getattr(prod, 'Subdetector') != "HF":
if hasattr(prod, 'digiTimeFromDB'):
delattr(prod, 'digiTimeFromDB')

# Remove "saturationParameters" if "setSaturationFlags" is false
if hasattr(prod, 'setSaturationFlags') and not getattr(prod, 'setSaturationFlags'):
if hasattr(prod, 'saturationParameters'):
delattr(prod, 'saturationParameters')

# Remove "hfTimingTrustParameters" if "setTimingTrustFlags" is false
if hasattr(prod, 'setTimingTrustFlags') and not getattr(prod, 'setTimingTrustFlags'):
if hasattr(prod, 'hfTimingTrustParameters'):
delattr(prod, 'hfTimingTrustParameters')

# Remove 'PETstat', 'S8S1stat', 'S9S1stat', 'digistat' and 'HFInWindowStat' if "setNoiseFlags" is false
if hasattr(prod, 'setNoiseFlags') and not getattr(prod, 'setNoiseFlags'):
for param in ['PETstat', 'S8S1stat', 'S9S1stat', 'digistat', 'HFInWindowStat']:
if hasattr(prod, param):
delattr(prod, param)

# Remove useless parameters
if hasattr(prod,'setHSCPFlags'):
delattr(prod,'setHSCPFlags')

if hasattr(prod,'setPulseShapeFlags'):
delattr(prod,'setPulseShapeFlags')

for prod in producers_by_type(process, 'HFPhase1Reconstructor'):
# Remove 'HFStripFilter' if "runHFStripFilter" is false
if hasattr(prod, 'runHFStripFilter') and not getattr(prod, 'runHFStripFilter'):
delattr(prod,'HFStripFilter')

return process


def customizeHLTfor47047(process):
"""Migrates many ESProducers to MoveToDeviceCache"""
import copy
Expand Down
22 changes: 10 additions & 12 deletions RecoLocalCalo/HcalRecProducers/src/HFPhase1Reconstructor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,9 @@ void HFPhase1Reconstructor::fillDescriptions(edm::ConfigurationDescriptions& des
desc.add<edm::ParameterSetDescription>("algorithm", fillDescriptionForParseHFPhase1AlgoDescription())
->setComment("configure the reconstruction algorithm");

desc.ifValue(
edm::ParameterDescription<bool>("runHFStripFilter", true, true),
false >> edm::EmptyGroupDescription() or true >> edm::ParameterDescription<edm::ParameterSetDescription>(
"HFStripFilter", HFStripFilter::fillDescription(), true));
desc.add<bool>("runHFStripFilter", true);
desc.add<edm::ParameterSetDescription>("HFStripFilter", HFStripFilter::fillDescription());
desc.add<bool>("setNoiseFlags", true);

{
// Define common vectors
Expand Down Expand Up @@ -320,7 +319,10 @@ void HFPhase1Reconstructor::fillDescriptions(edm::ConfigurationDescriptions& des
S9S1statDesc.add<std::vector<double>>("longETParams", std::vector<double>(13, 0));
S9S1statDesc.add<int>("HcalAcceptSeverityLevel", 9);
S9S1statDesc.add<bool>("isS8S1", false);
desc.add<edm::ParameterSetDescription>("S9S1stat", S9S1statDesc);
}

{
// S8S1stat configuration
edm::ParameterSetDescription S8S1statDesc;
S8S1statDesc.add<std::vector<double>>(
Expand All @@ -335,7 +337,10 @@ void HFPhase1Reconstructor::fillDescriptions(edm::ConfigurationDescriptions& des
S8S1statDesc.add<std::vector<double>>("longETParams", std::vector<double>(13, 0));
S8S1statDesc.add<int>("HcalAcceptSeverityLevel", 9);
S8S1statDesc.add<bool>("isS8S1", true);
desc.add<edm::ParameterSetDescription>("S8S1stat", S8S1statDesc);
}

{
// PETstat configuration
edm::ParameterSetDescription PETstatDesc;
PETstatDesc.add<std::vector<double>>("short_R", {0.8});
Expand All @@ -350,14 +355,7 @@ void HFPhase1Reconstructor::fillDescriptions(edm::ConfigurationDescriptions& des
PETstatDesc.add<std::vector<double>>("short_R_29", {0.8});
PETstatDesc.add<std::vector<double>>("long_R_29", {0.8});
PETstatDesc.add<int>("HcalAcceptSeverityLevel", 9);

// Conditionally add S9S1stat if setNoiseFlags is true
desc.ifValue(
edm::ParameterDescription<bool>("setNoiseFlags", true, true),
false >> edm::EmptyGroupDescription() or
true >> (edm::ParameterDescription<edm::ParameterSetDescription>("S9S1stat", S9S1statDesc, true) and
edm::ParameterDescription<edm::ParameterSetDescription>("S8S1stat", S8S1statDesc, true) and
edm::ParameterDescription<edm::ParameterSetDescription>("PETstat", PETstatDesc, true)));
desc.add<edm::ParameterSetDescription>("PETstat", PETstatDesc);
}

descriptions.addWithDefaultLabel(desc);
Expand Down
53 changes: 21 additions & 32 deletions RecoLocalCalo/HcalRecProducers/src/HcalHitReconstructor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,36 +529,29 @@ void HcalHitReconstructor::fillDescriptions(edm::ConfigurationDescriptions& desc

edm::ParameterSetDescription saturationParametersDesc;
saturationParametersDesc.add<int>("maxADCvalue", 127);
desc.add<edm::ParameterSetDescription>("saturationParameters", saturationParametersDesc);

// Conditionally add saturationParameters if setSaturationFlags is true
desc.ifValue(
edm::ParameterDescription<bool>("setSaturationFlags", true, true),
false >> edm::EmptyGroupDescription() or true >> edm::ParameterDescription<edm::ParameterSetDescription>(
"saturationParameters", saturationParametersDesc, true));

// Add digiTimeFromDB conditionally based on Subdetector being "HF"
desc.ifValue(edm::ParameterDescription<std::string>("Subdetector", "HF", true),
"HF" >> edm::ParameterDescription<bool>("digiTimeFromDB", false, true) or
"HO" >> edm::EmptyGroupDescription() // Default case: do nothing
);
desc.add<bool>("setSaturationFlags", true);
desc.add<std::string>("Subdetector", "HF");
desc.add<bool>("digiTimeFromDB", false);

edm::ParameterSetDescription hfTimingTrustParametersDesc;
hfTimingTrustParametersDesc.add<int>("hfTimingTrustLevel1", 1);
hfTimingTrustParametersDesc.add<int>("hfTimingTrustLevel2", 4);
desc.add<edm::ParameterSetDescription>("hfTimingTrustParameters", hfTimingTrustParametersDesc);

// Conditionally add hfTimingTrustParameters if setTimingTrustFlags is true
desc.ifValue(edm::ParameterDescription<bool>("setTimingTrustFlags", true, true),
false >> edm::EmptyGroupDescription() or
true >> edm::ParameterDescription<edm::ParameterSetDescription>(
"hfTimingTrustParameters", hfTimingTrustParametersDesc, true));
desc.add<bool>("setTimingTrustFlags", true);
desc.add<bool>("setNoiseFlags", true);

{
edm::ParameterSetDescription digiStatDesc;
HcalHFStatusBitFromDigis::fillHFDigiTimeParamsDesc(digiStatDesc);
edm::ParameterSetDescription digiStatDesc;
HcalHFStatusBitFromDigis::fillHFDigiTimeParamsDesc(digiStatDesc);
desc.add<edm::ParameterSetDescription>("digistat", digiStatDesc);

edm::ParameterSetDescription hfInWindowStatDesc;
HcalHFStatusBitFromDigis::fillHFTimeInWindowParamsDesc(hfInWindowStatDesc);
edm::ParameterSetDescription hfInWindowStatDesc;
HcalHFStatusBitFromDigis::fillHFTimeInWindowParamsDesc(hfInWindowStatDesc);
desc.add<edm::ParameterSetDescription>("HFInWindowStat", hfInWindowStatDesc);

{
edm::ParameterSetDescription s9s1StatDesc;
s9s1StatDesc.add<std::vector<double>>("short_optimumSlope",
{-99999,
Expand Down Expand Up @@ -597,7 +590,10 @@ void HcalHitReconstructor::fillDescriptions(edm::ConfigurationDescriptions& desc
s9s1StatDesc.add<std::vector<double>>("longETParams", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
s9s1StatDesc.add<int>("HcalAcceptSeverityLevel", 9);
s9s1StatDesc.add<bool>("isS8S1", false);
desc.add<edm::ParameterSetDescription>("S9S1stat", s9s1StatDesc);
}

{
edm::ParameterSetDescription s8s1StatDesc;
s8s1StatDesc.add<std::vector<double>>(
"short_optimumSlope", {0.30, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10});
Expand All @@ -611,7 +607,10 @@ void HcalHitReconstructor::fillDescriptions(edm::ConfigurationDescriptions& desc
s8s1StatDesc.add<std::vector<double>>("longETParams", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
s8s1StatDesc.add<int>("HcalAcceptSeverityLevel", 9);
s8s1StatDesc.add<bool>("isS8S1", true);
desc.add<edm::ParameterSetDescription>("S8S1stat", s8s1StatDesc);
}

{
edm::ParameterSetDescription petStatDesc;
petStatDesc.add<std::vector<double>>("short_R", {0.8});
petStatDesc.add<std::vector<double>>(
Expand All @@ -625,17 +624,7 @@ void HcalHitReconstructor::fillDescriptions(edm::ConfigurationDescriptions& desc
petStatDesc.add<std::vector<double>>("short_R_29", {0.8});
petStatDesc.add<std::vector<double>>("long_R_29", {0.8});
petStatDesc.add<int>("HcalAcceptSeverityLevel", 9);

// Conditionally add S9S1stat if setNoiseFlags is true
desc.ifValue(
edm::ParameterDescription<bool>("setNoiseFlags", true, true),
false >> edm::EmptyGroupDescription() or
true >>
(edm::ParameterDescription<edm::ParameterSetDescription>("digistat", digiStatDesc, true) and
edm::ParameterDescription<edm::ParameterSetDescription>("HFInWindowStat", hfInWindowStatDesc, true) and
edm::ParameterDescription<edm::ParameterSetDescription>("S9S1stat", s9s1StatDesc, true) and
edm::ParameterDescription<edm::ParameterSetDescription>("S8S1stat", s8s1StatDesc, true) and
edm::ParameterDescription<edm::ParameterSetDescription>("PETstat", petStatDesc, true)));
desc.add<edm::ParameterSetDescription>("PETstat", petStatDesc);
}

desc.add<std::string>("dataOOTCorrectionName", std::string(""));
Expand Down

0 comments on commit e214fa7

Please sign in to comment.