39 std::ostringstream
str;
41 weightType = str.str();
46 getWeightsFromConfiguration(ps);
57 if (producedESPedestals_)
60 if (producedESWeights_) {
65 if (producedESADCToGeVConstant_)
69 producedESIntercalibConstants_ = ps.
getUntrackedParameter<
bool>(
"producedESIntercalibConstants",
true);
72 if (producedESIntercalibConstants_) {
73 if(intercalibConstantsFile_ ==
"") {
78 findingRecord<ESIntercalibConstantsRcd> () ;
99 if ( producedESChannelStatus_ ) {
100 if ( channelStatusFile_ !=
"" ) {
105 findingRecord<ESChannelStatusRcd>();
109 if (producedESPedestals_) findingRecord<ESPedestalsRcd>();
111 if (producedESWeights_) {
112 findingRecord<ESWeightStripGroupsRcd>();
113 findingRecord<ESTBWeightsRcd>();
116 if (producedESADCToGeVConstant_) findingRecord<ESADCToGeVConstantRcd>();
132 if(verbose_>=1)
std::cout <<
"ESTrivialConditionRetriever::setIntervalFor(): record key = " << rk.
name() <<
"\ttime: " << iTime.
time().
value() << std::endl;
138 std::unique_ptr<ESPedestals>
140 std::cout<<
" producing pedestals"<< std::endl;
141 auto peds = std::make_unique<ESPedestals>();
143 ESitem.
mean = ESpedMean_;
144 ESitem.rms = ESpedRMS_;
149 for (
int iplane=1; iplane<=2; iplane++){
150 for(
int izeta=-1; izeta<=1 ;++izeta) {
151 if(izeta==0)
continue;
154 ESDetId aPositiveId(istrip,ix,iy,iplane,izeta);
155 peds->insert(std::make_pair(aPositiveId.
rawId(),ESitem));
166 std::cout<<
" produced pedestals"<< std::endl;
170 std::unique_ptr<ESWeightStripGroups>
173 auto xtalGroups = std::make_unique<ESWeightStripGroups>();
175 std::cout <<
"entering produce weight groups"<< std::endl;
179 for (
int iplane=1; iplane<=2; iplane++){
180 for(
int izeta=-1; izeta<=1 ;++izeta) {
181 if(izeta==0)
continue;
184 ESDetId anESId(istrip,ix,iy,iplane,izeta);
186 xtalGroups->setValue(anESId.
rawId(), defaultGroupId );
196 std::cout <<
"done with produce weight groups"<< std::endl;
201 std::unique_ptr<ESIntercalibConstants>
204 auto ical = std::make_unique<ESIntercalibConstants>();
205 std::cout <<
"entring produce intercalib "<< std::endl;
210 for (
int iplane=1; iplane<=2; iplane++){
211 for(
int izeta=-1; izeta<=1 ;++izeta) {
212 if(izeta==0)
continue;
215 ESDetId anESId(istrip,ix,iy,iplane,izeta);
216 double r = (double)
std::rand()/( double(RAND_MAX)+double(1) );
217 ical->setValue( anESId.
rawId(), intercalibConstantMean_ + r*intercalibConstantSigma_ );
227 std::cout <<
"done produce intercalib"<< std::endl;
233 std::unique_ptr<ESADCToGeVConstant>
236 return std::make_unique<ESADCToGeVConstant>(adcToGeVLowConstant_,adcToGeVHighConstant_);
239 std::unique_ptr<ESTBWeights>
243 auto tbwgt = std::make_unique<ESTBWeights>();
249 tbwgt->setValue(igrp,wgt);
262 if (!getWeightsFromFile_ )
269 else if (getWeightsFromFile_)
272 std::ifstream amplFile(
edm::FileInPath(amplWeightsFile_).fullPath().c_str());
273 while (!amplFile.eof() )
275 for(
int j = 0;
j < 2; ++
j) {
276 std::vector<float> vec(3) ;
277 for(
int k = 0;
k < 3; ++
k) {
289 edm::LogError(
"ESTrivialConditionRetriever") <<
"Configuration not supported. Exception is raised ";
300 std::unique_ptr<ESChannelStatus>
303 auto ecalStatus = std::make_unique<ESChannelStatus>();
312 for (
int iplane=1; iplane<=2; iplane++){
313 for(
int izeta=-1; izeta<=1 ;++izeta) {
314 if(izeta==0)
continue;
317 ESDetId anESId(istrip,ix,iy,iplane,izeta);
319 ecalStatus->setValue( anESId, 0 );
333 std::ifstream statusFile(
edm::FileInPath(channelStatusFile_).fullPath().c_str());
334 if ( !statusFile.good() ) {
336 <<
"*** Problems opening file: " << channelStatusFile_ ;
345 while (!statusFile.eof())
347 statusFile >> ESSubDet;
350 std::getline(statusFile,str);
355 statusFile>> hashIndex >>
status;
362 ecalStatus->setValue( esid, status );
367 <<
" *** " << ESSubDet <<
" is not ES ";
380 std::unique_ptr<ESChannelStatus>
384 auto ical = std::make_unique<ESChannelStatus>();
388 for (
int iplane=1; iplane<=2; iplane++){
389 for(
int izeta=-1; izeta<=1 ;++izeta) {
390 if(izeta==0)
continue;
393 ESDetId anESId(istrip,ix,iy,iplane,izeta);
395 ical->setValue( anESId, 0 );
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
T getUntrackedParameter(std::string const &, T const &) const
virtual std::unique_ptr< ESIntercalibConstants > produceESIntercalibConstants(const ESIntercalibConstantsRcd &)
virtual std::unique_ptr< ESChannelStatus > produceESChannelStatus(const ESChannelStatusRcd &)
static const IOVSyncValue & endOfTime()
std::pair< Time_t, Time_t > ValidityInterval
math::Matrix< 2, 3 >::type ESWeightMatrix
static const int ISTRIP_MAX
virtual ~ESTrivialConditionRetriever()
virtual std::unique_ptr< ESChannelStatus > getChannelStatusFromConfiguration(const ESChannelStatusRcd &)
uint32_t rawId() const
get the raw id
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 &)
virtual std::unique_ptr< ESADCToGeVConstant > produceESADCToGeVConstant(const ESADCToGeVConstantRcd &)
const Timestamp & time() const
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::string fullPath() const
static const int ISTRIP_MIN
TimeValue_t value() const