CMS 3D CMS Logo

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

#include <CSCAnodeData2007.h>

Inheritance diagram for CSCAnodeData2007:
CSCAnodeDataFormat

Public Member Functions

virtual void add (const CSCWireDigi &, int layer)
 
 CSCAnodeData2007 (const CSCALCTHeader &)
 a blank one, for Monte Carlo More...
 
 CSCAnodeData2007 (const CSCALCTHeader &, const unsigned short *buf)
 fill from a real datastream More...
 
virtual unsigned short * data ()
 
virtual unsigned short int sizeInWords () const
 the amount of the input binary buffer read, in 16-bit words More...
 
virtual std::vector< CSCWireDigiwireDigis (int layer) const
 input layer is from 1 to 6 More...
 
- Public Member Functions inherited from CSCAnodeDataFormat
virtual ~CSCAnodeDataFormat ()
 

Static Public Member Functions

static void selfTest ()
 

Private Types

enum  { MAXFRAMES =2700 }
 we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2 More...
 

Private Member Functions

CSCAnodeDataFrame2007 findFrame (int tbin, int layer, int layerPart) const
 
int index (int tbin, int layer, int layerPart) const
 
void init (const CSCALCTHeader &)
 

Private Attributes

unsigned int alctBX_
 number of wiregroups in the ALCT More...
 
unsigned short int layerParts_
 
unsigned short int maxWireGroups_
 number of layer parts in the ALCT More...
 
unsigned short int nAFEBs_
 
unsigned short int nTimeBins_
 
unsigned short int sizeInWords2007_
 
unsigned short theDataFrames [MAXFRAMES]
 

Detailed Description

Definition at line 34 of file CSCAnodeData2007.h.

Member Enumeration Documentation

anonymous enum
private

we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2

Enumerator
MAXFRAMES 

Definition at line 59 of file CSCAnodeData2007.h.

Constructor & Destructor Documentation

CSCAnodeData2007::CSCAnodeData2007 ( const CSCALCTHeader header)
explicit

a blank one, for Monte Carlo

To get BX from ALCT digis

Definition at line 7 of file CSCAnodeData2007.cc.

References alctBX_, CSCALCTHeader::BXNCount(), init(), sizeInWords(), and theDataFrames.

8  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
9 {
10  init(header);
11  bzero(theDataFrames, sizeInWords()*2);
13  alctBX_= header.BXNCount();
14 }
unsigned short int nLCTChipRead() const
for packing
void init(const CSCALCTHeader &)
unsigned short int nAFEBs_
unsigned int alctBX_
number of wiregroups in the ALCT
unsigned short theDataFrames[MAXFRAMES]
virtual unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:42
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:61
unsigned short int nTimeBins_
CSCAnodeData2007::CSCAnodeData2007 ( const CSCALCTHeader header,
const unsigned short *  buf 
)

fill from a real datastream

dont memcpy if not 2006 or 2007

To get BX from ALCT digis

Definition at line 17 of file CSCAnodeData2007.cc.

References alctBX_, CSCALCTHeader::BXNCount(), init(), sizeInWords(), and theDataFrames.

19  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
20 {
21  init(header);
22  memcpy(theDataFrames, buf, sizeInWords()*2);
23  alctBX_= header.BXNCount();
25 }
unsigned short int nLCTChipRead() const
for packing
void init(const CSCALCTHeader &)
unsigned short int nAFEBs_
unsigned int alctBX_
number of wiregroups in the ALCT
unsigned short theDataFrames[MAXFRAMES]
virtual unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:42
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:61
unsigned short int nTimeBins_

Member Function Documentation

void CSCAnodeData2007::add ( const CSCWireDigi digi,
int  layer 
)
virtual

Implements CSCAnodeDataFormat.

Definition at line 93 of file CSCAnodeData2007.cc.

References CSCAnodeDataFrame2007::addHit(), CSCAnodeDataFrame2007::data(), findFrame(), CSCWireDigi::getTimeBinsOn(), CSCWireDigi::getWireGroup(), index(), layerParts_, LogTrace, nTimeBins_, and theDataFrames.

Referenced by counter.Counter::register(), and selfTest().

