LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PMTAna_module.cc
Go to the documentation of this file.
1 
15 // ART includes
20 #include "art_root_io/TFileService.h"
21 #include "fhiclcpp/ParameterSet.h"
22 
23 // LArSoft
25 
26 // STL
27 #include <functional>
28 #include <numeric>
29 #include <string>
30 
31 // ROOT
32 #include <TTree.h>
33 
34 // My modules
39 
40 namespace pmtana {
41 
46  class PMTAna : public art::EDAnalyzer {
47 
48  public:
51 
53  void analyze(const art::Event&);
54 
55  private:
56  std::string _fifo_mod_name;
57  TTree* _tree;
58 
63  };
64 
65 }
66 
67 namespace pmtana {
69 }
70 
71 namespace pmtana {
72 
73  //#######################################################################################################
75  : EDAnalyzer(pset), _preco_man(), _th_algo(), _fw_algo(), _ped_algo()
76  //#######################################################################################################
77  {
78 
79  // Obtain module names for input data
80  _fifo_mod_name = pset.get<std::string>("fModName_FIFOChannel");
81 
82  // Next we make storage data class objects for those data types specified in fcl files.
84 
85  // Create TTree
86  _tree = fileService->make<TTree>("pmt_tree", "Analysis Tree");
87 
88  //
89  // Demonstration purpose ...
90  //
94  }
95 
96  //#######################################################################################################
98  //#######################################################################################################
99  {
100 
101  //data_ptr->set_event(evt.id().event(), evt.run(), evt.subRun());
102 
103  // std::vector<const optdata::FIFOChannel*> pmtArray;
104  std::vector<const raw::OpDetWaveform*> pmtArray;
105  try {
106 
107  evt.getView(_fifo_mod_name, pmtArray);
108  }
109  catch (art::Exception const& e) {
110 
111  if (e.categoryCode() != art::errors::ProductNotFound) throw;
112  }
113 
114  for (size_t i = 0; i < pmtArray.size(); ++i) {
115 
116  // const optdata::FIFOChannel* fifo_ptr(pmtArray.at(i));
117  const raw::OpDetWaveform* fifo_ptr(pmtArray.at(i));
118 
119  _preco_man.Reconstruct(*fifo_ptr);
120 
121  //
122  // here I add code to store reco-ed pulse w/ channel number
123  // OR I may make a singleton storage manager...
124 
125  /*
126  data_ptr->add_pmtfifo(fifo_ptr->ChannelNumber(),
127  fifo_ptr->Category(),
128  fifo_ptr->Frame(),
129  fifo_ptr->TimeSlice(),
130  *fifo_ptr);
131  */
132 
133  //
134  //
135  //
136  }
137  }
138 
139 }
140  // end of PMTAna group
AlgoFixedWindow _fw_algo
TTree * _tree
output data holder TTree
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
void AddRecoAlgo(pmtana::PMTPulseRecoBase *algo, PMTPedestalBase *ped_algo=nullptr)
A method to set pulse reconstruction algorithm.
void analyze(const art::Event &)
Function to be called per event.
AlgoThreshold _th_algo
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:65
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
T get(std::string const &key) const
Definition: ParameterSet.h:314
PedAlgoEdges _ped_algo
std::string _fifo_mod_name
Input FIFOChannel producer name.
PulseRecoManager _preco_man
PMTAna(const fhicl::ParameterSet &)
Constructor.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Class definition file of AlgoFixedWindow.
Class definition file of AlgoThreshold.
void SetDefaultPedAlgo(pmtana::PMTPedestalBase *algo)
A method to set a choice of pedestal estimation method.
Class definition file of PedAlgoEdges.
TCEvent evt
Definition: DataStructs.cxx:8
Float_t e
Definition: plot.C:35
Class definition file of PulseRecoManager.