CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FUResource.h
Go to the documentation of this file.
1 //
3 // FUResource
4 // ----------
5 //
6 // 12/10/2006 Philipp Schieferdecker <philipp.schieferdecker@cern.ch>
7 // 20/01/2012 Andrei Spataru <aspataru@cern.ch>
9 
10 #ifndef FURESOURCE_H
11 #define FURESOURCE_H 1
12 
16 
17 #include "log4cplus/logger.h"
18 
19 #include <vector>
20 
21 #define FED_HCTRLID 0x50000000
22 #define FED_TCTRLID 0xa0000000
23 #define REAL_SOID_MASK 0x0003FF00
24 #define FED_RBIT_MASK 0x0000C004
25 
26 //#define DEBUG_FURESOURCE_H
27 
28 namespace xdaq {
29 class Application;
30 }
31 
32 namespace evf {
33 
34 class EvffedFillerRB;
35 
43 class FUResource {
44 public:
45  //
46  // construction/destruction
47  //
48  FUResource(UInt_t fuResourceId, log4cplus::Logger, EvffedFillerRB *,
49  xdaq::Application *);
50  virtual ~FUResource();
51 
52  //
53  // member functions
54  //
55 
64  void process(MemRef_t* bufRef);
65 
69  void release(bool detachResource);
70 
74  void appendBlockToSuperFrag(MemRef_t* bufRef);
75 
80 
84  void superFragSize() throw (evf::Exception);
85 
89  void fillSuperFragPayload() throw (evf::Exception);
90 
94  void releaseSuperFrag();
95 
96  static
99  }
100  static
103  }
104  void doCrcCheck(bool doCrcCheck) {
106  }
108  return doCrcCheck_;
109  }
110  bool fatalError() const {
111  return fatalError_;
112  }
113  bool isAllocated() const {
114  return 0 != shmCell_;
115  }
116  bool isComplete() const;
117 
119  return fuResourceId_;
120  }
122  return buResourceId_;
123  }
124  UInt_t evtNumber() const {
125  return evtNumber_;
126  }
127  UInt_t nbSent() const {
128  return nbSent_;
129  }
130 
134  void incNbSent() {
135  nbSent_++;
136  }
137 
138  UInt_t nbErrors(bool reset = true);
139  UInt_t nbCrcErrors(bool reset = true);
140  UInt_t nbBytes(bool reset = true);
141 
146  return shmCell_;
147  }
150  }
151 
152 private:
153  //
154  // member data
155  //
156  log4cplus::Logger log_;
157 
158  static
160  static
164 
168 
171 
175 
180 
182 
186 
190 
193 
194  xdaq::Application *app_;
195 
197 
198  static unsigned int gtpDaqId_;
199  static unsigned int gtpEvmId_;
200  static unsigned int gtpeId_;
201 
202  friend class ResourceChecker;
203 
204 };
205 
206 //
207 // typedefs
208 //
209 typedef std::vector<FUResource*> FUResourceVec_t;
210 
211 } // namespace evf
212 
213 //
214 // implementation of inline functions
215 //
216 
220 inline
222 
223 #ifdef DEBUG_FURESOURCE_H
224  cout << "------------------------------------------------------"<< endl;
225  cout << "nBlock " << nBlock_
226  << " iBlock " << iBlock_
227  << " nSuperFrag " << nSuperFrag_
228  << " iSuperFrag " << iSuperFrag_
229  << endl;
230 #endif
231  return (nBlock_ && nSuperFrag_ && (iSuperFrag_ == nSuperFrag_) && (iBlock_
232  == nBlock_));
233 }
234 
235 #endif
UInt_t nbErrors_
Definition: FUResource.h:183
FUResource(UInt_t fuResourceId, log4cplus::Logger, EvffedFillerRB *, xdaq::Application *)
Definition: FUResource.cc:45
static bool doFedIdCheck_
Definition: FUResource.h:159
void process(MemRef_t *bufRef)
Definition: FUResource.cc:126
UInt_t fuResourceId_
Definition: FUResource.h:165
void releaseSuperFrag()
Definition: FUResource.cc:298
EvffedFillerRB * frb_
Definition: FUResource.h:192
bool fatalError() const
Definition: FUResource.h:110
virtual ~FUResource()
Definition: FUResource.cc:54
void appendBlockToSuperFrag(MemRef_t *bufRef)
Definition: FUResource.cc:184
UInt_t nbErrors(bool reset=true)
Definition: FUResource.cc:308
UInt_t nbBytes(bool reset=true)
Definition: FUResource.cc:324
static bool useEvmBoard_
Definition: FUResource.h:161
toolbox::mem::Reference MemRef_t
Definition: FUTypes.h:10
void fillSuperFragPayload()
Definition: FUResource.cc:248
void release(bool detachResource)
Definition: FUResource.cc:82
MemRef_t * superFragHead_
Definition: FUResource.h:169
static void useEvmBoard(bool useEvmBoard)
Definition: FUResource.h:101
bool crcBeingChecked()
Definition: FUResource.h:107
log4cplus::Logger log_
Definition: FUResource.h:156
evf::FUShmRawCell * shmCell_
Definition: FUResource.h:191
UInt_t fuResourceId() const
Definition: FUResource.h:118
static unsigned int gtpDaqId_
Definition: FUResource.h:198
MemRef_t * superFragTail_
Definition: FUResource.h:170
void removeLastAppendedBlockFromSuperFrag()
Definition: FUResource.cc:196
UInt_t evtNumber_
Definition: FUResource.h:167
void superFragSize()
Definition: FUResource.cc:216
std::vector< FUResource * > FUResourceVec_t
Definition: FUResource.h:209
UInt_t fedSize_[1024]
Definition: FUResource.h:187
UInt_t buResourceId() const
Definition: FUResource.h:121
bool isComplete() const
Definition: FUResource.h:221
UInt_t iSuperFrag_
Definition: FUResource.h:178
UInt_t eventPayloadSize_
Definition: FUResource.h:172
unsigned int UInt_t
Definition: FUTypes.h:12
evf::FUShmRawCell * shmCell()
Definition: FUResource.h:145
UInt_t evtNumber() const
Definition: FUResource.h:124
bool isAllocated() const
Definition: FUResource.h:113
UInt_t nbCrcErrors_
Definition: FUResource.h:184
UInt_t nbSent() const
Definition: FUResource.h:127
static unsigned int gtpeId_
Definition: FUResource.h:200
UInt_t superFragSize_
Definition: FUResource.h:188
UInt_t buResourceId_
Definition: FUResource.h:166
void doCrcCheck(bool doCrcCheck)
Definition: FUResource.h:104
xdaq::Application * app_
Definition: FUResource.h:194
static unsigned int gtpEvmId_
Definition: FUResource.h:199
UInt_t nSuperFrag_
Definition: FUResource.h:179
UInt_t eventSize_
Definition: FUResource.h:189
static void doFedIdCheck(bool doFedIdCheck)
Definition: FUResource.h:97
UInt_t nbCrcErrors(bool reset=true)
Definition: FUResource.cc:316
tuple cout
Definition: gather_cfg.py:121
UInt_t nSuperFragMax_
Definition: FUResource.h:174
void scheduleCRCError()
Definition: FUResource.h:148
bool nextEventWillHaveCRCError_
Definition: FUResource.h:196
void reset(double vett[256])
Definition: TPedValues.cc:11
void allocate(FUShmRawCell *shmCell)
Definition: FUResource.cc:63
void incNbSent()
Definition: FUResource.h:134