94 {
95  int wireGroup = digi.getWireGroup();
96  // wireGroup = (layerPart*12+j)+1;
97  unsigned layerPart = (wireGroup-1) / 12;
98  unsigned wireInPart = (wireGroup-1) % 12;
99 
100  std::vector<int> timeBinsOn = digi.getTimeBinsOn();
101  for(std::vector<int>::const_iterator timeBinOn = timeBinsOn.begin();
102  timeBinOn != timeBinsOn.end(); ++timeBinOn)
103  {
104  // crash if there's a bad wire number, but don't freak out
105  // if a time bin is out of range
106  // assert(alctBoard < nAFEBs_);
107  if(layerPart >= layerParts_)
108  {
109  edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi.";
110  return;
111  }
112 
113  if((*timeBinOn) >= 0 && (*timeBinOn) < nTimeBins_)
114  {
115  CSCAnodeDataFrame2007 frame = findFrame(*timeBinOn, layer, layerPart);
116  frame.addHit(wireInPart);
117  // FIXME doesn't carry over the (currently 0) leading bits
118  theDataFrames[index(*timeBinOn, layer, layerPart)] = frame.data();
119  }
120  else
121  {
122  LogTrace("CSCAnodeData|CSCRawToDigi")<< "warning: not saving anode data in bx " << *timeBinOn
123  << ": out of range ";
124  }
125  }
126 }
std::vector< int > getTimeBinsOn() const
return vector of time bins ON
Definition: CSCWireDigi.cc:48
int index(int tbin, int layer, int layerPart) const
#define LogTrace(id)
CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
unsigned short theDataFrames[MAXFRAMES]
void addHit(unsigned wireGroup)
unsigned short data() const
unsigned short int nTimeBins_
unsigned short int layerParts_
virtual unsigned short* CSCAnodeData2007::data ( )
inlinevirtual

Implements CSCAnodeDataFormat.

Definition at line 42 of file CSCAnodeData2007.h.

References theDataFrames.

Referenced by cuy.FindIssue::__init__().

42 {return theDataFrames;}
unsigned short theDataFrames[MAXFRAMES]
CSCAnodeDataFrame2007 CSCAnodeData2007::findFrame ( int  tbin,
int  layer,
int  layerPart 
) const
private

Definition at line 77 of file CSCAnodeData2007.cc.

References index(), and theDataFrames.

Referenced by add(), and wireDigis().

77  {
78  return CSCAnodeDataFrame2007(theDataFrames[index(tbin, layer, layerPart)]);
79 }
int index(int tbin, int layer, int layerPart) const
unsigned short theDataFrames[MAXFRAMES]
int CSCAnodeData2007::index ( int  tbin,
int  layer,
int  layerPart 
) const
private

Definition at line 82 of file CSCAnodeData2007.cc.

References assert(), layerParts_, MAXFRAMES, nTimeBins_, and mps_fire::result.

Referenced by BeautifulSoup.PageElement::_invert(), add(), and findFrame().

83 {
84  assert(tbin<nTimeBins_);
85  assert(layer<=6);
86  assert(layerPart<layerParts_);
87  int result = tbin*6*layerParts_+(layer-1)*layerParts_+layerPart;
88  assert(result < MAXFRAMES);
89  return result;
90 }
assert(m_qm.get())
tuple result
Definition: mps_fire.py:83
unsigned short int nTimeBins_
unsigned short int layerParts_
void CSCAnodeData2007::init ( const CSCALCTHeader header)
private

the sizes of raw words vary depending on type of the ALCT board number of layer parts for various alct board types: 1 2 3 5 6

Definition at line 28 of file CSCAnodeData2007.cc.

References CSCALCTHeader::alctHeader2007(), CSCALCTHeader2007::boardType, layerParts_, maxWireGroups_, CSCALCTHeader2007::rawBins, CSCALCTHeader2007::rawOverflow, and sizeInWords2007_.

Referenced by CSCAnodeData2007().

28  {
32  static unsigned short int layerParts[7] = { 3, 3, 4, 6, 6, 8,10};
33  static unsigned short int wireGroups[7] = {32,32,48,64,64,96,112};
34  //header.ALCTDigis();
36  header.alctHeader2007().rawBins*layerParts[header.alctHeader2007().boardType];
37  layerParts_ = layerParts[header.alctHeader2007().boardType];
38  maxWireGroups_ = wireGroups[header.alctHeader2007().boardType];
39 }
CSCALCTHeader2007 alctHeader2007() const
unsigned short int sizeInWords2007_
unsigned short int maxWireGroups_
number of layer parts in the ALCT
unsigned short int layerParts_
void CSCAnodeData2007::selfTest ( )
static

Definition at line 128 of file CSCAnodeData2007.cc.

References add(), assert(), and wireDigis().

