ATLAS Offline Software
MuCalCircClient.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <string>
6 
7 #include "circ/Circ.h"
8 #include "circ/Circservice.h"
9 
10 #include "MuCalDecode/CalibEvent.h"
11 #include "MuCalDecode/CalibUti.h"
12 
13 #include "MuCalCircClient.h"
14 
15 TrigL2MuonSA::MuCalCircClient::MuCalCircClient (unsigned short port, std::string &buffer_name, unsigned int buffer_size)
16  : m_port (port), m_bufferName (buffer_name), m_bufferSize (buffer_size)
17 {
18 
19  std::vector<char> writable(m_bufferName.begin(), m_bufferName.end());
20  writable.push_back('\0');
21 
22  // char *name = const_cast <char *> (m_bufferName.c_str());
23  if ( ( m_cid = CircOpenCircConnection_t (m_port, &*writable.begin(), m_bufferSize) ) < 0)
24  {
26  throw e;
27  }
28 }
29 
31 {
32  std::vector<char> writable(m_bufferName.begin(), m_bufferName.end());
33  writable.push_back('\0');
34  if (m_cid >=0 )
35  CircCloseCircConnection_t (m_port, &*writable.begin() , m_cid);
36 }
37 
38 bool TrigL2MuonSA::MuCalCircClient::dumpToCirc (LVL2_MUON_CALIBRATION::CalibEvent &event) const
39 {
40  char *ptr;
41  bool success = false;
42  uint16_t event_size = event.size ();
43 
44  if (m_cid>=0){
45  if ((ptr = CircReserve_t (m_cid, event_size )) != (char *) -1)
46  {
47  uint8_t *buff = reinterpret_cast <uint8_t *> (ptr);
48  int bufsize = event.dumpWords (buff, event_size);
49 
50  (void) CircValidate_t (m_cid, ptr, bufsize);
51  success = true;
52  }
53  }
54  return success;
55 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
get_hdefs.buff
buff
Definition: get_hdefs.py:61
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
TrigL2MuonSA::MuCalCircClient::m_cid
int m_cid
Definition: MuCalCircClient.h:36
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
TrigL2MuonSA::MuCalCircClient::dumpToCirc
bool dumpToCirc(LVL2_MUON_CALIBRATION::CalibEvent &event) const
Definition: MuCalCircClient.cxx:38
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
MuCalCircClient.h
TrigL2MuonSA::MuCalCircClient::MuCalCircClient
MuCalCircClient(unsigned short port, std::string &buffer_name, unsigned int buffer_size)
Definition: MuCalCircClient.cxx:15
TrigL2MuonSA::MuCalCircClient::m_bufferSize
unsigned int m_bufferSize
Definition: MuCalCircClient.h:39
TrigL2MuonSA::MuCalCircClient::~MuCalCircClient
virtual ~MuCalCircClient()
Definition: MuCalCircClient.cxx:30
TrigL2MuonSA::MuCalCircClient::m_bufferName
std::string m_bufferName
Definition: MuCalCircClient.h:38
TrigL2MuonSA::Circexception
Definition: MuCalCircClient.h:20
TrigL2MuonSA::MuCalCircClient::m_port
unsigned short m_port
Definition: MuCalCircClient.h:37