Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Text file formats for different data types is as following:
- # in first column comments the line
- HcalPedestals, HcalGains, HcalGainWidths have identical formats:
eta(int) phi(int) depth(int) det(HB,HE,HF) cap1_value(float) cap2_value(float) cap3_value(float) cap4_value(float) HcalDetId(int,optional)
- HcalPFCuts:
eta(int) phi(int) depth(int) det(HB,HE,HF) noiseThreshold(float) seedThreshold(float)
- HcalPedestalWidths:
eta(int) phi(int) depth(int) det(HB,HE,HF) sigma_1_1(float) sigma_2_1 sigma_2_2 sigma_3_1 sigma_3_2 sigma_3_3 sigma_4_1 sigma_4_2 sigma_4_3 sigma_4_4
- HcalQIEShape:
Expand Down Expand Up @@ -67,6 +69,8 @@ namespace HcalDbASCIIIO {
bool dumpObject(std::ostream& fOutput, const HcalGains& fObject);
bool getObject(std::istream& fInput, HcalGainWidths* fObject);
bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject);
bool getObject(std::istream& fInput, HcalPFCuts* fObject);
bool dumpObject(std::ostream& fOutput, const HcalPFCuts& fObject);
bool getObject(std::istream& fInput, HcalQIEData* fObject);
bool dumpObject(std::ostream& fOutput, const HcalQIEData& fObject);
bool getObject(std::istream& fInput, HcalCalibrationQIEData* fObject);
Expand Down
2 changes: 2 additions & 0 deletions CalibCalorimetry/HcalAlgos/interface/HcalDbHardcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "CondFormats/HcalObjects/interface/HcalPedestalWidth.h"
#include "CondFormats/HcalObjects/interface/HcalGain.h"
#include "CondFormats/HcalObjects/interface/HcalGainWidth.h"
#include "CondFormats/HcalObjects/interface/HcalPFCut.h"
#include "CondFormats/HcalObjects/interface/HcalZSThreshold.h"
#include "CondFormats/HcalObjects/interface/HcalQIECoder.h"
#include "CondFormats/HcalObjects/interface/HcalQIEShape.h"
Expand Down Expand Up @@ -100,6 +101,7 @@ class HcalDbHardcode {
HcalPedestalWidth makePedestalWidth(HcalGenericDetId fId, bool eff, const HcalTopology* topo, double intlumi);
HcalGain makeGain(HcalGenericDetId fId, bool fSmear = false) const;
HcalGainWidth makeGainWidth(HcalGenericDetId fId) const;
HcalPFCut makePFCut(HcalGenericDetId fId) const;
HcalZSThreshold makeZSThreshold(HcalGenericDetId fId) const;
HcalQIECoder makeQIECoder(HcalGenericDetId fId) const;
HcalCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId) const;
Expand Down
37 changes: 22 additions & 15 deletions CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class HcalHardcodeParameters {
public:
//default constructor
HcalHardcodeParameters() {}

//construct from values
HcalHardcodeParameters(double pedestal,
double pedestalWidth,
Expand All @@ -23,28 +24,33 @@ class HcalHardcodeParameters {
int recoShape,
double photoelectronsToAnalog,
const std::vector<double>& darkCurrent,
const std::vector<double>& noiseCorrelation);
const std::vector<double>& noiseCorrelation,
double noiseThreshold,
double seedThreshold);

//construct from pset
HcalHardcodeParameters(const edm::ParameterSet& p);

//destructor
virtual ~HcalHardcodeParameters() {}
inline virtual ~HcalHardcodeParameters() {}

//accessors
//note: all vector accessors use at() in order to throw exceptions for malformed conditions
const double pedestal() const { return pedestal_; }
const double pedestalWidth() const { return pedestalWidth_; }
const double gain(unsigned index) const { return gain_.at(index); }
const double gainWidth(unsigned index) const { return gainWidth_.at(index); }
const int zsThreshold() const { return zsThreshold_; }
const int qieType() const { return qieType_; }
const double qieOffset(unsigned range) const { return qieOffset_.at(range); }
const double qieSlope(unsigned range) const { return qieSlope_.at(range); }
const int mcShape() const { return mcShape_; }
const int recoShape() const { return recoShape_; }
const double photoelectronsToAnalog() const { return photoelectronsToAnalog_; }
const double darkCurrent(unsigned index, double intlumi) const;
const double noiseCorrelation(unsigned index) const;
inline double pedestal() const { return pedestal_; }
inline double pedestalWidth() const { return pedestalWidth_; }
inline double gain(unsigned index) const { return gain_.at(index); }
inline double gainWidth(unsigned index) const { return gainWidth_.at(index); }
inline int zsThreshold() const { return zsThreshold_; }
inline int qieType() const { return qieType_; }
inline double qieOffset(unsigned range) const { return qieOffset_.at(range); }
inline double qieSlope(unsigned range) const { return qieSlope_.at(range); }
inline int mcShape() const { return mcShape_; }
inline int recoShape() const { return recoShape_; }
inline double photoelectronsToAnalog() const { return photoelectronsToAnalog_; }
double darkCurrent(unsigned index, double intlumi) const;
double noiseCorrelation(unsigned index) const;
inline double noiseThreshold() const { return noiseThreshold_; }
inline double seedThreshold() const { return seedThreshold_; }

private:
//member variables
Expand All @@ -59,6 +65,7 @@ class HcalHardcodeParameters {
std::vector<double> noiseCorrelation_;
bool doSipmRadiationDamage_;
HcalSiPMRadiationDamage sipmRadiationDamage_;
double noiseThreshold_, seedThreshold_;
};

#endif
49 changes: 49 additions & 0 deletions CalibCalorimetry/HcalAlgos/src/HcalDbASCIIIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,48 @@ bool getHcalSingleObject(std::istream& fInput, T* fObject) {
return true;
}

template <class T>
bool dumpHcalDoubleFloatObject(std::ostream& fOutput, const T& fObject) {
char buffer[1024];
sprintf(buffer, "# %15s %15s %15s %15s %10s %10s %10s\n", "eta", "phi", "dep", "det", "value0", "value1", "DetId");
fOutput << buffer;
std::vector<DetId> channels = fObject.getAllChannels();
std::sort(channels.begin(), channels.end(), DetIdLess());
for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
const float value0 = fObject.getValues(*channel)->getValue0();
const float value1 = fObject.getValues(*channel)->getValue1();
HcalDbASCIIIO::dumpId(fOutput, *channel);
sprintf(buffer, " %10.7f %10.7f %10X\n", value0, value1, channel->rawId());
fOutput << buffer;
}
return true;
}

