Belle II Software  release-08-01-10
LUT.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 //-----------------------------------------------------------------------------
9 // $Id$
10 //-----------------------------------------------------------------------------
11 // Filename : LUT.h
12 // Section : TRG CDC
13 // Owner : KyungTae KIM (K.U.)
14 // Email : ktkim@hep.korea.ac.kr
15 //-----------------------------------------------------------------------------
16 // Description : A class to use LUTs for TRGCDC
17 //-----------------------------------------------------------------------------
18 // $Log$
19 //-----------------------------------------------------------------------------
20 
21 #ifndef TRGCDCLUT_FLAG_
22 #define TRGCDCLUT_FLAG_
23 
24 #include <string>
25 #include <vector>
26 #include <map>
27 
28 #ifdef TRGCDC_SHORT_NAMES
29 #define TCLUT TRGCDCLUT
30 #endif
31 
32 namespace Belle2 {
39  class TRGCDCLUT {
40 
41  public:
42 
44  TRGCDCLUT();
45 
47  virtual ~TRGCDCLUT();
48 
49  public:
50 
52  std::string name(void) const;
53 
55  std::string version(void) const;
56 
58  void setDataFile(const std::string& filename, int);
59 
61  int getValue(unsigned) const;
62 
64  static std::map<std::string, TRGCDCLUT> dictionary;
65 
67  static TRGCDCLUT* getLUT(const std::string& filename, int);
68 
69  private:
70 
72  std::vector<int> m_data;
73 
75  int m_bitsize;
76 
78  std::string m_name;
79 
80  };
81 
82 //-----------------------------------------------------------------------------
83 
84  inline
85  std::string
86  TRGCDCLUT::name(void)const
87  {
88  return m_name;
89  }
90 
92 } // namespace Belle2
93 
94 #endif /* TRGCDCLUT_FLAG_ */
A class to use LUTs for TRGCDC.
Definition: LUT.h:39
std::vector< int > m_data
LUT data.
Definition: LUT.h:72
int m_bitsize
Input bit size.
Definition: LUT.h:75
std::string m_name
LUT name.
Definition: LUT.h:78
void setDataFile(const std::string &filename, int)
set LUT data.
Definition: LUT.cc:57
virtual ~TRGCDCLUT()
Destructor.
Definition: LUT.cc:43
std::string version(void) const
returns version.
Definition: LUT.cc:33
int getValue(unsigned) const
get LUT Values
Definition: LUT.cc:47
TRGCDCLUT()
Contructor.
Definition: LUT.cc:38
static TRGCDCLUT * getLUT(const std::string &filename, int)
get LUT from dictionary, load new LUT if it doesn't exist
Definition: LUT.cc:83
std::string name(void) const
returns name.
Definition: LUT.h:86
static std::map< std::string, TRGCDCLUT > dictionary
list of LUTs, to avoid reading LUT data 2336 times
Definition: LUT.h:64
Abstract base class for different kinds of events.