CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

DCCEventBlock Class Reference

#include <DCCEventBlock.h>

Inheritance diagram for DCCEventBlock:
DCCEBEventBlock DCCEEEventBlock

List of all members.

Public Member Functions

unsigned int bx ()
 DCCEventBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool forceToKeepFRdata)
void display (std::ostream &o)
void enableFeIdChecks ()
void enableSyncChecks ()
unsigned int fov ()
short getHLTChannel (int channel)
unsigned int l1A ()
unsigned int mem ()
void reset ()
void setFESyncNumbers (short l1, short bx, short id)
void setHLTChannel (int channel, short value)
void setSRPSyncNumbers (short l1, short bx)
void setTCCSyncNumbers (short l1, short bx, short id)
unsigned int smId ()
virtual void unpack (const uint64_t *buffer, size_t bufferSize, unsigned int expFedId)
DCCDataUnpackerunpacker ()
void updateCollectors ()
virtual ~DCCEventBlock ()

Protected Member Functions

void addHeaderToCollection ()
unsigned int next_tower_search (const unsigned int current_tower_id)
virtual int unpackTCCBlocks ()

Protected Attributes

unsigned int blockLength_
unsigned int bx_
const uint64_t * data_
unsigned int dccErrors_
std::auto_ptr
< EcalRawDataCollection > * 
dccHeaders_
unsigned int detailedTriggerType_
unsigned int dwToEnd_
unsigned int eventSize_
std::vector< short > feBx_
std::vector< short > feChStatus_
unsigned int fedId_
std::vector< short > feLv1_
bool feUnpacking_
bool forceToKeepFRdata_
unsigned int fov_
bool headerUnpacking_
std::vector< short > hlt_
unsigned int l1_
EcalElectronicsMappermapper_
unsigned int mem_
DCCMemBlockmemBlock_
bool memUnpacking_
unsigned int orbitCounter_
unsigned int runNumber_
unsigned int runType_
unsigned int smId_
unsigned int sr_
unsigned int srChStatus_
DCCSRPBlocksrpBlock_
short srpBx_
short srpLv1_
bool srpUnpacking_
DCCTCCBlocktccBlock_
std::vector< short > tccBx_
std::vector< short > tccChStatus_
std::vector< short > tccLv1_
bool tccUnpacking_
DCCFEBlocktowerBlock_
unsigned int triggerType_
unsigned int tzs_
DCCDataUnpackerunpacker_
unsigned int zs_

Detailed Description

Definition at line 33 of file DCCEventBlock.h.


Constructor & Destructor Documentation

DCCEventBlock::DCCEventBlock ( DCCDataUnpacker u,
EcalElectronicsMapper m,
bool  hU,
bool  srpU,
bool  tccU,
bool  feU,
bool  memU,
bool  forceToKeepFRdata 
)

Definition at line 14 of file DCCEventBlock.cc.

References feBx_, feChStatus_, feLv1_, hlt_, memBlock_, srpBx_, srpLv1_, tccBx_, tccChStatus_, and tccLv1_.

                                                                                                                                                           : 
  unpacker_(u), mapper_(m), headerUnpacking_(hU), srpUnpacking_(srpU), tccUnpacking_(tccU), feUnpacking_(feU),memUnpacking_(memU), forceToKeepFRdata_(forceToKeepFRdata)
{
  
  // Build a Mem Unpacker Block
  memBlock_   = new DCCMemBlock(u,m,this);
 
  // setup and initialize ch status vectors
  for( int feChannel=1;  feChannel <= 70;  feChannel++) { feChStatus_.push_back(0); hlt_.push_back(1);}
  for( int tccChannel=1; tccChannel <= 4 ; tccChannel++){ tccChStatus_.push_back(0);}
  
  // setup and initialize sync vectors
  for( int feChannel=1;  feChannel <= 70;  feChannel++) { feBx_.push_back(-1);  feLv1_.push_back(-1); }
  for( int tccChannel=1; tccChannel <= 4 ; tccChannel++){ tccBx_.push_back(-1); tccLv1_.push_back(-1);}
  srpBx_=-1;
  srpLv1_=-1;
  
}
DCCEventBlock::~DCCEventBlock ( ) [virtual]