template <class S, class T>
bool getHcalDoubleFloatObject(std::istream& fInput, T* fObject) {
if (!fObject)
return false; //fObject = new T;
char buffer[1024];
while (fInput.getline(buffer, 1024)) {
if (buffer[0] == '#')
continue; //ignore comment
std::vector<std::string> items = splitString(std::string(buffer));
if (items.empty())
continue; // blank line
if (items.size() < 6) {
edm::LogWarning("Format Error") << "Bad line: " << buffer
<< "\n line must contain 6 items: eta, phi, depth, subdet, value0, value1"
<< std::endl;
continue;
}
DetId id = HcalDbASCIIIO::getId(items);
S fCondObject(id, atof(items[4].c_str()), atof(items[5].c_str()));
fObject->addValues(fCondObject);
}

return true;
}

template <class T>
bool dumpHcalSingleFloatObject(std::ostream& fOutput, const T& fObject) {
char buffer[1024];
Expand Down Expand Up @@ -389,6 +431,13 @@ namespace HcalDbASCIIIO {
}
bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject) { return dumpHcalObject(fOutput, fObject); }

bool getObject(std::istream& fInput, HcalPFCuts* fObject) {
return getHcalDoubleFloatObject<HcalPFCut>(fInput, fObject);
}
bool dumpObject(std::ostream& fOutput, const HcalPFCuts& fObject) {
return dumpHcalDoubleFloatObject(fOutput, fObject);
}

bool getObject(std::istream& fInput, HcalRespCorrs* fObject) {
return getHcalSingleObject<float, HcalRespCorr>(fInput, fObject);
}
Expand Down
11 changes: 10 additions & 1 deletion CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ HcalDbHardcode::HcalDbHardcode()
105, //Reco shape
0.0, //photoelectronsToAnalog
{0.0}, //dark current
{0.0} //noise correlation
{0.0}, //noise correlation
0.0, //PF noise threshold
0.1 //PF seed threshold
),
setHB_(false),
setHE_(false),
Expand Down Expand Up @@ -176,6 +178,13 @@ HcalGainWidth HcalDbHardcode::makeGainWidth(HcalGenericDetId fId) const { // Ge
return result;
}

HcalPFCut HcalDbHardcode::makePFCut(HcalGenericDetId fId) const { // GeV
float value0 = getParameters(fId).noiseThreshold();
float value1 = getParameters(fId).seedThreshold();
HcalPFCut result(fId.rawId(), value0, value1);
return result;
}

