CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DCCSRPBlock.cc
Go to the documentation of this file.
5 
8 ) : DCCDataBlockPrototype(u,m,e,unpack)
9 {
10 
11  // Todo : include data integrity collections
13  // Set SR flags to zero
14  for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ srFlags_[i]=0; }
15 
16 }
17 
18 
19 int DCCSRPBlock::unpack(const uint64_t ** data, unsigned int * dwToEnd, unsigned int numbFlags ){
20 
21  // Set SR flags to zero
22  for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){ srFlags_[i]=0; }
23 
24 
25  expNumbSrFlags_ = numbFlags;
26  error_ = false;
27  datap_ = data;
28  data_ = *data;
29  dwToEnd_ = dwToEnd;
30 
31  // Check SRP Length
32  if( (*dwToEnd_) < blockLength_ ){
34  edm::LogWarning("IncorrectEvent")
35  <<"\n Event "<<l1_
36  <<"\n Unable to unpack SRP block for event "<<event_->l1A()<<" in fed <<"<<mapper_->getActiveDCC()
37  <<"\n Only "<<((*dwToEnd_)*8)<<" bytes are available while "<<(blockLength_*8)<<" are needed!";
38  }
39 
40  //Note : add to error collection
41 
42  return STOP_EVENT_UNPACKING;
43 
44  }
45 
46 
47 
48  // Point to begin of block
49  data_++;
50 
51  srpId_ = ( *data_ ) & SRP_ID_MASK;
52  bx_ = ( *data_>>SRP_BX_B ) & SRP_BX_MASK;
53  l1_ = ( *data_>>SRP_L1_B ) & SRP_L1_MASK;
55 
57 
58  if( ! checkSrpIdAndNumbSRFlags() ){
60  //return STOP_EVENT_UNPACKING;
62  return SKIP_BLOCK_UNPACKING;
63  }
64 
65  // Check synchronization
66  if(sync_){
67  const unsigned int dccL1 = ( event_->l1A() ) & SRP_L1_MASK;
68  const unsigned int dccBx = ( event_->bx() ) & SRP_BX_MASK;
69  const unsigned int fov = ( event_->fov() ) & H_FOV_MASK;
70 
71  if (! isSynced(dccBx, bx_, dccL1, l1_, TCC_SRP, fov)) {
73  edm::LogWarning("IncorrectEvent")
74  << "Synchronization error for SRP block"
75  << " (L1A " << event_->l1A() << " bx " << event_->bx() << " fed " << mapper_->getActiveDCC() << ")\n"
76  << " dccBx = " << dccBx << " bx_ = " << bx_ << " dccL1 = " << dccL1 << " l1_ = " << l1_ << "\n"
77  << " => Stop event unpacking";
78  }
79  //Note : add to error collection ?
81  // return STOP_EVENT_UNPACKING;
83  return SKIP_BLOCK_UNPACKING;
84  }
85  }
86 
87  // initialize array, protecting in case of inconsistently formatted data
88  for(int dccCh=0; dccCh<SRP_NUMBFLAGS; dccCh++) srFlags_[dccCh] =0;
89 
90  //display(cout);
92 
94 
95  return true;
96 
97 }
98 
99 
100 
101 void DCCSRPBlock::display(std::ostream& o){
102 
103  o<<"\n Unpacked Info for SRP Block"
104  <<"\n DW1 ============================="
105  <<"\n SRP Id "<<srpId_
106  <<"\n Numb Flags "<<nSRFlags_
107  <<"\n Bx "<<bx_
108  <<"\n L1 "<<l1_;
109 
110  for(unsigned int i=0; i<SRP_NUMBFLAGS; i++){
111  o<<"\n SR flag "<<(i+1)<<" = "<<(srFlags_[i]);
112  }
113 }
114 
115 
116 
117 
unsigned int srpId_
Definition: DCCSRPBlock.h:49
int i
Definition: DBlmapReader.cc:9
unsigned short srFlags_[SRP_NUMBFLAGS]
Definition: DCCSRPBlock.h:57
bool isSynced(const unsigned int dccBx, const unsigned int bx, const unsigned int dccL1, const unsigned int l1, const BlockType type, const unsigned int fov)
unsigned int expNumbSrFlags_
Definition: DCCSRPBlock.h:55
unsigned int l1_
Definition: DCCSRPBlock.h:53
virtual bool checkSrpIdAndNumbSRFlags()
Definition: DCCSRPBlock.h:49
virtual void addSRFlagToCollection()
Definition: DCCSRPBlock.h:47
static std::atomic< bool > silentMode_
unsigned int bx()
Definition: DCCEventBlock.h:55
unsigned int bx_
Definition: DCCSRPBlock.h:52
unsigned int fov()
Definition: DCCEventBlock.h:52
DCCSRPBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
Definition: DCCSRPBlock.cc:6
unsigned long long uint64_t
Definition: Time.h:15
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int unpack(const uint64_t **data, unsigned int *dwToEnd, unsigned int numbFlags=SRP_NUMBFLAGS)
Definition: DCCSRPBlock.cc:19
virtual void updateEventPointers()
void display(std::ostream &o)
Definition: DCCSRPBlock.cc:101
EcalElectronicsMapper * mapper_
void setSRPSyncNumbers(short l1, short bx)
Definition: DCCEventBlock.h:58
unsigned int nSRFlags_
Definition: DCCSRPBlock.h:54
unsigned int l1A()
Definition: DCCEventBlock.h:54