Definition at line 210 of file DCCEventBlock.cc.

References memBlock_, srpBlock_, tccBlock_, and towerBlock_.

                             {
  if(towerBlock_){ delete towerBlock_; } 
  if(tccBlock_)  { delete tccBlock_;   }
  if(memBlock_)  { delete memBlock_;   }
  if(srpBlock_)  { delete srpBlock_;   }
}

Member Function Documentation

void DCCEventBlock::addHeaderToCollection ( ) [protected]

Definition at line 127 of file DCCEventBlock.cc.

References bx_, dccErrors_, ecaldqm::dccId(), EcalDCCHeaderRuntypeDecoder::Decode(), detailedTriggerType_, feBx_, feChStatus_, fedId_, feLv1_, EcalElectronicsMapper::getActiveSM(), l1_, mapper_, orbitCounter_, runNumber_, runType_, EcalDCCHeaderBlock::setBasicTriggerType(), EcalDCCHeaderBlock::setBX(), EcalDCCHeaderBlock::setErrors(), EcalDCCHeaderBlock::setFEBx(), EcalDCCHeaderBlock::setFedId(), EcalDCCHeaderBlock::setFELv1(), EcalDCCHeaderBlock::setFEStatus(), EcalDCCHeaderBlock::setId(), EcalDCCHeaderBlock::setLV1(), EcalDCCHeaderBlock::setOrbit(), EcalDCCHeaderBlock::setRunNumber(), EcalDCCHeaderBlock::setSelectiveReadout(), EcalDCCHeaderBlock::setSRPBx(), EcalDCCHeaderBlock::setSRPLv1(), EcalDCCHeaderBlock::setSrpStatus(), EcalDCCHeaderBlock::setTCCBx(), EcalDCCHeaderBlock::setTCCLv1(), EcalDCCHeaderBlock::setTccStatus(), EcalDCCHeaderBlock::setTestZeroSuppression(), EcalDCCHeaderBlock::setZeroSuppression(), sr_, srChStatus_, srpBx_, srpLv1_, tccBx_, tccChStatus_, tccLv1_, triggerType_, tzs_, and zs_.

Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

                                         {
  
  
  EcalDCCHeaderBlock theDCCheader;

  // container for fed_id (601-654 for ECAL) 
  theDCCheader.setFedId(fedId_);
  
  
  // this needs to be migrated to the ECAL mapping package

  // dccId is number internal to ECAL running 1.. 54.
  // convention is that dccId = (fed_id - 600)
  int dccId = mapper_->getActiveSM();
  // DCCHeaders follow  the same convenction
  theDCCheader.setId(dccId);
  

  theDCCheader.setRunNumber(runNumber_);  
  theDCCheader.setBasicTriggerType(triggerType_);
  theDCCheader.setLV1(l1_);
  theDCCheader.setBX(bx_);
  theDCCheader.setOrbit(orbitCounter_);
  theDCCheader.setErrors(dccErrors_);
  theDCCheader.setSelectiveReadout(sr_);
  theDCCheader.setZeroSuppression(zs_);
  theDCCheader.setTestZeroSuppression(tzs_);
  theDCCheader.setSrpStatus(srChStatus_);
  theDCCheader.setTccStatus(tccChStatus_);
  theDCCheader.setFEStatus(feChStatus_);
  
  
  theDCCheader.setSRPLv1(srpLv1_);
  theDCCheader.setSRPBx(srpBx_);
  theDCCheader.setFELv1(feLv1_);
  theDCCheader.setFEBx(feBx_);
  theDCCheader.setTCCLv1(tccLv1_);
  theDCCheader.setTCCBx(tccBx_);
  

  EcalDCCHeaderRuntypeDecoder theRuntypeDecoder;
  unsigned int DCCruntype              = runType_;
  unsigned int DCCdetTriggerType = detailedTriggerType_;
  theRuntypeDecoder.Decode(triggerType_, DCCdetTriggerType , DCCruntype, &theDCCheader);

  // Add Header to collection 
  (*dccHeaders_)->push_back(theDCCheader);
   
}
unsigned int DCCEventBlock::bx ( ) [inline]
void DCCEventBlock::display ( std::ostream &  o)

