All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OpFlashSimpleAna_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: OpFlashSimpleAna
3 // Module Type: analyzer
4 // File: OpFlashSimpleAna_module.cc
5 //
6 // Generated at Tue Apr 21 10:58:24 2015 by Wesley Ketchum using artmod
7 // from cetpkgsupport v1_08_05.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include "art/Framework/Core/EDAnalyzer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Services/Registry/ServiceHandle.h"
15 #include "fhiclcpp/ParameterSet.h"
16 
17 #include "art_root_io/TFileService.h"
18 
19 #include "OpFlashAnaAlg.h"
20 
21 #include "TTree.h"
22 
23 namespace opdet {
24  class OpFlashSimpleAna;
25 }
26 
27 class opdet::OpFlashSimpleAna : public art::EDAnalyzer {
28 public:
29  explicit OpFlashSimpleAna(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  OpFlashSimpleAna(OpFlashSimpleAna const &) = delete;
36  OpFlashSimpleAna & operator = (OpFlashSimpleAna const &) = delete;
38 
39  void analyze(art::Event const & e) override;
40 
41  void beginJob() override;
42 
43 private:
44 
45  // Declare member data here.
46  std::string fOpFlashModuleLabel;
47  std::string fOpHitModuleLabel;
49 
51 
52 };
53 
54 
55 opdet::OpFlashSimpleAna::OpFlashSimpleAna(fhicl::ParameterSet const & p)
56  :
57  EDAnalyzer(p) // ,
58  // More initializers here.
59 {
60  fOpFlashModuleLabel = p.get<std::string>("OpFlashModuleLabel","");
61  fOpHitModuleLabel = p.get<std::string>("OpFlashModuleLabel","");
62  fMakeOpDetPEHist = p.get<bool>("MakeOpDetPEHist",true);
63 }
64 
65 void opdet::OpFlashSimpleAna::analyze(art::Event const & e)
66 {
67  if(fOpFlashModuleLabel.size()>0){
68  art::Handle< std::vector< recob::OpFlash > > flashHandle;
69  e.getByLabel(fOpFlashModuleLabel, flashHandle);
70  std::vector<recob::OpFlash> const& flashVector(*flashHandle);
71  fAnaAlg.FillOpFlashes(flashVector);
72  }
73  if(fOpHitModuleLabel.size()>0){
74  art::Handle< std::vector< recob::OpHit > > hitHandle;
75  e.getByLabel(fOpHitModuleLabel, hitHandle);
76  std::vector<recob::OpHit> const& hitVector(*hitHandle);
77  fAnaAlg.FillOpHits(hitVector);
78  }
79 }
80 
82 {
83  art::ServiceHandle<art::TFileService const> tfs;
84  if(fOpFlashModuleLabel.size()>0)
85  fAnaAlg.SetOpFlashTree(tfs->make<TTree>("OpFlashTree","OpFlashSimpleAna: Flash Tree"),
86  fMakeOpDetPEHist);
87  if(fOpHitModuleLabel.size()>0)
88  fAnaAlg.SetOpHitTree(tfs->make<TTree>("OpHitTree","OpFlashSimpleAna: Hit Tree"));
89 }
90 
91 DEFINE_ART_MODULE(opdet::OpFlashSimpleAna)
OpFlashSimpleAna & operator=(OpFlashSimpleAna const &)=delete
pdgs p
Definition: selectors.fcl:22
void analyze(art::Event const &e) override
do i e
art::ServiceHandle< art::TFileService > tfs
OpFlashSimpleAna(fhicl::ParameterSet const &p)