forked from kvtsang/Supera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RSEFilter_module.cc
76 lines (57 loc) · 2.09 KB
/
RSEFilter_module.cc
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
////////////////////////////////////////////////////////////////////////
// Class: RSEFilter
// Module Type: filter
// File: RSEFilter_module.cc
//
// Generated at Fri Jul 28 01:52:57 2017 by Kazuhiro Terao using artmod
// from cetpkgsupport v1_11_00.
////////////////////////////////////////////////////////////////////////
#include "art/Framework/Core/EDFilter.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Handle.h"
#include "art/Framework/Principal/Run.h"
#include "art/Framework/Principal/SubRun.h"
//#include "art/Utilities/InputTag.h"
#include "fhiclcpp/ParameterSet.h"
#include "messagefacility/MessageLogger/MessageLogger.h"
#include <exception>
#include <memory>
#include <set>
#include <map>
#include "SuperaCSVReader.h"
class RSEFilter;
class RSEFilter : public art::EDFilter {
public:
explicit RSEFilter(fhicl::ParameterSet const & p);
// The destructor generated by the compiler is fine for classes
// without bare pointers or other resource use.
// Plugins should not be copied or assigned.
RSEFilter(RSEFilter const &) = delete;
RSEFilter(RSEFilter &&) = delete;
RSEFilter & operator = (RSEFilter const &) = delete;
RSEFilter & operator = (RSEFilter &&) = delete;
// Required functions.
bool filter(art::Event & e) override;
private:
// Declare member data here.
std::map<supera::RSEID, std::array<double, 3> > _event_m;
};
RSEFilter::RSEFilter(fhicl::ParameterSet const & p)
{
std::string runlist;
//cet::search_path finder("FHICL_FILE_PATH");
cet::search_path finder("FW_SEARCH_PATH");
if ( !finder.find_file(p.get<std::string>("CSVName"), runlist) )
throw cet::exception("LArSoftSuperaSriver") << "Unable to find supera cfg in " << finder.to_string() << "\n";
supera::csvreader::read_constraint_file(runlist, _event_m);
}
bool RSEFilter::filter(art::Event & e)
{
int run = e.id().run();
int subrun = e.id().subRun();
int event = e.id().event();
supera::RSEID id(run, subrun, event);
return _event_m.find(id) != _event_m.end();
}
DEFINE_ART_MODULE(RSEFilter)