Skip to content

Commit

Permalink
Merge pull request #16526 from kpedro88/Phase1-DbHardcode4
Browse files Browse the repository at this point in the history
Update SiPM parameters and fix a few bugs in hardcode conditions
  • Loading branch information
cmsbuild committed Nov 16, 2016
2 parents 1a23a91 + 8bb6f5a commit c768c55
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 45 deletions.
7 changes: 4 additions & 3 deletions CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h
Expand Up @@ -12,7 +12,7 @@ class HcalHardcodeParameters {
//construct from values
HcalHardcodeParameters(double pedestal, double pedestalWidth, std::vector<double> gain, std::vector<double> gainWidth,
int qieType, std::vector<double> qieOffset, std::vector<double> qieSlope, int mcShape, int recoShape,
double photoelectronsToAnalog, double darkCurrent);
double photoelectronsToAnalog, std::vector<double> darkCurrent);
//construct from pset
HcalHardcodeParameters(const edm::ParameterSet & p);

Expand All @@ -31,7 +31,7 @@ class HcalHardcodeParameters {
const int mcShape() const { return mcShape_; }
const int recoShape() const { return recoShape_; }
const double photoelectronsToAnalog() const { return photoelectronsToAnalog_; }
const double darkCurrent() const { return darkCurrent_; }
const double darkCurrent(unsigned index) const { return darkCurrent_.at(index); }

private:
//member variables
Expand All @@ -40,7 +40,8 @@ class HcalHardcodeParameters {
int qieType_;
std::vector<double> qieOffset_, qieSlope_;
int mcShape_, recoShape_;
double photoelectronsToAnalog_, darkCurrent_;
double photoelectronsToAnalog_;
std::vector<double> darkCurrent_;
};

#endif
28 changes: 20 additions & 8 deletions CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc
Expand Up @@ -14,7 +14,7 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"

HcalDbHardcode::HcalDbHardcode()
: theDefaultParameters_(3.0,0.5,{0.2,0.2},{0.0,0.0},0,{0.0,0.0,0.0,0.0},{0.9,0.9,0.9,0.9},125,105,0.0,0.0), //"generic" set of conditions
: theDefaultParameters_(3.0,0.5,{0.2,0.2},{0.0,0.0},0,{0.0,0.0,0.0,0.0},{0.9,0.9,0.9,0.9},125,105,0.0,{0.0}), //"generic" set of conditions
setHB_(false), setHE_(false), setHF_(false), setHO_(false),
setHBUpgrade_(false), setHEUpgrade_(false), setHFUpgrade_(false),
useHBUpgrade_(false), useHEUpgrade_(false), useHOUpgrade_(true),
Expand Down Expand Up @@ -60,8 +60,8 @@ const int HcalDbHardcode::getGainIndex(HcalGenericDetId fId){
else index = 1;
} else if (fId.genericSubdet() == HcalGenericDetId::HcalGenForward) {
HcalDetId hid(fId);
if (hid.depth() == 1) index = 0;
else if (hid.depth() == 2) index = 1;
if (hid.depth() % 2 == 1) index = 0; //depths 1,3
else if (hid.depth() % 2 == 0) index = 1; //depths 2,4
}
return index;
}
Expand Down Expand Up @@ -563,17 +563,29 @@ HcalSiPMParameter HcalDbHardcode::makeHardcodeSiPMParameter (HcalGenericDetId fI
// rule for type: cells with >4 layers use larger device (3.3mm diameter), otherwise 2.8mm
HcalSiPMType theType = HcalNoSiPM;
double thePe2fC = getParameters(fId).photoelectronsToAnalog();
double theDC = getParameters(fId).darkCurrent();
double theDC = getParameters(fId).darkCurrent(0);
if (fId.genericSubdet() == HcalGenericDetId::HcalGenBarrel && useHBUpgrade_) {
HcalDetId hid(fId);
int nLayersInDepth = getLayersInDepth(hid.ietaAbs(),hid.depth(),topo);
if(nLayersInDepth > 4) theType = HcalHBHamamatsu2;
else theType = HcalHBHamamatsu1;
if(nLayersInDepth > 4) {
theType = HcalHBHamamatsu2;
theDC = getParameters(fId).darkCurrent(1);
}
else {
theType = HcalHBHamamatsu1;
theDC = getParameters(fId).darkCurrent(0);
}
} else if (fId.genericSubdet() == HcalGenericDetId::HcalGenEndcap && useHEUpgrade_) {
HcalDetId hid(fId);
int nLayersInDepth = getLayersInDepth(hid.ietaAbs(),hid.depth(),topo);
if(nLayersInDepth > 4) theType = HcalHEHamamatsu2;
else theType = HcalHEHamamatsu1;
if(nLayersInDepth > 4) {
theType = HcalHEHamamatsu2;
theDC = getParameters(fId).darkCurrent(1);
}
else {
theType = HcalHEHamamatsu1;
theDC = getParameters(fId).darkCurrent(0);
}
} else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter && useHOUpgrade_) {
theType = HcalHOHamamatsu;
}
Expand Down
4 changes: 2 additions & 2 deletions CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc
Expand Up @@ -2,7 +2,7 @@

