CMS 3D CMS Logo

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

DCCTBTCCBlock Class Reference

#include <DCCTCCBlock.h>

Inheritance diagram for DCCTBTCCBlock:
DCCTBBlockPrototype

List of all members.

Public Member Functions

 DCCTBTCCBlock (DCCTBEventBlock *dccBlock, DCCTBDataParser *parser, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset, uint32_t expectedId)
std::vector< int > triggerFlags ()
std::vector< std::pair< int,
bool > > 
triggerSamples ()

Protected Types

enum  tccFields {
  BXMASK = 0xFFF, L1MASK = 0xFFF, BPOSITION_BLOCKID = 29, BLOCKID = 3,
  BPOSITION_FGVB = 8, ETMASK = 0xFF
}

Protected Member Functions

void dataCheck ()
void increment (uint32_t numb)

Protected Attributes

DCCTBEventBlockdccBlock_
uint32_t expectedId_

Detailed Description

Definition at line 24 of file DCCTCCBlock.h.


Member Enumeration Documentation

enum DCCTBTCCBlock::tccFields [protected]

Define TCC block fields BXMASK (mask for BX, 12bit) L1MASK (mask for LV1, 12 bit) BPOSITION_BLOCKID (bit position for TCC block id, bit=61/29 for 64/32bit words BLOCKID (TCC block id B'011' = 3)

Enumerator:
BXMASK 
L1MASK 
BPOSITION_BLOCKID 
BLOCKID 
BPOSITION_FGVB 
ETMASK 

Definition at line 62 of file DCCTCCBlock.h.

                { 
    BXMASK = 0xFFF,
    L1MASK = 0xFFF, 
    BPOSITION_BLOCKID = 29,
    BLOCKID = 3,
    BPOSITION_FGVB = 8,
    ETMASK = 0xFF                  
  };

Constructor & Destructor Documentation

DCCTBTCCBlock::DCCTBTCCBlock ( DCCTBEventBlock dccBlock,
DCCTBDataParser parser,
uint32_t *  buffer,
uint32_t  numbBytes,
uint32_t  wordsToEnd,
uint32_t  wordEventOffset,
uint32_t  expectedId 
)

Class constructor

Definition at line 13 of file DCCTCCBlock.cc.

References dataCheck(), DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBDataParser::numbTTs(), DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, DCCTBDataMapper::tcc16Fields(), DCCTBDataMapper::tcc32Fields(), and DCCTBDataMapper::tcc68Fields().

                             : 
  DCCTBBlockPrototype(parser,"TCC", buffer, numbBytes, wordsToEnd, wordEventOffset),dccBlock_(dccBlock), expectedId_(expectedId){

  //Reset error counters
  errors_["TCC::HEADER"]  = 0;
  errors_["TCC::BLOCKID"] = 0;
        
  //Get data fields from the mapper and retrieve data 
  if(      parser_->numbTTs() == 68){ mapperFields_ = parser_->mapper()->tcc68Fields();}
  else if( parser_->numbTTs() == 32){ mapperFields_ = parser_->mapper()->tcc32Fields();}        
  else if( parser_->numbTTs() == 16){ mapperFields_ = parser_->mapper()->tcc16Fields();}
  
  parseData();
  
  // check internal data 
  if(parser_->debug())
    dataCheck();
}

Member Function Documentation

void DCCTBTCCBlock::dataCheck ( ) [protected]

Checks header's data

Definition at line 43 of file DCCTCCBlock.cc.

References DCCTBBlockPrototype::blockError_, BXMASK, DCCTBBlockPrototype::checkDataField(), dccBlock_, DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedId_, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), L1MASK, DCCTBBlockPrototype::name_, DCCTBBlockPrototype::parser_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DCCTBTCCBlock().

                             {
  std::pair <bool,std::string> res;            //check result
  std::string checkErrors("");            //error string

  //check BX(LOCAL) field (1st word bit 16)
  res = checkDataField("BX", BXMASK & (dccBlock_->getDataField("BX")));
  if(!res.first){ 
    checkErrors += res.second; 
    (errors_["TCC::HEADER"])++; 
  }
  
  //check LV1(LOCAL) field (1st word bit 32)
  res = checkDataField("LV1", L1MASK & (dccBlock_->getDataField("LV1"))); 
  if(!res.first){ 
    checkErrors += res.second; 
    (errors_["TCC::HEADER"])++; 
  }
  
  //check TCC ID field (1st word bit 0)
  res = checkDataField("TCC ID",expectedId_); 
  if(!res.first){ 
    checkErrors += res.second; 
    (errors_["TCC::HEADER"])++; 
  } 
  
  
  if(checkErrors!=""){
         blockError_=true;
    errorString_ +="\n ======================================================================\n"; 
         errorString_ += std::string(" ") + name_ + std::string("( ID = ")+parser_->getDecString((uint32_t)(expectedId_))+std::string(" ) errors : ") ;
         errorString_ += checkErrors ;
         errorString_ += "\n ======================================================================";
  }
  
  
}
void DCCTBTCCBlock::increment ( uint32_t  numb) [protected]

Adds a new TCC block

Definition at line 86 of file DCCTCCBlock.cc.

References BLOCKID, BPOSITION_BLOCKID, DCCTBBlockPrototype::dataP_, DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::parser_, and DCCTBBlockPrototype::wordCounter_.

                                           {
  //if no debug is required increments the number of blocks
  //otherwise checks if block id is really B'011'=3
  if(!parser_->debug()){ 
    DCCTBBlockPrototype::increment(numb); 
  }
  else {
    for(uint32_t counter=0; counter<numb; counter++, dataP_++, wordCounter_++){
      uint32_t blockID = (*dataP_) >> BPOSITION_BLOCKID;
      if( blockID != BLOCKID ){
        (errors_["TCC::BLOCKID"])++;
        //errorString_ += std::string("\n") + parser_->index(nunb)+(" blockId has value ") + parser_->getDecString(blockID);
        //errorString  += std::string(", while ")+parser_->getDecString(BLOCKID)+std::string(" is expected");
      }
    }
  }
  
}
std::vector< int > DCCTBTCCBlock::triggerFlags ( )
std::vector< std::pair< int, bool > > DCCTBTCCBlock::triggerSamples ( )

Definition at line 107 of file DCCTCCBlock.cc.

References BPOSITION_FGVB, data, ETMASK, DCCTBBlockPrototype::getDataField(), DCCTBDataParser::getDecString(), i, DCCTBBlockPrototype::name(), DCCTBDataParser::numbTTs(), DCCTBBlockPrototype::parser_, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                             {
  std::vector< std::pair<int,bool> > data;

  for(unsigned int i=1;i <= parser_->numbTTs();i++){
    std::string name = std::string("TPG#") + parser_->getDecString(i);
    int tpgValue = getDataField( name ) ;
                 std::pair<int,bool> tpg( tpgValue&ETMASK, bool(tpgValue>>BPOSITION_FGVB));
    data.push_back (tpg);
     
  }

  return data;
}

Member Data Documentation

Definition at line 71 of file DCCTCCBlock.h.

Referenced by dataCheck().

uint32_t DCCTBTCCBlock::expectedId_ [protected]

Definition at line 72 of file DCCTCCBlock.h.

Referenced by dataCheck().