Go to the documentation of this file.00001 #include "EventFilter/EcalRawToDigi/interface/DCCSRPBlock.h"
00002 #include "EventFilter/EcalRawToDigi/interface/DCCEventBlock.h"
00003 #include "EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h"
00004 #include "EventFilter/EcalRawToDigi/interface/DCCDataUnpacker.h"
00005
00006 DCCSRPBlock::DCCSRPBlock(
00007 DCCDataUnpacker * u,EcalElectronicsMapper * m, DCCEventBlock * e, bool unpack
00008 ) : DCCDataBlockPrototype(u,m,e,unpack)
00009 {
00010
00011
00012 blockLength_ = SRP_BLOCKLENGTH;
00013
00014 for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ srFlags_[i]=0; }
00015
00016 }
00017
00018
00019 int DCCSRPBlock::unpack(const uint64_t ** data, unsigned int * dwToEnd, unsigned int numbFlags ){
00020
00021
00022 for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ srFlags_[i]=0; }
00023
00024
00025 expNumbSrFlags_ = numbFlags;
00026 error_ = false;
00027 datap_ = data;
00028 data_ = *data;
00029 dwToEnd_ = dwToEnd;
00030
00031
00032 if( (*dwToEnd_) < blockLength_ ){
00033 if( ! DCCDataUnpacker::silentMode_ ){
00034 edm::LogWarning("IncorrectEvent")
00035 <<"\n Event "<<l1_
00036 <<"\n Unable to unpack SRP block for event "<<event_->l1A()<<" in fed <<"<<mapper_->getActiveDCC()
00037 <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available while "<<(blockLength_*8)<<" are needed!";
00038 }
00039
00040
00041
00042 return STOP_EVENT_UNPACKING;
00043
00044 }
00045
00046
00047
00048
00049 data_++;
00050
00051 srpId_ = ( *data_ ) & SRP_ID_MASK;
00052 bx_ = ( *data_>>SRP_BX_B ) & SRP_BX_MASK;
00053 l1_ = ( *data_>>SRP_L1_B ) & SRP_L1_MASK;
00054 nSRFlags_ = ( *data_>>SRP_NFLAGS_B ) & SRP_NFLAGS_MASK;
00055
00056 event_->setSRPSyncNumbers(l1_,bx_);
00057
00058 if( ! checkSrpIdAndNumbSRFlags() ){
00059
00060 return STOP_EVENT_UNPACKING;
00061 }
00062
00063
00064 if(sync_){
00065 const unsigned int dccL1 = ( event_->l1A() ) & SRP_L1_MASK;
00066 const unsigned int dccBx = ( event_->bx() ) & SRP_BX_MASK;
00067 const unsigned int fov = ( event_->fov() ) & H_FOV_MASK;
00068
00069 if (! isSynced(dccBx, bx_, dccL1, l1_, TCC_SRP, fov)) {
00070 if( ! DCCDataUnpacker::silentMode_ ){
00071 edm::LogWarning("IncorrectEvent")
00072 << "Synchronization error for SRP block"
00073 << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << ")\n"
00074 << " dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
00075 << " => Stop event unpacking";
00076 }
00077
00078
00079 return STOP_EVENT_UNPACKING;
00080 }
00081 }
00082
00083
00084 for(int dccCh=0; dccCh<SRP_NUMBFLAGS; dccCh++) srFlags_[dccCh] =0;
00085
00086
00087 addSRFlagToCollection();
00088
00089 updateEventPointers();
00090
00091 return true;
00092
00093 }
00094
00095
00096
00097 void DCCSRPBlock::display(std::ostream& o){
00098
00099 o<<"\n Unpacked Info for SRP Block"
00100 <<"\n DW1 ============================="
00101 <<"\n SRP Id "<<srpId_
00102 <<"\n Numb Flags "<<nSRFlags_
00103 <<"\n Bx "<<bx_
00104 <<"\n L1 "<<l1_;
00105
00106 for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){
00107 o<<"\n SR flag "<<(i+1)<<" = "<<(srFlags_[i]);
00108 }
00109 }
00110
00111
00112
00113