CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

DCCSRPBlock Class Reference

#include <DCCSRPBlock.h>

Inheritance diagram for DCCSRPBlock:
DCCDataBlockPrototype DCCEBSRPBlock DCCEESRPBlock

List of all members.

Public Member Functions

 DCCSRPBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
void display (std::ostream &o)
unsigned short srFlag (unsigned int feChannel)
int unpack (const uint64_t **data, unsigned int *dwToEnd, unsigned int numbFlags=SRP_NUMBFLAGS)

Protected Member Functions

virtual void addSRFlagToCollection ()
virtual bool checkSrpIdAndNumbSRFlags ()

Protected Attributes

unsigned int bx_
unsigned int expNumbSrFlags_
unsigned int l1_
unsigned int nSRFlags_
unsigned short srFlags_ [SRP_NUMBFLAGS]
unsigned int srpId_

Detailed Description

Definition at line 35 of file DCCSRPBlock.h.


Constructor & Destructor Documentation

DCCSRPBlock::DCCSRPBlock ( DCCDataUnpacker u,
EcalElectronicsMapper m,
DCCEventBlock e,
bool  unpack 
)

Definition at line 6 of file DCCSRPBlock.cc.

References DCCDataBlockPrototype::blockLength_, i, srFlags_, SRP_BLOCKLENGTH, and SRP_NUMBFLAGS.

  : DCCDataBlockPrototype(u,m,e,unpack)
{
 
  // Todo : include data integrity collections
  blockLength_    = SRP_BLOCKLENGTH;
  // Set SR flags to zero
  for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ srFlags_[i]=0; }

}

Member Function Documentation

virtual void DCCSRPBlock::addSRFlagToCollection ( ) [inline, protected, virtual]

Reimplemented in DCCEBSRPBlock, and DCCEESRPBlock.

Definition at line 49 of file DCCSRPBlock.h.

Referenced by unpack().

{};
virtual bool DCCSRPBlock::checkSrpIdAndNumbSRFlags ( ) [inline, protected, virtual]

Reimplemented in DCCEBSRPBlock, and DCCEESRPBlock.

Definition at line 51 of file DCCSRPBlock.h.

Referenced by unpack().

{ return true; };
void DCCSRPBlock::display ( std::ostream &  o) [virtual]

Reimplemented from DCCDataBlockPrototype.

Definition at line 97 of file DCCSRPBlock.cc.

References bx_, i, l1_, nSRFlags_, srFlags_, SRP_NUMBFLAGS, and srpId_.

                                      {

  o<<"\n Unpacked Info for SRP Block"
  <<"\n DW1 ============================="
  <<"\n SRP Id "<<srpId_
  <<"\n Numb Flags "<<nSRFlags_ 
  <<"\n Bx "<<bx_
  <<"\n L1 "<<l1_;
 
  for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ 
    o<<"\n SR flag "<<(i+1)<<" = "<<(srFlags_[i]); 
  } 
} 
unsigned short DCCSRPBlock::srFlag ( unsigned int  feChannel) [inline]
int DCCSRPBlock::unpack ( const uint64_t **  data,
unsigned int *  dwToEnd,
unsigned int  numbFlags = SRP_NUMBFLAGS 
)

Definition at line 19 of file DCCSRPBlock.cc.

