All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
16 #include "art/Framework/Core/EDAnalyzer.h"
17 #include "art/Framework/Core/ModuleMacros.h"
18 #include "art/Framework/Principal/Event.h"
19 #include "art/Framework/Principal/fwd.h"
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
51  PMTAna(const fhicl::ParameterSet&);
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 {
70  DEFINE_ART_MODULE(PMTAna)
71 }
72 
73 namespace pmtana {
74 
75  //#######################################################################################################
76  PMTAna::PMTAna(fhicl::ParameterSet const& pset) :
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.
89  art::ServiceHandle<art::TFileService const> fileService;
90 
91  // Create TTree
92  _tree = fileService->make<TTree>("pmt_tree","Analysis Tree");
93 
94  //
95  // Demonstration purpose ...
96  //
100 
101  }
102 
103  //#######################################################################################################
104  void PMTAna::analyze(const art::Event& evt)
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
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
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
PedAlgoEdges _ped_algo
std::string _fifo_mod_name
Input FIFOChannel producer name.
PulseRecoManager _preco_man
PMTAna(const fhicl::ParameterSet &)
Constructor.
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.
do i e
Class definition file of PedAlgoEdges.
TCEvent evt
Definition: DataStructs.cxx:8
Class definition file of PulseRecoManager.