CMS 3D CMS Logo

CSCTMBMiniScope.cc
Go to the documentation of this file.
1 //_________________________________________________________
2 //
3 // CSCTMBMiniScope July 2010 Alexander Sakharov
4 // Unpacks TMB Logic MiniScope Analyzer and stores in CSCTMBMiniScope.h
5 //_________________________________________________________
6 //
7 
10 #include <iostream>
11 
12 CSCTMBMiniScope::CSCTMBMiniScope(const uint16_t *buf, int Line6b07, int Line6E07) {
13  size_ = UnpackMiniScope(buf, Line6b07, Line6E07);
14 
15 }
16 
17 int CSCTMBMiniScope::UnpackMiniScope(const uint16_t *buf, int Line6b07, int Line6E07) {
18  if ((Line6E07 - Line6b07) != 0) {
20  miniScopeTbinCount = buf[Line6b07 + 1] & 0x00FF;
21  miniScopeTbinPreTrigger = (buf[Line6b07 + 1] >> 8) & 0x000F;
22 
23  LogTrace("CSCTMBMiniScope") << " MiniScope Found | Tbin: " << miniScopeTbinCount
24  << " | Tbin Pretrigger: " << miniScopeTbinPreTrigger << std::endl;
25 
26  miniScopeAdress.clear();
27  miniScopeData.clear();
28 
29  for (int i = 0; i < miniScopeTbinCount; i++) {
30  miniScopeAdress.push_back(284 + i);
31  miniScopeData.push_back(buf[Line6b07 + 1 + i]);
32  }
33 
34  //print();
35  }
36 
37  return (Line6E07 - Line6b07 + 1);
38 
39 }
40 
41 std::vector<int> CSCTMBMiniScope::getChannelsInTbin(int data) const {
42  std::vector<int> channelInTbin;
43  channelInTbin.clear();
44  for (int k = 0; k < 14; k++) {
45  int chBit = 0;
46  chBit = (data >> k) & 0x1;
47  if (chBit != 0)
48  channelInTbin.push_back(k);
49  }
50  return channelInTbin;
51 }
52 
53 void CSCTMBMiniScope::print() const {
54  for (unsigned int k = 0; k < getAdr().size(); ++k) {
55  if (k == 0) {
56  std::cout << " Adr = " << getAdr()[k] << " | Data: " << std::hex << getData()[k] << std::dec << std::endl;
57  } else {
58  std::cout << " Adr = " << getAdr()[k] << " | Data: " << std::hex << getData()[k] << std::dec << " ==>| Ch# ";
59  for (unsigned int j = 0; j < getChannelsInTbin(getData()[k]).size(); j++) {
60  std::cout << " " << getChannelsInTbin(getData()[k])[j];
61  }
62  std::cout << std::endl;
63  }
64  }
65 }
std::vector< int > miniScopeAdress
std::vector< int > miniScopeData
stores all mini scope adresses
std::vector< int > getAdr() const
#define LogTrace(id)
std::vector< int > getData() const
std::vector< int > getChannelsInTbin(int data) const
UnpackScope.
int miniScopeTbinCount
stores all mini scope data
int UnpackMiniScope(const uint16_t *buf, int Line6b07, int Line6E07)
Print the maped content of the miniscope.
void print() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79