HcalHardcodeParameters::HcalHardcodeParameters(double pedestal, double pedestalWidth, std::vector<double> gain, std::vector<double> gainWidth,
int qieType, std::vector<double> qieOffset, std::vector<double> qieSlope, int mcShape, int recoShape,
double photoelectronsToAnalog, double darkCurrent)
double photoelectronsToAnalog, std::vector<double> darkCurrent)
: pedestal_(pedestal),
pedestalWidth_(pedestalWidth),
gain_(gain),
Expand All @@ -28,6 +28,6 @@ HcalHardcodeParameters::HcalHardcodeParameters(const edm::ParameterSet & p)
mcShape_(p.getParameter<int>("mcShape")),
recoShape_(p.getParameter<int>("recoShape")),
photoelectronsToAnalog_(p.getParameter<double>("photoelectronsToAnalog")),
darkCurrent_(p.getParameter<double>("darkCurrent"))
darkCurrent_(p.getParameter<std::vector<double>>("darkCurrent"))
{
}
Expand Up @@ -26,8 +26,8 @@
killHE = cms.bool(False),
useLayer0Weight = cms.bool(False),
hb = cms.PSet(
pedestal = cms.double(3.0),
pedestalWidth = cms.double(0.55),
pedestal = cms.double(3.285),
pedestalWidth = cms.double(0.809),
gain = cms.vdouble(0.19),
gainWidth = cms.vdouble(0.0),
qieType = cms.int32(0),
Expand All @@ -36,11 +36,11 @@
mcShape = cms.int32(125),
recoShape = cms.int32(105),
photoelectronsToAnalog = cms.double(0.0),
darkCurrent = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
),
he = cms.PSet(
pedestal = cms.double(3.0),
pedestalWidth = cms.double(0.79),
pedestal = cms.double(3.163),
pedestalWidth = cms.double(0.9698),
gain = cms.vdouble(0.23),
gainWidth = cms.vdouble(0),
qieType = cms.int32(0),
Expand All @@ -49,11 +49,11 @@
mcShape = cms.int32(125),
recoShape = cms.int32(105),
photoelectronsToAnalog = cms.double(0.0),
darkCurrent = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
),
hf = cms.PSet(
pedestal = cms.double(3.0),
pedestalWidth = cms.double(0.84),
pedestal = cms.double(9.354),
pedestalWidth = cms.double(2.516),
gain = cms.vdouble(0.14,0.135),
gainWidth = cms.vdouble(0.0,0.0),
qieType = cms.int32(0),
Expand All @@ -62,11 +62,11 @@
mcShape = cms.int32(301),
recoShape = cms.int32(301),
photoelectronsToAnalog = cms.double(0.0),
darkCurrent = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
),
ho = cms.PSet(
pedestal = cms.double(11.0),
pedestalWidth = cms.double(0.57),
pedestal = cms.double(12.06),
pedestalWidth = cms.double(0.6285),
gain = cms.vdouble(0.0060,0.0087),
gainWidth = cms.vdouble(0.0,0.0),
qieType = cms.int32(0),
Expand All @@ -75,33 +75,33 @@
mcShape = cms.int32(201),
recoShape = cms.int32(201),
photoelectronsToAnalog = cms.double(4.0),
darkCurrent = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
),
hbUpgrade = cms.PSet(
pedestal = cms.double(17.3),
pedestalWidth = cms.double(1.5),
gain = cms.vdouble(1/3568.), #62.06 is pe/GeV 57.5 is fC/pe.
gain = cms.vdouble(1/2276.), #51.72 is pe/GeV 44.0 is fC/pe.
gainWidth = cms.vdouble(0),
qieType = cms.int32(2),
qieOffset = cms.vdouble(0.,0.,0.,0.),
qieSlope = cms.vdouble(0.05376,0.05376,0.05376,0.05376), #1/(3.1*6) where 6 is shunt factor
mcShape = cms.int32(203),
recoShape = cms.int32(203),
photoelectronsToAnalog = cms.double(57.5),
darkCurrent = cms.double(0.055),
photoelectronsToAnalog = cms.double(44.0),
darkCurrent = cms.vdouble(0.01,0.015),
),
heUpgrade = cms.PSet(
pedestal = cms.double(17.3),
pedestalWidth = cms.double(1.5),
gain = cms.vdouble(1/3568.), #62.06 is pe/GeV 57.5 is fC/pe.
gain = cms.vdouble(1/2276.), #51.72 is pe/GeV 44.0 is fC/pe.
gainWidth = cms.vdouble(0),
qieType = cms.int32(2),
qieOffset = cms.vdouble(0.,0.,0.,0.),
qieSlope = cms.vdouble(0.05376,0.05376,0.05376,0.05376), #1/(3.1*6) where 6 is shunt factor
mcShape = cms.int32(203),
recoShape = cms.int32(203),
photoelectronsToAnalog = cms.double(57.5),
darkCurrent = cms.double(0.055),
photoelectronsToAnalog = cms.double(44.0),
darkCurrent = cms.vdouble(0.01,0.015),
),
hfUpgrade = cms.PSet(
pedestal = cms.double(13.33),
Expand All @@ -114,16 +114,16 @@
mcShape = cms.int32(301),
recoShape = cms.int32(301),
photoelectronsToAnalog = cms.double(0.0),
darkCurrent = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
),
# types (in order): HcalHOZecotek, HcalHOHamamatsu, HcalHEHamamatsu1, HcalHEHamamatsu2, HcalHBHamamatsu1, HcalHBHamamatsu2
SiPMCharacteristics = cms.VPSet(
cms.PSet( pixels = cms.int32(36000), crosstalk = cms.double(0.0), nonlin1 = cms.double(1.0), nonlin2 = cms.double(0.0), nonlin3 = cms.double(0.0) ),
cms.PSet( pixels = cms.int32(2500), crosstalk = cms.double(0.0), nonlin1 = cms.double(1.0), nonlin2 = cms.double(0.0), nonlin3 = cms.double(0.0) ),
cms.PSet( pixels = cms.int32(27370), crosstalk = cms.double(0.32), nonlin1 = cms.double(1.00985), nonlin2 = cms.double(7.84089E-6), nonlin3 = cms.double(2.86282E-10) ),
cms.PSet( pixels = cms.int32(38018), crosstalk = cms.double(0.32), nonlin1 = cms.double(1.00546), nonlin2 = cms.double(6.40239E-6), nonlin3 = cms.double(1.27011E-10) ),
cms.PSet( pixels = cms.int32(27370), crosstalk = cms.double(0.32), nonlin1 = cms.double(1.00985), nonlin2 = cms.double(7.84089E-6), nonlin3 = cms.double(2.86282E-10) ),
cms.PSet( pixels = cms.int32(38018), crosstalk = cms.double(0.32), nonlin1 = cms.double(1.00546), nonlin2 = cms.double(6.40239E-6), nonlin3 = cms.double(1.27011E-10) ),
cms.PSet( pixels = cms.int32(27370), crosstalk = cms.double(0.17), nonlin1 = cms.double(1.00985), nonlin2 = cms.double(7.84089E-6), nonlin3 = cms.double(2.86282E-10) ),
cms.PSet( pixels = cms.int32(38018), crosstalk = cms.double(0.196), nonlin1 = cms.double(1.00546), nonlin2 = cms.double(6.40239E-6), nonlin3 = cms.double(1.27011E-10) ),
cms.PSet( pixels = cms.int32(27370), crosstalk = cms.double(0.17), nonlin1 = cms.double(1.00985), nonlin2 = cms.double(7.84089E-6), nonlin3 = cms.double(2.86282E-10) ),
cms.PSet( pixels = cms.int32(38018), crosstalk = cms.double(0.196), nonlin1 = cms.double(1.00546), nonlin2 = cms.double(6.40239E-6), nonlin3 = cms.double(1.27011E-10) ),
),
)

