LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PIDAAnalyzer_module.cc
Go to the documentation of this file.
1 // Class: PIDAAnalyzer
3 // Module Type: analyzer
4 // File: PIDAAnalyzer_module.cc
5 //
6 // Generated at Sat Nov 1 23:10:27 2014 by Wesley Ketchum using artmod
7 // from cetpkgsupport v1_07_01.
9 
15 #include "art_root_io/TFileService.h"
16 #include "fhiclcpp/ParameterSet.h"
17 
18 #include "PIDAAlg.h"
20 
21 #include "TH1F.h"
22 #include "TTree.h"
23 
24 namespace pid {
25  class PIDAAnalyzer;
26 }
27 
29 public:
30  explicit PIDAAnalyzer(fhicl::ParameterSet const& p);
31  // The destructor generated by the compiler is fine for classes
32  // without bare pointers or other resource use.
33 
34  // Plugins should not be copied or assigned.
35  PIDAAnalyzer(PIDAAnalyzer const&) = delete;
36  PIDAAnalyzer(PIDAAnalyzer&&) = delete;
37  PIDAAnalyzer& operator=(PIDAAnalyzer const&) = delete;
38  PIDAAnalyzer& operator=(PIDAAnalyzer&&) = delete;
39 
40  void analyze(art::Event const& e) override;
41 
42  void beginJob() override;
43 
44 private:
45  std::string fCaloModuleLabel;
47 };
48 
50  : EDAnalyzer(p)
51  , fCaloModuleLabel(p.get<std::string>("CaloModuleLabel"))
52  , fPIDAAlg(p.get<fhicl::ParameterSet>("PIDAAlg"))
53 {}
54 
56 {
58 
59  std::vector<TH1F*> kde_hists;
60  for (size_t i_b = 0; i_b < fPIDAAlg.getNKDEBandwidths(); i_b++) {
61  std::stringstream hname;
62  hname << "hkde_" << i_b;
63  kde_hists.push_back(tfs->make<TH1F>(hname.str().c_str(), "PIDA KDE Distribution", 100, 0, 30));
64  }
65 
66  fPIDAAlg.SetPIDATree(tfs->make<TTree>("pida", "PIDAPropertiesTree"),
67  tfs->make<TH1F>("hvals", "PIDA Distribution", 100, 0, 30),
68  kde_hists);
69 }
70 
72 {
74  e.getByLabel(fCaloModuleLabel, caloHandle);
75  std::vector<anab::Calorimetry> const& caloVector(*caloHandle);
76 
77  for (size_t i_calo = 0; i_calo < caloVector.size(); i_calo++) {
78  fPIDAAlg.FillPIDATree(e.run(), e.event(), i_calo, caloVector[i_calo]);
79  }
80 }
81 
void SetPIDATree(TTree *, TH1F *, std::vector< TH1F * >)
Definition: PIDAAlg.cxx:58
void beginJob() override
void FillPIDATree(unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
Definition: PIDAAlg.cxx:176
size_t getNKDEBandwidths()
Definition: PIDAAlg.h:64
PIDAAnalyzer(fhicl::ParameterSet const &p)
STL namespace.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
PIDAAnalyzer & operator=(PIDAAnalyzer const &)=delete
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
parameter set interface
EventNumber_t event() const
Definition: Event.cc:41
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
Definition: StdUtils.h:120
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
std::string fCaloModuleLabel
Float_t e
Definition: plot.C:35
RunNumber_t run() const
Definition: Event.cc:29
void analyze(art::Event const &e) override