35 typedef std::vector<edm::ParameterSet>
Parameters;
38 for ( Parameters::iterator itToPut=toPut.begin(); itToPut!=toPut.end(); itToPut++ ) {
39 inpFileName_.push_back(itToPut->getUntrackedParameter<std::string>(
"inputFile"));
40 objectName_.push_back(itToPut->getUntrackedParameter<std::string>(
"conditionType"));
41 since_.push_back(itToPut->getUntrackedParameter<
unsigned int>(
"since"));
52 std::cout <<
"PoolDBOutputService is unavailable" << std::endl;
75 std::cout <<
"Reading " <<
objectName_[
i] <<
" from file and writing to DB with newTime " << newTime << std::endl;
111 std::vector<EcalDQMStatusDictionary::codeDef> dictionary;
117 for (
int ic=1; ic<=1700; ic++ ) {
124 for (
int ix=1; ix<=100; ix++ ) {
125 for (
int iy=1; iy<=100; iy++ ) {
137 std::cout <<
"Reading channel status from file " << inputFile << std::endl;
138 FILE *
ifile = fopen( inputFile ,
"r" );
145 while ( fgets(line, 255, ifile) ) {
147 std::stringstream stream;
155 if ( key.size() == 0 || strcmp(key.c_str(),
" ") == 0 || strncmp(key.c_str(),
"#", 1) == 0 ) {
159 }
else if ( strcmp(key.c_str(),
"EB") == 0 ) {
163 stream >> index >> code;
169 if ( it != status->
end() ) code |= it->getStatusCode();
172 }
else if ( strcmp(key.c_str(),
"EE") == 0 ) {
176 stream >> ix >> iy >> iz >> code;
182 if ( it != status->
end() ) code |= it->getStatusCode();
185 }
else if ( strcmp(key.c_str(),
"Crystal") == 0 ) {
190 if ( strncmp(module.c_str(),
"EB+", 3) == 0 || strncmp(module.c_str(),
"EB-", 3) == 0 ) {
195 stream >> ie >> ip >> token;
197 int sm = atoi( module.substr(2, module.size()-2).c_str() );
199 int ism = (sm>=1&&sm<=18) ? sm+18 : -sm;
201 int ic = 20*(ie-1)+(ip-1)+1;
205 stream >> ic >> token;
207 int sm = atoi( module.substr(2, module.size()-2).c_str() );
209 int ism = (sm>=1&&sm<=18) ? sm+18 : -sm;
215 for (
unsigned int i=0;
i<dictionary.size();
i++ ) {
216 if ( strcmp(token.c_str(), dictionary[
i].desc) == 0 ) {
217 code = dictionary[
i].code;
221 std::cout <<
" --> not found in the dictionary: " << token << std::endl;
226 if ( it != status->
end() ) code |= it->getStatusCode();
229 }
else if ( strncmp(module.c_str(),
"EE+", 3) == 0 || strncmp(module.c_str(),
"EE-", 3) == 0 ) {
234 stream >> jx >> jy >> token;
238 stream >> index >> token;
243 int sm = atoi( module.substr(2, module.size()-2).c_str() );
246 if( sm == -99 ) sm = -1;
247 if( sm == +99 ) sm = +1;
249 case -7: ism = 1;
break;
250 case -8: ism = 2;
break;
251 case -9: ism = 3;
break;
252 case -1: ism = 4;
break;
253 case -2: ism = 5;
break;
254 case -3: ism = 6;
break;
255 case -4: ism = 7;
break;
256 case -5: ism = 8;
break;
257 case -6: ism = 9;
break;
258 case +7: ism = 10;
break;
259 case +8: ism = 11;
break;
260 case +9: ism = 12;
break;
261 case +1: ism = 13;
break;
262 case +2: ism = 14;
break;
263 case +3: ism = 15;
break;
264 case +4: ism = 16;
break;
265 case +5: ism = 17;
break;
266 case +6: ism = 18;
break;
269 EEDetId id(jx, jy, (ism>=1&&ism<=9)?-1:+1);
271 for (
unsigned int i=0;
i<dictionary.size();
i++ ) {
272 if ( strcmp(token.c_str(), dictionary[
i].desc) == 0 ) {
273 code = dictionary[
i].code;
277 std::cout <<
" --> not found in the dictionary: " << token << std::endl;
282 if ( it != status->
end() ) code |= it->getStatusCode();
287 std:: cout <<
"--> unknown token at line #" << ii <<
" : " <<
line;
291 }
else if ( strcmp(key.c_str(),
"TT") == 0 ) {
295 }
else if ( strcmp(key.c_str(),
"PN") == 0 || strcmp(key.c_str(),
"MemCh") == 0 || strcmp(key.c_str(),
"MemTT") == 0 ) {
297 std::cout <<
"--> unsupported key at line #" << ii <<
" : " <<
line;
317 std::vector<EcalDQMStatusDictionary::codeDef> dictionary;
321 for (
int ix=1; ix<=17; ix++ ) {
322 for (
int iy=1; iy<=72; iy++ ) {
335 for (
int ix=1; ix<=20; ix++ ) {
336 for (
int iy=1; iy<=20; iy++ ) {
348 std::cout <<
"Reading tower status from file " << inputFile << std::endl;
349 FILE *
ifile = fopen( inputFile ,
"r" );
356 while ( fgets(line, 255, ifile) ) {
358 std::stringstream stream;
366 if ( key.size() == 0 || strcmp(key.c_str(),
" ") == 0 || strncmp(key.c_str(),
"#", 1) == 0 ) {
370 }
else if ( strcmp(key.c_str(),
"EB") == 0 ) {
374 }
else if ( strcmp(key.c_str(),
"EE") == 0 ) {
378 }
else if ( strcmp(key.c_str(),
"Crystal") == 0 ) {
382 }
else if ( strcmp(key.c_str(),
"TT") == 0 ) {
387 if ( strncmp(module.c_str(),
"EB+", 3) == 0 || strncmp(module.c_str(),
"EB-", 3) == 0 ) {
391 stream >> itt >> token;
393 if ( itt >= 1 && itt <= 68 ) {
395 int sm = atoi( module.substr(2, module.size()-2).c_str() );
397 int iet = (itt-1)/4+1;
398 int ipt = (itt-1)%4+1;
402 if ( ipt < 1 ) ipt = ipt+72;
403 if ( ipt > 72 ) ipt = ipt-72;
406 if ( ipt < 1 ) ipt = ipt+72;
407 if ( ipt > 72 ) ipt = ipt-72;
412 for (
unsigned int i=0;
i<dictionary.size();
i++ ) {
413 if ( strcmp(token.c_str(), dictionary[
i].desc) == 0 ) {
414 code = dictionary[
i].code;
418 std::cout <<
" --> not found in the dictionary: " << token << std::endl;
423 if ( it != status->
end() ) code |= it->getStatusCode();
428 std::cout <<
"--> unsupported configuration at line #" << ii <<
" : " <<
line;
432 }
else if ( strncmp(module.c_str(),
"EE+", 3) == 0 || strncmp(module.c_str(),
"EE-", 3) == 0 ) {
436 stream >> isc >> token;
438 if ( isc >= 1 && isc <= 68 ) {
440 int sm = atoi( module.substr(2, module.size()-2).c_str() );
444 case -7: ism = 1;
break;
445 case -8: ism = 2;
break;
446 case -9: ism = 3;
break;
447 case -1: ism = 4;
break;
448 case -2: ism = 5;
break;
449 case -3: ism = 6;
break;
450 case -4: ism = 7;
break;
451 case -5: ism = 8;
break;
452 case -6: ism = 9;
break;
453 case +7: ism = 10;
break;
454 case +8: ism = 11;
break;
455 case +9: ism = 12;
break;
456 case +1: ism = 13;
break;
457 case +2: ism = 14;
break;
458 case +3: ism = 15;
break;
459 case +4: ism = 16;
break;
460 case +5: ism = 17;
break;
461 case +6: ism = 18;
break;
464 int idcc = (ism>=1&&ism<=9) ? ism : ism-9+45;
468 for (
unsigned int i=0;
i<crystals->size();
i++ ) {
472 for (
unsigned int i=0;
i<dictionary.size();
i++ ) {
473 if ( strcmp(token.c_str(), dictionary[
i].desc) == 0 ) {
474 code = dictionary[
i].code;
478 std::cout <<
" --> not found in the dictionary: " << token << std::endl;
483 if ( it != status->
end() ) code |= it->getStatusCode();
490 std::cout <<
"--> unsupported configuration at line #" << ii <<
" : " <<
line;
496 std:: cout <<
"--> unknown token at line #" << ii <<
" : " <<
line;
500 }
else if ( strcmp(key.c_str(),
"PN") == 0 || strcmp(key.c_str(),
"MemCh") == 0 || strcmp(key.c_str(),
"MemTT") == 0 ) {
502 std::cout <<
"--> unsupported key at line #" << ii <<
" : " <<
line;
520 if ( chStatus == 1 || (chStatus >= 8 && chStatus <= 12 )) {
546 }
else if ( chStatus == 2 ) {
558 }
else if ( chStatus == 3 ) {
571 }
else if ( chStatus == 4 ) {
583 }
else if ( chStatus == 13 || chStatus == 14 ) {
588 }
else if ( (chStatus&0x3f) == 13 || (chStatus&0x7f) == 13 ||
589 (chStatus&0x3f) == 14 || (chStatus&0x7f) == 14 ) {
static bool validDetId(int ix, int iy, int iz)
T getParameter(std::string const &) const
static const int LED_MEAN_ERROR
T getUntrackedParameter(std::string const &, T const &) const
static const int PEDESTAL_MIDDLE_GAIN_RMS_ERROR
static const int LASER_MEAN_ERROR
const_iterator end() const
static const int TESTPULSE_LOW_GAIN_RMS_ERROR
static const int PHYSICS_BAD_CHANNEL_WARNING
std::vector< unsigned long long > since_
Some "id" conversions.
static const int LASER_TIMING_RMS_ERROR
static const int PEDESTAL_HIGH_GAIN_MEAN_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int TESTPULSE_MIDDLE_GAIN_MEAN_ERROR
static const int PEDESTAL_LOW_GAIN_RMS_ERROR
EcalDQMTowerStatus * readEcalDQMTowerStatusFromFile(const char *)
void setValue(const uint32_t id, const Item &item)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
const_iterator find(uint32_t rawId) const
static const int PEDESTAL_HIGH_GAIN_RMS_ERROR
static const int STATUS_FLAG_ERROR
void setValue(const uint32_t id, const Item &item)
static const int TESTPULSE_MIDDLE_GAIN_RMS_ERROR
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
EcalDQMChannelStatusMap EcalDQMChannelStatus
unsigned long long Time_t
vector< ParameterSet > Parameters
static void getDictionary(std::vector< codeDef > &dict)
bool isNewTagRequest(const std::string &recordName)
uint32_t convert(uint32_t c)
EcalDQMTowerStatusMap EcalDQMTowerStatus
cond::Time_t beginOfTime() const
EcalDQMChannelStatus * readEcalDQMChannelStatusFromFile(const char *)
static const int TESTPULSE_HIGH_GAIN_RMS_ERROR
static const int LED_TIMING_MEAN_ERROR
void beginRun(const edm::Run &r, const edm::EventSetup &c)
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
static const int PEDESTAL_LOW_GAIN_MEAN_ERROR
std::vector< std::string > inpFileName_
static const int TESTPULSE_LOW_GAIN_MEAN_ERROR
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
std::vector< std::string > objectName_
static const int LED_TIMING_RMS_ERROR
std::vector< Item >::const_iterator const_iterator
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
static const int PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
cond::Time_t endOfTime() const
static const int LASER_TIMING_MEAN_ERROR
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
const_iterator find(uint32_t rawId) const
const_iterator end() const
static const int LED_RMS_ERROR
EcalDQMStatusWriter(const edm::ParameterSet &ps)
std::vector< Item >::const_iterator const_iterator
static const int PEDESTAL_MIDDLE_GAIN_MEAN_ERROR
static const int TESTPULSE_HIGH_GAIN_MEAN_ERROR
static const int LASER_RMS_ERROR
static const int SMCRYSTALMODE
int ism(int ieta, int iphi)