CMS 3D CMS Logo

L1GctProcessor.h
Go to the documentation of this file.
1 
2 #ifndef L1GCTPROCESSOR_H_
3 #define L1GCTPROCESSOR_H_
4 
20 #include <vector>
21 
23 
24  public:
25 
27  virtual ~L1GctProcessor() {};
28 
30  inline void reset() {
31  m_bxStart = 0;
32  m_numOfBx = 1;
33  m_bx = 0;
36  setupObjects();
37  }
38 
40  virtual void fetchInput() = 0;
41 
43  virtual void process() = 0;
44 
46  inline void setBxRange(const int firstBx, const int numberOfBx) {
47  m_bxStart = firstBx;
48  m_numOfBx = numberOfBx;
50  }
51 
53  inline void setNextBx(const int bxnum) {
54  if ( (bxnum-m_bxStart >= 0) && (bxnum-m_bxStart < m_numOfBx) ) {
55  m_bx = bxnum;
56  } else {
57  m_bx = 0;
58  }
60  setupObjects();
61  }
62 
64  bool setupOk() const { return true; }
65 
67  void setVerbose() { m_verbose = true; }
68  void setTerse() { m_verbose = false; }
69 
70  protected:
71 
73  virtual void resetProcessor() = 0;
74  virtual void resetPipelines() = 0;
75 
77  virtual void setupObjects() = 0;
78 
80  inline int bxMin() const { return m_bxStart; }
81  inline int bxMax() const { return (m_bxStart + m_numOfBx - 1); }
82  inline int numOfBx() const { return m_numOfBx; }
83  inline int bxAbs() const { return m_bx; }
84  inline int bxRel() const { return (m_bx - m_bxStart); }
85 
86  template <class T>
87  struct Pipeline {
88 
89  std::vector<T> contents;
90  unsigned entriesPerBx;
91 
92  Pipeline() : contents(1), entriesPerBx(1) {}
93  Pipeline(const unsigned size) : contents(size), entriesPerBx(size) {}
94 
95  void resize(const unsigned size) {
96  entriesPerBx = size;
97  }
98 
99  void reset(const unsigned nBx) {
100  contents.clear();
101  contents.resize(nBx*entriesPerBx);
102  }
103 
104  void store(const T& thisBx, const int bxNum) {
105  contents.at(bxNum) = thisBx;
106  }
107 
108  void store(const std::vector<T>& thisBx, const int bxNum) {
109  unsigned pos = entriesPerBx*bxNum;
110  for (unsigned i=0; i<entriesPerBx; i++) {
111  contents.at(pos++) = thisBx.at(i);
112  }
113  }
114  };
115 
117  bool m_verbose;
118 
119  private:
121  int m_bx;
125 };
126 
127 #endif
size
Write out results.
void reset()
complete reset of processor
virtual ~L1GctProcessor()
int i
Definition: DBlmapReader.cc:9
bool setupOk() const
Method to check the setup for this processor. Returns true by default.
Pipeline(const unsigned size)
void store(const T &thisBx, const int bxNum)
bool m_verbose
Flag to control output messages.
int bxRel() const
int bxMin() const
Support for multiple beam crossing operation.
void store(const std::vector< T > &thisBx, const int bxNum)
int numOfBx() const
ABC for a GCT trigger data processing unit.
void setVerbose()
control output messages
void resize(const unsigned size)
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
virtual void process()=0
process the data and set outputs
int bxMax() const
void reset(const unsigned nBx)
virtual void resetPipelines()=0
int bxAbs() const
virtual void resetProcessor()=0
Separate reset methods for the processor itself and any data stored in pipelines. ...
void setNextBx(const int bxnum)
clear input data buffers and process a new bunch crossing
std::vector< T > contents
long double T
virtual void setupObjects()=0
Initialise inputs with null objects for the correct bunch crossing if required.
int m_bx
Support for multiple beam crossing operation.
virtual void fetchInput()=0
set the input buffers