LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 
17 #include "fhiclcpp/ParameterSet.h"
20 
21 #include "PIDAAlg.h"
22 
23 namespace pid{
24  class PIDAAnalyzer;
25 }
26 
28 public:
29  explicit PIDAAnalyzer(fhicl::ParameterSet const & p);
30  // The destructor generated by the compiler is fine for classes
31  // without bare pointers or other resource use.
32 
33  // Plugins should not be copied or assigned.
34  PIDAAnalyzer(PIDAAnalyzer const &) = delete;
35  PIDAAnalyzer(PIDAAnalyzer &&) = delete;
36  PIDAAnalyzer & operator = (PIDAAnalyzer const &) = delete;
37  PIDAAnalyzer & operator = (PIDAAnalyzer &&) = delete;
38 
39  void analyze(art::Event const & e) override;
40 
41  void reconfigure(fhicl::ParameterSet const & p) ;
42  void beginJob() override;
43 
44 private:
45 
46  std::string fCaloModuleLabel;
48 
49 };
50 
51 
53  :
54  EDAnalyzer(p),
55  fCaloModuleLabel(p.get<std::string>("CaloModuleLabel")),
56  fPIDAAlg(p.get<fhicl::ParameterSet>("PIDAAlg"))
57 {}
58 
61 
62  std::vector<TH1F*> kde_hists;
63  for(size_t i_b=0; i_b<fPIDAAlg.getNKDEBandwidths(); i_b++){
64  std::stringstream hname;
65  hname << "hkde_" << i_b;
66  kde_hists.push_back(tfs->make<TH1F>(hname.str().c_str(),"PIDA KDE Distribution",100,0,30));
67  }
68 
69  fPIDAAlg.SetPIDATree(tfs->make<TTree>("pida","PIDAPropertiesTree"),
70  tfs->make<TH1F>("hvals","PIDA Distribution",100,0,30),
71  kde_hists);
72 
73 }
74 
76 {
78  e.getByLabel(fCaloModuleLabel,caloHandle);
79  std::vector<anab::Calorimetry> const& caloVector(*caloHandle);
80 
81  for(size_t i_calo=0; i_calo<caloVector.size(); i_calo++){
82  fPIDAAlg.FillPIDATree(e.run(),e.event(),i_calo,caloVector[i_calo]);
83  }
84 
85 }
86 
88 {
89  fCaloModuleLabel = p.get<std::string>("CaloModuleLabel");
91 }
92 
void SetPIDATree(TTree *, TH1F *, std::vector< TH1F * >)
Definition: PIDAAlg.cxx:51
void beginJob() override
void FillPIDATree(unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
Definition: PIDAAlg.cxx:170
size_t getNKDEBandwidths()
Definition: PIDAAlg.h:61
PIDAAnalyzer(fhicl::ParameterSet const &p)
STL namespace.
PIDAAnalyzer & operator=(PIDAAnalyzer const &)=delete
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
void reconfigure(fhicl::ParameterSet const &p)
Definition: PIDAAlg.cxx:16
parameter set interface
T get(std::string const &key) const
Definition: ParameterSet.h:231
EventNumber_t event() const
Definition: Event.h:67
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
void reconfigure(fhicl::ParameterSet const &p)
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
std::string fCaloModuleLabel
Float_t e
Definition: plot.C:34
RunNumber_t run() const
Definition: Event.h:77
void analyze(art::Event const &e) override