Expand Down
14 changes: 7 additions & 7 deletions CalibCalorimetry/HcalPlugins/src/HcalHardcodeCalibrations.cc
Expand Up @@ -873,7 +873,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_hb.add<int>("mcShape",125);
desc_hb.add<int>("recoShape",105);
desc_hb.add<double>("photoelectronsToAnalog",0.0);
desc_hb.add<double>("darkCurrent",0.0);
desc_hb.add<std::vector<double>>("darkCurrent",std::vector<double>(0.0));
desc.add<edm::ParameterSetDescription>("hb", desc_hb);

edm::ParameterSetDescription desc_hbUpgrade;
Expand All @@ -887,7 +887,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_hbUpgrade.add<int>("mcShape",203);
desc_hbUpgrade.add<int>("recoShape",203);
desc_hbUpgrade.add<double>("photoelectronsToAnalog",57.5);
desc_hbUpgrade.add<double>("darkCurrent",0.055);
desc_hbUpgrade.add<std::vector<double>>("darkCurrent",std::vector<double>(0.055));
desc.add<edm::ParameterSetDescription>("hbUpgrade", desc_hbUpgrade);

edm::ParameterSetDescription desc_he;
Expand All @@ -901,7 +901,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_he.add<int>("mcShape",125);
desc_he.add<int>("recoShape",105);
desc_he.add<double>("photoelectronsToAnalog",0.0);
desc_he.add<double>("darkCurrent",0.0);
desc_he.add<std::vector<double>>("darkCurrent",std::vector<double>(0.0));
desc.add<edm::ParameterSetDescription>("he", desc_he);

