162 std::cout <<
"------- Ecal DAQ - > getNewObjects\n";
164 std::ostringstream ss;
167 unsigned long long max_since = 1;
173 std::cout <<
" max_since : " << max_since << std::endl;
177 std::cout <<
"retrieved last payload " << std::endl;
183 uint16_t oldEBStatus[72][17][2];
184 uint16_t newEBStatus[72][17][2];
185 uint16_t oldEEStatus[20][20][2];
186 uint16_t newEEStatus[20][20][2];
188 for(
int k = 0 ;
k < 2;
k++ ) {
190 for(
int iphi = 1 ; iphi < 73; iphi++) {
191 for(
int ieta = 1 ; ieta < 18; ieta++) {
195 uint16_t dbStatus = 0;
196 dbStatus =(daq_db->barrel( ebid.hashedIndex())).getStatusCode();
197 oldEBStatus[iphi - 1][ieta -1][
k] = dbStatus;
200 if ( it != daq_db->end() ) {
202 std::cout<<
"*** error channel not found: eta/phi ="<< ieta <<
"/" << iphi << std::endl;
204 daq_temp->
setValue( ebid, dbStatus );
205 if(dbStatus != 0)
std::cout <<
"barrel side " <<
k <<
" phi " << iphi <<
" eta " << ieta <<
" status " << dbStatus << std::endl;
211 for(
int ix = 1 ; ix < 21; ix++) {
212 for(
int iy = 1 ; iy < 21; iy++) {
218 uint16_t dbStatus = 0;
219 if ( it != daq_db->end() ) {
220 dbStatus = it->getStatusCode();
222 oldEEStatus[ix - 1][iy -1][
k] = dbStatus;
223 daq_temp->
setValue( eeid, dbStatus );
224 if(dbStatus != 0)
std::cout <<
"endcap side " <<
k <<
" x " << ix <<
" y " << iy <<
" status " << dbStatus << std::endl;
233 std::cout <<
"Retrieving DAQ status from OMDS DB ... " << std::endl;
235 std::cout <<
"Connection done" << std::endl;
257 min_run= (int)max_since+1;
261 std::cout <<
"min_run " << min_run <<
" max_run " << max_run << std::endl;
266 std::vector<RunIOV> run_vec = my_list.
getRuns();
267 int num_runs = run_vec.size();
269 std::cout <<
" number of runs is : " << num_runs << std::endl;
271 unsigned long irun=0;
280 int krmax =
std::min(num_runs, 1000);
281 for(
int kr = 0; kr < krmax; kr++){
284 if(run_vec[kr].getRunTag().getGeneralTag() !=
"GLOBAL")
continue;
285 bool somediff =
false;
287 if(kr == 0) debug =
true;
289 irun = (
unsigned long) run_vec[kr].getRunNumber();
290 for(
int k = 0 ;
k < 2;
k++ ) {
291 for(
int iphi = 0 ; iphi < 72; iphi++) {
292 for(
int ieta = 0 ; ieta < 17; ieta++) {
293 newEBStatus[iphi][ieta][
k] = 0;
296 for(
int ix = 0 ; ix < 20; ix++) {
297 for(
int iy = 0 ; iy < 20; iy++) {
298 newEEStatus[ix][iy][
k] = 0;
306 std::map<EcalLogicID, RunDat> fed_dat;
310 typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
315 std::map<EcalLogicID, RunFEConfigDat> feconfig;
318 if(fed_dat.size() == 0 || feconfig.size() == 0) {
319 std::cout <<
" run " << irun <<
" tag " << run_vec[kr].getRunTag().getGeneralTag()
320 <<
" Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
321 <<
" feconfig and/or read FED size = 0, leaving..." << std::endl;
326 if(fed_dat.size() != 54 ) {
328 int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
330 int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};
331 for (fedIter
p=fed_dat.begin();
p!=fed_dat.end();
p++) {
346 Sect[izz][sm - 1] = 1;
356 for(
int sm = 0; sm < 36; sm++)
360 for(
int tt = 0; tt < 68; tt++)
361 newEBStatus[
iphiEB[sm][tt] - 1][
ietaEB[sm][tt] - 1][0] = 1;
363 for(
int tt = 0; tt < 68; tt++)
364 newEBStatus[
iphiEB[sm - 18][tt] - 1][
ietaEB[sm - 18][tt] - 1][1] = 1;
366 for(
int z = 0; z < 2; z++)
367 for(
int sec = 0; sec < 9; sec++)
368 if(Sect[z][sec] != 1) {
371 if(z == 1) sec18 = sec + 9;
372 for(
int sc = 0 ; sc < 41; sc++) {
373 if(
ixx[sec18][sc][0] != 0) {
374 newEEStatus[
ixx[sec18][sc][0] - 1][
iyy[sec18][sc][0] - 1][
z] = 1;
375 if(
ixx[sec18][sc][1] != 0) {
376 newEEStatus[
ixx[sec18][sc][1] - 1][iyy[sec18][sc][1] - 1][
z] = 1;
377 if(
ixx[sec18][sc][2] != 0) {
378 newEEStatus[
ixx[sec18][sc][2] - 1][iyy[sec18][sc][2] - 1][
z] = 1;
386 typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
391 for (feConfIter
p=feconfig.begin();
p!=feconfig.end();
p++) {
399 myconfig.
setId(fe_conf_id);
405 std::vector< ODBadTTDat > badTT_dat;
419 NbadTT = badTT_dat.size();
430 for(
size_t iTT = 0; iTT < NbadTT; iTT++){
431 int fed_id = badTT_dat[iTT].getFedId();
432 int tt_id = badTT_dat[iTT].getTTId();
438 if(fed_id >= 610 && fed_id <= 645) {
443 if(fed_id > 627) side = +1;
445 <<
" eta " <<
ietaEB[fed_id - 610][tt_id - 1]
446 <<
" side " << side << std::endl;
447 newEBStatus[
iphiEB[fed_id - 610][tt_id - 1] - 1][
ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
449 else if(fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) {
455 if(debug)
std::cout <<
" x " <<
ixx[fed_id - 601][tt_id - 1][0]
456 <<
" y " <<
iyy[fed_id - 601][tt_id - 1][0];
457 newEEStatus[
ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
458 if(
ixx[fed_id - 601][tt_id - 1][1] != 0) {
459 if(debug)
std::cout <<
" x2 " <<
ixx[fed_id - 601][tt_id - 1][1]
460 <<
" y2 " << iyy[fed_id - 601][tt_id - 1][1];
461 newEEStatus[
ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
462 if(
ixx[fed_id - 601][tt_id - 1][2] != 0) {
463 if(debug)
std::cout <<
" x3 " <<
ixx[fed_id - 601][tt_id - 1][2]
464 <<
" y3 " << iyy[fed_id - 601][tt_id - 1][2];
465 newEEStatus[
ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
468 if(debug)
std::cout <<
" side " << side << std::endl;
472 if(debug)
std::cout <<
" x " <<
ixx[fed_id - 637][tt_id - 1][0]
473 <<
" y " << iyy[fed_id - 637][tt_id - 1][0];
474 newEEStatus[
ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
475 if(
ixx[fed_id - 637][tt_id - 1][1] != 0) {
476 if(debug)
std::cout <<
" x2 " <<
ixx[fed_id - 637][tt_id - 1][1]
477 <<
" y2 " << iyy[fed_id - 637][tt_id - 1][1];
478 newEEStatus[
ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
479 if(
ixx[fed_id - 637][tt_id - 1][2] != 0) {
480 if(debug)
std::cout <<
" x3 " <<
ixx[fed_id - 637][tt_id - 1][2]
481 <<
" y3 " << iyy[fed_id - 637][tt_id - 1][2];
482 newEEStatus[
ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
485 if(debug)
std::cout <<
" side " << side << std::endl;
489 std::cout <<
" Strange Fed " << fed_id <<
" TT/SC " << tt_id <<
" Give up " << std::endl;
495 for(
int k = 0 ;
k < 2;
k++ ) {
498 if(debug)
std::cout <<
" Side : " <<
k <<
" barrel " << std::endl;
499 for(
int iphi = 0 ; iphi < 72; iphi++) {
500 for(
int ieta = 0 ; ieta < 17; ieta++) {
501 if(newEBStatus[iphi][ieta][
k] != oldEBStatus[iphi][ieta][
k]) {
504 daq_temp->
setValue( ebid, newEBStatus[iphi][ieta][k]);
505 if(debug)
std::cout <<
" change in EB side " << iz <<
" phi " << iphi +1 <<
" eta " << ieta + 1 << std::endl;
507 if(debug)
std::cout << newEBStatus[iphi][ieta][
k] <<
" " ;
508 oldEBStatus[iphi][ieta][
k] = newEBStatus[iphi][ieta][
k];
512 if(debug)
std::cout <<
" endcaps " << std::endl;
513 for(
int iy = 0 ; iy < 20; iy++) {
514 for(
int ix = 0 ; ix < 20; ix++) {
516 if(newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
519 daq_temp->
setValue( eeid, newEEStatus[ix][iy][k]);
520 if(debug)
std::cout <<
" change in EE side " << iz <<
" x " << ix +1 <<
" y " << iy + 1 << std::endl;
522 if(debug)
std::cout << newEEStatus[ix][iy][
k] <<
" " ;
523 oldEEStatus[ix][iy][
k] = newEEStatus[ix][iy][
k];
541 for(
int k = 0 ; k < 2; k++ ) {
543 for(
int iphi = 1 ; iphi < 73; iphi++) {
544 for(
int ieta = 1 ; ieta < 18; ieta++) {
547 uint16_t dbStatus = 0;
548 dbStatus =(daq_temp->
barrel( ebid.hashedIndex())).getStatusCode();
549 daq_pop->
setValue( ebid, dbStatus );
555 for(
int ix = 1 ; ix < 21; ix++) {
556 for(
int iy = 1 ; iy < 21; iy++) {
561 uint16_t dbStatus = 0;
562 if ( it != daq_temp->
end() ) {
563 dbStatus = it->getStatusCode();
565 daq_pop->
setValue( eeid, dbStatus );
573 std::cout <<
"Generating popcon record for run "<< irun << std::endl;
577 ss <<
"Run=" << irun <<
"_DAQchanged_"<<std::endl;
582 std::cout<<
"Run DAQ record was the same as previous run " << std::endl;
583 ss <<
"Run=" << irun <<
"_DAQunchanged_"<<std::endl;
595 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
EcalDAQTowerStatusMap EcalDAQTowerStatus
static bool validDetId(int ix, int iy, int iz)
std::vector< RunIOV > getRuns()
std::string m_userTextLog
edm::Ref< Container > Ref
const_iterator end() const
void setLocationDef(const LocationDef locDef)
RunList fetchRunListByLocation(RunTag tag, int min_run, int max_run, const LocationDef locDef)
void setValue(const uint32_t id, const Item &item)
const_iterator find(uint32_t rawId) const
OldContainer m_to_transfer
cond::TagInfo const & tagInfo() const
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf)
EcalCondDBInterface * econn
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov)
void setRunTypeDef(const RunTypeDef runTypeDef)
void setRunType(std::string runtype)
void fetchConfigSet(ICONF *iconf)
const Item & barrel(size_t hashedIndex) const
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
cond::ValidityInterval lastInterval
void setLocation(std::string loc)
std::vector< Item >::const_iterator const_iterator
void setGeneralTag(std::string tag)