forked from kvtsang/Supera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SuperaChStatus.cxx
65 lines (50 loc) · 1.79 KB
/
SuperaChStatus.cxx
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
#ifndef __SUPERACHSTATUS_CXX__
#define __SUPERACHSTATUS_CXX__
#include "SuperaChStatus.h"
#include "larcv/core/DataFormat/EventChStatus.h"
namespace larcv {
static SuperaChStatusProcessFactory __global_SuperaChStatusProcessFactory__;
SuperaChStatus::SuperaChStatus(const std::string name)
: SuperaBase(name)
{}
void SuperaChStatus::configure(const PSet& cfg)
{
SuperaBase::configure(cfg);
supera::ParamsChStatus::configure(cfg);
_in_chstatus_producer = cfg.get<std::string>("LArChStatusProducer");
}
void SuperaChStatus::initialize()
{
SuperaBase::initialize();
for (size_t i = 0; i < ::supera::NProjections(); ++i) {
::larcv::ChStatus status;
status.id(i);
status.initialize(::supera::Nwires(i), ::larcv::chstatus::kUNKNOWN);
_status_m.emplace(status.id(), status);
}
}
void SuperaChStatus::set_chstatus(::larcv::ProjectionID_t plane, unsigned int wire, short status)
{
if (wire >= ::supera::Nwires(plane)) throw ::larcv::larbys("Invalid wire number to store status!");
_status_m[plane].status(wire, status);
}
bool SuperaChStatus::process(IOManager& mgr)
{
SuperaBase::process(mgr);
auto ev_chstatus = (EventChStatus*)(mgr.get_data("chstatus",OutChStatusLabel()));
if(!ev_chstatus) {
LARCV_CRITICAL() << "Output chstatus could not be created!" << std::endl;
throw larbys();
}
for (auto const& id_status : _status_m)
ev_chstatus->insert(id_status.second);
// Reset status
for (auto& plane_status : _status_m) plane_status.second.reset(::larcv::chstatus::kUNKNOWN);
return true;
}
void SuperaChStatus::finalize()
{ SuperaBase::finalize(); }
bool SuperaChStatus::is(const std::string question) const
{ return (question == "SuperaChStatus"); }
}
#endif