HcalZSThreshold HcalDbHardcode::makeZSThreshold(HcalGenericDetId fId) const {
int value = getParameters(fId).zsThreshold();
HcalZSThreshold result(fId.rawId(), value);
Expand Down
30 changes: 18 additions & 12 deletions CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#include "CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h"

HcalHardcodeParameters::HcalHardcodeParameters(double pedestal,
double pedestalWidth,
HcalHardcodeParameters::HcalHardcodeParameters(const double pedestal,
const double pedestalWidth,
const std::vector<double>& gain,
const std::vector<double>& gainWidth,
int zsThreshold,
int qieType,
const int zsThreshold,
const int qieType,
const std::vector<double>& qieOffset,
const std::vector<double>& qieSlope,
int mcShape,
int recoShape,
double photoelectronsToAnalog,
const int mcShape,
const int recoShape,
const double photoelectronsToAnalog,
const std::vector<double>& darkCurrent,
const std::vector<double>& noiseCorrelation)
const std::vector<double>& noiseCorrelation,
const double noiseTh,
const double seedTh)
: pedestal_(pedestal),
pedestalWidth_(pedestalWidth),
gain_(gain),
Expand All @@ -26,7 +28,9 @@ HcalHardcodeParameters::HcalHardcodeParameters(double pedestal,
photoelectronsToAnalog_(photoelectronsToAnalog),
darkCurrent_(darkCurrent),
noiseCorrelation_(noiseCorrelation),
doSipmRadiationDamage_(false) {}
doSipmRadiationDamage_(false),
noiseThreshold_(noiseTh),
seedThreshold_(seedTh) {}

HcalHardcodeParameters::HcalHardcodeParameters(const edm::ParameterSet& p)
: pedestal_(p.getParameter<double>("pedestal")),
Expand All @@ -42,15 +46,17 @@ HcalHardcodeParameters::HcalHardcodeParameters(const edm::ParameterSet& p)
photoelectronsToAnalog_(p.getParameter<double>("photoelectronsToAnalog")),
darkCurrent_(p.getParameter<std::vector<double>>("darkCurrent")),
noiseCorrelation_(p.getParameter<std::vector<double>>("noiseCorrelation")),
doSipmRadiationDamage_(p.getParameter<bool>("doRadiationDamage")) {
doSipmRadiationDamage_(p.getParameter<bool>("doRadiationDamage")),
noiseThreshold_(p.getParameter<double>("noiseThreshold")),
seedThreshold_(p.getParameter<double>("seedThreshold")) {
if (doSipmRadiationDamage_)
sipmRadiationDamage_ = HcalSiPMRadiationDamage(darkCurrent_, p.getParameter<edm::ParameterSet>("radiationDamage"));
}

const double HcalHardcodeParameters::darkCurrent(unsigned index, double intlumi) const {
double HcalHardcodeParameters::darkCurrent(unsigned index, double intlumi) const {
if (doSipmRadiationDamage_ and intlumi > 0)
return sipmRadiationDamage_.getDarkCurrent(intlumi, index);
return darkCurrent_.at(index);
}

const double HcalHardcodeParameters::noiseCorrelation(unsigned index) const { return noiseCorrelation_.at(index); }
double HcalHardcodeParameters::noiseCorrelation(unsigned index) const { return noiseCorrelation_.at(index); }
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
photoelectronsToAnalog = cms.double(0.3305),
darkCurrent = cms.vdouble(0.0),
noiseCorrelation = cms.vdouble(0.0),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(False)
),
he = cms.PSet(
Expand All @@ -64,6 +66,8 @@
photoelectronsToAnalog = cms.double(0.3305),
darkCurrent = cms.vdouble(0.0),
noiseCorrelation = cms.vdouble(0.0),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(False)
),
hf = cms.PSet(
Expand All @@ -80,6 +84,8 @@
photoelectronsToAnalog = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
noiseCorrelation = cms.vdouble(0.0),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(False)
),
ho = cms.PSet(
Expand All @@ -96,6 +102,8 @@
photoelectronsToAnalog = cms.double(4.0),
darkCurrent = cms.vdouble(0.0),
noiseCorrelation = cms.vdouble(0.0),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(False)
),
hbUpgrade = cms.PSet(
Expand All @@ -112,6 +120,8 @@
photoelectronsToAnalog = cms.double(40.0),
darkCurrent = cms.vdouble(0.01,0.015),
noiseCorrelation = cms.vdouble(0.26,0.254),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(True),
radiationDamage = cms.PSet(
temperatureBase = cms.double(20),
Expand Down Expand Up @@ -139,6 +149,8 @@
photoelectronsToAnalog = cms.double(40.0),
darkCurrent = cms.vdouble(0.01,0.015),
noiseCorrelation = cms.vdouble(0.26,0.254),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(True),
radiationDamage = cms.PSet(
temperatureBase = cms.double(20),
Expand Down Expand Up @@ -166,6 +178,8 @@
photoelectronsToAnalog = cms.double(0.0),
darkCurrent = cms.vdouble(0.0),
noiseCorrelation = cms.vdouble(0.0),
noiseThreshold = cms.double(0.0),
seedThreshold = cms.double(0.1),
doRadiationDamage = cms.bool(False)
),
# types (in order): HcalHOZecotek, HcalHOHamamatsu, HcalHEHamamatsu1, HcalHEHamamatsu2, HcalHBHamamatsu1, HcalHBHamamatsu2, HcalHPD
Expand Down Expand Up @@ -201,6 +215,7 @@
'LutMetadata',
'L1TriggerObjects',
'PFCorrs',
'PFCuts',
'ElectronicsMap',
'FrontEndMap',
'CovarianceMatrices',
Expand Down
Loading