CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CSCGEMData Class Reference

#include <CSCGEMData.h>

Public Member Functions

bool check () const
 
 CSCGEMData (int ntbins=12, int gem_fibers_mask=0xf)
 default constructor More...
 
 CSCGEMData (const unsigned short *c04buf, int length, int gem_fibers_mask=0xf)
 
std::vector< GEMPadDigiClusterdigis (int gem_chamber) const
 
std::vector< GEMPadDigiClusteretaDigis (int gem_chamber, int eta) const
 
int gemFibersMask () const
 
int nTbins () const
 
int numGEMEnabledFibers () const
 
int numGEMs () const
 
void print () const
 
int sizeInWords () const
 

Static Public Member Functions

static void setDebug (bool debugValue)
 turns on the debug flag for this class More...
 

Private Member Functions

int getPartitionNumber (int address, int nPads) const
 
int getPartitionStripNumber (int address, int nPads, int etaPart) const
 

Private Attributes

int gems_enabled_
 
int ngems_
 
int ntbins_
 
int size_
 
unsigned short theData [8 *2 *32+2]
 

Static Private Attributes

static std::atomic< bool > debug {false}
 

Detailed Description

Definition at line 11 of file CSCGEMData.h.

Constructor & Destructor Documentation

CSCGEMData::CSCGEMData ( int  ntbins = 12,
int  gem_fibers_mask = 0xf 
)

default constructor

Definition at line 16 of file CSCGEMData.cc.

References gems_enabled_, ngems_, ntbins_, size_, and theData.

16  : ntbins_(ntbins), size_(0) {
17  theData[0] = 0x6C04;
18  ntbins_ = ntbins;
19  gems_enabled_ = gems_fibers;
20  ngems_ = 0;
21  /* Not implemented in the firmware yet */
22  /*
23  for (int i=0; i<4; i++)
24  ngems_ += (gems_fibers>>i) & 0x1;
25  */
26  ngems_ = 4;
27  size_ = 2 + ntbins_ * ngems_ * 4;
28  theData[size_ - 1] = 0x6D04;
29 }
int ngems_
Definition: CSCGEMData.h:46
unsigned short theData[8 *2 *32+2]
Definition: CSCGEMData.h:48
int ntbins_
Definition: CSCGEMData.h:44
int gems_enabled_
Definition: CSCGEMData.h:45
CSCGEMData::CSCGEMData ( const unsigned short *  c04buf,
int  length,
int  gem_fibers_mask = 0xf 
)

Definition at line 31 of file CSCGEMData.cc.

References gems_enabled_, ngems_, ntbins_, size_, and theData.

31  : size_(length) {
32  size_ = length;
33  ngems_ = 0;
34  /* Not implemented in the firmware yet */
35  /*
36  for (int i=0; i<4; i++)
37  ngems_ += (gems_fibers>>i) & 0x1;
38  */
39  ngems_ = 4;
40  ntbins_ = (size_ - 2) / (4 * ngems_);
41  gems_enabled_ = gems_fibers;
42  memcpy(theData, buf, size_ * 2);
43 }
int ngems_
Definition: CSCGEMData.h:46
unsigned short theData[8 *2 *32+2]
Definition: CSCGEMData.h:48
int ntbins_
Definition: CSCGEMData.h:44
int gems_enabled_
Definition: CSCGEMData.h:45

Member Function Documentation

bool CSCGEMData::check ( ) const
inline

Definition at line 29 of file CSCGEMData.h.

References size_, and theData.

29 { return ((theData[0] == 0x6C04) && (theData[size_ - 1] == 0x6D04)); }
unsigned short theData[8 *2 *32+2]
Definition: CSCGEMData.h:48
std::vector< GEMPadDigiCluster > CSCGEMData::digis ( int  gem_chamber) const

GEM data format v2

GEM data format v1 It is not used in the production Keeping this commented code just for v1 unpacking algo reference

Definition at line 58 of file CSCGEMData.cc.

References debug, TauDecayModes::dec, PVValHelper::eta, mps_fire::i, LogTrace, beam_dqm_sourceclient-live_cfg::maxClusters, ntbins_, mps_fire::result, and theData.

