34 std::ostringstream
str;
36 weightType = str.str();
41 getWeightsFromConfiguration(ps);
52 if (producedESPedestals_)
55 if (producedESWeights_) {
60 if (producedESADCToGeVConstant_)
64 producedESIntercalibConstants_ = ps.
getUntrackedParameter<
bool>(
"producedESIntercalibConstants",
true);
67 if (producedESIntercalibConstants_) {
68 if (intercalibConstantsFile_.empty()) {
73 findingRecord<ESIntercalibConstantsRcd>();
94 if (producedESChannelStatus_) {
95 if (!channelStatusFile_.empty()) {
100 findingRecord<ESChannelStatusRcd>();
104 if (producedESPedestals_)
105 findingRecord<ESPedestalsRcd>();
107 if (producedESWeights_) {
108 findingRecord<ESWeightStripGroupsRcd>();
109 findingRecord<ESTBWeightsRcd>();
112 if (producedESADCToGeVConstant_)
113 findingRecord<ESADCToGeVConstantRcd>();
125 std::cout <<
"ESTrivialConditionRetriever::setIntervalFor(): record key = " << rk.
name()
126 <<
"\ttime: " << iTime.
time().
value() << std::endl;
133 std::cout <<
" producing pedestals" << std::endl;
134 auto peds = std::make_unique<ESPedestals>();
136 ESitem.
mean = ESpedMean_;
137 ESitem.rms = ESpedRMS_;
142 for (
int iplane = 1; iplane <= 2; iplane++) {
143 for (
int izeta = -1; izeta <= 1; ++izeta) {
148 ESDetId aPositiveId(istrip, ix, iy, iplane, izeta);
149 peds->insert(std::make_pair(aPositiveId.
rawId(), ESitem));
158 std::cout <<
" produced pedestals" << std::endl;
164 auto xtalGroups = std::make_unique<ESWeightStripGroups>();
166 std::cout <<
"entering produce weight groups" << std::endl;
170 for (
int iplane = 1; iplane <= 2; iplane++) {
171 for (
int izeta = -1; izeta <= 1; ++izeta) {
176 ESDetId anESId(istrip, ix, iy, iplane, izeta);
178 xtalGroups->setValue(anESId.
rawId(), defaultGroupId);
186 std::cout <<
"done with produce weight groups" << std::endl;
193 auto ical = std::make_unique<ESIntercalibConstants>();
194 std::cout <<
"entring produce intercalib " << std::endl;
199 for (
int iplane = 1; iplane <= 2; iplane++) {
200 for (
int izeta = -1; izeta <= 1; ++izeta) {
205 ESDetId anESId(istrip, ix, iy, iplane, izeta);
206 double r = (double)std::rand() / (double(RAND_MAX) + double(1));
207 ical->setValue(anESId.
rawId(), intercalibConstantMean_ + r * intercalibConstantSigma_);
215 std::cout <<
"done produce intercalib" << std::endl;
222 return std::make_unique<ESADCToGeVConstant>(adcToGeVLowConstant_, adcToGeVHighConstant_);
227 auto tbwgt = std::make_unique<ESTBWeights>();
233 tbwgt->setValue(igrp, wgt);
241 if (!getWeightsFromFile_) {
245 }
else if (getWeightsFromFile_) {
249 while (!amplFile.eof()) {
250 for (
int j = 0;
j < 2; ++
j) {
251 std::vector<float> vec(3);
252 for (
int k = 0;
k < 3; ++
k) {
262 edm::LogError(
"ESTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
273 auto ecalStatus = std::make_unique<ESChannelStatus>();
280 for (
int iplane = 1; iplane <= 2; iplane++) {
281 for (
int izeta = -1; izeta <= 1; ++izeta) {
286 ESDetId anESId(istrip, ix, iy, iplane, izeta);
288 ecalStatus->setValue(anESId, 0);
302 if (!statusFile.good()) {
303 edm::LogError(
"ESTrivialConditionRetriever") <<
"*** Problems opening file: " << channelStatusFile_;
312 while (!statusFile.eof()) {
313 statusFile >> ESSubDet;
315 std::getline(statusFile, str);
318 statusFile >> hashIndex >>
status;
324 ecalStatus->setValue(esid, status);
326 edm::LogError(
"ESTrivialConditionRetriever") <<
" *** " << ESSubDet <<
" is not ES ";
338 auto ical = std::make_unique<ESChannelStatus>();
342 for (
int iplane = 1; iplane <= 2; iplane++) {
343 for (
int izeta = -1; izeta <= 1; ++izeta) {
348 ESDetId anESId(istrip, ix, iy, iplane, izeta);
350 ical->setValue(anESId, 0);
T getUntrackedParameter(std::string const &, T const &) const
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
virtual std::unique_ptr< ESIntercalibConstants > produceESIntercalibConstants(const ESIntercalibConstantsRcd &)
virtual std::unique_ptr< ESChannelStatus > produceESChannelStatus(const ESChannelStatusRcd &)
static const IOVSyncValue & endOfTime()
constexpr uint32_t rawId() const
get the raw id
std::pair< Time_t, Time_t > ValidityInterval
~ESTrivialConditionRetriever() override
static const int ISTRIP_MAX
Log< level::Error, false > LogError
virtual std::unique_ptr< ESChannelStatus > getChannelStatusFromConfiguration(const ESChannelStatusRcd &)
virtual std::unique_ptr< ESTBWeights > produceESTBWeights(const ESTBWeightsRcd &)
virtual std::unique_ptr< ESPedestals > produceESPedestals(const ESPedestalsRcd &)
static const IOVSyncValue & beginOfTime()
ESTrivialConditionRetriever(const edm::ParameterSet &pset)
const char * name() const
void getWeightsFromConfiguration(const edm::ParameterSet &ps)
virtual std::unique_ptr< ESWeightStripGroups > produceESWeightStripGroups(const ESWeightStripGroupsRcd &)
math::Matrix< 2, 3 >::type ESWeightMatrix
Log< level::Info, false > LogInfo
virtual std::unique_ptr< ESADCToGeVConstant > produceESADCToGeVConstant(const ESADCToGeVConstantRcd &)
std::string fullPath() const
const Timestamp & time() const
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
static const int ISTRIP_MIN
TimeValue_t value() const