test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
popcon::EcalDAQHandler Class Reference

#include <EcalDAQHandler.h>

Inheritance diagram for popcon::EcalDAQHandler:
popcon::PopConSourceHandler< EcalDAQTowerStatus >

Public Member Functions

int detIDToLogicID (int, int, int)
 
 EcalDAQHandler (edm::ParameterSet const &)
 
void getNewObjects ()
 
std::string id () const
 
uint16_t OffDBStatus (uint16_t dbStatus, int pos)
 
 ~EcalDAQHandler ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Public Attributes

EcalCondDBInterfaceeconn
 

Private Attributes

bool m_debug
 
unsigned long m_firstRun
 
std::string m_gentag
 
unsigned long m_lastRun
 
std::string m_location
 
std::string m_name
 
std::string m_pass
 
std::string m_runtype
 
std::string m_sid
 
std::string m_user
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< EcalDAQTowerStatus
*, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler
< EcalDAQTowerStatus
self
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef EcalDAQTowerStatus value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
int add (value_type *payload, Summary *summary, Time_t time)
 
- Protected Attributes inherited from popcon::PopConSourceHandler< EcalDAQTowerStatus >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 48 of file EcalDAQHandler.h.

Constructor & Destructor Documentation

popcon::EcalDAQHandler::EcalDAQHandler ( edm::ParameterSet const &  ps)

Definition at line 132 of file EcalDAQHandler.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), m_debug, m_firstRun, m_gentag, m_lastRun, m_location, m_pass, m_runtype, m_sid, m_user, and AlCaHLTBitMon_QueryRunRegistry::string.

133  : m_name(ps.getUntrackedParameter<std::string>("name","EcalDAQHandler")) {
134 
135  std::cout << "EcalDAQ Source handler constructor\n" << std::endl;
136  m_firstRun =(unsigned long)atoi( ps.getParameter<std::string>("firstRun").c_str());
137  m_lastRun =(unsigned long)atoi( ps.getParameter<std::string>("lastRun").c_str());
138  m_sid = ps.getParameter<std::string>("OnlineDBSID");
139  m_user = ps.getParameter<std::string>("OnlineDBUser");
140  m_pass = ps.getParameter<std::string>("OnlineDBPassword");
141  m_location = ps.getParameter<std::string>("location");
142  m_runtype = ps.getParameter<std::string>("runtype");
143  m_gentag = ps.getParameter<std::string>("gentag");
144  m_debug = ps.getParameter<bool>("debug");
145 
146  std::cout << m_sid << "/" << m_user << std::endl;
147 
148 }
unsigned long m_lastRun
unsigned long m_firstRun
tuple cout
Definition: gather_cfg.py:145
popcon::EcalDAQHandler::~EcalDAQHandler ( )

Definition at line 150 of file EcalDAQHandler.cc.

150  {
151 }

Member Function Documentation

int popcon::EcalDAQHandler::detIDToLogicID ( int  ,
int  ,
int   
)
void popcon::EcalDAQHandler::getNewObjects ( )
virtual

Implements popcon::PopConSourceHandler< EcalDAQTowerStatus >.

Definition at line 161 of file EcalDAQHandler.cc.

References EcalCondTowerObjectContainer< T >::barrel(), gather_cfg::cout, EcalBarrel, EcalCondTowerObjectContainer< T >::end(), Exception, EcalCondTowerObjectContainer< T >::find(), ODFEDAQConfig::getBadTTId(), RunFEConfigDat::getConfigId(), EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getLogicID(), RunList::getRuns(), EcalTrigTowerDetId::hashedIndex(), ietaEB, iphiEB, ixx, iyy, relval_2017::k, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), RunTag::setGeneralTag(), ODBadTTInfo::setId(), ODFEDAQConfig::setId(), LocationDef::setLocation(), RunTag::setLocationDef(), RunTypeDef::setRunType(), RunTag::setRunTypeDef(), EcalCondTowerObjectContainer< T >::setValue(), findQualityFiles::size, contentValuesCheck::ss, dumpRecoGeometry_cfg::tagInfo, groupFilesInBlocks::tt, EcalTrigTowerDetId::validDetId(), and EcalScDetId::validDetId().