58  {
60  std::vector<GEMPadDigiCluster> result;
61  result.clear();
62  int nPads = 192; // From geometry
63  int maxClusters = 4;
64  int nGEMs = 4;
65  // nGEMs = ngems_; // based on enabled fibers. not implemented in the firmware yet
66  for (int i = 0; i < ntbins_; i++) {
67  for (int fiber = 0; fiber < nGEMs; fiber++) {
68  for (int cluster = 0; cluster < maxClusters; cluster++) {
69  int dataAddr = 1 + (i * nGEMs + fiber) * maxClusters + cluster;
70  int gem_layer = (theData[dataAddr] >> 14) & 0x1; // gemA=0 or gemB=1
71  if (gem_layer == gem_chamber) {
72  int cl_word = theData[dataAddr] & 0x3fff;
73  int pad = theData[dataAddr] & 0xff;
74  int eta = (theData[dataAddr] >> 8) & 0x7;
75  int cluster_size = (theData[dataAddr] >> 11) & 0x7;
76  if (pad < nPads) {
77  int padInPart = eta * nPads + pad;
78  if (debug)
79  LogTrace("CSCGEMData|CSCRawToDigi")
80  << "GEMlayer" << gem_layer << " cl_word" << dataAddr << ": 0x" << std::hex << cl_word << std::dec
81  << " tbin: " << i << " fiber#: " << (fiber + 1) << " cluster#: " << (cluster + 1)
82  << " padInPart: " << padInPart << " pad: " << pad << " eta: " << eta
83  << " cluster_size: " << cluster_size << std::endl;
84  std::vector<short unsigned int> pads;
85  for (int iP = 0; iP <= cluster_size; ++iP)
86  pads.push_back(padInPart + iP);
87  GEMPadDigiCluster pad_cluster(pads, i);
88  result.push_back(pad_cluster);
89  }
90  }
91  }
92  }
93  }
94 
98  /*
99  std::vector<GEMPadDigiCluster> result;
100  result.clear();
101  int nPads = 192; // From geometry
102  int maxAddr = 1536;
103  int nGEMs = 2;
104  int maxClusters = 8;
105  // std::cout << std::hex << "markers " << theData[0] << ": " << theData[size_-1] << std::dec << " size: " << size_ << std::endl;
106  for (int i=0; i<ntbins_; i++)
107  {
108  for (int gem=0; gem<nGEMs; gem++)
109  {
110  if (gem==gem_chamber) // Return only digis for specified GEM chamber
111  {
112  for (int TMBCluster=0; TMBCluster<maxClusters; TMBCluster++)
113  {
114  int dataAddr = 1 + (i*nGEMs+gem)*maxClusters + TMBCluster;
115  int address = theData[dataAddr] & 0x7ff;
116  // std::cout << dataAddr << ": " << address <<std::endl;
117  int nExtraPads = (theData[dataAddr] >>11)&0x7;
118  if (address<maxAddr)
119  {
120  int etaPart = getPartitionNumber(address,nPads);
121  int padInPart = getPartitionStripNumber(address,nPads,etaPart);
122  vector<short unsigned int> pads;
123  for(int iP = 0; iP <= nExtraPads; ++iP)
124  pads.push_back(padInPart + iP );
125  GEMPadDigiCluster cluster ( pads, i);
126  result.push_back(cluster);
127  }
128  }
129  }
130  }
131  }
132  */
133  return result;
134 }
static std::atomic< bool > debug
Definition: CSCGEMData.h:41
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
unsigned short theData[8 *2 *32+2]
Definition: CSCGEMData.h:48
int ntbins_
Definition: CSCGEMData.h:44
std::vector< GEMPadDigiCluster > CSCGEMData::etaDigis ( int  gem_chamber,
int  eta 
) const

GEM data format v2

Definition at line 136 of file CSCGEMData.cc.

References debug, TauDecayModes::dec, PVValHelper::eta, mps_fire::i, LogTrace, beam_dqm_sourceclient-live_cfg::maxClusters, ntbins_, mps_fire::result, and theData.

