CMS 3D CMS Logo

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

DCCTBXtalBlock Class Reference

#include <DCCXtalBlock.h>

Inheritance diagram for DCCTBXtalBlock:
DCCTBBlockPrototype

List of all members.

Public Member Functions

void dataCheck ()
 DCCTBXtalBlock (DCCTBDataParser *parser, uint32_t *buffer, uint32_t numbBytes, uint32_t wordsToEnd, uint32_t wordEventOffset, uint32_t expectedXtalID, uint32_t expectedStripID)
int stripID ()
std::vector< int > xtalDataSamples ()
int xtalID ()

Protected Types

enum  xtalBlockFields { BPOSITION_BLOCKID = 30, BLOCKID = 3 }

Protected Member Functions

void increment (uint32_t numb)

Protected Attributes

uint32_t expectedStripID_
uint32_t expectedXtalID_

Detailed Description

Definition at line 10 of file DCCXtalBlock.h.


Member Enumeration Documentation

Enumerator:
BPOSITION_BLOCKID 
BLOCKID 

Definition at line 33 of file DCCXtalBlock.h.

{ BPOSITION_BLOCKID = 30, BLOCKID = 3};

Constructor & Destructor Documentation

DCCTBXtalBlock::DCCTBXtalBlock ( DCCTBDataParser parser,
uint32_t *  buffer,
uint32_t  numbBytes,
uint32_t  wordsToEnd,
uint32_t  wordEventOffset,
uint32_t  expectedXtalID,
uint32_t  expectedStripID 
)

Definition at line 6 of file DCCXtalBlock.cc.

References dataCheck(), DCCTBDataParser::debug(), DCCTBBlockPrototype::errors_, DCCTBDataParser::mapper(), DCCTBBlockPrototype::mapperFields_, DCCTBBlockPrototype::parseData(), DCCTBBlockPrototype::parser_, and DCCTBDataMapper::xtalFields().

  : DCCTBBlockPrototype(parser,"XTAL", buffer, numbBytes, wordsToEnd, wordEventOffset),
expectedXtalID_(expectedXtalID), expectedStripID_(expectedStripID){
        
        
        //Reset error counters ////
        errors_["XTAL::HEADER"]  = 0;
        errors_["XTAL::BLOCKID"] = 0; 
        
        // Get data fields from the mapper and retrieve data /////////////////////////////////////
        mapperFields_ = parser_->mapper()->xtalFields();        
        parseData();
        
        // check internal data ////////////
        if(parser_->debug()){ dataCheck();}

}

Member Function Documentation

void DCCTBXtalBlock::dataCheck ( )

Definition at line 36 of file DCCXtalBlock.cc.

References DCCTBBlockPrototype::blockError_, DCCTBBlockPrototype::checkDataField(), DCCTBBlockPrototype::errors_, DCCTBBlockPrototype::errorString_, expectedStripID_, expectedXtalID_, DCCTBBlockPrototype::name_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DCCTBXtalBlock().

                              {
        
        std::string checkErrors("");
                
        std::pair <bool,std::string> res;
        
        
        if(expectedXtalID_ !=0){ 
                res = checkDataField("XTAL ID",expectedXtalID_); 
                if(!res.first){ checkErrors += res.second; (errors_["XTAL::HEADER"])++; } 
        }
        if(expectedStripID_!=0){ 
                res = checkDataField("STRIP ID",expectedStripID_);
                if(!res.first){ checkErrors += res.second; (errors_["XTAL::HEADER"])++; } 
        }
        if(checkErrors!=""){
                errorString_ +="\n ======================================================================\n";           
                errorString_ += std::string(" ") + name_ + std::string(" data fields checks errors : ") ;
                errorString_ += checkErrors ;
                errorString_ += "\n ======================================================================";
                blockError_ = true;     
        }
        
}
void DCCTBXtalBlock::increment ( uint32_t  numb) [protected]

Definition at line 62 of file DCCXtalBlock.cc.

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

                                            {
        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_["XTAL::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");
                        }
                }
        }
}
int DCCTBXtalBlock::stripID ( )

Definition at line 94 of file DCCXtalBlock.cc.

References DCCTBBlockPrototype::getDataField(), DCCTBBlockPrototype::mapperFields_, and query::result.

                            {
  int result=-1;

  for(std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator it = mapperFields_->begin(); it!= mapperFields_->end(); it++){
    if ( (*it)->name() == "STRIP ID" ) 
      result=getDataField( (*it)->name() )  ;
    
  }
  
  return result;

}
std::vector< int > DCCTBXtalBlock::xtalDataSamples ( )
int DCCTBXtalBlock::xtalID ( )

Definition at line 76 of file DCCXtalBlock.cc.

References DCCTBBlockPrototype::getDataField(), DCCTBBlockPrototype::mapperFields_, and query::result.

                           {

  int result=-1;

  for(  std::set<DCCTBDataField *,DCCTBDataFieldComparator>::iterator 
           it = mapperFields_->begin(); it!= mapperFields_->end(); it++){
  
    if ( (*it)->name() == "XTAL ID" ) 
      result=getDataField( (*it)->name() )  ;
    
  }


 
  return result; 

}

Member Data Documentation

uint32_t DCCTBXtalBlock::expectedStripID_ [protected]

Definition at line 36 of file DCCXtalBlock.h.

Referenced by dataCheck().

uint32_t DCCTBXtalBlock::expectedXtalID_ [protected]

Definition at line 35 of file DCCXtalBlock.h.

Referenced by dataCheck().