Belle II Software  release-08-01-10
TRGGRL.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 #ifndef TRGGRL_FLAG_
10 #define TRGGRL_FLAG_
11 
12 #define TRGGRL_UNDEFINED 999999
13 
14 #include <vector>
15 #include "trg/trg/Clock.h"
16 #include "trg/grl/TRGGRLMatch.h"
17 #include <TFile.h>
18 #include <TTree.h>
19 
20 
21 namespace HepGeom {
22  template <class T> class Point3D;
23 }
24 
25 namespace Belle2 {
31  class TRGTime;
32  class TRGClock;
33  class TRGLink;
34  class TRGGRL;
35 
36 // The instance of TRGGRL is a singleton. 'TRGGRL::getTRGGRL()'
37 // gives you a pointer to access the TRGGRL. Geometrical information
38 // is initialized automatically. Before accessing hit information,
39 // user has to call 'update()' to initialize hit information event
40 // by event.
41 
43  class TRGGRL {
44 
45  public:
46 
48  static TRGGRL* getTRGGRL(const std::string& configFile,
49  unsigned simulationMode = 0,
50  unsigned fastSimulationMode = 0,
51  unsigned firmwareSimulationMode = 0);
52 
55  static TRGGRL* getTRGGRL(void);
56 
57  private:
58 
60  TRGGRL(const std::string& configFile,
61  unsigned simulationMode,
62  unsigned fastSimulationMode,
63  unsigned firmwareSimulationMode);
64 
66  virtual ~TRGGRL();
67 
69  void initialize(void);
70 
72  void configure(void);
73 
75  void simulate(void);
76 
78  void terminate(void);
79 
81  //bool barrel_matching_2D(TRGCDCTrack *, TRGECLCluster *);
82 
83  public:// Selectors
84 
86  std::string name(void) const;
87 
89  std::string version(void) const;
90 
92  std::string configFile(void) const;
93 
95  unsigned mode(void) const;
96 
98  unsigned mode(unsigned);
99 
101  unsigned firmwareSimulationMode(void) const;
102 
104  void dump(const std::string& message) const;
105 
107  int debugLevel(void) const;
108 
110  int debugLevel(int) const;
111 
112  public:// Event by event information.
113 
115  void clear(void);
116 
118  void fastClear(void);
119 
121  void update(bool mcAnalysis = true);
122 
123  public:// Utility functions
124 
125  public:// TRG information
126 
128  const TRGClock& systemClock(void) const;
129 
130  private:
131 
133  void fastSimulation(void);
134 
136  void firmwareSimulation(void);
137 
138  private:
139 
141  static TRGGRL* _grl;
142 
144  mutable int _debugLevel;
145 
147  std::string _configFilename;
148 
150  unsigned _simulationMode;
151 
154 
157 
159  const TRGClock& _clock;
160 
162  TFile* m_file;
163 
165  TTree* h1;
166 
168  double x0;
170  double x1;
172  double x2;
174  double x3;
176  double x4;
178  double x5;
180  double x6;
182  double x7;
184  double x8;
186  double x9;
188  std::vector<TRGGRLMatch* > matchList;
190  std::vector<TRGGRLMatch* > matchList3D;
191 
192  friend class TRGGRLModule;
193  };
194 
195 //-----------------------------------------------------------------------------
196 
197  inline
198  int
199  TRGGRL::debugLevel(void) const
200  {
201  return _debugLevel;
202  }
203 
204  inline
205  int
206  TRGGRL::debugLevel(int a) const
207  {
208  return _debugLevel = a;
209  }
210 
211  inline
212  const TRGClock&
214  {
215  return _clock;
216  }
217 
218  inline
219  unsigned
221  {
223  }
224 
225  inline
226  std::string
227  TRGGRL::configFile(void) const
228  {
229  return _configFilename;
230  }
231 
233 } // namespace Belle2
234 
235 #endif /* TRGGRL_FLAG_ */
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
A module to simulate the Global Decision Logic.
Definition: TRGGRLModule.h:29
a class for TRGGRL
Definition: TRGGRL.h:43
unsigned _simulationMode
Simulation mode.
Definition: TRGGRL.h:150
std::string _configFilename
root file name.
Definition: TRGGRL.h:147
unsigned _fastSimulationMode
Fast simulation mode.
Definition: TRGGRL.h:153
double x9
Temporary variables to make tree in root files.
Definition: TRGGRL.h:186
int _debugLevel
Debug level.
Definition: TRGGRL.h:144
std::vector< TRGGRLMatch * > matchList
Vector which stores list of TRGGRLMatch without 3D information.
Definition: TRGGRL.h:188
double x5
Temporary variables to make tree in root files.
Definition: TRGGRL.h:178
unsigned _firmwareSimulationMode
Firmware simulation mode.
Definition: TRGGRL.h:156
const TRGClock & _clock
GRL trigger system clock.
Definition: TRGGRL.h:159
unsigned mode(void) const
returns simulation mode.
unsigned mode(unsigned)
sets and returns simulation mode.
std::vector< TRGGRLMatch * > matchList3D
Vector which stores list of TRGGRLMatch with 3D information.
Definition: TRGGRL.h:190
double x8
Temporary variables to make tree in root files.
Definition: TRGGRL.h:184
double x3
Temporary variables to make tree in root files.
Definition: TRGGRL.h:174
TFile * m_file
root file
Definition: TRGGRL.h:162
TTree * h1
root tree
Definition: TRGGRL.h:165
double x7
Temporary variables to make tree in root files.
Definition: TRGGRL.h:182
double x1
Temporary variables to make tree in root files.
Definition: TRGGRL.h:170
double x2
Temporary variables to make tree in root files.
Definition: TRGGRL.h:172
double x6
Temporary variables to make tree in root files.
Definition: TRGGRL.h:180
double x0
Temporary variables to make tree in root files.
Definition: TRGGRL.h:168
double x4
Temporary variables to make tree in root files.
Definition: TRGGRL.h:176
const TRGClock & systemClock(void) const
returns the system clock.
Definition: TRGGRL.h:213
void configure(void)
configures trigger modules for firmware simulation.
Definition: TRGGRL.cc:261
int debugLevel(void) const
returns debug level.
Definition: TRGGRL.h:199
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:32
std::string name(void) const
matching function
Definition: TRGGRL.cc:37
void fastClear(void)
clears TRGGRL information.
Definition: TRGGRL.cc:138
void terminate(void)
terminates when run is finished
Definition: TRGGRL.cc:120
static TRGGRL * getTRGGRL(void)
returns TRGGRL object.
Definition: TRGGRL.cc:73
TRGGRL(const std::string &configFile, unsigned simulationMode, unsigned fastSimulationMode, unsigned firmwareSimulationMode)
Constructor.
Definition: TRGGRL.cc:80
unsigned firmwareSimulationMode(void) const
returns firmware simulation mode.
Definition: TRGGRL.h:220
void initialize(void)
initializes GRL.
Definition: TRGGRL.cc:101
void dump(const std::string &message) const
dumps debug information.
Definition: TRGGRL.cc:125
void update(bool mcAnalysis=true)
updates TRGGRL information.
Definition: TRGGRL.cc:143
void fastSimulation(void)
Fast simulation.
Definition: TRGGRL.cc:251
std::string version(void) const
returns version.
Definition: TRGGRL.cc:43
std::string configFile(void) const
returns configuration file name.
Definition: TRGGRL.h:227
void simulate(void)
fast trigger simulation.
Definition: TRGGRL.cc:162
void clear(void)
clears all TRGGRL information.
Definition: TRGGRL.cc:133
void firmwareSimulation(void)
Firmware simulation.
Definition: TRGGRL.cc:256
static TRGGRL * _grl
GRL singleton.
Definition: TRGGRL.h:141
virtual ~TRGGRL()
Destructor.
Definition: TRGGRL.cc:153
Abstract base class for different kinds of events.