161  {
162  if(m_debug) std::cout << "------- Ecal DAQ - > getNewObjects\n";
163 
164  std::ostringstream ss;
165  ss<<"ECAL ";
166 
167  unsigned long long max_since = 1;
168 
169  // this is the last inserted run
170  max_since = tagInfo().lastInterval.first;
171 
172  // this is the last object in the DB
173  std::cout << " max_since : " << max_since << std::endl;
174 
175 
176  uint16_t oldEBStatus[72][17][2];
177  uint16_t newEBStatus[72][17][2];
178  uint16_t oldEEStatus[20][20][2];
179  uint16_t newEEStatus[20][20][2];
180 
181  // we copy the last valid record to a temporary object peds
182  EcalDAQTowerStatus* daq_temp = new EcalDAQTowerStatus();
183 
184  if(tagInfo().size) {
185  Ref daq_db = lastPayload();
186  if(m_debug) std::cout << "retrieved last payload " << std::endl;
187 
188  // barrel
189  int iz = -1;
190  for(int k = 0 ; k < 2; k++ ) {
191  if(k == 1) iz = 1;
192  for(int iphi = 1 ; iphi < 73; iphi++) {
193  for(int ieta = 1 ; ieta < 18; ieta++) {
194  if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,ieta,iphi )){
195  EcalTrigTowerDetId ebid(iz,EcalBarrel,ieta,iphi);
196 
197  uint16_t dbStatus = 0;
198  dbStatus =(daq_db->barrel( ebid.hashedIndex())).getStatusCode();
199  oldEBStatus[iphi - 1][ieta -1][k] = dbStatus;
200 
201  EcalDAQTowerStatus::const_iterator it =daq_db->find(ebid.rawId());
202  if ( it != daq_db->end() ) {
203  } else {
204  std::cout<<"*** error channel not found: eta/phi ="<< ieta << "/" << iphi << std::endl;
205  }
206  daq_temp->setValue( ebid, dbStatus );
207  if(m_debug && dbStatus != 0) std::cout << "barrel side " << k << " phi " << iphi << " eta " << ieta << " status " << dbStatus << std::endl;
208  }
209  } // end loop over ieta
210  } // end loop over iphi
211 
212  // endcap
213  for(int ix = 1 ; ix < 21; ix++) {
214  for(int iy = 1 ; iy < 21; iy++) {
215  if (EcalScDetId::validDetId(ix,iy,iz )){
216  EcalScDetId eeid(ix,iy,iz);
217 
218  EcalDAQTowerStatus::const_iterator it =daq_db->find(eeid.rawId());
219 
220  uint16_t dbStatus = 0;
221  if ( it != daq_db->end() ) {
222  dbStatus = it->getStatusCode();
223  }
224  oldEEStatus[ix - 1][iy -1][k] = dbStatus;
225  daq_temp->setValue( eeid, dbStatus );
226  if(m_debug && dbStatus != 0) std::cout << "endcap side " << k << " x " << ix << " y " << iy << " status " << dbStatus << std::endl;
227  }
228  } // end loop over iy
229  } // end loop over ix
230  } // end loop over k (side)
231  } // check if there is already a payload
232  else {
233  if(m_debug) std::cout << " No db found : set default values " << std::endl;
234  // barrel
235  int iz = -1;
236  for(int k = 0 ; k < 2; k++ ) {
237  if(k == 1) iz = 1;
238  for(int iphi = 1 ; iphi < 73; iphi++) {
239  for(int ieta = 1 ; ieta < 18; ieta++) {
240  if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,ieta,iphi )){
241  EcalTrigTowerDetId ebid(iz,EcalBarrel,ieta,iphi);
242 
243  uint16_t dbStatus = 0;
244  oldEBStatus[iphi - 1][ieta -1][k] = dbStatus;
245  daq_temp->setValue( ebid, dbStatus );
246  } // valid Id
247  } // end loop over ieta
248  } // end loop over iphi
249  // endcap
250  for(int ix = 1 ; ix < 21; ix++) {
251  for(int iy = 1 ; iy < 21; iy++) {
252  if (EcalScDetId::validDetId(ix,iy,iz )){
253  EcalScDetId eeid(ix,iy,iz);
254  uint16_t dbStatus = 0;
255  oldEEStatus[ix - 1][iy -1][k] = dbStatus;
256  daq_temp->setValue( eeid, dbStatus );
257  } // valid Id
258  } // end loop over iy
259  } // end loop over ix
260  } // end loop over k (side)
261  } // no payload set default values
262 
263  // now read the actual status from the online DB
264 
265 
266  if(m_debug) std::cout << "Retrieving DAQ status from OMDS DB ... " << std::endl;
268  if(m_debug) std::cout << "Connection done" << std::endl;
269 
270  if (!econn) {
271  std::cout << " Problem with OMDS: connection parameters " << m_sid << "/" << m_user << "/" << m_pass << std::endl;
272  throw cms::Exception("OMDS not available");
273  }
274 
275  // code from EcalTPGBadTTHandler.cc
276  LocationDef my_locdef;
277  my_locdef.setLocation(m_location);
278 
279  RunTypeDef my_rundef;
280  my_rundef.setRunType(m_runtype);
281 
282  RunTag my_runtag;
283  my_runtag.setLocationDef( my_locdef );
284  my_runtag.setRunTypeDef( my_rundef );
285  my_runtag.setGeneralTag(m_gentag);
286 
287  // range of validity
288  int min_run = 0;
289  if(m_firstRun < (unsigned long)max_since) {
290  min_run= (int)max_since+1; // we have to add 1 to the last transferred one
291  }
292  else { min_run=(int)m_firstRun; }
293  int max_run=(int)m_lastRun;
294  std::cout << "min_run " << min_run << " max_run " << max_run << std::endl;
295 
296  RunList my_list;
297  my_list = econn->fetchRunListByLocation(my_runtag, min_run, max_run, my_locdef);
298 
299  std::vector<RunIOV> run_vec = my_list.getRuns();
300  int num_runs = run_vec.size();
301 
302  std::cout << " number of runs is : " << num_runs << std::endl;
303 
304  unsigned long irun=0;
305  if(num_runs > 0){
306  // char outfile[800];
307  //sprintf(outfile,"BadChannelsEB_run%d.txt",min_run);
308  //ofstream *daqFile;
309  //daqFile = new ofstream(outfile,ios::out);
310 
311  //hlt for(int kr = 0; kr < num_runs; kr++){
312  for(int kr = num_runs -1; kr < num_runs; kr++){
313  // int krmax = std::min(num_runs, 1000);
314  // for(int kr = 0; kr < krmax; kr++){
315  //hlt if(m_to_transfer.size() < 20 ) {
316 
317  if(run_vec[kr].getRunTag().getGeneralTag() != "GLOBAL") continue;
318  bool somediff = false;
319  // initialize this run status to all OK
320  irun = (unsigned long) run_vec[kr].getRunNumber();
321  for(int k = 0 ; k < 2; k++ ) {
322  for(int iphi = 0 ; iphi < 72; iphi++) {
323  for(int ieta = 0 ; ieta < 17; ieta++) {
324  newEBStatus[iphi][ieta][k] = 0;
325  }
326  }
327  for(int ix = 0 ; ix < 20; ix++) {
328  for(int iy = 0 ; iy < 20; iy++) {
329  newEEStatus[ix][iy][k] = 0;
330  }
331  }
332  } // loop over side
333 
334 
335 
336  // these are the online conditions DB classes readout FEDs
337  std::map<EcalLogicID, RunDat> fed_dat;
338  econn->fetchDataSet(&fed_dat, &run_vec[kr]);
339 
340  // these are the online conditions DB classes unread FEs
341  typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
342  // EcalLogicID ecid_xt;
343  RunDat rdat_fe;
344  EcalLogicID idfed;
345 
346  std::map<EcalLogicID, RunFEConfigDat> feconfig;
347  econn->fetchDataSet(&feconfig, &run_vec[kr]);
348 
349  if(fed_dat.size() == 0 || feconfig.size() == 0) {
350  std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
351  << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
352  << " feconfig and/or read FED size = 0, leaving..." << std::endl;
353  continue;
354  }
355 
356 
357  if(fed_dat.size() != 54 ) {
358  int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
359  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
360  int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};
361  for (fedIter p=fed_dat.begin(); p!=fed_dat.end(); p++) {
362  idfed = p->first;
363  int sm = 0;
364  int z = 0;
365  if(idfed.getLogicID()<2000000000){// eb
366  sm = idfed.getID1();
367  // std::cout << " EB " << sm;
368  SM[sm - 1] = 1;
369  }
370  else { // ee
371  z = idfed.getID1();
372  sm = idfed.getID2();
373  // std::cout << " EE " << z << " " << sm;
374  int izz = z;
375  if(z == -1) izz = 0;
376  Sect[izz][sm - 1] = 1;
377  }
378  } // loop over all FED
380  /* if(irun == 124089) {
381  Sect[0][2] = 0;
382  Sect[1][7] = 0;
383  } */
385  // mark all TT/SC in the not read out FEDs
386  for(int sm = 0; sm < 36; sm++) // barrel
387  if(SM[sm] != 1) {
388  //std::cout << " missing EB " << sm + 1 << std::endl;
389  if(sm < 18)
390  for(int tt = 0; tt < 68; tt++)
391  newEBStatus[iphiEB[sm][tt] - 1][ietaEB[sm][tt] - 1][0] = 1;
392  else
393  for(int tt = 0; tt < 68; tt++)
394  newEBStatus[iphiEB[sm - 18][tt] - 1][ietaEB[sm - 18][tt] - 1][1] = 1;
395  }
396  for(int z = 0; z < 2; z++) // endcaps
397  for(int sec = 0; sec < 9; sec++)
398  if(Sect[z][sec] != 1) {
399  //std::cout << " missing EE " << z << " " << sec + 1 << std::endl;
400  int sec18 = sec;
401  if(z == 1) sec18 = sec + 9;
402  for(int sc = 0 ; sc < 41; sc++) {
403  if(ixx[sec18][sc][0] != 0) {
404  newEEStatus[ixx[sec18][sc][0] - 1][iyy[sec18][sc][0] - 1][z] = 1;
405  if(ixx[sec18][sc][1] != 0) {
406  newEEStatus[ixx[sec18][sc][1] - 1][iyy[sec18][sc][1] - 1][z] = 1;
407  if(ixx[sec18][sc][2] != 0) {
408  newEEStatus[ixx[sec18][sc][2] - 1][iyy[sec18][sc][2] - 1][z] = 1;
409  }
410  }
411  }
412  } // loop over all possible SC in a sector
413  } // not read out sector
414  } // not all FED are read out
415 
416  typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
417  // EcalLogicID ecid_xt;
418  RunFEConfigDat rd_fe;
419 
420  int fe_conf_id = 0;
421  for (feConfIter p=feconfig.begin(); p!=feconfig.end(); p++) {
422  // ecid_xt = p->first;
423  rd_fe = p->second;
424  fe_conf_id = rd_fe.getConfigId();
425  }
426 
427  // reading this configuration
428  ODFEDAQConfig myconfig;
429  myconfig.setId(fe_conf_id);
430  econn->fetchConfigSet(&myconfig);
431 
432  // list of bad towers
433  int myTT = myconfig.getBadTTId();
434  ODBadTTInfo mybadTT;
435  std::vector< ODBadTTDat > badTT_dat;
436  unsigned NbadTT = 0;
437 
438  /* if(myTT == 0) {
439  std::cout << " myTT = 0" << std::endl;
440  continue;
441  }
442  else {
443  */
444  if(myTT != 0) {
445  mybadTT.setId(myTT);
446  econn->fetchConfigSet(&mybadTT);
447 
448  econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
449  NbadTT = badTT_dat.size();
450  }
451 
452  /* std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
453  << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
454  << " number of read FEDs " << fed_dat.size()
455  << " number of bad FEs " << NbadTT
456  << " fe_conf_id " << fe_conf_id << std::endl;
457  */
458 
459  // *daqFile << " run " << irun << " bad TT number " << NbadTT << "\n" << "Towers : ";
460  for(size_t iTT = 0; iTT < NbadTT; iTT++){
461  int fed_id = badTT_dat[iTT].getFedId();
462  int tt_id = badTT_dat[iTT].getTTId();
463  // int SM = badTT_dat[iTT].getSMId(); // SM always 0!
464  int side = 0; // EB/EE-
465  //*daqFile << fed_id << "/" << tt_id << " ";
466  // std::cout << fed_id << "/" << tt_id << "/" << SM << "/" ;
467  // std::cout << fed_id << "/" << tt_id << "/";
468  if(fed_id >= 610 && fed_id <= 645) { // barrel
469  if(tt_id > 68) {
470  //std::cout << " Problem in Fed " << fed_id << " TT " << tt_id << " Give up " << std::endl;
471  continue;
472  }
473  if(fed_id > 627) side = +1; // EB+
474  if(m_debug) std::cout << " phi " << iphiEB[fed_id - 610][tt_id - 1]
475  << " eta " << ietaEB[fed_id - 610][tt_id - 1]
476  << " side " << side << std::endl;
477  newEBStatus[iphiEB[fed_id - 610][tt_id - 1] - 1][ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
478  }
479  else if(fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) { // endcap
480  if(tt_id > 41) {
481  //std::cout << " Problem in Fed " << fed_id << " SC " << tt_id << " Give up " << std::endl;
482  continue;
483  }
484  if(fed_id < 610) { // EE-
485  if(m_debug) std::cout << " x " << ixx[fed_id - 601][tt_id - 1][0]
486  << " y " << iyy[fed_id - 601][tt_id - 1][0];
487  newEEStatus[ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
488  if(ixx[fed_id - 601][tt_id - 1][1] != 0) { // partial SC
489  if(m_debug) std::cout << " x2 " << ixx[fed_id - 601][tt_id - 1][1]
490  << " y2 " << iyy[fed_id - 601][tt_id - 1][1];
491  newEEStatus[ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
492  if(ixx[fed_id - 601][tt_id - 1][2] != 0) { // partial SC
493  if(m_debug) std::cout << " x3 " << ixx[fed_id - 601][tt_id - 1][2]
494  << " y3 " << iyy[fed_id - 601][tt_id - 1][2];
495  newEEStatus[ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
496  }
497  }
498  if(m_debug) std::cout << " side " << side << std::endl;
499  }
500  else { // EE+
501  side = +1;
502  if(m_debug) std::cout << " x " << ixx[fed_id - 637][tt_id - 1][0]
503  << " y " << iyy[fed_id - 637][tt_id - 1][0];
504  newEEStatus[ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
505  if(ixx[fed_id - 637][tt_id - 1][1] != 0) { // partial SC
506  if(m_debug) std::cout << " x2 " << ixx[fed_id - 637][tt_id - 1][1]
507  << " y2 " << iyy[fed_id - 637][tt_id - 1][1];
508  newEEStatus[ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
509  if(ixx[fed_id - 637][tt_id - 1][2] != 0) { // partial SC
510  if(m_debug) std::cout << " x3 " << ixx[fed_id - 637][tt_id - 1][2]
511  << " y3 " << iyy[fed_id - 637][tt_id - 1][2];
512  newEEStatus[ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
513  }
514  }
515  if(m_debug) std::cout << " side " << side << std::endl;
516  }
517  }
518  else {
519  std::cout << " Strange Fed " << fed_id << " TT/SC " << tt_id << " Give up " << std::endl;
520  continue;
521  }
522  } // end loop over iTT
523  if(m_debug) std::cout << std::endl;
524  //*daqFile << std::endl;
525  for(int k = 0 ; k < 2; k++ ) {
526  int iz = -1;
527  if(k == 1) iz = 1;
528  if(m_debug) std::cout << " Side : " << k << " barrel " << std::endl; // barrel
529  for(int iphi = 0 ; iphi < 72; iphi++) {
530  for(int ieta = 0 ; ieta < 17; ieta++) {
531  if(newEBStatus[iphi][ieta][k] != oldEBStatus[iphi][ieta][k]) {
532  somediff = true;
533  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta + 1, iphi + 1);
534  daq_temp->setValue( ebid, newEBStatus[iphi][ieta][k]);
535  if(m_debug) std::cout << " change in EB side " << iz << " phi " << iphi +1 << " eta " << ieta + 1 << std::endl;
536  } // new status
537  if(m_debug) std::cout << newEBStatus[iphi][ieta][k] << " " ;
538  oldEBStatus[iphi][ieta][k] = newEBStatus[iphi][ieta][k];
539  }
540  if(m_debug) std::cout << std::endl;
541  }
542  if(m_debug) std::cout << " endcaps " << std::endl; // endcap
543  for(int iy = 0 ; iy < 20; iy++) {
544  for(int ix = 0 ; ix < 20; ix++) {
545  if (EcalScDetId::validDetId(ix + 1, iy + 1, iz )){
546  if(newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
547  somediff = true;
548  EcalScDetId eeid(ix + 1, iy + 1, iz);
549  daq_temp->setValue( eeid, newEEStatus[ix][iy][k]);
550  if(m_debug) std::cout << " change in EE side " << iz << " x " << ix +1 << " y " << iy + 1 << std::endl;
551  } // new status
552  if(m_debug) std::cout << newEEStatus[ix][iy][k] << " " ;
553  oldEEStatus[ix][iy][k] = newEEStatus[ix][iy][k];
554  } // valid SC
555  else {
556  if(m_debug) std::cout << ". ";
557  }
558  }
559  if(m_debug) std::cout << std::endl;
560  }
561  } // loop over side
562 
563  if(somediff) {
564 
565  // we copy the last valid record to the object that is sent to the DB
566  EcalDAQTowerStatus* daq_pop = new EcalDAQTowerStatus();
567 
568 
569 
570  int iz = -1;
571  for(int k = 0 ; k < 2; k++ ) {
572  if(k == 1) iz = 1;
573  for(int iphi = 1 ; iphi < 73; iphi++) {
574  for(int ieta = 1 ; ieta < 18; ieta++) {
575  if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,ieta,iphi )){
576  EcalTrigTowerDetId ebid(iz,EcalBarrel,ieta,iphi);
577  uint16_t dbStatus = 0;
578  dbStatus =(daq_temp->barrel( ebid.hashedIndex())).getStatusCode();
579  daq_pop->setValue( ebid, dbStatus );
580  }
581  } // end loop over ieta
582  } // end loop over iphi
583 
584  // endcap
585  for(int ix = 1 ; ix < 21; ix++) {
586  for(int iy = 1 ; iy < 21; iy++) {
587  if (EcalScDetId::validDetId(ix,iy,iz )){
588  EcalScDetId eeid(ix,iy,iz);
589 
590  EcalDAQTowerStatus::const_iterator it =daq_temp->find(eeid.rawId());
591  uint16_t dbStatus = 0;
592  if ( it != daq_temp->end() ) {
593  dbStatus = it->getStatusCode();
594  }
595  daq_pop->setValue( eeid, dbStatus );
596  }
597  } // end loop over iy
598  } // end loop over ix
599  } // end loop over k (side)
600 
601 
602 
603  std::cout << "Generating popcon record for run "<< irun << std::endl;
604 
605  m_to_transfer.push_back(std::make_pair((EcalDAQTowerStatus*)daq_pop, irun));
606 
607  ss << "Run=" << irun << "_DAQchanged_"<<std::endl;
608  m_userTextLog = ss.str()+";";
609  } // some change found
610  else {
611 
612  std::cout<< "Run" << irun << " DAQ record was the same as previous run " << std::endl;
613  ss << "Run=" << irun << "_DAQunchanged_"<<std::endl;
614  m_userTextLog = ss.str()+";";
615 
616  } // no change
617 
618  // hlt } // check on number of already transferred runs
619  } // loop over runs
620  } // check on run number > 0
621 
622  // disconnect from DB
623  delete econn;
624  delete daq_temp;
625  if(m_debug) std::cout << "Ecal - > end of getNewObjects -----------\n";
626 }
EcalDAQTowerStatusMap EcalDAQTowerStatus
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
void setRunTypeDef(const RunTypeDef &runTypeDef)
Definition: RunTag.cc:70
std::vector< RunIOV > getRuns()
Definition: RunList.cc:35
unsigned long m_lastRun
void setId(int id)
Definition: ODFEDAQConfig.h:18
int iyy[18][41][3]
Definition: RunTag.h:13
int ixx[18][41][3]
void setValue(const uint32_t id, const Item &item)
float float float z
const_iterator find(uint32_t rawId) const
int getID2() const
Definition: EcalLogicID.cc:51
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf)
cond::ValidityInterval lastInterval
Definition: Types.h:73
EcalCondDBInterface * econn
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov)
int getID1() const
Definition: EcalLogicID.cc:46
int getLogicID() const
Definition: EcalLogicID.cc:41
void setLocationDef(const LocationDef &locDef)
Definition: RunTag.cc:53
int getBadTTId() const
Definition: ODFEDAQConfig.h:36
void setId(int id)
Definition: ODBadTTInfo.h:18
int iphiEB[36][68]
void setRunType(std::string runtype)
Definition: RunTypeDef.cc:33
int getConfigId() const
unsigned long m_firstRun
void fetchConfigSet(ICONF *iconf)
const Item & barrel(size_t hashedIndex) const
Definition: RunDat.h:11
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
int ietaEB[36][68]
void setLocation(std::string loc)
Definition: LocationDef.cc:33
tuple cout
Definition: gather_cfg.py:145
void setGeneralTag(std::string tag)
Definition: RunTag.cc:36
tuple size
Write out results.
RunList fetchRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef)
std::string popcon::EcalDAQHandler::id ( ) const
inlinevirtual

