forked from DeepLearnPhysics/Supera
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SuperaBase.h
167 lines (112 loc) · 5.01 KB
/
SuperaBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/**
* \file SuperaBase.h
*
* \ingroup Package_Name
*
* \brief Class def header for a class SuperaBase
*
* @author kazuhiro
*/
/** \addtogroup Package_Name
@{*/
#ifndef __SUPERABASE_H__
#define __SUPERABASE_H__
#include "larcv/core/Processor/ProcessBase.h"
#include "larcv/core/Processor/ProcessFactory.h"
#include "larcv/core/DataFormat/ImageMeta.h"
#include "FMWKInterface.h"
#include "SuperaTypes.h"
//#include "ImageMetaMakerBase.h"
// FIXME(kvtsang) Temporary solution to access associations
#include "art/Framework/Principal/Event.h"
namespace larcv {
/**
\class ProcessBase
User defined class SuperaBase ... these comments are used to generate
doxygen documentation!
*/
class SuperaBase : public ProcessBase {
public:
/// Default constructor
SuperaBase(const std::string name="SuperaBase");
/// Default destructor
~SuperaBase(){}
virtual void configure(const PSet&);
virtual void initialize();
virtual bool process(IOManager& mgr);
virtual void finalize();
virtual bool is(const std::string question) const;
void Request(supera::LArDataType_t, std::string);
template <class T>
void LArData(const T&);
inline void SetCSV(const std::string& fname)
{ _csv_fname = fname; }
// FIXME(kvtsang) Temporary solution to access associations
void SetEvent(const art::Event *ev) { _event = ev; };
void ClearEventData();
//
// Getter
//
const std::string& LArDataLabel(supera::LArDataType_t type) const;
template <class T>
const std::vector<T>& LArData() const;
int TimeOffset() const { return _time_offset; }
const std::string& CSV() const { return _csv_fname; }
const art::Event *GetEvent();
private:
std::string _empty_string;
int _time_offset;
std::map<supera::LArDataType_t,std::string> _data_request_m;
std::vector<supera::LArWire_t>* _ptr_wire_v;
std::vector<supera::LArHit_t>* _ptr_hit_v;
std::vector<supera::LArOpDigit_t>* _ptr_opdigit_v;
std::vector<supera::LArSimCh_t>* _ptr_sch_v;
std::vector<supera::LArMCTruth_t>* _ptr_mctruth_v;
std::vector<supera::LArMCParticle_t>* _ptr_mcp_v;
std::vector<supera::LArMCTrack_t>* _ptr_mct_v;
std::vector<supera::LArMCShower_t>* _ptr_mcs_v;
std::vector<supera::LArSimEnergyDeposit_t>* _ptr_simedep_v;
std::vector<supera::LArSpacePoint_t>* _ptr_spacepoint_v;
std::string _csv_fname;
// FIXME(kvtsang) Temporary solution to access associations
const art::Event *_event;
};
//
// Pointer getter/setters (templated)
//
template <> const std::vector<supera::LArWire_t>& SuperaBase::LArData<supera::LArWire_t>() const;
template <> const std::vector<supera::LArHit_t>& SuperaBase::LArData<supera::LArHit_t>() const;
template <> const std::vector<supera::LArOpDigit_t>& SuperaBase::LArData<supera::LArOpDigit_t>() const;
template <> const std::vector<supera::LArSimCh_t>& SuperaBase::LArData<supera::LArSimCh_t>() const;
template <> const std::vector<supera::LArMCTruth_t>& SuperaBase::LArData<supera::LArMCTruth_t>() const;
template <> const std::vector<supera::LArMCParticle_t>& SuperaBase::LArData<supera::LArMCParticle_t>() const;
template <> const std::vector<supera::LArMCTrack_t>& SuperaBase::LArData<supera::LArMCTrack_t>() const;
template <> const std::vector<supera::LArMCShower_t>& SuperaBase::LArData<supera::LArMCShower_t>() const;
template <> const std::vector<supera::LArSimEnergyDeposit_t>& SuperaBase::LArData<supera::LArSimEnergyDeposit_t>() const;
template <> const std::vector<supera::LArSpacePoint_t>& SuperaBase::LArData<supera::LArSpacePoint_t>() const;
template <> void SuperaBase::LArData(const std::vector<supera::LArWire_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArHit_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArOpDigit_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArMCTruth_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArMCParticle_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArMCTrack_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArMCShower_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArSimCh_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArSimEnergyDeposit_t>& data_v);
template <> void SuperaBase::LArData(const std::vector<supera::LArSpacePoint_t>& data_v);
/**
\class larcv::SuperaBaseFactory
\brief A concrete factory class for larcv::SuperaBase
*/
class SuperaBaseProcessFactory : public ProcessFactoryBase {
public:
/// ctor
SuperaBaseProcessFactory() { ProcessFactory::get().add_factory("SuperaBase",this); }
/// dtor
~SuperaBaseProcessFactory() {}
/// creation method
ProcessBase* create(const std::string instance_name) { return new SuperaBase(instance_name); }
};
}
#endif
/** @} */ // end of doxygen group