CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

DCCTCCBlock Class Reference

#include <DCCTCCBlock.h>

Inheritance diagram for DCCTCCBlock:
DCCDataBlockPrototype DCCEBTCCBlock DCCEETCCBlock

List of all members.

Public Member Functions

virtual void addTriggerPrimitivesToCollection ()
 DCCTCCBlock (DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
void display (std::ostream &o)
int unpack (const uint64_t **data, unsigned int *dwToEnd, short tccChId=0)

Protected Member Functions

virtual bool checkTccIdAndNumbTTs ()

Protected Attributes

unsigned int bx_
unsigned int expNumbTTs_
unsigned int expTccId_
unsigned int l1_
unsigned int nTSamples_
unsigned int nTTs_
EcalPseudoStripInputDigipPS_
unsigned int ps_
std::auto_ptr
< EcalPSInputDigiCollection > * 
pss_
EcalTriggerPrimitiveDigipTP_
EcalTrigTowerDetIdpTTDetId_
unsigned int tccId_
std::auto_ptr
< EcalTrigPrimDigiCollection > * 
tps_

Detailed Description

Definition at line 36 of file DCCTCCBlock.h.


Constructor & Destructor Documentation

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

Class constructor

Definition at line 7 of file DCCTCCBlock.cc.


Member Function Documentation

virtual void DCCTCCBlock::addTriggerPrimitivesToCollection ( ) [inline, virtual]

Reimplemented in DCCEBTCCBlock, and DCCEETCCBlock.

Definition at line 44 of file DCCTCCBlock.h.

Referenced by unpack().

{};
virtual bool DCCTCCBlock::checkTccIdAndNumbTTs ( ) [inline, protected, virtual]

Reimplemented in DCCEBTCCBlock, and DCCEETCCBlock.

Definition at line 56 of file DCCTCCBlock.h.

Referenced by unpack().

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

Reimplemented from DCCDataBlockPrototype.

Definition at line 122 of file DCCTCCBlock.cc.

References bx_, l1_, nTSamples_, nTTs_, and tccId_.

                                      {

  o<<"\n Unpacked Info for DCC TCC Block"
   <<"\n DW1 ============================="
   <<"\n TCC Id "<<tccId_
   <<"\n Bx "<<bx_
   <<"\n L1 "<<l1_
   <<"\n Numb TT "<<nTTs_
   <<"\n Numb Samp "<<nTSamples_;  
} 
int DCCTCCBlock::unpack ( const uint64_t **  data,
unsigned int *  dwToEnd,
short  tccChId = 0 
)

Unpacks TCC data

Definition at line 11 of file DCCTCCBlock.cc.

References addTriggerPrimitivesToCollection(), B_MASK, BLOCK_UNPACKED, DCCDataBlockPrototype::blockLength_, DCCEventBlock::bx(), bx_, checkTccIdAndNumbTTs(), AlCaHLTBitMon_QueryRunRegistry::data, DCCDataBlockPrototype::data_, DCCDataBlockPrototype::datap_, DCCDataBlockPrototype::dwToEnd_, DCCDataBlockPrototype::event_, DCCEventBlock::fov(), EcalElectronicsMapper::getActiveDCC(), DCCDataBlockPrototype::getLength(), H_FOV_MASK, isSynced(), l1_, DCCEventBlock::l1A(), DCCDataBlockPrototype::mapper_, nTSamples_, nTTs_, ps_, DCCEventBlock::setTCCSyncNumbers(), DCCDataUnpacker::silentMode_, SKIP_BLOCK_UNPACKING, STOP_EVENT_UNPACKING, DCCDataBlockPrototype::sync_, TCC_BX_B, TCC_BX_MASK, TCC_ID_MASK, TCC_L1_B, TCC_L1_MASK, TCC_PS_B, TCC_SRP, TCC_TS_B, TCC_TS_MASK, TCC_TT_B, TCC_TT_MASK, tccId_, DCCDataBlockPrototype::unpackInternalData_, and DCCDataBlockPrototype::updateEventPointers().

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

                                                                                    { 
 
  dwToEnd_    = dwToEnd;  
  datap_      = data;
  data_       = *data;
  
  // Need at least 1 dw to findout if pseudo-strips readout is enabled
  if(*dwToEnd == 1){
    if( ! DCCDataUnpacker::silentMode_ ){
      edm::LogWarning("IncorrectEvent")
        <<"EcalRawToDigi@SUB=DCCTCCBlock:unpack"
        <<"\n Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
        <<"\n Only 8 bytes are available until the end of event ..."
        <<"\n => Skipping to next fed block...";
     }
    
    //todo : add this to error colection
    
    return STOP_EVENT_UNPACKING;
  }

  blockLength_ = getLength();
  
  
  if( (*dwToEnd_)<blockLength_ ){
    if( ! DCCDataUnpacker::silentMode_ ){
      edm::LogWarning("IncorrectEvent")
        <<"EcalRawToDigi@SUB=DCCTCCBlock:unpack"
        <<"\n Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
        <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available until the end of event while "<<(blockLength_*8)<<" are needed!"
        <<"\n => Skipping to next fed block...";
     }
    
    //todo : add this to error colection
    
    return STOP_EVENT_UNPACKING;
  }
  
  
  
  if(unpackInternalData_){ 
  
    //  Go to the begining of the tcc block
    data_++;
  
    tccId_    = ( *data_ )           & TCC_ID_MASK;
    ps_       = ( *data_>>TCC_PS_B ) & B_MASK;      
    bx_       = ( *data_>>TCC_BX_B ) & TCC_BX_MASK;
    l1_       = ( *data_>>TCC_L1_B ) & TCC_L1_MASK;
    nTTs_     = ( *data_>>TCC_TT_B ) & TCC_TT_MASK;
    nTSamples_= ( *data_>>TCC_TS_B ) & TCC_TS_MASK;
        
    event_->setTCCSyncNumbers(l1_,bx_,tccChId);

    if ( ! checkTccIdAndNumbTTs() ){
          updateEventPointers();
          return SKIP_BLOCK_UNPACKING;
        }  
  
    // Check synchronization
    if(sync_){
      const unsigned int dccBx = (event_->bx())  & TCC_BX_MASK;
      const unsigned int dccL1 = (event_->l1A()) & TCC_L1_MASK;
      const unsigned int fov   = ( event_->fov() ) & H_FOV_MASK;
      
      if (! isSynced(dccBx, bx_, dccL1, l1_, TCC_SRP, fov)) {
        if( ! DCCDataUnpacker::silentMode_ ){
          edm::LogWarning("IncorrectBlock")
            << "Synchronization error for TCC block"
            << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << ")\n"
            << "  dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
            << "  => TCC block skipped";
        }
        
        //Note : add to error collection ?        
        updateEventPointers();
        return SKIP_BLOCK_UNPACKING;
        
      }
    }
    
    //check numb of samples
   /*  
    unsigned int expTriggerTSamples(mapper_->numbTriggerTSamples());
    
    if( nTSamples_ != expTriggerTSamples ){
      edm::LogWarning("IncorrectBlock")
        <<"Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
        <<"\n Number of time samples is "<<nTSamples_<<" while "<<expTriggerTSamples<<" is expected"
        <<"\n TCC block skipped..."<<endl;
                
       //Note : add to error collection ?
           updateEventPointers();                 
      return SKIP_BLOCK_UNPACKING;
    }
    */         
  
    // debugging
    // display(cout);

    addTriggerPrimitivesToCollection();

  } 

  updateEventPointers();
  return BLOCK_UNPACKED;        
  
}

Member Data Documentation

unsigned int DCCTCCBlock::bx_ [protected]

Definition at line 59 of file DCCTCCBlock.h.

Referenced by display(), and unpack().

unsigned int DCCTCCBlock::expNumbTTs_ [protected]
unsigned int DCCTCCBlock::expTccId_ [protected]

Definition at line 64 of file DCCTCCBlock.h.

Referenced by DCCEBTCCBlock::checkTccIdAndNumbTTs().

unsigned int DCCTCCBlock::l1_ [protected]

Definition at line 60 of file DCCTCCBlock.h.

Referenced by display(), and unpack().

unsigned int DCCTCCBlock::nTSamples_ [protected]

Definition at line 62 of file DCCTCCBlock.h.

Referenced by DCCEBTCCBlock::addTriggerPrimitivesToCollection(), display(), and unpack().

unsigned int DCCTCCBlock::nTTs_ [protected]

Definition at line 69 of file DCCTCCBlock.h.

Referenced by DCCEETCCBlock::addTriggerPrimitivesToCollection().

unsigned int DCCTCCBlock::ps_ [protected]
std::auto_ptr<EcalPSInputDigiCollection>* DCCTCCBlock::pss_ [protected]

Definition at line 71 of file DCCTCCBlock.h.

Referenced by DCCEETCCBlock::updateCollectors().

Definition at line 67 of file DCCTCCBlock.h.

unsigned int DCCTCCBlock::tccId_ [protected]
std::auto_ptr<EcalTrigPrimDigiCollection>* DCCTCCBlock::tps_ [protected]