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::auto_ptr<ESPedestals>
140 std::cout<<
" producing pedestals"<< std::endl;
141 std::auto_ptr<ESPedestals> peds = std::auto_ptr<ESPedestals>(
new 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::auto_ptr<ESWeightStripGroups>
173 std::auto_ptr<ESWeightStripGroups> xtalGroups = std::auto_ptr<ESWeightStripGroups>(
new 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::auto_ptr<ESIntercalibConstants>
204 std::auto_ptr<ESIntercalibConstants> ical = std::auto_ptr<ESIntercalibConstants>(
new 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::auto_ptr<ESADCToGeVConstant>
236 return std::auto_ptr<ESADCToGeVConstant>(
new ESADCToGeVConstant(adcToGeVLowConstant_,adcToGeVHighConstant_) );
239 std::auto_ptr<ESTBWeights>
243 std::auto_ptr<ESTBWeights> tbwgt = std::auto_ptr<ESTBWeights>(
new 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::auto_ptr<ESChannelStatus>
303 std::auto_ptr<ESChannelStatus> ecalStatus = std::auto_ptr<ESChannelStatus>(
new 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::auto_ptr<ESChannelStatus>
384 std::auto_ptr<ESChannelStatus> ical = std::auto_ptr<ESChannelStatus>(
new 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 &)
virtual std::auto_ptr< ESChannelStatus > produceESChannelStatus(const ESChannelStatusRcd &)
T getUntrackedParameter(std::string const &, T const &) const
virtual std::auto_ptr< ESChannelStatus > getChannelStatusFromConfiguration(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 std::auto_ptr< ESWeightStripGroups > produceESWeightStripGroups(const ESWeightStripGroupsRcd &)
ESPedestalsMap ESPedestals
virtual ~ESTrivialConditionRetriever()
ESChannelStatusMap ESChannelStatus
uint32_t rawId() const
get the raw id
virtual std::auto_ptr< ESTBWeights > produceESTBWeights(const ESTBWeightsRcd &)
static const IOVSyncValue & beginOfTime()
ESTrivialConditionRetriever(const edm::ParameterSet &pset)
const char * name() const
void getWeightsFromConfiguration(const edm::ParameterSet &ps)
TimeValue_t value() const
virtual std::auto_ptr< ESPedestals > produceESPedestals(const ESPedestalsRcd &)
ESIntercalibConstantMap ESIntercalibConstants
const Timestamp & time() const
static ESDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::string fullPath() const
virtual std::auto_ptr< ESADCToGeVConstant > produceESADCToGeVConstant(const ESADCToGeVConstantRcd &)
static const int ISTRIP_MIN
virtual std::auto_ptr< ESIntercalibConstants > produceESIntercalibConstants(const ESIntercalibConstantsRcd &)
ESCondObjectContainer< ESStripGroupId > ESWeightStripGroups