129 {
130  int wireGroup = 12;
131  int timeBin = 6;
132  CSCWireDigi wireDigi(wireGroup, (1 << timeBin));
133  CSCALCTHeader header(1);
134  CSCAnodeData2007 anodeData(header);
135  anodeData.add(wireDigi, 1);
136  anodeData.add(wireDigi, 6);
137 
138  std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1);
139  std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6);
140 
141  assert(wires1.size() == 1);
142  assert(wires6.size() == 1);
143  assert(wires1[0].getWireGroup() == wireGroup);
144  assert(wires6[0].getWireGroup() == wireGroup);
145  assert(wires1[0].getTimeBin() == timeBin);
146  assert(wires6[0].getTimeBin() == timeBin);
147 
148 }
assert(m_qm.get())
virtual unsigned short int CSCAnodeData2007::sizeInWords ( ) const
inlinevirtual

the amount of the input binary buffer read, in 16-bit words

Implements CSCAnodeDataFormat.

Definition at line 44 of file CSCAnodeData2007.h.

References sizeInWords2007_.

Referenced by CSCAnodeData2007().

44 {return sizeInWords2007_;}
unsigned short int sizeInWords2007_
std::vector< CSCWireDigi > CSCAnodeData2007::wireDigis ( int  layer) const
virtual

input layer is from 1 to 6

BX from ACT (first component)

we know how many layer parts are there from ALCT header

loop over 12 bits in each word (each bit is one wiregroup) we want to stop if we reached the maxWireGroups

loop over tbins

BX from ALCT encoded in wireGroup

end of the loop over bits in the data frame

end of the loop over layer parts

Implements CSCAnodeDataFormat.

Definition at line 42 of file CSCAnodeData2007.cc.

References alctBX_, CSCAnodeDataFrame2007::data(), findFrame(), CSCAnodeDataFrame2007::isHit(), j, layerParts_, LogTrace, maxWireGroups_, and nTimeBins_.

Referenced by selfTest().

42  {
43  std::vector<CSCWireDigi> digis;
44  uint32_t tbinbits=0;
45  uint32_t wireGroup=0;
47  for(int layerPart = 0; layerPart <layerParts_; ++layerPart) {
49  for (int j=0; (j<12)&&((layerPart*12+j)<maxWireGroups_) ;++j) {
52  for(int tbin = 0; tbin < nTimeBins_; ++tbin) {
53  CSCAnodeDataFrame2007 frame = findFrame(tbin, layer, layerPart);
54  if(frame.data() != 0) {
55  if(frame.isHit(j)) {
56  tbinbits=tbinbits + (1<<tbin);
57  }
58  }
59  }//end of tbin loop
60  if (tbinbits !=0 ) {
61  wireGroup = (layerPart*12+j)+1;
63  uint32_t wireGroupBX=alctBX_;
64  wireGroup = wireGroup | (wireGroupBX << 16);
65  CSCWireDigi digi(wireGroup, tbinbits);
66  LogTrace ("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi;
67  digis.push_back(digi);
68  tbinbits=0;
69  }
70  }
71  }
72 
73  return digis;
74 }
bool isHit(unsigned wireGroup) const
given a wiregroup between 0 and 11, it tells whether this bit was on
int j
Definition: DBlmapReader.cc:9
#define LogTrace(id)
CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const
unsigned int alctBX_
number of wiregroups in the ALCT
unsigned short int maxWireGroups_
number of layer parts in the ALCT
unsigned short data() const
unsigned short int nTimeBins_
unsigned short int layerParts_

Member Data Documentation

unsigned int CSCAnodeData2007::alctBX_
private

number of wiregroups in the ALCT

Definition at line 67 of file CSCAnodeData2007.h.

Referenced by CSCAnodeData2007(), and wireDigis().

unsigned short int CSCAnodeData2007::layerParts_
private

Definition at line 65 of file CSCAnodeData2007.h.

Referenced by add(), index(), init(), and wireDigis().

unsigned short int CSCAnodeData2007::maxWireGroups_
private

number of layer parts in the ALCT

Definition at line 66 of file CSCAnodeData2007.h.

Referenced by init(), and wireDigis().

unsigned short int CSCAnodeData2007::nAFEBs_
private

Definition at line 62 of file CSCAnodeData2007.h.

unsigned short int CSCAnodeData2007::nTimeBins_
private

Definition at line 63 of file CSCAnodeData2007.h.

Referenced by add(), index(), and wireDigis().

unsigned short int CSCAnodeData2007::sizeInWords2007_
private

Definition at line 61 of file CSCAnodeData2007.h.

Referenced by init(), and sizeInWords().

unsigned short CSCAnodeData2007::theDataFrames[MAXFRAMES]
private

Definition at line 60 of file CSCAnodeData2007.h.

Referenced by add(), CSCAnodeData2007(), data(), and findFrame().