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>
14  class FTLDataFrameT {
15  public:
16 
20  typedef D key_type;
21 
26  FTLDataFrameT(const D& id) : id_(id), maxSampleSize_(15) { data_.resize(maxSampleSize_); }
28 
32  const D& id() const { return id_; }
33 
37  const int row() const { return DECODE::row(id_,data_); }
38 
42  const int column() const { return DECODE::col(id_,data_); }
43 
47  int size() const { return data_.size() & 0xf; }
48 
52  void resize(size_t s) { data_.resize(s); }
53 
57  const S& operator[](int i) const { return data_[i]; }
58  const S& sample(int i) const { return data_[i]; }
59  void setSample(int i, const S &sample) { if(i<(int)data_.size()) data_[i]=sample; }
60  void print(std::ostream &out=std::cout)
61  {
62  for(size_t i=0; i<data_.size(); i++)
63  {
64  out << "[" << i << "] ";
65  data_[i].print(out);
66  }
67  }
68 
69 
70 private:
71 
72  //collection of samples
73  std::vector<S> data_;
74 
75  // det id for this data frame
76  D id_;
77 
78  //number of samples and maximum available
80 
81 };
82 
83 #endif
size_t maxSampleSize_
Definition: FTLDataFrameT.h:79
const int row() const
row
Definition: FTLDataFrameT.h:37
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:47
std::vector< S > data_
Definition: FTLDataFrameT.h:73
FTLDataFrameT()
CTOR.
Definition: FTLDataFrameT.h:25
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:52
const S & sample(int i) const
Definition: FTLDataFrameT.h:58
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:59
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
FTLDataFrameT(const FTLDataFrameT &o)
Definition: FTLDataFrameT.h:27
const S & operator[](int i) const
assess/set specific samples
Definition: FTLDataFrameT.h:57
col
Definition: cuy.py:1010
Readout digi for HGC.
Definition: FTLDataFrameT.h:14
const int column() const
column
Definition: FTLDataFrameT.h:42
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:60
FTLDataFrameT(const D &id)
Definition: FTLDataFrameT.h:26
const D & id() const
det id
Definition: FTLDataFrameT.h:32
D key_type
key to sort the collection
Definition: FTLDataFrameT.h:20