All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlashMatchManager.h
Go to the documentation of this file.
1 /**
2  * \file FlashMatchManager.h
3  *
4  * \ingroup Base
5  *
6  * \brief Class def header for a class FlashMatchManager
7  *
8  * @author kazuhiro
9  */
10 
11 /** \addtogroup Base
12 
13  @{*/
14 #ifndef OPT0FINDER_FLASHMATCHMANAGER_H
15 #define OPT0FINDER_FLASHMATCHMANAGER_H
16 
17 #include "LoggerFeature.h"
18 #include "FMWKInterface.h"
19 #include "BaseAlgorithm.h"
20 #include "BaseTPCFilter.h"
21 #include "BaseFlashFilter.h"
22 #include "BaseProhibitAlgo.h"
23 #include "BaseFlashMatch.h"
24 #include "BaseFlashHypothesis.h"
25 namespace flashmatch {
26  /**
27  \class FlashMatchManager
28  */
30 
31  public:
32 
33  /// Default constructor
34  FlashMatchManager(const std::string name="FlashMatchManager");
35 
36  /// Default destructor
38 
39  /// Name getter
40  const std::string& Name() const;
41 
42  /// Configuration
43  void Configure(const Config_t& cfg);
44 
45  /// Algorithm getter
47 
48  /// Custom algorithm getter
50 
51 #ifndef __CINT__
52  /// Emplacer of a TPC object (hidden from ROOT5 CINT)
53  void Emplace(flashmatch::QCluster_t&& obj);
54  /// Emplacer of a TPC object (hidden from ROOT5 CINT)
55  void Emplace(flashmatch::Flash_t&& obj);
56 #endif
57  /// Adder of a TPC object
58  void Add(flashmatch::QCluster_t& obj);
59  /// Adder of a TPC object
60  void Add(flashmatch::Flash_t& obj);
61 
62  /**
63  CORE FUNCTION: executes algorithms to find a match of TPC object and flash provided by users. \n
64  The execution takes following steps: \n
65  0) TPC filter algorithm if provided (optional) \n
66  1) Flash filter algorithm if provided (optional) \n
67  3) Flash matching algorithm (required) \n
68  4) Returns match information for created TPC object & flash pair which respects the outcome of 3)
69  */
70  std::vector<flashmatch::FlashMatch_t> Match();
71 
72  /// Clears locally kept TPC object (QClusterArray_t) and flash (FlashArray_t), both provided by a user
73  void Reset()
74  { _tpc_object_v.clear(); _flash_v.clear(); }
75 
76  /// Configuration option: true => allows an assignment of the same flash to multiple TPC objects
77  void CanReuseFlash(bool ok=true)
78  { _allow_reuse_flash = ok; }
79 
80  void PrintConfig();
81 
82  /// Access to an input: TPC objects in the form of QClusterArray_t
83  const QClusterArray_t& QClusterArray() const { return _tpc_object_v; }
84 
85  /// Access to an input: PMT objects in the form of FlashArray_t
86  const FlashArray_t& FlashArray() const { return _flash_v; }
87 
88  /// Access to a full results (if configured to store) for [tpc][flash] indexing
89  const std::vector<std::vector<flashmatch::FlashMatch_t> > FullResultTPCFlash() const
90  { return _res_tpc_flash_v; }
91 
92  /// Access to a full results (if configured to store) for [flash][tpc] indexing
93  const std::vector<std::vector<flashmatch::FlashMatch_t> > FullResultFlashTPC() const
94  { return _res_flash_tpc_v; }
95 
96  /// Sets the op channels to be used for matching
97  void SetChannelMask(std::vector<int>);
98 
99  /// Sets the TPC and Cryo numbers
100  void SetTPCCryo(int tpc, int _cryo);
101 
102  /// Sets the channels sensitive to visible light
103  void SetUncoatedPMTs(std::vector<int> ch_uncoated);
104 
105  #if USING_LARSOFT == 1
106  void SetSemiAnalyticalModel(std::unique_ptr<SemiAnalyticalModel> model);
107  #endif
108 
109  private:
110 
111  void AddCustomAlgo(BaseAlgorithm* alg);
112 
113  BaseFlashFilter* _alg_flash_filter; ///< Flash filter algorithm
114  BaseTPCFilter* _alg_tpc_filter; ///< TPC filter algorithm
115  BaseProhibitAlgo* _alg_match_prohibit; ///< Flash matchinig prohibit algorithm
116  BaseFlashMatch* _alg_flash_match; ///< Flash matching algorithm
117  BaseFlashHypothesis* _alg_flash_hypothesis; ///< Flash hypothesis algorithm
118 
119  /**
120  A set of custom algorithms (not to be executed but to be configured)
121  */
122  std::map<std::string,flashmatch::BaseAlgorithm*> _custom_alg_m;
123 
124  /// TPC object information collection (provided by a user)
126  /// Flash object information collection (provided by a user)
128  /// Configuration option to allow re-use of a flash (i.e. 1 flash can be assigned to multiple TPC object)
130  /// Configuration readiness flag
132  /// Configuration file
133  std::string _config_file;
134  /// Name
135  std::string _name;
136  /// Request boolean to store full matching result (per Match function call)
138  /// Full result container indexed by [tpc][flash]
139  std::vector<std::vector<flashmatch::FlashMatch_t> > _res_tpc_flash_v;
140  /// Full result container indexed by [flash][tpc]
141  std::vector<std::vector<flashmatch::FlashMatch_t> > _res_flash_tpc_v;
142  /// TPC number where to perform the matching
143  int _tpc = 0;
144  /// Cryo number where to perform the matching
145  int _cryo = 0;
146  };
147 }
148 
149 #endif
150 /** @} */ // end of doxygen group
151 
~FlashMatchManager()
Default destructor.
const std::vector< std::vector< flashmatch::FlashMatch_t > > FullResultTPCFlash() const
Access to a full results (if configured to store) for [tpc][flash] indexing.
Algorithm_t
Enumerator for different types of algorithm.
BaseTPCFilter * _alg_tpc_filter
TPC filter algorithm.
std::vector< flashmatch::QCluster_t > QClusterArray_t
Collection of 3D point clusters (one use case is TPC object representation for track(s) and shower(s)...
std::vector< flashmatch::FlashMatch_t > Match()
std::vector< std::vector< flashmatch::FlashMatch_t > > _res_flash_tpc_v
Full result container indexed by [flash][tpc].
flashmatch::BaseAlgorithm * GetCustomAlgo(std::string name)
Custom algorithm getter.
void SetSemiAnalyticalModel(std::unique_ptr< SemiAnalyticalModel > model)
BaseFlashHypothesis * _alg_flash_hypothesis
Flash hypothesis algorithm.
Class definition file of LoggerFeature.
const std::string & Name() const
Name getter.
Class def header for a class BaseAlgorithm.
std::map< std::string, flashmatch::BaseAlgorithm * > _custom_alg_m
void SetTPCCryo(int tpc, int _cryo)
Sets the TPC and Cryo numbers.
fhicl::ParameterSet Config_t
Configuration object.
Definition: FMWKInterface.h:31
void Add(flashmatch::QCluster_t &obj)
Adder of a TPC object.
Struct to represent an optical flash.
void SetChannelMask(std::vector< int >)
Sets the op channels to be used for matching.
BaseFlashFilter * _alg_flash_filter
Flash filter algorithm.
Class def header for a class BaseProhibitAlgo.
const QClusterArray_t & QClusterArray() const
Access to an input: TPC objects in the form of QClusterArray_t.
BaseProhibitAlgo * _alg_match_prohibit
Flash matchinig prohibit algorithm.
void SetUncoatedPMTs(std::vector< int > ch_uncoated)
Sets the channels sensitive to visible light.
flashmatch::BaseAlgorithm * GetAlgo(flashmatch::Algorithm_t type)
Algorithm getter.
std::string _config_file
Configuration file.
Class def header for a class BaseTPCFilter.
Class def header for a class BaseFlashFilter.
Collection of charge deposition 3D point (cluster)
void Reset()
Clears locally kept TPC object (QClusterArray_t) and flash (FlashArray_t), both provided by a user...
const std::vector< std::vector< flashmatch::FlashMatch_t > > FullResultFlashTPC() const
Access to a full results (if configured to store) for [flash][tpc] indexing.
bool _configured
Configuration readiness flag.
bool _store_full
Request boolean to store full matching result (per Match function call)
std::vector< std::vector< flashmatch::FlashMatch_t > > _res_tpc_flash_v
Full result container indexed by [tpc][flash].
bool _allow_reuse_flash
Configuration option to allow re-use of a flash (i.e. 1 flash can be assigned to multiple TPC object)...
int _tpc
TPC number where to perform the matching.
const FlashArray_t & FlashArray() const
Access to an input: PMT objects in the form of FlashArray_t.
QClusterArray_t _tpc_object_v
TPC object information collection (provided by a user)
FlashArray_t _flash_v
Flash object information collection (provided by a user)
int _cryo
Cryo number where to perform the matching.
void Configure(const Config_t &cfg)
Configuration.
std::vector< flashmatch::Flash_t > FlashArray_t
Collection of Flash objects.
void CanReuseFlash(bool ok=true)
Configuration option: true =&gt; allows an assignment of the same flash to multiple TPC objects...
Class def header for a class BaseFlashMatch.
FlashMatchManager(const std::string name="FlashMatchManager")
Default constructor.
const std::string & name() const
Name getter, defined in a logger instance attribute.
Definition: LoggerFeature.h:51
void Emplace(flashmatch::QCluster_t &&obj)
Emplacer of a TPC object (hidden from ROOT5 CINT)
BaseFlashMatch * _alg_flash_match
Flash matching algorithm.
void AddCustomAlgo(BaseAlgorithm *alg)