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, min(), 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  // for(int kr = 0; kr < num_runs; kr++){
312  int krmax = std::min(num_runs, 1000);
313  for(int kr = 0; kr < krmax; kr++){
314  if(m_to_transfer.size() < 20 ) {
315 
316  if(run_vec[kr].getRunTag().getGeneralTag() != "GLOBAL") continue;
317  bool somediff = false;
318  // initialize this run status to all OK
319  irun = (unsigned long) run_vec[kr].getRunNumber();
320  for(int k = 0 ; k < 2; k++ ) {
321  for(int iphi = 0 ; iphi < 72; iphi++) {
322  for(int ieta = 0 ; ieta < 17; ieta++) {
323  newEBStatus[iphi][ieta][k] = 0;
324  }
325  }
326  for(int ix = 0 ; ix < 20; ix++) {
327  for(int iy = 0 ; iy < 20; iy++) {
328  newEEStatus[ix][iy][k] = 0;
329  }
330  }
331  } // loop over side
332 
333 
334 
335  // these are the online conditions DB classes readout FEDs
336  std::map<EcalLogicID, RunDat> fed_dat;
337  econn->fetchDataSet(&fed_dat, &run_vec[kr]);
338 
339  // these are the online conditions DB classes unread FEs
340  typedef std::map<EcalLogicID, RunDat>::const_iterator fedIter;
341  // EcalLogicID ecid_xt;
342  RunDat rdat_fe;
343  EcalLogicID idfed;
344 
345  std::map<EcalLogicID, RunFEConfigDat> feconfig;
346  econn->fetchDataSet(&feconfig, &run_vec[kr]);
347 
348  if(fed_dat.size() == 0 || feconfig.size() == 0) {
349  std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
350  << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
351  << " feconfig and/or read FED size = 0, leaving..." << std::endl;
352  continue;
353  }
354 
355 
356  if(fed_dat.size() != 54 ) {
357  int SM[36] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
358  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
359  int Sect[2][9] = {{0, 0, 0, 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0, 0, 0}};
360  for (fedIter p=fed_dat.begin(); p!=fed_dat.end(); p++) {
361  idfed = p->first;
362  int sm = 0;
363  int z = 0;
364  if(idfed.getLogicID()<2000000000){// eb
365  sm = idfed.getID1();
366  // std::cout << " EB " << sm;
367  SM[sm - 1] = 1;
368  }
369  else { // ee
370  z = idfed.getID1();
371  sm = idfed.getID2();
372  // std::cout << " EE " << z << " " << sm;
373  int izz = z;
374  if(z == -1) izz = 0;
375  Sect[izz][sm - 1] = 1;
376  }
377  } // loop over all FED
379  /* if(irun == 124089) {
380  Sect[0][2] = 0;
381  Sect[1][7] = 0;
382  } */
384  // mark all TT/SC in the not read out FEDs
385  for(int sm = 0; sm < 36; sm++) // barrel
386  if(SM[sm] != 1) {
387  //std::cout << " missing EB " << sm + 1 << std::endl;
388  if(sm < 18)
389  for(int tt = 0; tt < 68; tt++)
390  newEBStatus[iphiEB[sm][tt] - 1][ietaEB[sm][tt] - 1][0] = 1;
391  else
392  for(int tt = 0; tt < 68; tt++)
393  newEBStatus[iphiEB[sm - 18][tt] - 1][ietaEB[sm - 18][tt] - 1][1] = 1;
394  }
395  for(int z = 0; z < 2; z++) // endcaps
396  for(int sec = 0; sec < 9; sec++)
397  if(Sect[z][sec] != 1) {
398  //std::cout << " missing EE " << z << " " << sec + 1 << std::endl;
399  int sec18 = sec;
400  if(z == 1) sec18 = sec + 9;
401  for(int sc = 0 ; sc < 41; sc++) {
402  if(ixx[sec18][sc][0] != 0) {
403  newEEStatus[ixx[sec18][sc][0] - 1][iyy[sec18][sc][0] - 1][z] = 1;
404  if(ixx[sec18][sc][1] != 0) {
405  newEEStatus[ixx[sec18][sc][1] - 1][iyy[sec18][sc][1] - 1][z] = 1;
406  if(ixx[sec18][sc][2] != 0) {
407  newEEStatus[ixx[sec18][sc][2] - 1][iyy[sec18][sc][2] - 1][z] = 1;
408  }
409  }
410  }
411  } // loop over all possible SC in a sector
412  } // not read out sector
413  } // not all FED are read out
414 
415  typedef std::map<EcalLogicID, RunFEConfigDat>::const_iterator feConfIter;
416  // EcalLogicID ecid_xt;
417  RunFEConfigDat rd_fe;
418 
419  int fe_conf_id = 0;
420  for (feConfIter p=feconfig.begin(); p!=feconfig.end(); p++) {
421  // ecid_xt = p->first;
422  rd_fe = p->second;
423  fe_conf_id = rd_fe.getConfigId();
424  }
425 
426  // reading this configuration
427  ODFEDAQConfig myconfig;
428  myconfig.setId(fe_conf_id);
429  econn->fetchConfigSet(&myconfig);
430 
431  // list of bad towers
432  int myTT = myconfig.getBadTTId();
433  ODBadTTInfo mybadTT;
434  std::vector< ODBadTTDat > badTT_dat;
435  unsigned NbadTT = 0;
436 
437  /* if(myTT == 0) {
438  std::cout << " myTT = 0" << std::endl;
439  continue;
440  }
441  else {
442  */
443  if(myTT != 0) {
444  mybadTT.setId(myTT);
445  econn->fetchConfigSet(&mybadTT);
446 
447  econn->fetchConfigDataSet(&badTT_dat, &mybadTT);
448  NbadTT = badTT_dat.size();
449  }
450 
451  /* std::cout << " run " << irun << " tag " << run_vec[kr].getRunTag().getGeneralTag()
452  << " Run type " << run_vec[kr].getRunTag().getRunTypeDef().getRunType()
453  << " number of read FEDs " << fed_dat.size()
454  << " number of bad FEs " << NbadTT
455  << " fe_conf_id " << fe_conf_id << std::endl;
456  */
457 
458  // *daqFile << " run " << irun << " bad TT number " << NbadTT << "\n" << "Towers : ";
459  for(size_t iTT = 0; iTT < NbadTT; iTT++){
460  int fed_id = badTT_dat[iTT].getFedId();
461  int tt_id = badTT_dat[iTT].getTTId();
462  // int SM = badTT_dat[iTT].getSMId(); // SM always 0!
463  int side = 0; // EB/EE-
464  //*daqFile << fed_id << "/" << tt_id << " ";
465  // std::cout << fed_id << "/" << tt_id << "/" << SM << "/" ;
466  // std::cout << fed_id << "/" << tt_id << "/";
467  if(fed_id >= 610 && fed_id <= 645) { // barrel
468  if(tt_id > 68) {
469  //std::cout << " Problem in Fed " << fed_id << " TT " << tt_id << " Give up " << std::endl;
470  continue;
471  }
472  if(fed_id > 627) side = +1; // EB+
473  if(m_debug) std::cout << " phi " << iphiEB[fed_id - 610][tt_id - 1]
474  << " eta " << ietaEB[fed_id - 610][tt_id - 1]
475  << " side " << side << std::endl;
476  newEBStatus[iphiEB[fed_id - 610][tt_id - 1] - 1][ietaEB[fed_id - 610][tt_id - 1] - 1][side] = 1;
477  }
478  else if(fed_id <= 609 || (fed_id >= 646 && fed_id <= 654)) { // endcap
479  if(tt_id > 41) {
480  //std::cout << " Problem in Fed " << fed_id << " SC " << tt_id << " Give up " << std::endl;
481  continue;
482  }
483  if(fed_id < 610) { // EE-
484  if(m_debug) std::cout << " x " << ixx[fed_id - 601][tt_id - 1][0]
485  << " y " << iyy[fed_id - 601][tt_id - 1][0];
486  newEEStatus[ixx[fed_id - 601][tt_id - 1][0] - 1][iyy[fed_id - 601][tt_id - 1][0] - 1][side] = 1;
487  if(ixx[fed_id - 601][tt_id - 1][1] != 0) { // partial SC
488  if(m_debug) std::cout << " x2 " << ixx[fed_id - 601][tt_id - 1][1]
489  << " y2 " << iyy[fed_id - 601][tt_id - 1][1];
490  newEEStatus[ixx[fed_id - 601][tt_id - 1][1] - 1][iyy[fed_id - 601][tt_id - 1][1] - 1][side] = 1;
491  if(ixx[fed_id - 601][tt_id - 1][2] != 0) { // partial SC
492  if(m_debug) std::cout << " x3 " << ixx[fed_id - 601][tt_id - 1][2]
493  << " y3 " << iyy[fed_id - 601][tt_id - 1][2];
494  newEEStatus[ixx[fed_id - 601][tt_id - 1][2] - 1][iyy[fed_id - 601][tt_id - 1][2] - 1][side] = 1;
495  }
496  }
497  if(m_debug) std::cout << " side " << side << std::endl;
498  }
499  else { // EE+
500  side = +1;
501  if(m_debug) std::cout << " x " << ixx[fed_id - 637][tt_id - 1][0]
502  << " y " << iyy[fed_id - 637][tt_id - 1][0];
503  newEEStatus[ixx[fed_id - 637][tt_id - 1][0] - 1][iyy[fed_id - 637][tt_id - 1][0] - 1][side] = 1;
504  if(ixx[fed_id - 637][tt_id - 1][1] != 0) { // partial SC
505  if(m_debug) std::cout << " x2 " << ixx[fed_id - 637][tt_id - 1][1]
506  << " y2 " << iyy[fed_id - 637][tt_id - 1][1];
507  newEEStatus[ixx[fed_id - 637][tt_id - 1][1] - 1][iyy[fed_id - 637][tt_id - 1][1] - 1][side] = 1;
508  if(ixx[fed_id - 637][tt_id - 1][2] != 0) { // partial SC
509  if(m_debug) std::cout << " x3 " << ixx[fed_id - 637][tt_id - 1][2]
510  << " y3 " << iyy[fed_id - 637][tt_id - 1][2];
511  newEEStatus[ixx[fed_id - 637][tt_id - 1][2] - 1][iyy[fed_id - 637][tt_id - 1][2] - 1][side] = 1;
512  }
513  }
514  if(m_debug) std::cout << " side " << side << std::endl;
515  }
516  }
517  else {
518  std::cout << " Strange Fed " << fed_id << " TT/SC " << tt_id << " Give up " << std::endl;
519  continue;
520  }
521  } // end loop over iTT
522  if(m_debug) std::cout << std::endl;
523  //*daqFile << std::endl;
524  for(int k = 0 ; k < 2; k++ ) {
525  int iz = -1;
526  if(k == 1) iz = 1;
527  if(m_debug) std::cout << " Side : " << k << " barrel " << std::endl; // barrel
528  for(int iphi = 0 ; iphi < 72; iphi++) {
529  for(int ieta = 0 ; ieta < 17; ieta++) {
530  if(newEBStatus[iphi][ieta][k] != oldEBStatus[iphi][ieta][k]) {
531  somediff = true;
532  EcalTrigTowerDetId ebid(iz, EcalBarrel, ieta + 1, iphi + 1);
533  daq_temp->setValue( ebid, newEBStatus[iphi][ieta][k]);
534  if(m_debug) std::cout << " change in EB side " << iz << " phi " << iphi +1 << " eta " << ieta + 1 << std::endl;
535  } // new status
536  if(m_debug) std::cout << newEBStatus[iphi][ieta][k] << " " ;
537  oldEBStatus[iphi][ieta][k] = newEBStatus[iphi][ieta][k];
538  }
539  if(m_debug) std::cout << std::endl;
540  }
541  if(m_debug) std::cout << " endcaps " << std::endl; // endcap
542  for(int iy = 0 ; iy < 20; iy++) {
543  for(int ix = 0 ; ix < 20; ix++) {
544  if (EcalScDetId::validDetId(ix + 1, iy + 1, iz )){
545  if(newEEStatus[ix][iy][k] != oldEEStatus[ix][iy][k]) {
546  somediff = true;
547  EcalScDetId eeid(ix + 1, iy + 1, iz);
548  daq_temp->setValue( eeid, newEEStatus[ix][iy][k]);
549  if(m_debug) std::cout << " change in EE side " << iz << " x " << ix +1 << " y " << iy + 1 << std::endl;
550  } // new status
551  if(m_debug) std::cout << newEEStatus[ix][iy][k] << " " ;
552  oldEEStatus[ix][iy][k] = newEEStatus[ix][iy][k];
553  } // valid SC
554  else {
555  if(m_debug) std::cout << ". ";
556  }
557  }
558  if(m_debug) std::cout << std::endl;
559  }
560  } // loop over side
561 
562  if(somediff) {
563 
564  // we copy the last valid record to the object that is sent to the DB
565  EcalDAQTowerStatus* daq_pop = new EcalDAQTowerStatus();
566 
567 
568 
569  int iz = -1;
570  for(int k = 0 ; k < 2; k++ ) {
571  if(k == 1) iz = 1;
572  for(int iphi = 1 ; iphi < 73; iphi++) {
573  for(int ieta = 1 ; ieta < 18; ieta++) {
574  if (EcalTrigTowerDetId::validDetId(iz,EcalBarrel,ieta,iphi )){
575  EcalTrigTowerDetId ebid(iz,EcalBarrel,ieta,iphi);
576  uint16_t dbStatus = 0;
577  dbStatus =(daq_temp->barrel( ebid.hashedIndex())).getStatusCode();
578  daq_pop->setValue( ebid, dbStatus );
579  }
580  } // end loop over ieta
581  } // end loop over iphi
582 
583  // endcap
584  for(int ix = 1 ; ix < 21; ix++) {
585  for(int iy = 1 ; iy < 21; iy++) {
586  if (EcalScDetId::validDetId(ix,iy,iz )){
587  EcalScDetId eeid(ix,iy,iz);
588 
589  EcalDAQTowerStatus::const_iterator it =daq_temp->find(eeid.rawId());
590  uint16_t dbStatus = 0;
591  if ( it != daq_temp->end() ) {
592  dbStatus = it->getStatusCode();
593  }
594  daq_pop->setValue( eeid, dbStatus );
595  }
596  } // end loop over iy
597  } // end loop over ix
598  } // end loop over k (side)
599 
600 
601 
602  std::cout << "Generating popcon record for run "<< irun << std::endl;
603 
604  m_to_transfer.push_back(std::make_pair((EcalDAQTowerStatus*)daq_pop, irun));
605 
606  ss << "Run=" << irun << "_DAQchanged_"<<std::endl;
607  m_userTextLog = ss.str()+";";
608  } // some change found
609  else {
610 
611  std::cout<< "Run" << irun << " DAQ record was the same as previous run " << std::endl;
612  ss << "Run=" << irun << "_DAQunchanged_"<<std::endl;
613  m_userTextLog = ss.str()+";";
614 
615  } // no change
616 
617  } // check on number of already transferred runs
618  } // loop over runs
619  } // check on run number > 0
620 
621  // disconnect from DB
622  delete econn;
623  delete daq_temp;
624  if(m_debug) std::cout << "Ecal - > end of getNewObjects -----------\n";
625 }
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
T min(T a, T b)
Definition: MathUtil.h:58
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().