CMS 3D CMS Logo

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

List of all members.

Public Member Functions

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

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
unsigned short int layerParts_
unsigned short int maxWireGroups_
 number of layer parts in the ALCT
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.

{MAXFRAMES=2700};

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.

  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
{
  init(header);
  bzero(theDataFrames, sizeInWords()*2);
  alctBX_= header.BXNCount();
}
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.

  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
{
    init(header);
    memcpy(theDataFrames, buf, sizeInWords()*2);

   alctBX_= header.BXNCount();
}

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 selfTest().

{
  int wireGroup = digi.getWireGroup();
  //           wireGroup = (layerPart*12+j)+1;
  unsigned layerPart = (wireGroup-1) / 12;
  unsigned wireInPart = (wireGroup-1) % 12; 
  std::vector<int> timeBinsOn = digi.getTimeBinsOn();
  for(std::vector<int>::const_iterator timeBinOn = timeBinsOn.begin();
      timeBinOn != timeBinsOn.end(); ++timeBinOn)
  {
    // crash if there's a bad wire number, but don't freak out
    // if a time bin is out of range 
    //  assert(alctBoard < nAFEBs_);
    if(layerPart >= layerParts_)
      {
        edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi.";
        return;
      }

    if((*timeBinOn) >= 0 && (*timeBinOn) < nTimeBins_) 
      {
        CSCAnodeDataFrame2007 frame = findFrame(*timeBinOn, layer, layerPart);
        frame.addHit(wireInPart);
        // FIXME doesn't carry over the (currently 0) leading bits
        theDataFrames[index(*timeBinOn, layer, layerPart)]  = frame.data();
      } 
    else 
      {
        LogTrace("CSCAnodeData|CSCRawToDigi")<< "warning: not saving anode data in bx " << *timeBinOn 
                              << ": out of range ";
      }
  }
}
virtual unsigned short* CSCAnodeData2007::data ( ) [inline, virtual]

Implements CSCAnodeDataFormat.

Definition at line 42 of file CSCAnodeData2007.h.

References theDataFrames.

{return theDataFrames;}
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().

                                                                                          {
  return CSCAnodeDataFrame2007(theDataFrames[index(tbin, layer, layerPart)]);
}
int CSCAnodeData2007::index ( int  tbin,
int  layer,
int  layerPart 
) const [private]

Definition at line 82 of file CSCAnodeData2007.cc.

References layerParts_, MAXFRAMES, nTimeBins_, and query::result.

Referenced by add(), and findFrame().

{
  assert(tbin<nTimeBins_);
  assert(layer<=6);
  assert(layerPart<layerParts_);
  int result = tbin*6*layerParts_+(layer-1)*layerParts_+layerPart;
  assert(result < MAXFRAMES);
  return result;
}
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().

                                                        {
  static unsigned short int layerParts[7]    = { 3, 3, 4, 6, 6, 8,10};
  static unsigned short int wireGroups[7]    = {32,32,48,64,64,96,112};
  //header.ALCTDigis();
  sizeInWords2007_=(1-header.alctHeader2007().rawOverflow)*6*
  header.alctHeader2007().rawBins*layerParts[header.alctHeader2007().boardType];
  layerParts_ = layerParts[header.alctHeader2007().boardType];
  maxWireGroups_ = wireGroups[header.alctHeader2007().boardType];
}
void CSCAnodeData2007::selfTest ( ) [static]

Definition at line 127 of file CSCAnodeData2007.cc.

References add(), errorMatrix2Lands::header, and wireDigis().

{
  int wireGroup = 12;
  int timeBin = 6;
  CSCWireDigi wireDigi(wireGroup, (1 << timeBin));
  CSCALCTHeader header(1);
  CSCAnodeData2007 anodeData(header);
  anodeData.add(wireDigi, 1);
  anodeData.add(wireDigi, 6);

  std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1);
  std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6);

  assert(wires1.size() == 1);
  assert(wires6.size() == 1);
  assert(wires1[0].getWireGroup() == wireGroup);
  assert(wires6[0].getWireGroup() == wireGroup);
  assert(wires1[0].getTimeBin() == timeBin);
  assert(wires6[0].getTimeBin() == timeBin);

}
virtual unsigned short int CSCAnodeData2007::sizeInWords ( ) const [inline, virtual]

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().

{return 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 ACT incoded 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().

                                                                  {
  std::vector<CSCWireDigi> digis;
  uint32_t tbinbits=0;
  uint32_t wireGroup=0;
  for(int layerPart = 0; layerPart <layerParts_; ++layerPart) {
    for (int j=0; (j<12)&&((layerPart*12+j)<maxWireGroups_) ;++j) {
      for(int tbin = 0; tbin < nTimeBins_; ++tbin) { 
        CSCAnodeDataFrame2007 frame = findFrame(tbin, layer, layerPart);
        if(frame.data() != 0) {
          if(frame.isHit(j)) {
            tbinbits=tbinbits + (1<<tbin);
          }
        }
      }//end of tbin loop
      if (tbinbits !=0 ) {
        wireGroup = (layerPart*12+j)+1;
        uint32_t wireGroupBX=alctBX_;
        wireGroup = wireGroup | (wireGroupBX << 16);
        CSCWireDigi digi(wireGroup, tbinbits);
        LogTrace ("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi;
        digis.push_back(digi);
        tbinbits=0;
      }
    }
  }
  
  return digis;
}

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().