PIDAAnalyzer_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // 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.
8 ////////////////////////////////////////////////////////////////////////
9 
14 #include "fhiclcpp/ParameterSet.h"
15 #include "art_root_io/TFileService.h"
16 
17 #include "PIDAAlg.h"
19 
20 #include "TH1F.h"
21 #include "TTree.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 beginJob() override;
42 
43 private:
44 
47 
48 };
49 
50 
52  :
53  EDAnalyzer(p),
54  fCaloModuleLabel(p.get<std::string>("CaloModuleLabel")),
55  fPIDAAlg(p.get<fhicl::ParameterSet>("PIDAAlg"))
56 {}
57 
60 
61  std::vector<TH1F*> kde_hists;
62  for(size_t i_b=0; i_b<fPIDAAlg.getNKDEBandwidths(); i_b++){
63  std::stringstream hname;
64  hname << "hkde_" << i_b;
65  kde_hists.push_back(tfs->make<TH1F>(hname.str().c_str(),"PIDA KDE Distribution",100,0,30));
66  }
67 
68  fPIDAAlg.SetPIDATree(tfs->make<TTree>("pida","PIDAPropertiesTree"),
69  tfs->make<TH1F>("hvals","PIDA Distribution",100,0,30),
70  kde_hists);
71 
72 }
73 
75 {
77  e.getByLabel(fCaloModuleLabel,caloHandle);
78  std::vector<anab::Calorimetry> const& caloVector(*caloHandle);
79 
80  for(size_t i_calo=0; i_calo<caloVector.size(); i_calo++){
81  fPIDAAlg.FillPIDATree(e.run(),e.event(),i_calo,caloVector[i_calo]);
82  }
83 
84 }
85 
void SetPIDATree(TTree *, TH1F *, std::vector< TH1F * >)
Definition: PIDAAlg.cxx:57
EventNumber_t event() const
Definition: DataViewImpl.cc:85
void beginJob() override
void FillPIDATree(unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
Definition: PIDAAlg.cxx:176
std::string string
Definition: nybbler.cc:12
size_t getNKDEBandwidths()
Definition: PIDAAlg.h:62
PIDAAnalyzer(fhicl::ParameterSet const &p)
STL namespace.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
PIDAAnalyzer & operator=(PIDAAnalyzer const &)=delete
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
p
Definition: test.py:223
RunNumber_t run() const
Definition: DataViewImpl.cc:71
std::string fCaloModuleLabel
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
void analyze(art::Event const &e) override