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 public:
25  virtual ~L1GctProcessor(){};
26 
28  inline void reset() {
29  m_bxStart = 0;
30  m_numOfBx = 1;
31  m_bx = 0;
34  setupObjects();
35  }
36 
38  virtual void fetchInput() = 0;
39 
41  virtual void process() = 0;
42 
44  inline void setBxRange(const int firstBx, const int numberOfBx) {
45  m_bxStart = firstBx;
46  m_numOfBx = numberOfBx;
48  }
49 
51  inline void setNextBx(const int bxnum) {
52  if ((bxnum - m_bxStart >= 0) && (bxnum - m_bxStart < m_numOfBx)) {
53  m_bx = bxnum;
54  } else {
55  m_bx = 0;
56  }
58  setupObjects();
59  }
60 
62  bool setupOk() const { return true; }
63 
65  void setVerbose() { m_verbose = true; }
66  void setTerse() { m_verbose = false; }
67 
68 protected:
70  virtual void resetProcessor() = 0;
71  virtual void resetPipelines() = 0;
72 
74  virtual void setupObjects() = 0;
75 
77  inline int bxMin() const { return m_bxStart; }
78  inline int bxMax() const { return (m_bxStart + m_numOfBx - 1); }
79  inline int numOfBx() const { return m_numOfBx; }
80  inline int bxAbs() const { return m_bx; }
81  inline int bxRel() const { return (m_bx - m_bxStart); }
82 
83  template <class T>
84  struct Pipeline {
85  std::vector<T> contents;
86  unsigned entriesPerBx;
87 
89  Pipeline(const unsigned size) : contents(size), entriesPerBx(size) {}
90 
91  void resize(const unsigned size) { entriesPerBx = size; }
92 
93  void reset(const unsigned nBx) {
94  contents.clear();
95  contents.resize(nBx * entriesPerBx);
96  }
97 
98  void store(const T& thisBx, const int bxNum) { contents.at(bxNum) = thisBx; }
99 
100  void store(const std::vector<T>& thisBx, const int bxNum) {
101  unsigned pos = entriesPerBx * bxNum;
102  for (unsigned i = 0; i < entriesPerBx; i++) {
103  contents.at(pos++) = thisBx.at(i);
104  }
105  }
106  };
107 
109  bool m_verbose;
110 
111 private:
113  int m_bx;
117 };
118 
119 #endif
L1GctProcessor::L1GctProcessor
L1GctProcessor()
Definition: L1GctProcessor.h:24
mps_fire.i
i
Definition: mps_fire.py:355
funct::false
false
Definition: Factorize.h:34
L1GctProcessor::setNextBx
void setNextBx(const int bxnum)
clear input data buffers and process a new bunch crossing
Definition: L1GctProcessor.h:51
L1GctProcessor::resetPipelines
virtual void resetPipelines()=0
pos
Definition: PixelAliasList.h:18
L1GctProcessor::numOfBx
int numOfBx() const
Definition: L1GctProcessor.h:79
L1GctProcessor::setVerbose
void setVerbose()
control output messages
Definition: L1GctProcessor.h:65
L1GctProcessor::bxRel
int bxRel() const
Definition: L1GctProcessor.h:81
L1GctProcessor::setBxRange
void setBxRange(const int firstBx, const int numberOfBx)
define the bunch crossing range to process
Definition: L1GctProcessor.h:44
L1GctProcessor::setupOk
bool setupOk() const
Method to check the setup for this processor. Returns true by default.
Definition: L1GctProcessor.h:62
L1GctProcessor::Pipeline::resize
void resize(const unsigned size)
Definition: L1GctProcessor.h:91
L1GctProcessor::bxAbs
int bxAbs() const
Definition: L1GctProcessor.h:80
L1GctProcessor::Pipeline::entriesPerBx
unsigned entriesPerBx
Definition: L1GctProcessor.h:86
L1GctProcessor::Pipeline::contents
std::vector< T > contents
Definition: L1GctProcessor.h:85
L1GctProcessor::Pipeline::store
void store(const std::vector< T > &thisBx, const int bxNum)
Definition: L1GctProcessor.h:100
L1GctProcessor::bxMax
int bxMax() const
Definition: L1GctProcessor.h:78
L1GctProcessor::reset
void reset()
complete reset of processor
Definition: L1GctProcessor.h:28
L1GctProcessor::Pipeline::store
void store(const T &thisBx, const int bxNum)
Definition: L1GctProcessor.h:98
L1GctProcessor::setTerse
void setTerse()
Definition: L1GctProcessor.h:66
L1GctProcessor::m_verbose
bool m_verbose
Flag to control output messages.
Definition: L1GctProcessor.h:109
L1GctProcessor::bxMin
int bxMin() const
Support for multiple beam crossing operation.
Definition: L1GctProcessor.h:77
L1GctProcessor::Pipeline::Pipeline
Pipeline()
Definition: L1GctProcessor.h:88
L1GctProcessor::m_bx
int m_bx
Support for multiple beam crossing operation.
Definition: L1GctProcessor.h:113
T
long double T
Definition: Basic3DVectorLD.h:48
L1GctProcessor::m_numOfBx
int m_numOfBx
Definition: L1GctProcessor.h:116
L1GctProcessor::Pipeline::Pipeline
Pipeline(const unsigned size)
Definition: L1GctProcessor.h:89
L1GctProcessor::process
virtual void process()=0
process the data and set outputs
L1GctProcessor::setupObjects
virtual void setupObjects()=0
Initialise inputs with null objects for the correct bunch crossing if required.
L1GctProcessor::fetchInput
virtual void fetchInput()=0
set the input buffers
L1GctProcessor::~L1GctProcessor
virtual ~L1GctProcessor()
Definition: L1GctProcessor.h:25
L1GctProcessor
ABC for a GCT trigger data processing unit.
Definition: L1GctProcessor.h:22
L1GctProcessor::Pipeline
Definition: L1GctProcessor.h:84
L1GctProcessor::Pipeline::reset
void reset(const unsigned nBx)
Definition: L1GctProcessor.h:93
L1GctProcessor::resetProcessor
virtual void resetProcessor()=0
Separate reset methods for the processor itself and any data stored in pipelines.
L1GctProcessor::m_bxStart
int m_bxStart
Definition: L1GctProcessor.h:115
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443