CMS 3D CMS Logo

HGCDataFrame.h
Go to the documentation of this file.
1 #ifndef DIGIHGCAL_HGCDATAFRAME_H
2 #define DIGIHGCAL_HGCDATAFRAME_H
3 
4 #include <vector>
5 #include <ostream>
6 #include <iostream>
7 
13 template <class D, class S>
14 class HGCDataFrame {
15 public:
16 
20  typedef D key_type;
21 
26  HGCDataFrame(const D& id) : id_(id), maxSampleSize_(15) { data_.resize(maxSampleSize_); }
28 
32  const D& id() const { return id_; }
33 
37  int size() const { return data_.size() & 0xf; }
38 
42  void resize(size_t s) { data_.resize(s); }
43 
47  const S& operator[](int i) const { return data_[i]; }
48  const S& sample(int i) const { return data_[i]; }
49  void setSample(int i, const S &sample) { if(i<(int)data_.size()) data_[i]=sample; }
50  void print(std::ostream &out=std::cout)
51  {
52  for(size_t i=0; i<data_.size(); i++)
53  {
54  out << "[" << i << "] ";
55  data_[i].print(out);
56  }
57  }
58 
59 
60 private:
61 
62  //collection of samples
63  std::vector<S> data_;
64 
65  // det id for this data frame
66  D id_;
67 
68  //number of samples and maximum available
70 
71 };
72 
73 #endif
size_t maxSampleSize_
Definition: HGCDataFrame.h:69
void print(std::ostream &out=std::cout)
Definition: HGCDataFrame.h:50
void resize(size_t s)
allow to set size
Definition: HGCDataFrame.h:42
const S & sample(int i) const
Definition: HGCDataFrame.h:48
const S & operator[](int i) const
assess/set specific samples
Definition: HGCDataFrame.h:47
HGCDataFrame(const HGCDataFrame &o)
Definition: HGCDataFrame.h:27
D key_type
key to sort the collection
Definition: HGCDataFrame.h:20
HGCDataFrame(const D &id)
Definition: HGCDataFrame.h:26
std::vector< S > data_
Definition: HGCDataFrame.h:63
const D & id() const
det id
Definition: HGCDataFrame.h:32
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
Readout digi for HGC.
Definition: HGCDataFrame.h:14
void setSample(int i, const S &sample)
Definition: HGCDataFrame.h:49
HGCDataFrame()
CTOR.
Definition: HGCDataFrame.h:25
int size() const
total number of samples in the digi
Definition: HGCDataFrame.h:37