Definition at line 177 of file DCCEventBlock.cc.

References blockLength_, bx_, dccErrors_, feChStatus_, fedId_, i, gen::k, l1_, runNumber_, sr_, srChStatus_, tccChStatus_, triggerType_, tzs_, and zs_.

                                        {
  o<<"\n Unpacked Info for DCC Event Class"
   <<"\n DW1 ============================="
   <<"\n Fed Id "<<fedId_
   <<"\n Bx "<<bx_
   <<"\n L1 "<<l1_
   <<"\n Trigger Type "<<triggerType_
   <<"\n DW2 ============================="     
   <<"\n Length "<<blockLength_
   <<"\n Dcc errors "<<dccErrors_
   <<"\n Run number "<<runNumber_
   <<"\n DW3 ============================="
   <<"\n SR "<<sr_
   <<"\n ZS "<<zs_
   <<"\n TZS "<<tzs_
   <<"\n SRStatus "<<srChStatus_;
        
  std::vector<short>::iterator it;
  int i(0),k(0);
  for(it = tccChStatus_.begin(); it!=tccChStatus_.end();it++,i++){
    o<<"\n TCCStatus#"<<i<<" "<<(*it);
  } 
  
  i=0;
  for(it = feChStatus_.begin();it!=feChStatus_.end();it++ ,i++){
    if(!(i%14)){ o<<"\n DW"<<(k+3)<<" ============================="; k++; }
    o<<"\n FEStatus#"<<i<<" "<<(*it);           
  }

  o<<"\n";  
} 
void DCCEventBlock::enableFeIdChecks ( )
void DCCEventBlock::enableSyncChecks ( )
unsigned int DCCEventBlock::fov ( ) [inline]
short DCCEventBlock::getHLTChannel ( int  channel) [inline]

Definition at line 64 of file DCCEventBlock.h.

References hlt_.

Referenced by DCCFEBlock::unpack().

{ return hlt_[channel-1];}
unsigned int DCCEventBlock::l1A ( ) [inline]
unsigned int DCCEventBlock::mem ( ) [inline]

Definition at line 55 of file DCCEventBlock.h.

References mem_.

{ return mem_;      }
unsigned int DCCEventBlock::next_tower_search ( const unsigned int  current_tower_id) [protected]

Definition at line 60 of file DCCEventBlock.cc.

References bx(), bx_, data_, dwToEnd_, l1_, mapper_, and EcalElectronicsMapper::numbXtalTSamples().

Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

