NoiseHitFinder_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: NoiseHitFinder
3 // Module Type: producer
4 // File: NoiseHitFinder_module.cc
5 //
6 // Generated at Thu Apr 14 03:19:48 2016 by Andrey Sheshukov using artmod
7 // from cetpkgsupport v1_08_07.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
19 
24 
26 
27 #include <memory>
28 
29 namespace novaddt {
30  class NoiseHitFinder;
31 }
32 
34 public:
35  explicit NoiseHitFinder(fhicl::ParameterSet const & p);
36  // The destructor generated by the compiler is fine for classes
37  // without bare pointers or other resource use.
38 
39  // Plugins should not be copied or assigned.
40  NoiseHitFinder(NoiseHitFinder const &) = delete;
41  NoiseHitFinder(NoiseHitFinder &&) = delete;
42  NoiseHitFinder & operator = (NoiseHitFinder const &) = delete;
44 
45  // Required functions.
46  void produce(art::Event & e) override;
47 
48 
49 private:
50 
51  // Declare member data here.
53  double _NoiseMin;
54 };
55 
56 
58  _InputTag (p.get< std::string >("inputTag")),
59  _OutputTag (p.get< std::string >("outputTag")),
60  _NoiseMin(p.get<double>("Noise.min"))
61 {
62 
63  produces<HitList>(_OutputTag);
64  //output configuration
65  mf::LogInfo("NoiseHitFinder")<<"config:"
66  <<"\n\t inputTag="<<_InputTag
67  <<"\n\t outputTag="<<_OutputTag
68  <<"\n\t Noise threshold = "<<_NoiseMin;
69 }
70 
72 {
73  //read the input hit list
74  auto inputHits=event.getValidHandle<novaddt::HitList>(_InputTag);
75  //prepare the output hit list
76  std::unique_ptr<novaddt::HitList> outputHits(new novaddt::HitList);
77  ///use the shared noise map manager
79  //lock before reading
80  auto &NoiseMap = cms->getMap();
81  for(auto const& h: *inputHits){
82  auto noise=NoiseMap[h];
83  if(noise>=_NoiseMin)
84  outputHits->emplace_back(h);
85  }
86  mf::LogDebug("NoiseHitFinder")<<" find hits"
87  <<"\n\tinputHits: "<< inputHits->size()
88  <<"\n\toutputHits: "<<outputHits->size();
89  event.put(std::move(outputHits),_OutputTag);
90 
91 }
92 
void produce(art::Event &e) override
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)
const novaddt::calib::FDHitMap & getMap() const
NoiseHitFinder(fhicl::ParameterSet const &p)
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
NoiseHitFinder & operator=(NoiseHitFinder const &)=delete
Float_t e
Definition: plot.C:35
enum BeamMode string