CMS 3D CMS Logo

FTLDataFrameT.h
Go to the documentation of this file.
1 #ifndef DIGIFTL_FTLDATAFRAMET_H
2 #define DIGIFTL_FTLDATAFRAMET_H
3 
4 #include <vector>
5 #include <ostream>
6 #include <iostream>
7 
13 template <class D, class S, class DECODE>
15 public:
19  typedef D key_type;
20 
25  FTLDataFrameT(const D& id) : id_(id), maxSampleSize_(15) { data_.resize(maxSampleSize_); }
26 
30  const D& id() const { return id_; }
31 
35  const int row() const { return DECODE::row(id_, data_); }
36 
40  const int column() const { return DECODE::col(id_, data_); }
41 
45  int size() const { return data_.size() & 0xf; }
46 
50  void resize(size_t s) { data_.resize(s); }
51 
55  const S& operator[](int i) const { return data_[i]; }
56  const S& sample(int i) const { return data_[i]; }
57  void setSample(int i, const S& sample) {
58  if (i < (int)data_.size())
59  data_[i] = sample;
60  }
61  void print(std::ostream& out = std::cout) {
62  for (size_t i = 0; i < data_.size(); i++) {
63  out << "[" << i << "] ";
64  data_[i].print(out);
65  }
66  }
67 
68 private:
69  //collection of samples
70  std::vector<S> data_;
71 
72  // det id for this data frame
73  D id_;
74 
75  //number of samples and maximum available
77 };
78 
79 #endif
size_t maxSampleSize_
Definition: FTLDataFrameT.h:76
std::vector< S > data_
Definition: FTLDataFrameT.h:70
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:45
FTLDataFrameT()
CTOR.
Definition: FTLDataFrameT.h:24
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:50
const D & id() const
det id
Definition: FTLDataFrameT.h:30
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:57
const S & sample(int i) const
Definition: FTLDataFrameT.h:56
const S & operator[](int i) const
assess/set specific samples
Definition: FTLDataFrameT.h:55
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
const int column() const
column
Definition: FTLDataFrameT.h:40
col
Definition: cuy.py:1009
Readout digi for HGC.
Definition: FTLDataFrameT.h:14
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:61
FTLDataFrameT(const D &id)
Definition: FTLDataFrameT.h:25
const int row() const
row
Definition: FTLDataFrameT.h:35
D key_type
key to sort the collection
Definition: FTLDataFrameT.h:19