NoiseMapAna_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: NoiseMapAna
3 // Module Type: analyzer
4 // File: NoiseMapAna_module.cc
5 //
6 // Generated at Tue Aug 2 14:48:49 2016 by Andrew S. Hirsch using artmod
7 // from cetpkgsupport v1_10_02.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
19 
22 #include <TH2I.h>
23 
24 namespace novaddt {
25  class NoiseMapAna;
26 }
27 
28 
29 void MakeHist(int n)
30 {
31  ///use the shared noise map manager
33  //lock before reading
34  auto &NoiseMap = cms->getMap();
35 
36  //make noise histogram
38 
39  auto h1=tfs->make<TH1D>(Form("h1d_%d",n),
40  Form("Noise, event #%d",n),
41  1000,0,200);
42  auto h2=tfs->make<TH2D>(Form("h2d_%d",n),
43  Form("Noise Map, event #%d",n),
44  NoiseMap.Nplanes(),0,NoiseMap.Nplanes(),
45  NoiseMap.Ncells(),0,NoiseMap.Ncells());
46  uint64_t sum=0;
47  double mean=0, rms=0;
48  for(size_t nc=0;nc<NoiseMap.Ncells();++nc){
49  for(size_t np=0;np<NoiseMap.Nplanes();++np){
50  auto val=NoiseMap(novaddt::Plane(np),novaddt::Cell(nc));
51  sum+=val;
52  rms+=val*val;
53  h1->Fill(val);
54  h2->SetBinContent(np,nc,val);
55  }
56  }
57  mean=sum;
58  mean=mean/NoiseMap.Length();
59  rms=rms/NoiseMap.Length()-mean*mean;
60 
61  mf::LogInfo("NoiseMapAna")<<" activity["<<sum<<"] = "<<mean<<" +- "<<sqrt(rms);
62 }
63 
65 public:
66  explicit NoiseMapAna(fhicl::ParameterSet const & p);
67  // The destructor generated by the compiler is fine for classes
68  // without bare pointers or other resource use.
69 
70  // Plugins should not be copied or assigned.
71  NoiseMapAna(NoiseMapAna const &) = delete;
72  NoiseMapAna(NoiseMapAna &&) = delete;
73  NoiseMapAna & operator = (NoiseMapAna const &) = delete;
74  NoiseMapAna & operator = (NoiseMapAna &&) = delete;
75 
76  // Required functions.
77  void analyze(art::Event const & e) override;
78 
79  void endRun(art::Run const & r) override{
81  MakeHist(r.run());
82  }
83 
84 private:
85 
86 
87 };
88 
89 
90 
91 
93  :
94  EDAnalyzer(p) // ,
95  // More initializers here.
96 {}
97 
99 {
100  // Implementation of required member function here.
101 }
102 
void analyze(art::Event const &e) override
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
DEFINE_ART_MODULE(TestTMapFile)
RunNumber_t run() const
Definition: Run.h:47
void MakeHist(int n)
Definition: Run.h:31
const novaddt::calib::FDHitMap & getMap() const
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
NoiseMapAna & operator=(NoiseMapAna const &)=delete
TH1F * h2
Definition: plot.C:45
NoiseMapAna(fhicl::ParameterSet const &p)
TH1F * h1
T * make(ARGS...args) const
void endRun(art::Run const &r) override
TRandom3 r(0)
Double_t sum
Definition: plot.C:31
Float_t e
Definition: plot.C:35