References addSRFlagToCollection(), DCCDataBlockPrototype::blockLength_, DCCEventBlock::bx(), bx_, checkSrpIdAndNumbSRFlags(), AlCaHLTBitMon_QueryRunRegistry::data, DCCDataBlockPrototype::data_, DCCDataBlockPrototype::datap_, DCCDataBlockPrototype::dwToEnd_, DCCDataBlockPrototype::error_, DCCDataBlockPrototype::event_, expNumbSrFlags_, DCCEventBlock::fov(), EcalElectronicsMapper::getActiveDCC(), H_FOV_MASK, i, isSynced(), l1_, DCCEventBlock::l1A(), DCCDataBlockPrototype::mapper_, nSRFlags_, DCCEventBlock::setSRPSyncNumbers(), DCCDataUnpacker::silentMode_, srFlags_, SRP_BX_B, SRP_BX_MASK, SRP_ID_MASK, SRP_L1_B, SRP_L1_MASK, SRP_NFLAGS_B, SRP_NFLAGS_MASK, SRP_NUMBFLAGS, srpId_, STOP_EVENT_UNPACKING, DCCDataBlockPrototype::sync_, TCC_SRP, and DCCDataBlockPrototype::updateEventPointers().

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

                                                                                              {    

  // Set SR flags to zero
  for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ srFlags_[i]=0; }
  

  expNumbSrFlags_ = numbFlags;
  error_          = false;  
  datap_          = data;
  data_           = *data;
  dwToEnd_        = dwToEnd;
  
  // Check SRP Length
  if( (*dwToEnd_) < blockLength_ ){
    if( ! DCCDataUnpacker::silentMode_ ){ 
      edm::LogWarning("IncorrectEvent")
        <<"\n Event "<<l1_
        <<"\n Unable to unpack SRP block for event "<<event_->l1A()<<" in fed <<"<<mapper_->getActiveDCC()
        <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available while "<<(blockLength_*8)<<" are needed!";
     }
    
    //Note : add to error collection 
    
    return STOP_EVENT_UNPACKING;
    
  }
  
  
  
  // Point to begin of block
  data_++;
  
  srpId_          = ( *data_ ) & SRP_ID_MASK; 
  bx_             = ( *data_>>SRP_BX_B     ) & SRP_BX_MASK;
  l1_             = ( *data_>>SRP_L1_B     ) & SRP_L1_MASK;
  nSRFlags_       = ( *data_>>SRP_NFLAGS_B ) & SRP_NFLAGS_MASK;
  
  event_->setSRPSyncNumbers(l1_,bx_);
 
  if( ! checkSrpIdAndNumbSRFlags() ){ 
    // SRP flags are required to check FE data 
        return  STOP_EVENT_UNPACKING; 
  }
         
  // Check synchronization
  if(sync_){
    const unsigned int dccL1 = ( event_->l1A() ) & SRP_L1_MASK;
    const unsigned int dccBx = ( event_->bx()  ) & SRP_BX_MASK;
    const unsigned int fov   = ( event_->fov() ) & H_FOV_MASK;
    
    if (! isSynced(dccBx, bx_, dccL1, l1_, TCC_SRP, fov)) {
      if( ! DCCDataUnpacker::silentMode_ ){
        edm::LogWarning("IncorrectEvent")
          << "Synchronization error for SRP block"
          << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << ")\n"
          << "  dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
          << "  => Stop event unpacking";
      }
       //Note : add to error collection ?                
       // SRP flags are required to check FE , better using synchronized data...
           return STOP_EVENT_UNPACKING;
    }
  } 

  // initialize array, protecting in case of inconsistently formatted data
  for(int dccCh=0; dccCh<SRP_NUMBFLAGS; dccCh++) srFlags_[dccCh] =0;
  
  //display(cout); 
  addSRFlagToCollection();
  
  updateEventPointers();
  
  return true;
        
}

Member Data Documentation

unsigned int DCCSRPBlock::bx_ [protected]

Definition at line 54 of file DCCSRPBlock.h.

Referenced by display(), and unpack().

unsigned int DCCSRPBlock::expNumbSrFlags_ [protected]
unsigned int DCCSRPBlock::l1_ [protected]

Definition at line 55 of file DCCSRPBlock.h.

Referenced by display(), and unpack().

unsigned int DCCSRPBlock::nSRFlags_ [protected]

Definition at line 56 of file DCCSRPBlock.h.

Referenced by DCCEBSRPBlock::checkSrpIdAndNumbSRFlags(), display(), and unpack().

unsigned short DCCSRPBlock::srFlags_[SRP_NUMBFLAGS] [protected]
unsigned int DCCSRPBlock::srpId_ [protected]

Definition at line 51 of file DCCSRPBlock.h.

Referenced by display(), and unpack().