ATLAS Offline Software
Loading...
Searching...
No Matches
RPCbytestream.cxx
Go to the documentation of this file.
1/* // -*- C++ -*- */
2
3/*
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5*/
6
7
8#include <fstream>
10
11using namespace std;
12
13RPCbytestream::RPCbytestream(CMAdata& data,const std::string& filename,MsgStream& log,
14 debu cma_debug,debu pad_debug,debu rx_debug,
15 debu sl_debug,debu cma_struc_debug,
16 debu pad_struc_debug,debu rx_struc_debug,
17 debu sl_struc_debug, uint NOBXS, uint BCZERO) :
18 RPCtrigDataObject(0,"RPC byte stream"),
19 m_cma_ro_debug(cma_debug),
20 m_pad_ro_debug(pad_debug),
21 m_rx_ro_debug(rx_debug),
22 m_sl_ro_debug(sl_debug),
23 m_cma_rostruct_debug(cma_struc_debug),
24 m_pad_rostruct_debug(pad_struc_debug),
25 m_rx_rostruct_debug(rx_struc_debug),
26 m_sl_rostruct_debug(sl_struc_debug),
28{
29 CMAdata::PatternsList list = data.give_patterns();
30 CMAdata::PatternsList::iterator it = list.begin();
31
32 while(it != list.end())
33 {
34 int key = (*it)->sector() * 10000 +
35 (*it)->cma_parameters().id().PAD_index() * 100 +
36 (*it)->cma_parameters().id().type() * 10 +
37 (*it)->cma_parameters().id().Ixx_index();
38
39 std::pair < CMA_Readout::iterator, bool> ins =
40 m_cma_readout.insert(CMA_Readout::value_type(key,CMAreadout(*it, NOBXS, BCZERO)));
41 if(!ins.second)
42 {
43 log << MSG::ERROR << "Found duplicate CMA readout into CMA data!" << endmsg;
44 }
45
46 ++it;
47 }
48
49 build_pad_readout(log, NOBXS);
50 if(m_filename != "" ) dump_rpc_bytestream();
51}
52
68
69
74
75
76void
78{
79 for (int i=0;i<64;++i)
80 {
81 for(int j=0;j<=10;++j) // 99 is the maximum number allowed
82 {
83 int kPAD_lw = i * 10000 + j * 100;
84 int kPAD_hg = i * 10000 + j * 100 + 99;
85
86 CMA_Readout::iterator PAD_l = m_cma_readout.lower_bound(kPAD_lw);
87 CMA_Readout::iterator PAD_h = m_cma_readout.upper_bound(kPAD_hg);
88
89 if(distance(PAD_l,PAD_h) )
90 {
91 int SLid = (*PAD_l).second.sector();
92 int PADid = (*PAD_l).second.id().PAD_index();
93 PADreadout pad_readout(SLid,PADid);
94
95 int key = SLid * 100 + PADid;
96
97 if(SLid != i)
98 {
99 log << MSG::ERROR << "Key doesn't correspond to CMA Sector Id!" << endmsg;
100 }
101
102 for (CMA_Readout::iterator it = PAD_l; it != PAD_h; ++it)
103 {
104 auto cma_readout = (*it).second.give_matrix_readout(log, NOBXS);
105 pad_readout.load_readout(cma_readout);
106 if (log.level() <= MSG::DEBUG) {
107 log << MSG::DEBUG << "Dump of the matrices readout into PAD " << PADid
108 << endl
109 << cma_readout[0]
110 << cma_readout[1] << endmsg;
111 }
112 }
113
114 std::pair < PAD_Readout::iterator, bool> ins =
115 m_pad_readout.insert(PAD_Readout::value_type(key,pad_readout));
116 if(!ins.second)
117 {
118 log << MSG::ERROR << "Found duplicate PAD readout into CMA data!" << endmsg;
119 }
120 }
121 }
122 }
123}
124
125void
127{
128 ofstream out;
129 out.open(m_filename.c_str(),ios::app);
130
131 // dump the PAD chunk of data into the byte stream file
132 PAD_Readout::iterator it = m_pad_readout.begin();
133 while(it != m_pad_readout.end())
134 {
135 PadReadOut* readout = (*it).second.give_pad_readout();
136
137 readout->bytestream(out);
138
139 out << endl;
140
141 ++it;
142 }
143}
#define endmsg
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
unsigned int uint
const std::string & name() const
Definition BaseObject.h:23
std::list< CMApatterns * > PatternsList
Definition CMAdata.h:22
void bytestream(std::ostream &stream)
PAD_Readout m_pad_readout
debu rx_ro_debug(void) const
unsigned long int debu
std::string m_filename
debu m_pad_rostruct_debug
debu pad_ro_debug(void) const
const std::string & filename(void) const
debu m_rx_rostruct_debug
debu m_sl_rostruct_debug
debu m_cma_rostruct_debug
debu rx_rostruct_debug(void) const
debu pad_rostruct_debug(void) const
void dump_rpc_bytestream(void)
debu sl_ro_debug(void) const
const PAD_Readout & pad_readout(void) const
CMA_Readout m_cma_readout
RPCbytestream(CMAdata &, const std::string &, MsgStream &, debu, debu, debu, debu, debu, debu, debu, debu, uint, uint)
debu cma_rostruct_debug(void) const
debu sl_rostruct_debug(void) const
void build_pad_readout(MsgStream &log, uint NOBXS)
debu cma_ro_debug(void) const
const CMA_Readout & cma_readout(void) const
int number(void) const
RPCtrigDataObject(int, const std::string &)
STL namespace.