136  {
138  std::vector<GEMPadDigiCluster> result;
139  result.clear();
140  int nPads = 192; // From geometry
141  int maxClusters = 4;
142  int nGEMs = 4;
143  // nGEMs = ngems_; // based on enabled fibers. not implemented in the firmware yet
144  for (int i = 0; i < ntbins_; i++) {
145  for (int fiber = 0; fiber < nGEMs; fiber++) {
146  for (int cluster = 0; cluster < maxClusters; cluster++) {
147  int dataAddr = 1 + (i * nGEMs + fiber) * maxClusters + cluster;
148  int gem_layer = (theData[dataAddr] >> 14) & 0x1; // gemA=0 or gemB=1
149  if (gem_layer == gem_chamber) {
150  int cl_word = theData[dataAddr] & 0x3fff;
151  int pad = theData[dataAddr] & 0xff;
152  int eta = (theData[dataAddr] >> 8) & 0x7;
153  int cluster_size = (theData[dataAddr] >> 11) & 0x7;
154  if ((pad < nPads) && (eta == eta_roll)) {
155  int padInPart = pad;
156  if (debug)
157  LogTrace("CSCGEMData|CSCRawToDigi")
158  << "GEMlayer" << gem_layer << " cl_word" << dataAddr << ": 0x" << std::hex << cl_word << std::dec
159  << " tbin: " << i << " fiber#: " << (fiber + 1) << " cluster#: " << (cluster + 1)
160  << " padInPart: " << padInPart << " pad: " << pad << " eta: " << eta
161  << " cluster_size: " << cluster_size << std::endl;
162  std::vector<short unsigned int> pads;
163  for (int iP = 0; iP <= cluster_size; ++iP)
164  pads.push_back(padInPart + iP);
165  GEMPadDigiCluster pad_cluster(pads, i);
166  result.push_back(pad_cluster);
167  }
168  }
169  }
170  }
171  }
172  return result;
173 }
static std::atomic< bool > debug
Definition: CSCGEMData.h:41
#define LogTrace(id)
tuple result
Definition: mps_fire.py:311
unsigned short theData[8 *2 *32+2]
Definition: CSCGEMData.h:48
int ntbins_
Definition: CSCGEMData.h:44
int CSCGEMData::gemFibersMask ( ) const
inline

Definition at line 25 of file CSCGEMData.h.

References gems_enabled_.

25 { return gems_enabled_; }
int gems_enabled_
Definition: CSCGEMData.h:45
int CSCGEMData::getPartitionNumber ( int  address,
int  nPads 
) const
private

Definition at line 52 of file CSCGEMData.cc.

52 { return addr / (npads - 1); }
int CSCGEMData::getPartitionStripNumber ( int  address,
int  nPads,
int  etaPart 
) const
private

Definition at line 54 of file CSCGEMData.cc.

54  {
55  return address - (nPads * etaPart);
56 }
int CSCGEMData::nTbins ( ) const
inline

Definition at line 27 of file CSCGEMData.h.

References ntbins_.

27 { return ntbins_; }
int ntbins_
Definition: CSCGEMData.h:44
int CSCGEMData::numGEMEnabledFibers ( ) const
inline

Definition at line 26 of file CSCGEMData.h.

References ngems_.

26 { return ngems_; }
int ngems_
Definition: CSCGEMData.h:46
int CSCGEMData::numGEMs ( ) const
inline

Definition at line 22 of file CSCGEMData.h.

22  {
23  return 2; // !!! TODO actual number of GEM chambers in readout
24  }
void CSCGEMData::print ( void  ) const

Definition at line 45 of file CSCGEMData.cc.

References geometryCSVtoXML::line, LogTrace, size_, and theData.

45  {
46  LogTrace("CSCGEMData|CSCRawToDigi") << "CSCGEMData.Print";
47  for (int line = 0; line < ((size_)); ++line) {
48  LogTrace("CSCGEMData|CSCRawToDigi") << std::hex << theData[line];
49  }
50 }
#define LogTrace(id)
unsigned short theData[8 *2 *32+2]
Definition: CSCGEMData.h:48
static void CSCGEMData::setDebug ( bool  debugValue)
inlinestatic

turns on the debug flag for this class

Definition at line 32 of file CSCGEMData.h.

References debug.

32 { debug = debugValue; }
static std::atomic< bool > debug
Definition: CSCGEMData.h:41
int CSCGEMData::sizeInWords ( ) const
inline

Definition at line 21 of file CSCGEMData.h.

References size_.

Referenced by CSCTMBData::UnpackTMB().

21 { return size_; }

Member Data Documentation

std::atomic< bool > CSCGEMData::debug {false}
staticprivate
int CSCGEMData::gems_enabled_
private

Definition at line 45 of file CSCGEMData.h.

Referenced by CSCGEMData(), and gemFibersMask().

int CSCGEMData::ngems_
private

Definition at line 46 of file CSCGEMData.h.

Referenced by CSCGEMData(), and numGEMEnabledFibers().

int CSCGEMData::ntbins_
private

Definition at line 44 of file CSCGEMData.h.

Referenced by CSCGEMData(), digis(), etaDigis(), and nTbins().

int CSCGEMData::size_
private

Definition at line 47 of file CSCGEMData.h.

Referenced by check(), CSCGEMData(), print(), and sizeInWords().

unsigned short CSCGEMData::theData[8 *2 *32+2]
private

Definition at line 48 of file CSCGEMData.h.

Referenced by check(), CSCGEMData(), digis(), etaDigis(), and print().