CMS 3D CMS Logo

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

#include <TCPReceiver.h>

Public Member Functions

int Connect ()
 
int Disconnect ()
 
void GenerateFakeData (HCAL_HLX::LUMI_SECTION &localSection)
 
void GenerateRandomData (HCAL_HLX::LUMI_SECTION &localSection)
 
bool IsConnected ()
 
int ReceiveLumiSection (HCAL_HLX::LUMI_SECTION &localSection)
 
void SetIP (std::string IP)
 
int SetMode (unsigned char)
 
int SetPort (unsigned short int)
 
 TCPReceiver ()
 
 TCPReceiver (unsigned short int, std::string, unsigned char)
 
bool VerifyFakeData (HCAL_HLX::LUMI_SECTION &localSection)
 
 ~TCPReceiver ()
 

Private Attributes

unsigned char acquireMode
 
bool Connected
 
struct sockaddr_in servAddr
 
std::string servIP
 
unsigned short servPort
 
int tcpSocket
 

Detailed Description

Definition at line 35 of file TCPReceiver.h.

Constructor & Destructor Documentation

◆ TCPReceiver() [1/2]

HCAL_HLX::TCPReceiver::TCPReceiver ( )

Definition at line 34 of file TCPReceiver.cc.

34  {
35 #ifdef DEBUG
36  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
37 #endif
38 
39  acquireMode = 0;
40  servPort = 0;
41  servIP = "127.0.0.1";
42  Connected = false;
43 
44 #ifdef DEBUG
45  std::cout << "End " << __PRETTY_FUNCTION__ << std::endl;
46 #endif
47  }

References acquireMode, Connected, gather_cfg::cout, servIP, and servPort.

◆ TCPReceiver() [2/2]

HCAL_HLX::TCPReceiver::TCPReceiver ( unsigned short int  port,
std::string  IP,
unsigned char  mode = 0 
)

Definition at line 49 of file TCPReceiver.cc.

49  {
50 #ifdef DEBUG
51  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
52 #endif
53  acquireMode = mode;
54  servPort = port;
55  servIP = IP;
56  Connected = false;
57 
58 #ifdef DEBUG
59  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
60 #endif
61  }

References acquireMode, Connected, gather_cfg::cout, listHistos::IP, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, query::port, servIP, and servPort.

◆ ~TCPReceiver()

HCAL_HLX::TCPReceiver::~TCPReceiver ( )

Definition at line 63 of file TCPReceiver.cc.

63 { Disconnect(); }

References Disconnect().

Member Function Documentation

◆ Connect()

int HCAL_HLX::TCPReceiver::Connect ( )

Definition at line 229 of file TCPReceiver.cc.

