PMTAna_module.cc
Go to the documentation of this file.
1 /**
2  * \file PMTAna_module.cc
3  *
4  * \ingroup PMTAna
5  *
6  * \brief Class definition file of PMTAna
7  *
8  * @author Kazu - Nevis 2013
9  */
10 
11 /** \addtogroup PMTAna
12 
13 @{*/
14 
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 
42  /**
43  \class PMTAna
44  PMTAna module to copy LArSoft data contents into LArLight data formatted file
45  */
46  class PMTAna : public art::EDAnalyzer{
47 
48  public:
49 
50  /// Constructor
52 
53  /// Function to be called per event
54  void analyze (const art::Event&);
55 
56  private:
57 
58  std::string _fifo_mod_name; ///< Input FIFOChannel producer name
59  TTree* _tree; ///< output data holder TTree
60 
65  };
66 
67 }
68 
69 namespace pmtana {
71 }
72 
73 namespace pmtana {
74 
75  //#######################################################################################################
77  EDAnalyzer(pset),
78  _preco_man(),
79  _th_algo(),
80  _fw_algo(),
81  _ped_algo()
82  //#######################################################################################################
83  {
84 
85  // Obtain module names for input data
86  _fifo_mod_name = pset.get<std::string>("fModName_FIFOChannel" );
87 
88  // Next we make storage data class objects for those data types specified in fcl files.
90 
91  // Create TTree
92  _tree = fileService->make<TTree>("pmt_tree","Analysis Tree");
93 
94  //
95  // Demonstration purpose ...
96  //
100 
101  }
102 
103  //#######################################################################################################
105  //#######################################################################################################
106  {
107 
108  //data_ptr->set_event(evt.id().event(), evt.run(), evt.subRun());
109 
110 // std::vector<const optdata::FIFOChannel*> pmtArray;
111  std::vector<const raw::OpDetWaveform*> pmtArray;
112  try{
113 
114  evt.getView(_fifo_mod_name,pmtArray);
115 
116  }catch (art::Exception const& e) {
117 
118  if (e.categoryCode() != art::errors::ProductNotFound ) throw;
119 
120  }
121 
122 
123 
124 
125  for(size_t i=0; i<pmtArray.size(); ++i) {
126 
127 // const optdata::FIFOChannel* fifo_ptr(pmtArray.at(i));
128  const raw::OpDetWaveform* fifo_ptr(pmtArray.at(i));
129 
130  _preco_man.Reconstruct(*fifo_ptr);
131 
132  //
133  // here I add code to store reco-ed pulse w/ channel number
134  // OR I may make a singleton storage manager...
135 
136  /*
137  data_ptr->add_pmtfifo(fifo_ptr->ChannelNumber(),
138  fifo_ptr->Category(),
139  fifo_ptr->Frame(),
140  fifo_ptr->TimeSlice(),
141  *fifo_ptr);
142  */
143 
144  //
145  //
146  //
147  }
148 
149 
150  }
151 
152 }
153 
154 /** @}*/ // end of PMTAna group
AlgoFixedWindow _fw_algo
TTree * _tree
output data holder TTree
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
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
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
T get(std::string const &key) const
Definition: ParameterSet.h:271
PedAlgoEdges _ped_algo
std::string _fifo_mod_name
Input FIFOChannel producer name.
PulseRecoManager _preco_man
PMTAna(const fhicl::ParameterSet &)
Constructor.
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.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:500
Class definition file of PedAlgoEdges.
TCEvent evt
Definition: DataStructs.cxx:7
Class definition file of PulseRecoManager.