test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
8 
11 #include <iostream>
12 
13 CSCTMBMiniScope::CSCTMBMiniScope(unsigned short *buf,int Line6b07,int Line6E07) {
14 
15  size_ = UnpackMiniScope(buf,Line6b07,Line6E07);
16 
17 }
18 
19 
20 int CSCTMBMiniScope::UnpackMiniScope(unsigned short *buf,int Line6b07,int Line6E07) {
21 
22 
23  if((Line6E07-Line6b07) != 0) {
24 
26  miniScopeTbinCount = buf[Line6b07+1] & 0x00FF;
27  miniScopeTbinPreTrigger = (buf[Line6b07+1] >> 8) & 0x000F;
28 
29  LogTrace("CSCTMBMiniScope") << " MiniScope Found | Tbin: " << miniScopeTbinCount <<
30  " | Tbin Pretrigger: " << miniScopeTbinPreTrigger << std::endl;
31 
32  miniScopeAdress.clear();
33  miniScopeData.clear();
34 
35  for(int i=0; i<miniScopeTbinCount; i++){
36  miniScopeAdress.push_back(284+i);
37  miniScopeData.push_back(buf[Line6b07 + 1+i]);
38  }
39 
40  //print();
41  }
42 
43 
44  return (Line6E07-Line6b07 + 1);
45 
46 }
47 
48 std::vector<int> CSCTMBMiniScope::getChannelsInTbin(int data) const {
49  std::vector<int> channelInTbin;
50  channelInTbin.clear();
51  for(int k=0; k<14; k++){
52  int chBit=0;
53  chBit = (data >> k) & 0x1;
54  if(chBit !=0)
55  channelInTbin.push_back(k);
56  }
57  return channelInTbin;
58 }
59 
60 
61 void CSCTMBMiniScope::print() const {
62  for(unsigned int k=0; k<getAdr().size();++k){
63  if(k==0){
64  std::cout << " Adr = " << getAdr()[k] << " | Data: "
65  << std::hex << getData()[k] << std::dec << std::endl;
66  }
67  else{
68  std::cout << " Adr = " << getAdr()[k] << " | Data: "
69  << std::hex << getData()[k] << std::dec << " ==>| Ch# ";
70  for(unsigned int j=0; j<getChannelsInTbin(getData()[k]).size(); j++){
71  std::cout << " " << getChannelsInTbin(getData()[k])[j];
72  }
73  std::cout << std::endl;
74  }
75  }
76 }
std::vector< int > getData() const
int i
Definition: DBlmapReader.cc:9
std::vector< int > getAdr() const
std::vector< int > miniScopeAdress
std::vector< int > miniScopeData
stores all mini scope adresses
std::vector< int > getChannelsInTbin(int data) const
UnpackScope.
void print() const
int j
Definition: DBlmapReader.cc:9
int miniScopeTbinCount
stores all mini scope data
#define LogTrace(id)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int UnpackMiniScope(unsigned short *buf, int Line6b07, int Line6E07)
Print the maped content of the miniscope.
tuple cout
Definition: gather_cfg.py:145