CMS 3D CMS Logo

DCCTCCBlock.cc

Go to the documentation of this file.
00001 #include "EventFilter/EcalRawToDigiDev/interface/DCCTCCBlock.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "EventFilter/EcalRawToDigiDev/interface/EcalElectronicsMapper.h"
00004 #include "EventFilter/EcalRawToDigiDev/interface/DCCDataUnpacker.h"
00005 #include "EventFilter/EcalRawToDigiDev/interface/DCCEventBlock.h"
00006 
00007 DCCTCCBlock::DCCTCCBlock ( DCCDataUnpacker  * u, EcalElectronicsMapper * m, DCCEventBlock * e, bool unpack) : 
00008 DCCDataBlockPrototype(u,m,e,unpack){}
00009 
00010  
00011 int DCCTCCBlock::unpack(uint64_t ** data, uint * dwToEnd){ 
00012  
00013   dwToEnd_    = dwToEnd;  
00014   datap_      = data;
00015   data_       = *data;
00016   
00017   if( (*dwToEnd_)<blockLength_ ){
00018     if( ! DCCDataUnpacker::silentMode_ ){
00019       edm::LogWarning("EcalRawToDigiDevTCC")
00020         <<"EcalRawToDigi@SUB=DCCTCCBlock:unpack"
00021         <<"\n Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
00022         <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available until the end of event while "<<(blockLength_*8)<<" are needed!"
00023         <<"\n => Skipping to next fed block...";
00024      }
00025     
00026     //todo : add this to error colection
00027     
00028     return STOP_EVENT_UNPACKING;
00029   }
00030   
00031   if(unpackInternalData_){ 
00032   
00033     //  Go to the begining of the tcc block
00034     data_++;
00035   
00036     tccId_    = ( *data_ )           & TCC_ID_MASK;
00037     bx_       = ( *data_>>TCC_BX_B ) & TCC_BX_MASK;
00038     l1_       = ( *data_>>TCC_L1_B ) & TCC_L1_MASK;
00039     nTTs_     = ( *data_>>TCC_TT_B ) & TCC_TT_MASK;
00040     nTSamples_= ( *data_>>TCC_TS_B ) & TCC_TS_MASK;
00041 
00042     if ( ! checkTccIdAndNumbTTs() ){
00043           updateEventPointers();
00044           return SKIP_BLOCK_UNPACKING;
00045         }  
00046   
00047     // Check synchronization
00048     if(sync_){
00049       uint dccBx = (event_->bx())  & TCC_BX_MASK;
00050       uint dccL1 = (event_->l1A()) & TCC_L1_MASK;    
00051       if( dccBx != bx_ || dccL1 != l1_ ){
00052         if( ! DCCDataUnpacker::silentMode_ ){
00053           edm::LogWarning("EcalRawToDigiDevTCC")
00054             <<"\n Synchronization error for TCC block in event "<<event_->l1A()
00055             <<" with bx "<<event_->bx()<<" in fed <<"<<mapper_->getActiveDCC()
00056             <<"\n TCC local l1A is  "<<l1_<<" and local bx is "<<bx_
00057             <<"\n TCC block skipped ...";
00058         }
00059         
00060         //Note : add to error collection ?      
00061         updateEventPointers();
00062         return SKIP_BLOCK_UNPACKING;
00063         
00064       }
00065     }
00066     
00067     //check numb of samples
00068    /*  
00069     uint expTriggerTSamples(mapper_->numbTriggerTSamples());
00070     
00071     if( nTSamples_ != expTriggerTSamples ){
00072       edm::LogWarning("EcalRawToDigiDevTCC")
00073         <<"\n Unable to unpack TCC block for event "<<event_->l1A()<<" in fed "<<mapper_->getActiveDCC()
00074         <<"\n Number of time samples is "<<nTSamples_<<" while "<<expTriggerTSamples<<" is expected"
00075         <<"\n TCC block skipped..."<<endl;
00076                 
00077        //Note : add to error collection ?
00078            updateEventPointers();                
00079       return SKIP_BLOCK_UNPACKING;
00080     }
00081     */   
00082   
00083     // debugging
00084     // display(cout);
00085 
00086     addTriggerPrimitivesToCollection();
00087 
00088   } 
00089 
00090   updateEventPointers();
00091   return BLOCK_UNPACKED;        
00092   
00093 }
00094 
00095 
00096 
00097 void DCCTCCBlock::display(std::ostream& o){
00098 
00099   o<<"\n Unpacked Info for DCC TCC Block"
00100    <<"\n DW1 ============================="
00101    <<"\n TCC Id "<<tccId_
00102    <<"\n Bx "<<bx_
00103    <<"\n L1 "<<l1_
00104    <<"\n Numb TT "<<nTTs_
00105    <<"\n Numb Samp "<<nTSamples_;  
00106 } 
00107     

Generated on Tue Jun 9 17:34:37 2009 for CMSSW by  doxygen 1.5.4