Implements popcon::PopConSourceHandler< EcalDAQTowerStatus >.

Definition at line 55 of file EcalDAQHandler.h.

References m_name.

55 { return m_name;}
uint16_t popcon::EcalDAQHandler::OffDBStatus ( uint16_t  dbStatus,
int  pos 
)

Definition at line 154 of file EcalDAQHandler.cc.

154  {
155  uint16_t hv_off_dbstatus = ( dbStatus & (1 << pos ) ) ;
156  if(hv_off_dbstatus>0) hv_off_dbstatus=1;
157  return hv_off_dbstatus;
158 }

Member Data Documentation

EcalCondDBInterface* popcon::EcalDAQHandler::econn

Definition at line 56 of file EcalDAQHandler.h.

bool popcon::EcalDAQHandler::m_debug
private

Definition at line 71 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

unsigned long popcon::EcalDAQHandler::m_firstRun
private

Definition at line 62 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_gentag
private

Definition at line 70 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

unsigned long popcon::EcalDAQHandler::m_lastRun
private

Definition at line 63 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_location
private

Definition at line 68 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_name
private

Definition at line 67 of file EcalDAQHandler.h.

Referenced by id().

std::string popcon::EcalDAQHandler::m_pass
private

Definition at line 66 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_runtype
private

Definition at line 69 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_sid
private

Definition at line 64 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().

std::string popcon::EcalDAQHandler::m_user
private

Definition at line 65 of file EcalDAQHandler.h.

Referenced by EcalDAQHandler().