ActiveDCMFilter_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: ActiveDCMFilter
3 // Plugin Type: filter (art v1_17_06)
4 // File: ActiveDCMFilter_module.cc
5 //
6 // Generated at Tue Mar 27 03:39:21 2018 by Andrew S. Hirsch using cetskelgen
7 // from cetlib version v1_15_03.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
19 
22 
23 #include <memory>
24 
25 namespace novaddt {
26  class ActiveDCMFilter;
27 }
28 
29 
31 public:
32  explicit ActiveDCMFilter(fhicl::ParameterSet const & p);
33  // The compiler-generated destructor is fine for non-base
34  // classes without bare pointers or other resource use.
35 
36  // Plugins should not be copied or assigned.
37  ActiveDCMFilter(ActiveDCMFilter const &) = delete;
38  ActiveDCMFilter(ActiveDCMFilter &&) = delete;
39  ActiveDCMFilter & operator = (ActiveDCMFilter const &) = delete;
41 
42  // Required functions.
43  bool filter(art::Event & e) override;
44 
45 private:
46 
47  // Declare member data here.
48  art::InputTag fHitsTag; //where to read the hits for noise activity
49  std::map<novaddt::DCM, uint64_t> fDCMOccupancy;
51 
52 };
53 
54 
56 fHitsTag(p.get<std::string>("hits_tag")),
57 fNumDCMMinimum(p.get<int>("num_DCM_minimum"))
58 {
59  mf::LogInfo("ActiveDCMFilter")<<"Configured:\n"
60  <<"Reading hits from: "<<fHitsTag<<"\n "
61  <<"Discard events with: N active DCMs < "<<fNumDCMMinimum;
62 }
63 
65 {
66  //clear map of DCM activities
67  fDCMOccupancy.clear();
68  //fill the map with hits
70  for(const auto &hit: *hits) fDCMOccupancy[hit]+=1;
71 
72  LOG_DEBUG("Active DCMs")<<fDCMOccupancy.size();
73  //filter out if number of active DCMs is less than a given Minimum
74  return (fDCMOccupancy.size() >= fNumDCMMinimum);
75 }
76 
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
ActiveDCMFilter(fhicl::ParameterSet const &p)
void hits()
Definition: readHits.C:15
ActiveDCMFilter & operator=(ActiveDCMFilter const &)=delete
Definition: structs.h:12
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Float_t e
Definition: plot.C:35
std::map< novaddt::DCM, uint64_t > fDCMOccupancy
bool filter(art::Event &e) override
enum BeamMode string