{
  const uint64_t* const prev_data = data_;
  const unsigned int prev_dwToEnd = dwToEnd_;
  
  // expected LV1, BX, #TS
  const uint32_t lv1 = ((l1_ - 1) & 0xFFF);
  const uint32_t bx = (bx_ != 3564) ? bx_ : 0;
  const uint32_t ts = mapper_->numbXtalTSamples();
  
  // construct tower header and mask
  const uint64_t s_hi = 0xC0000000 + lv1;
  const uint64_t s_lo = 0xC0000000 + (bx << 16) + (ts << 8);
  
  const uint64_t sign = (s_hi << 32) + s_lo;
  const uint64_t mask = 0xC0001FFFDFFF7F00;
  
  // step forward to skip header word of problematic tower
  data_++;
  dwToEnd_--;
  
  //std::cerr << "header of bad tower = " << current_tower_id << " #" << dwToEnd_ << " 0x" << std::hex << *data_ << std::dec << std::endl;
  //std::cerr << "mask and sign = 0x" << std::hex << mask << " 0x" << sign << std::dec << std::endl;
  
  // navigate through tower data blocks to find tower block header
  while (dwToEnd_ > 0) {
    data_++;
    dwToEnd_--;
    
    //std::cerr << current_tower_id << " #" << dwToEnd_ << " 0x" << std::hex << *data_ << " 0x" << (*data_ & mask) << std::dec << std::endl;
    
    if ((*data_ & mask) == sign) {
      const unsigned int next_tower_id = (*data_) & 0xFF;
      
      if (next_tower_id <= current_tower_id) continue;
      
      //std::cerr << "next tower = " << next_tower_id << std::endl;
      
      // step back one word of the next tower header
      data_--;
      dwToEnd_++;
      
      return next_tower_id;
    }
  }
  
  // can't find next tower header
  // restore data pointer
  data_ = prev_data;
  dwToEnd_ = prev_dwToEnd;
  return 1000;
}
void DCCEventBlock::reset ( void  )

Definition at line 34 of file DCCEventBlock.cc.

References feBx_, feLv1_, srpBx_, srpLv1_, tccBx_, and tccLv1_.

Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

                         {

  // reset sync vectors
  for( int feChannel=1;  feChannel <= 70;  feChannel++) {   feBx_[feChannel-1]=-1;   feLv1_[feChannel-1]=-1; }
  for( int tccChannel=1; tccChannel <= 4 ; tccChannel++){ tccBx_[tccChannel-1]=-1; tccLv1_[tccChannel-1]=-1;}
  srpBx_=-1;
  srpLv1_=-1;


}
void DCCEventBlock::setFESyncNumbers ( short  l1,
short  bx,
short  id 
) [inline]

Definition at line 61 of file DCCEventBlock.h.

References bx(), feBx_, feLv1_, and errorMatrix2Lands_multiChannel::id.

Referenced by DCCMemBlock::unpack(), and DCCFEBlock::unpack().

{ feLv1_[id]= l1; feBx_[id]=bx;}
void DCCEventBlock::setHLTChannel ( int  channel,
short  value 
) [inline]

Definition at line 63 of file DCCEventBlock.h.

References hlt_, and relativeConstraints::value.

{ hlt_[channel-1] = value; }   
void DCCEventBlock::setSRPSyncNumbers ( short  l1,
short  bx 
) [inline]

Definition at line 60 of file DCCEventBlock.h.

References bx(), srpBx_, and srpLv1_.

Referenced by DCCSRPBlock::unpack().

{ srpLv1_=l1; srpBx_=bx; }
void DCCEventBlock::setTCCSyncNumbers ( short  l1,
short  bx,
short  id 
) [inline]

Definition at line 62 of file DCCEventBlock.h.

References bx(), errorMatrix2Lands_multiChannel::id, tccBx_, and tccLv1_.

Referenced by DCCTCCBlock::unpack().

{ tccLv1_[id]= l1; tccBx_[id]=bx;}
unsigned int DCCEventBlock::smId ( ) [inline]

Definition at line 53 of file DCCEventBlock.h.

References smId_.

{ return smId_;     }
virtual void DCCEventBlock::unpack ( const uint64_t *  buffer,
size_t  bufferSize,
unsigned int  expFedId 
) [inline, virtual]

Reimplemented in DCCEBEventBlock, and DCCEEEventBlock.

Definition at line 41 of file DCCEventBlock.h.

{};
DCCDataUnpacker* DCCEventBlock::unpacker ( ) [inline]

Definition at line 58 of file DCCEventBlock.h.

References unpacker_.

{ return unpacker_; }
virtual int DCCEventBlock::unpackTCCBlocks ( ) [inline, protected, virtual]

Reimplemented in DCCEBEventBlock, and DCCEEEventBlock.

