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

utilities for HGCAL end of life #30697

Merged
merged 14 commits into from
Jul 17, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class HGCalImagingAlgo : public HGCalClusteringAlgoBase {
iDesc.add<edm::ParameterSetDescription>("noises", descNestedNoises);
edm::ParameterSetDescription descNestedNoiseMIP;
descNestedNoiseMIP.add<bool>("scaleByDose", false);
descNestedNoiseMIP.add<double>("scaleByDoseFactor", 1.);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remind me why all these parameters are defined inside a Reco producer, but they are only read and used in Simulation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ciao @perrotta valid and good question.
The cluster algorithms import, by deliberate choice, parameters from the digitisation psets to access info like noise etc, and to ensure they use values consistent with those employed upstream. Together with parameters actually employed, the descriptor of the clustering producers end up having to include also values which are not employed actually.
I don't particularly like this set up however I would not plan to re-engineer this aspect of the clustering and if these lines are not added redo crashes lamenting the producer is provided an invalid parameter.

I hope I am clear and accurate enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is not related to the underlying mechanism of validating the input parameters but to the way in which parameters used for reconstruction and simulation have been bundled together in the same PSet. Once you've made this choice, anything else is just a mere consequence of that.

iDesc.add<edm::ParameterSetDescription>("scaleByDose", descNestedNoiseMIP);
descNestedNoiseMIP.add<std::string>("doseMap", "");
iDesc.add<edm::ParameterSetDescription>("doseMap", descNestedNoiseMIP);
Expand Down
1 change: 1 addition & 0 deletions RecoLocalCalo/HGCalRecProducers/plugins/HGCalCLUEAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class HGCalCLUEAlgoT : public HGCalClusteringAlgoBase {
edm::ParameterSetDescription descNestedNoiseMIP;
descNestedNoiseMIP.add<bool>("scaleByDose", false);
descNestedNoiseMIP.add<unsigned int>("scaleByDoseAlgo", 0);
descNestedNoiseMIP.add<double>("scaleByDoseFactor", 1.);
descNestedNoiseMIP.add<std::string>("doseMap", "");
descNestedNoiseMIP.add<double>("noise_MIP", 1. / 100.);
iDesc.add<edm::ParameterSetDescription>("noiseMip", descNestedNoiseMIP);
Expand Down
4 changes: 4 additions & 0 deletions SimCalorimetry/HGCalSimAlgos/test/HGCSiNoiseMapAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ HGCSiNoiseMapAnalyzer::HGCSiNoiseMapAnalyzer(const edm::ParameterSet &iConfig) {
//configure the dose map
std::string doseMapURL(iConfig.getParameter<std::string>("doseMap"));
unsigned int doseMapAlgo(iConfig.getParameter<unsigned int>("doseMapAlgo"));
double scaleByDoseFactor(iConfig.getParameter<double>("scaleByDoseFactor"));
std::vector<double> ileakParam(
iConfig.getParameter<edm::ParameterSet>("ileakParam").template getParameter<std::vector<double>>("ileakParam"));
std::vector<double> cceParamFine(
Expand All @@ -82,11 +83,14 @@ HGCSiNoiseMapAnalyzer::HGCSiNoiseMapAnalyzer(const edm::ParameterSet &iConfig) {

noiseMaps_[DetId::HGCalEE] = std::unique_ptr<HGCalSiNoiseMap>(new HGCalSiNoiseMap);
noiseMaps_[DetId::HGCalEE]->setDoseMap(doseMapURL, doseMapAlgo);
noiseMaps_[DetId::HGCalEE]->setFluenceScaleFactor(scaleByDoseFactor);

noiseMaps_[DetId::HGCalEE]->setIleakParam(ileakParam);
noiseMaps_[DetId::HGCalEE]->setCceParam(cceParamFine, cceParamThin, cceParamThick);

noiseMaps_[DetId::HGCalHSi] = std::unique_ptr<HGCalSiNoiseMap>(new HGCalSiNoiseMap);
noiseMaps_[DetId::HGCalHSi]->setDoseMap(doseMapURL, doseMapAlgo);
noiseMaps_[DetId::HGCalHSi]->setFluenceScaleFactor(scaleByDoseFactor);
noiseMaps_[DetId::HGCalHSi]->setIleakParam(ileakParam);
noiseMaps_[DetId::HGCalHSi]->setCceParam(cceParamFine, cceParamThin, cceParamThick);

Expand Down
3 changes: 2 additions & 1 deletion SimCalorimetry/HGCalSimAlgos/test/hgcsiNoiseMapTester_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
process = cms.Process("demo",eras.Phase2C8)

process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '')

Expand All @@ -20,6 +20,7 @@

from SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi import HGCAL_ileakParam_toUse, HGCAL_cceParams_toUse
process.plotter_eol = cms.EDAnalyzer("HGCSiNoiseMapAnalyzer",
scaleByDoseFactor = cms.double(1.),
doseMap = cms.string( options.doseMap ),
doseMapAlgo = cms.uint32(0),
ileakParam = HGCAL_ileakParam_toUse,
Expand Down
3 changes: 3 additions & 0 deletions SimCalorimetry/HGCalSimProducers/interface/HGCDigitizerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ class HGCDigitizerBase {
//determines if the dose map should be used instead
bool scaleByDose_;

//multiplicative fator to scale fluence map
double scaleByDoseFactor_;

//path to dose map
std::string doseMapFile_;

Expand Down
45 changes: 38 additions & 7 deletions SimCalorimetry/HGCalSimProducers/python/hgcalDigitizer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,32 @@
cceParamFine_ttu800 = [1.5e+15, 3.35246e-17, 0.251679] #120
cceParamThin_ttu800 = [1.5e+15, -1.62096e-16, 0.293828] #200
cceParamThick_ttu800 = [6e+14, -5.95259e-16, 0.183929] #300
# scaling the ddfz curve to match Timo's 800V measuremetn at 3.5E15
cceParamFine_epi800 = [3.5e+15, -1.4285714e-17, 0.263812] #120
# line+log tdr 600V EPI
cceParamFine_epi600 = [3.5e+15, -9.73872e-19, 0.263812] #100
cceParamFine_epi600 = [3.5e+15, -3.428571e-17, 0.263812] #120 - scaling the ddfz curve to match Timo's 600V measurement at 3.5E15
cceParamThin_epi600 = [1.5e+15, -3.09878e-16, 0.211207] #200
cceParamThick_epi600 = [6e+14, -7.96539e-16, 0.251751] #300


HGCAL_cceParams_toUse = cms.PSet(
cceParamFine = cms.vdouble(cceParamFine_tdr600),
cceParamFine = cms.vdouble(cceParamFine_epi600),
cceParamThin = cms.vdouble(cceParamThin_tdr600),
cceParamThick = cms.vdouble(cceParamThick_tdr600)
)

HGCAL_noise_fC = cms.PSet(
scaleByDose = cms.bool(False),
scaleByDoseAlgo = cms.uint32(0),
scaleByDoseFactor = cms.double(1),
doseMap = cms.string(""),
values = cms.vdouble( [x*fC_per_ele for x in nonAgedNoises] ), #100,200,300 um
)

HGCAL_noise_heback = cms.PSet(
scaleByDose = cms.bool(False),
scaleByDoseAlgo = cms.uint32(0),
scaleByDoseFactor = cms.double(1),
doseMap = cms.string(""), #empty dose map at begin-of-life
noise_MIP = cms.double(1./100.)
)
Expand Down Expand Up @@ -206,13 +211,35 @@
#function to set noise to aged HGCal
endOfLifeCCEs = [0.5, 0.5, 0.7]
endOfLifeNoises = [2400.0,2250.0,1750.0]
def HGCal_setEndOfLifeNoise(process,byDose=True,byDoseAlgo=0):
def HGCal_setEndOfLifeNoise(process,byDose=True,byDoseAlgo=0,byDoseFactor=1):
"""includes all effects from radiation and gain choice"""
# byDoseAlgo is used as a collection of bits to toggle: FLUENCE, CCE, NOISE, PULSEPERGAIN, CACHEDOP (from lsb to Msb)
process=HGCal_setRealisticNoiseSi(process,byDose=byDose,byDoseAlgo=byDoseAlgo)
process=HGCal_setRealisticNoiseSci(process,byDose=byDose,byDoseAlgo=byDoseAlgo)
process=HGCal_setRealisticNoiseSi(process,byDose=byDose,byDoseAlgo=byDoseAlgo,byDoseFactor=byDoseFactor)
process=HGCal_setRealisticNoiseSci(process,byDose=byDose,byDoseAlgo=byDoseAlgo,byDoseFactor=byDoseFactor)
return process

def HGCal_setEndOfLifeNoise_4000(process):
process.HGCAL_cceParams_toUse = cms.PSet(
cceParamFine = cms.vdouble(cceParamFine_epi800),
cceParamThin = cms.vdouble(cceParamThin_tdr800),
cceParamThick = cms.vdouble(cceParamThick_tdr800)
)
process.HGCAL_ileakParam_toUse = cms.PSet(
ileakParam = cms.vdouble(ileakParam_800V)
)
return HGCal_setEndOfLifeNoise(process,byDoseFactor=1.333)

def HGCal_setEndOfLifeNoise_1500(process):
process.HGCAL_cceParams_toUse = cms.PSet(
cceParamFine = cms.vdouble(cceParamFine_epi600),
cceParamThin = cms.vdouble(cceParamThin_tdr600),
cceParamThick = cms.vdouble(cceParamThick_tdr600)
)
process.HGCAL_ileakParam_toUse = cms.PSet(
ileakParam = cms.vdouble(ileakParam_600V)
)
return HGCal_setEndOfLifeNoise(process,byDoseFactor=0.5)

def HGCal_ignoreFluence(process):
"""include all effects except fluence impact on leakage current and CCE"""
# byDoseAlgo is used as a collection of bits to toggle: FLUENCE, CCE, NOISE, PULSEPERGAIN, CACHEDOP (from lsb to Msb)
Expand Down Expand Up @@ -256,10 +283,11 @@ def HGCal_useCaching(process):

doseMap = cms.string("SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.7.20.txt")

def HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap):
def HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap,byDoseFactor=1):
process.HGCAL_noise_fC = cms.PSet(
scaleByDose = cms.bool(byDose),
scaleByDoseAlgo = cms.uint32(byDoseAlgo),
scaleByDoseFactor = cms.double(byDoseFactor),
doseMap = byDoseMap,
values = cms.vdouble( [x*fC_per_ele for x in endOfLifeNoises] ), #100,200,300 um
)
Expand All @@ -271,10 +299,11 @@ def HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap
)
return process

def HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap):
def HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap,byDoseFactor=1):
process.HGCAL_noise_heback = cms.PSet(
scaleByDose = cms.bool(byDose),
scaleByDoseAlgo = cms.uint32(byDoseAlgo),
scaleByDoseFactor = cms.double(byDoseFactor),
doseMap = byDoseMap,
noise_MIP = cms.double(1./5.) #uses noise map
)
Expand All @@ -284,12 +313,14 @@ def HGCal_disableNoise(process):
process.HGCAL_noise_fC = cms.PSet(
scaleByDose = cms.bool(False),
scaleByDoseAlgo = cms.uint32(0),
scaleByDoseFactor = cms.double(1),
doseMap = cms.string(""),
values = cms.vdouble(0,0,0), #100,200,300 um
)
process.HGCAL_noise_heback = cms.PSet(
scaleByDose = cms.bool(False),
scaleByDoseAlgo = cms.uint32(0),
scaleByDoseFactor = cms.double(1),
doseMap = cms.string(""),
noise_MIP = cms.double(0.) #zero noise
)
Expand Down
17 changes: 11 additions & 6 deletions SimCalorimetry/HGCalSimProducers/src/HGCDigitizerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ HGCDigitizerBase<DFr>::HGCDigitizerBase(const edm::ParameterSet& ps)
scaleByDose_ = myCfg_.getParameter<edm::ParameterSet>("noise_fC").template getParameter<bool>("scaleByDose");
int scaleByDoseAlgo =
myCfg_.getParameter<edm::ParameterSet>("noise_fC").template getParameter<uint32_t>("scaleByDoseAlgo");
scaleByDoseFactor_ = myCfg_.getParameter<edm::ParameterSet>("noise_fC").getParameter<double>("scaleByDoseFactor");
doseMapFile_ = myCfg_.getParameter<edm::ParameterSet>("noise_fC").template getParameter<std::string>("doseMap");
scal_.setDoseMap(doseMapFile_, scaleByDoseAlgo);
scal_.setFluenceScaleFactor(scaleByDoseFactor_);
} else {
noise_fC_.resize(1, 1.f);
}
Expand Down Expand Up @@ -188,22 +190,25 @@ void HGCDigitizerBase<DFr>::runSimple(std::unique_ptr<HGCDigitizerBase::DColl>&

template <class DFr>
void HGCDigitizerBase<DFr>::updateOutput(std::unique_ptr<HGCDigitizerBase::DColl>& coll, const DFr& rawDataFrame) {
// 9th is the sample of hte intime amplitudes
int itIdx(9);
if (rawDataFrame.size() <= itIdx + 2)
return;

DFr dataFrame(rawDataFrame.id());
dataFrame.resize(5);
bool putInEvent(false);

// if in time amplitude is above threshold
// , then don't push back the dataframe
if ((!rawDataFrame[itIdx].threshold())) {
return;
}

for (int it = 0; it < 5; it++) {
dataFrame.setSample(it, rawDataFrame[itIdx - 2 + it]);
if (it == 2)
putInEvent = rawDataFrame[itIdx - 2 + it].threshold();
}

if (putInEvent) {
coll->push_back(dataFrame);
}
coll->push_back(dataFrame);
}

// cause the compiler to generate the appropriate code
Expand Down
2 changes: 2 additions & 0 deletions SimCalorimetry/HGCalSimProducers/src/HGCHEbackDigitizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ HGCHEbackDigitizer::HGCHEbackDigitizer(const edm::ParameterSet& ps) : HGCDigitiz
sipmMapFile_ = cfg.getParameter<std::string>("sipmMap");
scaleByDose_ = cfg.getParameter<edm::ParameterSet>("noise").getParameter<bool>("scaleByDose");
unsigned int scaleByDoseAlgo = cfg.getParameter<edm::ParameterSet>("noise").getParameter<uint32_t>("scaleByDoseAlgo");
scaleByDoseFactor_ = cfg.getParameter<edm::ParameterSet>("noise").getParameter<double>("scaleByDoseFactor");
doseMapFile_ = cfg.getParameter<edm::ParameterSet>("noise").getParameter<std::string>("doseMap");
noise_MIP_ = cfg.getParameter<edm::ParameterSet>("noise").getParameter<double>("noise_MIP");
thresholdFollowsMIP_ = cfg.getParameter<bool>("thresholdFollowsMIP");
Expand All @@ -31,6 +32,7 @@ HGCHEbackDigitizer::HGCHEbackDigitizer(const edm::ParameterSet& ps) : HGCDigitiz
sdPixels_ = cfg.getParameter<double>("sdPixels");

scal_.setDoseMap(doseMapFile_, scaleByDoseAlgo);
scal_.setFluenceScaleFactor(scaleByDoseFactor_);
scal_.setSipmMap(sipmMapFile_);
}

Expand Down