edm::ParameterSetDescription desc_heUpgrade;
Expand All @@ -915,7 +915,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_heUpgrade.add<int>("mcShape",203);
desc_heUpgrade.add<int>("recoShape",203);
desc_heUpgrade.add<double>("photoelectronsToAnalog",57.5);
desc_heUpgrade.add<double>("darkCurrent",0.055);
desc_heUpgrade.add<std::vector<double>>("darkCurrent",std::vector<double>(0.055));
desc.add<edm::ParameterSetDescription>("heUpgrade", desc_heUpgrade);

edm::ParameterSetDescription desc_hf;
Expand All @@ -929,7 +929,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_hf.add<int>("mcShape",301);
desc_hf.add<int>("recoShape",301);
desc_hf.add<double>("photoelectronsToAnalog",0.0);
desc_hf.add<double>("darkCurrent",0.0);
desc_hf.add<std::vector<double>>("darkCurrent",std::vector<double>(0.0));
desc.add<edm::ParameterSetDescription>("hf", desc_hf);

edm::ParameterSetDescription desc_hfUpgrade;
Expand All @@ -943,7 +943,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_hfUpgrade.add<int>("mcShape",301);
desc_hfUpgrade.add<int>("recoShape",301);
desc_hfUpgrade.add<double>("photoelectronsToAnalog",0.0);
desc_hfUpgrade.add<double>("darkCurrent",0.0);
desc_hfUpgrade.add<std::vector<double>>("darkCurrent",std::vector<double>(0.0));
desc.add<edm::ParameterSetDescription>("hfUpgrade", desc_hfUpgrade);

edm::ParameterSetDescription desc_hfrecal;
Expand All @@ -964,7 +964,7 @@ void HcalHardcodeCalibrations::fillDescriptions(edm::ConfigurationDescriptions &
desc_ho.add<int>("mcShape",201);
desc_ho.add<int>("recoShape",201);
desc_ho.add<double>("photoelectronsToAnalog",4.0);
desc_ho.add<double>("darkCurrent",0.055);
desc_ho.add<std::vector<double>>("darkCurrent",std::vector<double>(0.0));
desc.add<edm::ParameterSetDescription>("ho", desc_ho);

edm::ParameterSetDescription validator_sipm;
Expand Down
Expand Up @@ -123,7 +123,6 @@
from Configuration.Eras.Modifier_run2_HE_2017_cff import run2_HE_2017
run2_HE_2017.toModify( hcalSimParameters,
he = dict(
photoelectronsToAnalog = cms.vdouble([57.5]*14),
doSiPMSmearing = cms.bool(True),
sipmTau = cms.double(10.),
)
Expand All @@ -132,7 +131,6 @@
from Configuration.Eras.Modifier_run3_HB_cff import run3_HB
run3_HB.toModify( hcalSimParameters,
hb = dict(
photoelectronsToAnalog = cms.vdouble([57.5]*16),
doSiPMSmearing = cms.bool(True),
sipmTau = cms.double(10.),
)
Expand Down

0 comments on commit c768c55

Please sign in to comment.