Falaise  4.0.1
SuperNEMO Software Toolkit
event_generator.h
Go to the documentation of this file.
1 /// \file falaise/TrackerPreClustering/event_generator.h
2 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-03-30
4  * Last modified: 2014-02-07
5  *
6  * Copyright 2012-2014 F. Mauger
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * Randomization of fake GG hits.
26  *
27  */
28 
29 #ifndef FALAISE_TRACKERPRECLUSTERING_EVENT_GENERATOR_H
30 #define FALAISE_TRACKERPRECLUSTERING_EVENT_GENERATOR_H 1
31 
32 // Standard library:
33 #include <iostream>
34 #include <map>
35 #include <vector>
36 
37 // Third party:
38 // - Boost:
39 
40 // This is for current crappy Boost 1.55 (and can\'t forward declare their f'ing
41 // typedef. Needs review for later versions
42 #ifdef __clang__
43 #pragma clang diagnostic push
44 #pragma clang diagnostic ignored "-Wshadow"
45 #pragma clang diagnostic ignored "-Wunused-local-typedef"
46 #endif
47 #include <boost/random/mersenne_twister.hpp>
48 #ifdef __clang__
49 #pragma clang diagnostic pop
50 #endif
51 
52 #include <boost/scoped_ptr.hpp>
53 #include <boost/shared_ptr.hpp>
54 
55 // This project:
57 
58 namespace TrackerPreClustering {
59 /// \brief Generator of mock events (collections of Geiger hits)
61  public:
62  /// Set seed
63  void set_seed(long);
64 
65  /// Set the cell size
66  void set_cell_size(double cell_size_);
67 
68  /// Set the number of layers
69  void set_nb_layers(unsigned int nb_layers_);
70 
71  /// Set the number of rows
72  void set_nb_rows(unsigned int nb_rows_);
73 
74  /// Default constructor
76 
77  /// Constructor
78  event_generator(long seed_);
79 
80  /// Check initialization status
81  bool is_initialized();
82 
83  /// Initialization
84  void initialize();
85 
86  /// Reset
87  void reset();
88 
89  /// Generate the mock prompt Geiger hits
90  void generate_prompt_gg_hits(std::vector<const gg_hit *> &hits_);
91 
92  /// Generate the mock delayed Geiger hits
93  void generate_delayed_gg_hits(std::vector<const gg_hit *> &hits_);
94 
95  /// Generate an event with many Geiger hits
96  void shoot_event(std::vector<const gg_hit *> &hits_);
97 
98  /// Build a unique geometry Id (GID) from cell Ids
99  int build_gid(int side_, int layer_, int row_) const;
100 
101  /// Register a given geometry Id (GID) as prompt or delayed
102  void register_gid(int gid_, bool delayed_ = false);
103 
104  /// Check if some geometry Id (GID) is registered
105  bool has_gid(int gid_) const;
106 
107  private:
108  unsigned int _nb_layers_; /// Number of cell layers
109  unsigned int _nb_rows_; /// Number of cell rows
110  double _cell_size_; /// Cell size (diameter)
111  long _seed_; /// Seed for the embedded PRNG
112  boost::scoped_ptr<boost::random::mt19937> _generator_; /// Embedded PRNG
113  std::vector<boost::shared_ptr<gg_hit> > _hits_gc_; /// Internal collection of Geiger hits
114  std::map<int, bool> _gids_; /// Internal dictionnary of prompt/delayed status
115 };
116 
117 } // end of namespace TrackerPreClustering
118 
119 #endif // FALAISE_TRACKERPRECLUSTERING_EVENT_GENERATOR_H
120 
121 /*
122 ** Local Variables: --
123 ** mode: c++ --
124 ** c-file-style: "gnu" --
125 ** tab-width: 2 --
126 ** End: --
127 */
void set_nb_rows(unsigned int nb_rows_)
Set the number of rows.
Generator of mock events (collections of Geiger hits)
Definition: event_generator.h:60
bool is_initialized()
Check initialization status.
void register_gid(int gid_, bool delayed_=false)
Register a given geometry Id (GID) as prompt or delayed.
void set_nb_layers(unsigned int nb_layers_)
Set the number of layers.
event_generator()
Default constructor.
void set_cell_size(double cell_size_)
Set the cell size.
int build_gid(int side_, int layer_, int row_) const
Build a unique geometry Id (GID) from cell Ids.
void generate_delayed_gg_hits(std::vector< const gg_hit * > &hits_)
Generate the mock delayed Geiger hits.
bool has_gid(int gid_) const
Check if some geometry Id (GID) is registered.
Definition: event_display.h:40
void shoot_event(std::vector< const gg_hit * > &hits_)
Generate an event with many Geiger hits.
void generate_prompt_gg_hits(std::vector< const gg_hit * > &hits_)
Generate the mock prompt Geiger hits.