229  {
230 #ifdef DEBUG
231  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
232 #endif
233 
234  int errorCode;
235 
236  if (acquireMode == 0) {
237  struct hostent *hostInfo = gethostbyname(servIP.c_str());
238 
239  if (servPort < 1024) {
240  errorCode = 101; // Protected ports
241  } else {
242 #ifdef DEBUG
243  std::cout << "Requesting connection" << std::endl;
244 #endif
245  if ((tcpSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
246  perror("Socket Error");
247  errorCode = 301; // Socket failed
248  } else {
249  memset(&servAddr, 0, sizeof(servAddr));
250  servAddr.sin_family = hostInfo->h_addrtype;
251  memcpy((char *)&servAddr.sin_addr.s_addr, hostInfo->h_addr_list[0], hostInfo->h_length);
252  // servAddr.sin_addr.s_addr = inet_addr(servIP.c_str());
253  servAddr.sin_port = htons(servPort);
254 #ifdef DEBUG
255  std::cout << "Connecting" << std::endl;
256 #endif
257  if (connect(tcpSocket, (struct sockaddr *)&servAddr, sizeof(servAddr)) < 0) {
258  perror("Connect Error");
259  errorCode = 302; // connect failed
260  close(tcpSocket);
261  } else {
262  Connected = true;
263  errorCode = 1; // Successful connection
264  }
265  }
266  }
267  } else if (acquireMode == 1) {
268  Connected = true;
269  errorCode = 1; // do nothing for fake data
270  } else if (acquireMode == 2) {
271  Connected = true;
272  errorCode = 1; // do nothing for random data
273  } else {
274  errorCode = 201; // Invalid acquire mode
275  }
276 
277 #ifdef DEBUG
278  std::cout << "End " << __PRETTY_FUNCTION__ << " " << errorCode << std::endl;
279 #endif
280  return errorCode;
281  }

References acquireMode, DBConfiguration_cff::connect, Connected, gather_cfg::cout, servAddr, servIP, servPort, and tcpSocket.

Referenced by HLXMonitor::analyze(), and HLXMonitor::connectHLXTCP().

◆ Disconnect()

int HCAL_HLX::TCPReceiver::Disconnect ( )

Definition at line 283 of file TCPReceiver.cc.

283  {
284 #ifdef DEBUG
285  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
286 #endif
287 
288  int errorCode = 0;
289 
290  if (Connected) {
291  if (acquireMode == 0) {
292  if (shutdown(tcpSocket, SHUT_RDWR) < 0) {
293  perror("Shutdown Error");
294  errorCode = 601; // Disconnect Failed
295  } else {
296  errorCode = 1; // Successful Disconnect
297  }
298  }
299  Connected = false;
300  } else {
301  errorCode = 401; // Not Connected
302  }
303 
304 #ifdef DEBUG
305  std::cout << "End " << __PRETTY_FUNCTION__ << " " << errorCode << std::endl;
306 #endif
307  return errorCode;
308  }

References acquireMode, Connected, gather_cfg::cout, and tcpSocket.

Referenced by HLXMonitor::analyze(), HLXMonitor::~HLXMonitor(), and ~TCPReceiver().

◆ GenerateFakeData()

void HCAL_HLX::TCPReceiver::GenerateFakeData ( HCAL_HLX::LUMI_SECTION localSection)

Definition at line 310 of file TCPReceiver.cc.

310  {
311 #ifdef DEBUG
312  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
313 #endif
314  int i, j, k;
315 
316  localSection.hdr.runNumber = 1;
317  localSection.hdr.startOrbit = 2;
318  localSection.hdr.numOrbits = 3;
319  localSection.hdr.numBunches = 4;
320  localSection.hdr.numHLXs = 5;
321  localSection.hdr.bCMSLive = true;
322  localSection.hdr.sectionNumber = 120;
323 
324  timeval tvTemp;
325  gettimeofday(&tvTemp, nullptr);
326  localSection.hdr.timestamp = tvTemp.tv_sec;
327  localSection.hdr.timestamp_micros = tvTemp.tv_usec;
328 
329  localSection.lumiSummary.DeadtimeNormalization = 0.7;
330  localSection.lumiSummary.LHCNormalization = 0.75;
331  localSection.lumiSummary.OccNormalization[0] = 0.8;
332  localSection.lumiSummary.OccNormalization[1] = 0.85;
333  localSection.lumiSummary.ETNormalization = 0.8;
334  localSection.lumiSummary.InstantLumi = 0.9;
335  localSection.lumiSummary.InstantLumiErr = 0.10;
336  localSection.lumiSummary.InstantLumiQlty = 11;
337  localSection.lumiSummary.InstantETLumi = 0.12;
338  localSection.lumiSummary.InstantETLumiErr = 0.13;
339  localSection.lumiSummary.InstantETLumiQlty = 14;
340  localSection.lumiSummary.InstantOccLumi[0] = 0.15;
341  localSection.lumiSummary.InstantOccLumiErr[0] = 0.16;
342  localSection.lumiSummary.InstantOccLumiQlty[0] = 17;
343  localSection.lumiSummary.lumiNoise[0] = 0.18;
344  localSection.lumiSummary.InstantOccLumi[1] = 0.19;
345  localSection.lumiSummary.InstantOccLumiErr[1] = 0.20;
346  localSection.lumiSummary.InstantOccLumiQlty[1] = 21;
347  localSection.lumiSummary.lumiNoise[1] = 0.22;
348 
349  for (j = 0; j < 3564; j++) {
350  localSection.lumiDetail.ETBXNormalization[j] = 0.25 * j / 35640.0;
351  localSection.lumiDetail.OccBXNormalization[0][j] = 0.5 * j / 35640.0;
352  localSection.lumiDetail.OccBXNormalization[1][j] = 0.75 * j / 35640.0;
353  localSection.lumiDetail.LHCLumi[j] = 1 * j / 35640.0;
354  localSection.lumiDetail.ETLumi[j] = 2 * j / 35640.0;
355  localSection.lumiDetail.ETLumiErr[j] = 3 * j / 35640.0;
356  localSection.lumiDetail.ETLumiQlty[j] = 4 * j;
357  localSection.lumiDetail.OccLumi[0][j] = 5 * j / 35640.0;
358  localSection.lumiDetail.OccLumiErr[0][j] = 6 * j / 35640.0;
359  localSection.lumiDetail.OccLumiQlty[0][j] = 7 * j;
360  localSection.lumiDetail.OccLumi[1][j] = 8 * j / 35640.0;
361  localSection.lumiDetail.OccLumiErr[1][j] = 9 * j / 35640.0;
362  localSection.lumiDetail.OccLumiQlty[1][j] = 10 * j;
363  }
364 
365  for (i = 0; i < 36; i++) {
366  localSection.etSum[i].hdr.numNibbles = 7;
367  localSection.occupancy[i].hdr.numNibbles = 8;
368  localSection.lhc[i].hdr.numNibbles = 9;
369 
370  localSection.etSum[i].hdr.bIsComplete = true;
371  localSection.occupancy[i].hdr.bIsComplete = true;
372  localSection.lhc[i].hdr.bIsComplete = true;
373 
374  for (j = 0; j < 3564; j++) {
375  localSection.etSum[i].data[j] = 6 * j + 10 * i;
376  for (k = 0; k < 6; k++) {
377  localSection.occupancy[i].data[k][j] = k * j + 11 * i;
378  }
379  localSection.lhc[i].data[j] = 7 * j + 12 * i;
380  }
381  }
382 
383 #ifdef DEBUG
384  std::cout << "End " << __PRETTY_FUNCTION__ << std::endl;
385 #endif
386  }

References HCAL_HLX::LUMI_SECTION_HEADER::bCMSLive, HCAL_HLX::LUMI_SECTION_SUB_HEADER::bIsComplete, gather_cfg::cout, HCAL_HLX::ET_SUM_SECTION::data, HCAL_HLX::OCCUPANCY_SECTION::data, HCAL_HLX::LHC_SECTION::data, HCAL_HLX::LUMI_DETAIL::ETBXNormalization, HCAL_HLX::LUMI_DETAIL::ETLumi, HCAL_HLX::LUMI_DETAIL::ETLumiErr, HCAL_HLX::LUMI_DETAIL::ETLumiQlty, HCAL_HLX::LUMI_SUMMARY::ETNormalization, HCAL_HLX::LUMI_SECTION::etSum, HCAL_HLX::ET_SUM_SECTION::hdr, HCAL_HLX::OCCUPANCY_SECTION::hdr, HCAL_HLX::LHC_SECTION::hdr, HCAL_HLX::LUMI_SECTION::hdr, mps_fire::i, HCAL_HLX::LUMI_SUMMARY::InstantETLumi, HCAL_HLX::LUMI_SUMMARY::InstantETLumiErr, HCAL_HLX::LUMI_SUMMARY::InstantETLumiQlty, HCAL_HLX::LUMI_SUMMARY::InstantLumi, HCAL_HLX::LUMI_SUMMARY::InstantLumiErr, HCAL_HLX::LUMI_SUMMARY::InstantLumiQlty, HCAL_HLX::LUMI_SUMMARY::InstantOccLumi, HCAL_HLX::LUMI_SUMMARY::InstantOccLumiErr, HCAL_HLX::LUMI_SUMMARY::InstantOccLumiQlty, dqmiolumiharvest::j, dqmdumpme::k, HCAL_HLX::LUMI_SECTION::lhc, HCAL_HLX::LUMI_DETAIL::LHCLumi, HCAL_HLX::LUMI_SUMMARY::LHCNormalization, HCAL_HLX::LUMI_SECTION::lumiDetail, HCAL_HLX::LUMI_SUMMARY::lumiNoise, HCAL_HLX::LUMI_SECTION::lumiSummary, HCAL_HLX::LUMI_SECTION_HEADER::numBunches, HCAL_HLX::LUMI_SECTION_HEADER::numHLXs, HCAL_HLX::LUMI_SECTION_SUB_HEADER::numNibbles, HCAL_HLX::LUMI_SECTION_HEADER::numOrbits, HCAL_HLX::LUMI_DETAIL::OccBXNormalization, HCAL_HLX::LUMI_DETAIL::OccLumi, HCAL_HLX::LUMI_DETAIL::OccLumiErr, HCAL_HLX::LUMI_DETAIL::OccLumiQlty, HCAL_HLX::LUMI_SUMMARY::OccNormalization, HCAL_HLX::LUMI_SECTION::occupancy, HCAL_HLX::LUMI_SECTION_HEADER::runNumber, HCAL_HLX::LUMI_SECTION_HEADER::sectionNumber, HCAL_HLX::LUMI_SECTION_HEADER::startOrbit, HCAL_HLX::LUMI_SECTION_HEADER::timestamp, and HCAL_HLX::LUMI_SECTION_HEADER::timestamp_micros.

Referenced by ReceiveLumiSection(), and VerifyFakeData().

◆ GenerateRandomData()

void HCAL_HLX::TCPReceiver::GenerateRandomData ( HCAL_HLX::LUMI_SECTION localSection)

Definition at line 388 of file TCPReceiver.cc.

388  {
389 #ifdef DEBUG
390  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
391 #endif
392  int i, j, k;
393 
394  srand(time(nullptr));
395  localSection.hdr.runNumber = 55; //(rand() % 100);
396  localSection.hdr.startOrbit = (rand() % 100);
397  localSection.hdr.numOrbits = (rand() % 100);
398  localSection.hdr.numBunches = (rand() % 100);
399  localSection.hdr.numHLXs = (rand() % 100);
400  localSection.hdr.bCMSLive = true;
401  localSection.hdr.sectionNumber = (rand() % 100);
402 
403  localSection.lumiSummary.DeadtimeNormalization = (float)(rand() % 100) / 100;
404  localSection.lumiSummary.LHCNormalization = (float)(rand() % 100) / 100;
405  localSection.lumiSummary.OccNormalization[0] = (float)(rand() % 100) / 100;
406  localSection.lumiSummary.OccNormalization[1] = (float)(rand() % 100) / 100;
407  localSection.lumiSummary.ETNormalization = (float)(rand() % 100) / 100;
408  localSection.lumiSummary.InstantLumi = (float)(rand() % 100) / 100;
409  localSection.lumiSummary.InstantLumiErr = (float)(rand() % 100) / 100;
410  localSection.lumiSummary.InstantLumiQlty = (rand() % 100);
411  localSection.lumiSummary.InstantETLumi = (float)(rand() % 100) / 100;
412  localSection.lumiSummary.InstantETLumiErr = (float)(rand() % 100) / 100;
413  localSection.lumiSummary.InstantETLumiQlty = (rand() % 100);
414  localSection.lumiSummary.InstantOccLumi[0] = (float)(rand() % 100) / 100;
415  localSection.lumiSummary.InstantOccLumiErr[0] = (float)(rand() % 100) / 100;
416  localSection.lumiSummary.InstantOccLumiQlty[0] = (rand() % 100);
417  localSection.lumiSummary.lumiNoise[0] = (float)(rand() % 100) / 100;
418  localSection.lumiSummary.InstantOccLumi[1] = (float)(rand() % 100) / 100;
419  localSection.lumiSummary.InstantOccLumiErr[1] = (float)(rand() % 100) / 100;
420  localSection.lumiSummary.InstantOccLumiQlty[1] = (rand() % 100);
421  localSection.lumiSummary.lumiNoise[1] = (float)(rand() % 100) / 100;
422 
423  for (j = 0; j < 3564; j++) {
424  localSection.lumiDetail.ETBXNormalization[j] = 0.25 * j / 35640.0;
425  localSection.lumiDetail.OccBXNormalization[0][j] = 0.5 * j / 35640.0;
426  localSection.lumiDetail.OccBXNormalization[1][j] = 0.75 * j / 35640.0;
427  localSection.lumiDetail.LHCLumi[j] = (float)(rand() % 100) / 100.0;
428  localSection.lumiDetail.ETLumi[j] = (float)(rand() % 100) / 100.0;
429  localSection.lumiDetail.ETLumiErr[j] = (float)(rand() % 100) / 100.0;
430  localSection.lumiDetail.ETLumiQlty[j] = (rand() % 100);
431  localSection.lumiDetail.OccLumi[0][j] = (float)(rand() % 100) / 100.0;
432  localSection.lumiDetail.OccLumiErr[0][j] = (float)(rand() % 100) / 100.0;
433  localSection.lumiDetail.OccLumiQlty[0][j] = (rand() % 100);
434  localSection.lumiDetail.OccLumi[1][j] = (float)(rand() % 100) / 100.0;
435  localSection.lumiDetail.OccLumiErr[1][j] = (float)(rand() % 100) / 100.0;
436  localSection.lumiDetail.OccLumiQlty[1][j] = (rand() % 100);
437  }
438 
439  for (i = 0; i < 36; i++) {
440  localSection.etSum[i].hdr.numNibbles = (rand() % 100);
441  localSection.occupancy[i].hdr.numNibbles = 8 * (rand() % 100);
442  localSection.lhc[i].hdr.numNibbles = 9 * (rand() % 100);
443 
444  localSection.etSum[i].hdr.bIsComplete = true;
445  localSection.occupancy[i].hdr.bIsComplete = true;
446  localSection.lhc[i].hdr.bIsComplete = true;
447 
448  for (j = 0; j < 3564; j++) {
449  localSection.etSum[i].data[j] = 6 * (rand() % 3564);
450  for (k = 0; k < 6; k++) {
451  localSection.occupancy[i].data[k][j] = k * (rand() % 3564);
452  }
453  localSection.lhc[i].data[j] = 7 * (rand() % 3564);
454  }
455  }
456 
457 #ifdef DEBUG
458  std::cout << "End " << __PRETTY_FUNCTION__ << std::endl;
459 #endif
460  }

References HCAL_HLX::LUMI_SECTION_HEADER::bCMSLive, HCAL_HLX::LUMI_SECTION_SUB_HEADER::bIsComplete, gather_cfg::cout, HCAL_HLX::ET_SUM_SECTION::data, HCAL_HLX::OCCUPANCY_SECTION::data, HCAL_HLX::LHC_SECTION::data, HCAL_HLX::LUMI_DETAIL::ETBXNormalization, HCAL_HLX::LUMI_DETAIL::ETLumi, HCAL_HLX::LUMI_DETAIL::ETLumiErr, HCAL_HLX::LUMI_DETAIL::ETLumiQlty, HCAL_HLX::LUMI_SUMMARY::ETNormalization, HCAL_HLX::LUMI_SECTION::etSum, dqmMemoryStats::float, HCAL_HLX::ET_SUM_SECTION::hdr, HCAL_HLX::OCCUPANCY_SECTION::hdr, HCAL_HLX::LHC_SECTION::hdr, HCAL_HLX::LUMI_SECTION::hdr, mps_fire::i, HCAL_HLX::LUMI_SUMMARY::InstantETLumi, HCAL_HLX::LUMI_SUMMARY::InstantETLumiErr, HCAL_HLX::LUMI_SUMMARY::InstantETLumiQlty, HCAL_HLX::LUMI_SUMMARY::InstantLumi, HCAL_HLX::LUMI_SUMMARY::InstantLumiErr, HCAL_HLX::LUMI_SUMMARY::InstantLumiQlty, HCAL_HLX::LUMI_SUMMARY::InstantOccLumi, HCAL_HLX::LUMI_SUMMARY::InstantOccLumiErr, HCAL_HLX::LUMI_SUMMARY::InstantOccLumiQlty, dqmiolumiharvest::j, dqmdumpme::k, HCAL_HLX::LUMI_SECTION::lhc, HCAL_HLX::LUMI_DETAIL::LHCLumi, HCAL_HLX::LUMI_SUMMARY::LHCNormalization, HCAL_HLX::LUMI_SECTION::lumiDetail, HCAL_HLX::LUMI_SUMMARY::lumiNoise, HCAL_HLX::LUMI_SECTION::lumiSummary, HCAL_HLX::LUMI_SECTION_HEADER::numBunches, HCAL_HLX::LUMI_SECTION_HEADER::numHLXs, HCAL_HLX::LUMI_SECTION_SUB_HEADER::numNibbles, HCAL_HLX::LUMI_SECTION_HEADER::numOrbits, HCAL_HLX::LUMI_DETAIL::OccBXNormalization, HCAL_HLX::LUMI_DETAIL::OccLumi, HCAL_HLX::LUMI_DETAIL::OccLumiErr, HCAL_HLX::LUMI_DETAIL::OccLumiQlty, HCAL_HLX::LUMI_SUMMARY::OccNormalization, HCAL_HLX::LUMI_SECTION::occupancy, HCAL_HLX::LUMI_SECTION_HEADER::runNumber, HCAL_HLX::LUMI_SECTION_HEADER::sectionNumber, HCAL_HLX::LUMI_SECTION_HEADER::startOrbit, and protons_cff::time.

Referenced by ReceiveLumiSection().

◆ IsConnected()

bool HCAL_HLX::TCPReceiver::IsConnected ( )

Definition at line 172 of file TCPReceiver.cc.

172  {
173 #ifdef DEBUG
174  std::cout << "Begin and End " << __PRETTY_FUNCTION__ << " " << Connected << std::endl;
175 #endif
176  return Connected;
177  }

References Connected, and gather_cfg::cout.

Referenced by HLXMonitor::analyze(), and HLXMonitor::connectHLXTCP().

◆ ReceiveLumiSection()

int HCAL_HLX::TCPReceiver::ReceiveLumiSection ( HCAL_HLX::LUMI_SECTION localSection)

Definition at line 87 of file TCPReceiver.cc.

87  {
88 #ifdef DEBUG
89  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
90 #endif
91 
92  int errorCode = 0;
93 
94  if (acquireMode == 0) { // real data
95  if (Connected == false) {
96  errorCode = 701; // not connected
97  } else {
98  unsigned int bytesRcvd, bytesToReceive, totalBytesRcvd;
99  const unsigned int Buffer_Size = 8192;
100  char *Buffer;
101  char *BigBuffer;
102 
103  // From John's code
104 
105  fd_set fdsRead, fdsWrite, fdsExcept;
106 
107  // int outputcode;
108  //int z = 0, localCount = 0;
109  time_t tempTime, curTime;
110  //int ret;
111 
112  time(&curTime);
113 
114  bytesToReceive = sizeof(localSection);
115  Buffer = new char[Buffer_Size];
116  BigBuffer = new char[bytesToReceive];
117  totalBytesRcvd = 0;
118 
119  memset(reinterpret_cast<char *>(&localSection), 0, Buffer_Size);
120  memset(Buffer, 0, Buffer_Size);
121  memset(BigBuffer, 0, bytesToReceive);
122 
123  usleep(10000);
124 
125  while ((totalBytesRcvd < bytesToReceive) && (errorCode == 0)) {
126  SetupFDSets(fdsRead, fdsWrite, fdsExcept, -1, tcpSocket);
127 
128  if (select(tcpSocket + 1, &fdsRead, nullptr, &fdsExcept, nullptr) > 0) {
129  if (FD_ISSET(tcpSocket, &fdsRead)) {
130  if ((bytesRcvd = recv(tcpSocket, Buffer, Buffer_Size, 0)) <= 0) {
131  perror("Recv Error");
132  errorCode = 501;
133  } else {
134  if ((totalBytesRcvd + bytesRcvd) <= bytesToReceive) {
135  memcpy(&BigBuffer[totalBytesRcvd], Buffer, bytesRcvd);
136  } else {
137  std::cout << "***** MEM OVER FLOW: Did someone forget to update LumiStructures.hh? *****"
138  << std::endl;
139  errorCode = 502;
140  }
141  totalBytesRcvd += bytesRcvd;
142  time(&tempTime);
143  }
144  }
145  }
146  }
147 
148  if (errorCode == 0) {
149  memcpy(reinterpret_cast<char *>(&localSection), BigBuffer, sizeof(localSection));
150  errorCode = 1; // success
151  }
152  delete[] Buffer;
153  delete[] BigBuffer;
154  }
155  } else if (acquireMode == 1) { // fill with fake data. Should be unique.
156  GenerateFakeData(localSection);
157  errorCode = 1;
158  } else if (acquireMode == 2) { // fill with random fake data.
159  GenerateRandomData(localSection);
160  errorCode = 1;
161  } else {
162  errorCode = 201;
163  }
164 
165 #ifdef DEBUG
166  std::cout << "End " << __PRETTY_FUNCTION__ << " " << errorCode << std::endl;
167 #endif
168 
169  return errorCode;
170  }

References acquireMode, Connected, gather_cfg::cout, GenerateFakeData(), GenerateRandomData(), singleTopDQM_cfi::select, HCAL_HLX::SetupFDSets(), tcpSocket, and protons_cff::time.

Referenced by HLXMonitor::analyze().

◆ SetIP()

void HCAL_HLX::TCPReceiver::SetIP ( std::string  IP)

Definition at line 219 of file TCPReceiver.cc.

219  {
220 #ifdef DEBUG
221  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
222 #endif
223  servIP = IP;
224 #ifdef DEBUG
225  std::cout << "End " << __PRETTY_FUNCTION__ << std::endl;
226 #endif
227  }

References gather_cfg::cout, listHistos::IP, and servIP.

Referenced by HLXMonitor::analyze(), and HLXMonitor::connectHLXTCP().

◆ SetMode()

int HCAL_HLX::TCPReceiver::SetMode ( unsigned char  mode)

Definition at line 199 of file TCPReceiver.cc.

199  {
200 #ifdef DEBUG
201  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
202 #endif
203 
204  int errorCode;
205 
206  if (mode > 2) {
207  errorCode = 201;
208  } else {
209  acquireMode = mode;
210  errorCode = 1;
211  }
212 
213 #ifdef DEBUG
214  std::cout << "End " << __PRETTY_FUNCTION__ << " " << errorCode << std::endl;
215 #endif
216  return errorCode;
217  }

References acquireMode, gather_cfg::cout, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by HLXMonitor::connectHLXTCP().

◆ SetPort()

int HCAL_HLX::TCPReceiver::SetPort ( unsigned short int  port)

Definition at line 179 of file TCPReceiver.cc.

179  {
180 #ifdef DEBUG
181  std::cout << "Begin " << __PRETTY_FUNCTION__ << std::endl;
182 #endif
183 
184  int errorCode;
185 
186  if (port < 1024) {
187  errorCode = 101;
188  } else {
189  servPort = port;
190  errorCode = 1;
191  }
192 
193 #ifdef DEBUG
194  std::cout << "End " << __PRETTY_FUNCTION__ << " " << errorCode << std::endl;
195 #endif
196  return errorCode;
197  }

References gather_cfg::cout, query::port, and servPort.

Referenced by HLXMonitor::connectHLXTCP().

◆ VerifyFakeData()

bool HCAL_HLX::TCPReceiver::VerifyFakeData ( HCAL_HLX::LUMI_SECTION localSection)

Definition at line 462 of file TCPReceiver.cc.

462  {
465  return !(memcmp(&L, &localSection, sizeof(L)));
466  }

References GenerateFakeData(), and dttmaxenums::L.

Member Data Documentation

◆ acquireMode

unsigned char HCAL_HLX::TCPReceiver::acquireMode
private

Definition at line 53 of file TCPReceiver.h.

Referenced by Connect(), Disconnect(), ReceiveLumiSection(), SetMode(), and TCPReceiver().

◆ Connected

bool HCAL_HLX::TCPReceiver::Connected
private

Definition at line 54 of file TCPReceiver.h.

Referenced by Connect(), Disconnect(), IsConnected(), ReceiveLumiSection(), and TCPReceiver().

◆ servAddr

struct sockaddr_in HCAL_HLX::TCPReceiver::servAddr
private

Definition at line 59 of file TCPReceiver.h.

Referenced by Connect().

◆ servIP

std::string HCAL_HLX::TCPReceiver::servIP
private

Definition at line 57 of file TCPReceiver.h.

Referenced by Connect(), SetIP(), and TCPReceiver().

◆ servPort

unsigned short HCAL_HLX::TCPReceiver::servPort
private

Definition at line 56 of file TCPReceiver.h.

Referenced by Connect(), SetPort(), and TCPReceiver().

◆ tcpSocket

int HCAL_HLX::TCPReceiver::tcpSocket
private

Definition at line 58 of file TCPReceiver.h.

Referenced by Connect(), Disconnect(), and ReceiveLumiSection().

HCAL_HLX::LUMI_SUMMARY::InstantLumi
float InstantLumi
Definition: LumiRawDataStructures.h:133
HCAL_HLX::LUMI_SUMMARY::lumiNoise
float lumiNoise[2]
Definition: LumiRawDataStructures.h:147
HCAL_HLX::LUMI_SECTION
Definition: LumiRawDataStructures.h:285
dttmaxenums::L
Definition: DTTMax.h:29
HCAL_HLX::LUMI_SUMMARY::LHCNormalization
float LHCNormalization
Definition: LumiRawDataStructures.h:131
mps_fire.i
i
Definition: mps_fire.py:428
HCAL_HLX::ET_SUM_SECTION::hdr
LUMI_SECTION_SUB_HEADER hdr
Definition: LumiRawDataStructures.h:271
HCAL_HLX::LUMI_SUMMARY::InstantOccLumi
float InstantOccLumi[2]
Definition: LumiRawDataStructures.h:142
HCAL_HLX::LUMI_SECTION::lumiDetail
LUMI_DETAIL lumiDetail
Definition: LumiRawDataStructures.h:288
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
HCAL_HLX::LUMI_DETAIL::ETLumiErr
float ETLumiErr[4096]
Definition: LumiRawDataStructures.h:154
HCAL_HLX::LUMI_SUMMARY::InstantETLumiQlty
int16_t InstantETLumiQlty
Definition: LumiRawDataStructures.h:139
HCAL_HLX::LUMI_SUMMARY::InstantETLumi
float InstantETLumi
Definition: LumiRawDataStructures.h:137
HCAL_HLX::TCPReceiver::GenerateFakeData
void GenerateFakeData(HCAL_HLX::LUMI_SECTION &localSection)
Definition: TCPReceiver.cc:310
HCAL_HLX::SetupFDSets
void SetupFDSets(fd_set &ReadFDs, fd_set &WriteFDs, fd_set &ExceptFDs, int ListeningSocket=-1, int connectSocket=-1)
Definition: TCPReceiver.cc:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
singleTopDQM_cfi.select
select
Definition: singleTopDQM_cfi.py:50
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
protons_cff.time
time
Definition: protons_cff.py:39
HCAL_HLX::TCPReceiver::tcpSocket
int tcpSocket
Definition: TCPReceiver.h:58
HCAL_HLX::OCCUPANCY_SECTION::data
uint32_t data[6][4096]
Definition: LumiRawDataStructures.h:277
HCAL_HLX::LUMI_DETAIL::ETBXNormalization
float ETBXNormalization[4096]
Definition: LumiRawDataStructures.h:156
HCAL_HLX::LHC_SECTION::hdr
LUMI_SECTION_SUB_HEADER hdr
Definition: LumiRawDataStructures.h:281
HCAL_HLX::LUMI_SECTION_SUB_HEADER::bIsComplete
bool bIsComplete
Definition: LumiRawDataStructures.h:267
HCAL_HLX::LUMI_DETAIL::ETLumiQlty
int16_t ETLumiQlty[4096]
Definition: LumiRawDataStructures.h:155
HCAL_HLX::LUMI_SECTION_SUB_HEADER::numNibbles
uint32_t numNibbles
Definition: LumiRawDataStructures.h:266
HCAL_HLX::LUMI_DETAIL::ETLumi
float ETLumi[4096]
Definition: LumiRawDataStructures.h:153
HCAL_HLX::TCPReceiver::servPort
unsigned short servPort
Definition: TCPReceiver.h:56
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HCAL_HLX::OCCUPANCY_SECTION::hdr
LUMI_SECTION_SUB_HEADER hdr
Definition: LumiRawDataStructures.h:276
HCAL_HLX::LUMI_DETAIL::OccLumiQlty
int16_t OccLumiQlty[2][4096]
Definition: LumiRawDataStructures.h:160
HCAL_HLX::LUMI_SECTION_HEADER::bCMSLive
bool bCMSLive
Definition: LumiRawDataStructures.h:261
HCAL_HLX::TCPReceiver::acquireMode
unsigned char acquireMode
Definition: TCPReceiver.h:53
HCAL_HLX::TCPReceiver::servAddr
struct sockaddr_in servAddr
Definition: TCPReceiver.h:59
HCAL_HLX::LHC_SECTION::data
uint32_t data[4096]
Definition: LumiRawDataStructures.h:282
listHistos.IP
IP
Definition: listHistos.py:76
HCAL_HLX::LUMI_SUMMARY::OccNormalization
float OccNormalization[2]
Definition: LumiRawDataStructures.h:145
HCAL_HLX::LUMI_SUMMARY::ETNormalization
float ETNormalization
Definition: LumiRawDataStructures.h:140
HCAL_HLX::LUMI_SECTION_HEADER::timestamp_micros
uint32_t timestamp_micros
Definition: LumiRawDataStructures.h:251
query.port
int port
Definition: query.py:116
HCAL_HLX::LUMI_SECTION_HEADER::timestamp
uint32_t timestamp
Definition: LumiRawDataStructures.h:250
DBConfiguration_cff.connect
connect
Definition: DBConfiguration_cff.py:18
HCAL_HLX::LUMI_DETAIL::LHCLumi
float LHCLumi[4096]
Definition: LumiRawDataStructures.h:151
HCAL_HLX::TCPReceiver::Connected
bool Connected
Definition: TCPReceiver.h:54
HCAL_HLX::LUMI_SECTION::hdr
LUMI_SECTION_HEADER hdr
Definition: LumiRawDataStructures.h:286
HCAL_HLX::LUMI_SUMMARY::InstantLumiErr
float InstantLumiErr
Definition: LumiRawDataStructures.h:134
HCAL_HLX::LUMI_DETAIL::OccLumiErr
float OccLumiErr[2][4096]
Definition: LumiRawDataStructures.h:159
HCAL_HLX::LUMI_SECTION_HEADER::sectionNumber
uint32_t sectionNumber
Definition: LumiRawDataStructures.h:254
HCAL_HLX::LUMI_SUMMARY::InstantOccLumiErr
float InstantOccLumiErr[2]
Definition: LumiRawDataStructures.h:143
HCAL_HLX::TCPReceiver::Disconnect
int Disconnect()
Definition: TCPReceiver.cc:283
HCAL_HLX::LUMI_SECTION_HEADER::numHLXs
uint16_t numHLXs
Definition: LumiRawDataStructures.h:259
HCAL_HLX::LUMI_SECTION::etSum
ET_SUM_SECTION etSum[36]
Definition: LumiRawDataStructures.h:290
HCAL_HLX::LUMI_SUMMARY::InstantETLumiErr
float InstantETLumiErr
Definition: LumiRawDataStructures.h:138
HCAL_HLX::LUMI_SECTION_HEADER::numBunches
uint16_t numBunches
Definition: LumiRawDataStructures.h:258
HCAL_HLX::LUMI_SECTION_HEADER::startOrbit
uint32_t startOrbit
Definition: LumiRawDataStructures.h:256
HCAL_HLX::LUMI_DETAIL::OccBXNormalization
float OccBXNormalization[2][4096]
Definition: LumiRawDataStructures.h:161
HCAL_HLX::LUMI_SECTION_HEADER::numOrbits
uint32_t numOrbits
Definition: LumiRawDataStructures.h:257
HCAL_HLX::LUMI_SECTION::lhc
LHC_SECTION lhc[36]
Definition: LumiRawDataStructures.h:292
HCAL_HLX::LUMI_SECTION::lumiSummary
LUMI_SUMMARY lumiSummary
Definition: LumiRawDataStructures.h:287
HCAL_HLX::TCPReceiver::GenerateRandomData
void GenerateRandomData(HCAL_HLX::LUMI_SECTION &localSection)
Definition: TCPReceiver.cc:388
HCAL_HLX::LUMI_SUMMARY::InstantOccLumiQlty
int16_t InstantOccLumiQlty[2]
Definition: LumiRawDataStructures.h:144
HCAL_HLX::LUMI_DETAIL::OccLumi
float OccLumi[2][4096]
Definition: LumiRawDataStructures.h:158
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HCAL_HLX::ET_SUM_SECTION::data
float data[4096]
Definition: LumiRawDataStructures.h:272
HCAL_HLX::LUMI_SECTION_HEADER::runNumber
uint32_t runNumber
Definition: LumiRawDataStructures.h:253
HCAL_HLX::TCPReceiver::servIP
std::string servIP
Definition: TCPReceiver.h:57
HCAL_HLX::LUMI_SECTION::occupancy
OCCUPANCY_SECTION occupancy[36]
Definition: LumiRawDataStructures.h:291
HCAL_HLX::LUMI_SUMMARY::InstantLumiQlty
int16_t InstantLumiQlty
Definition: LumiRawDataStructures.h:135