Definition at line 71 of file DCCEventBlock.h.

References BLOCK_UNPACKED.

{ return BLOCK_UNPACKED;}
void DCCEventBlock::updateCollectors ( )

Member Data Documentation

unsigned int DCCEventBlock::blockLength_ [protected]

Definition at line 97 of file DCCEventBlock.h.

Referenced by display(), DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

unsigned int DCCEventBlock::bx_ [protected]
const uint64_t* DCCEventBlock::data_ [protected]
unsigned int DCCEventBlock::dccErrors_ [protected]

Definition at line 122 of file DCCEventBlock.h.

Referenced by updateCollectors().

unsigned int DCCEventBlock::detailedTriggerType_ [protected]
unsigned int DCCEventBlock::dwToEnd_ [protected]
unsigned int DCCEventBlock::eventSize_ [protected]

Definition at line 75 of file DCCEventBlock.h.

Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

std::vector<short> DCCEventBlock::feBx_ [protected]

Definition at line 84 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), DCCEventBlock(), reset(), and setFESyncNumbers().

std::vector<short> DCCEventBlock::feChStatus_ [protected]
unsigned int DCCEventBlock::fedId_ [protected]
std::vector<short> DCCEventBlock::feLv1_ [protected]

Definition at line 84 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), DCCEventBlock(), reset(), and setFESyncNumbers().

bool DCCEventBlock::feUnpacking_ [protected]
unsigned int DCCEventBlock::fov_ [protected]

Definition at line 91 of file DCCEventBlock.h.

Referenced by fov(), DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

Definition at line 115 of file DCCEventBlock.h.

Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

std::vector<short> DCCEventBlock::hlt_ [protected]

Definition at line 82 of file DCCEventBlock.h.

Referenced by DCCEventBlock(), getHLTChannel(), and setHLTChannel().

unsigned int DCCEventBlock::l1_ [protected]

Definition at line 113 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), and next_tower_search().

unsigned int DCCEventBlock::mem_ [protected]

Definition at line 104 of file DCCEventBlock.h.

Referenced by DCCEBEventBlock::DCCEBEventBlock(), mem(), and DCCEEEventBlock::unpack().

bool DCCEventBlock::memUnpacking_ [protected]

Definition at line 119 of file DCCEventBlock.h.

Referenced by DCCEBEventBlock::unpack(), and DCCEEEventBlock::unpack().

unsigned int DCCEventBlock::orbitCounter_ [protected]
unsigned int DCCEventBlock::runNumber_ [protected]
unsigned int DCCEventBlock::runType_ [protected]
unsigned int DCCEventBlock::smId_ [protected]

Definition at line 96 of file DCCEventBlock.h.

Referenced by smId().

unsigned int DCCEventBlock::sr_ [protected]
unsigned int DCCEventBlock::srChStatus_ [protected]
short DCCEventBlock::srpBx_ [protected]

Definition at line 86 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), DCCEventBlock(), reset(), and setSRPSyncNumbers().

short DCCEventBlock::srpLv1_ [protected]

Definition at line 86 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), DCCEventBlock(), reset(), and setSRPSyncNumbers().

bool DCCEventBlock::srpUnpacking_ [protected]
std::vector<short> DCCEventBlock::tccBx_ [protected]

Definition at line 85 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), DCCEventBlock(), reset(), and setTCCSyncNumbers().

std::vector<short> DCCEventBlock::tccChStatus_ [protected]
std::vector<short> DCCEventBlock::tccLv1_ [protected]

Definition at line 85 of file DCCEventBlock.h.

Referenced by addHeaderToCollection(), DCCEventBlock(), reset(), and setTCCSyncNumbers().

bool DCCEventBlock::tccUnpacking_ [protected]
unsigned int DCCEventBlock::triggerType_ [protected]
unsigned int DCCEventBlock::tzs_ [protected]
unsigned int DCCEventBlock::zs_ [protected]