Public Member Functions | Protected Attributes | List of all members
pdune::DataDumpHDF Class Reference
Inheritance diagram for pdune::DataDumpHDF:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 DataDumpHDF (fhicl::ParameterSet const &p)
 
 DataDumpHDF (DataDumpHDF const &)=delete
 
 DataDumpHDF (DataDumpHDF &&)=delete
 
DataDumpHDFoperator= (DataDumpHDF const &)=delete
 
DataDumpHDFoperator= (DataDumpHDF &&)=delete
 
void analyze (art::Event const &e) noexcept
 
void beginJob ()
 
virtual ~DataDumpHDF () noexcept
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Attributes

double evttime
 
hep_hpc::hdf5::File hdffile
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 53 of file DataDumpHDF_module.cc.

Constructor & Destructor Documentation

pdune::DataDumpHDF::DataDumpHDF ( fhicl::ParameterSet const &  p)
explicit

Definition at line 84 of file DataDumpHDF_module.cc.

85  : EDAnalyzer{p} // ,
86  // More initializers here.
87 {
88  // Call appropriate consumes<>() for any products to be retrieved by this module.
89 }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
pdune::DataDumpHDF::DataDumpHDF ( DataDumpHDF const &  )
delete
pdune::DataDumpHDF::DataDumpHDF ( DataDumpHDF &&  )
delete
pdune::DataDumpHDF::~DataDumpHDF ( )
virtualnoexcept

Definition at line 90 of file DataDumpHDF_module.cc.

91 {
92 }

Member Function Documentation

void pdune::DataDumpHDF::analyze ( art::Event const &  e)
virtualnoexcept

Implements art::EDAnalyzer.

Definition at line 95 of file DataDumpHDF_module.cc.

96 {
97 
98 //fGeom = &*(art::ServiceHandle<geo::Geometry>());
99 
100  hdffile = hep_hpc::hdf5::File(Form("r%d_e%d.h5",e.run(),e.event()), H5F_ACC_TRUNC);
101  auto event_id = get_eid(e);
102 
103  art::Timestamp ts = e.time();
104  if (ts.timeHigh() == 0){
105  TTimeStamp tts(ts.timeLow());
106  evttime = tts.AsDouble();
107  }
108  else{
109  TTimeStamp tts(ts.timeHigh(), ts.timeLow());
110  evttime = tts.AsDouble();
111  }
112 // channel.clear();
113 // tick.clear();
114 // adc.clear();
115 
116  //std::ofstream outfile (Form("r%de%d.txt",run,event));
117 
118  //wire_nt_t wiresigs(hdffile, "wiresigs", {{"eid",4}});
119  wire_nt_t wiresigs(hdffile, "wiresigs", {"adc"});
120  evt_nt_t evtids(hdffile, "evtids", {{"eid",3}, "evttime"});
121  evtids.insert(event_id.data(), evttime);
122 
123  art::InputTag itag("caldata","dataprep");
124  std::vector < art::Ptr < recob::Wire > > wires;
125  auto wireListHandle = e.getHandle < std::vector < recob::Wire > >(itag);
126  if (wireListHandle) {
127  art::fill_ptr_vector(wires, wireListHandle);
128  }
129 
130  std::sort(wires.begin(), wires.end(), chIncrease);
131 // auto const& wires =
132 // e.getValidHandle<std::vector<recob::Wire> >("caldata:dataprep");
133 // //std::vector<recob::Wire> const& wireVector(*wires);
134 
135  for (auto & wire : wires){
136  int channel = wire->Channel();
137  if (!((channel>=2080 && channel < 2560)||
138  (channel>=7200 && channel < 7680)||
139  (channel>=12320 && channel < 12800))) continue;
140  if (channel%1000==0) std::cout<<"Channel = "<<channel<<std::endl;
141 
142  const recob::Wire::RegionsOfInterest_t& signalROI = wire->SignalROI();
143  int lasttick = 0;
144  for(const auto& range : signalROI.get_ranges()){
145  const auto& waveform = range.data();
146  // ROI start time
147  raw::TDCtick_t roiFirstBinTick = range.begin_index();
148  for (int i = lasttick; i<roiFirstBinTick; ++i){
149  wiresigs.insert(0.);
150  }
151  for(size_t idx = 0; idx < waveform.size(); idx++){
152  wiresigs.insert(waveform[idx]);
153  ++lasttick;
154  }
155  }
156  for (int i = lasttick; i<6000; ++i){
157  wiresigs.insert(0.);
158  }
159  }
160 // int nticks = wire->Signal().size();
161 // for (int j = 0; j < nticks; j++){
162 // float adc = wire->Signal()[j];
163 // wiresigs.insert(adc);
164 // }
165 // if (nticks <6000){
166 // for (int j = nticks; j < 6000; j++)
167 // wiresigs.insert(0.);
168 // }
169 
170  std::cout<<"event_time: "<<evttime<<std::endl;
171 
172 }
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
uint8_t channel
Definition: CRTFragment.hh:201
hep_hpc::hdf5::File hdffile
bool chIncrease(art::Ptr< recob::Wire > const &w1, art::Ptr< recob::Wire > const &w2)
int TDCtick_t
Type representing a TDC tick.
Definition: RawTypes.h:25
const double e
hep_hpc::hdf5::Ntuple< float > wire_nt_t
std::array< unsigned int, 3 > get_eid(art::Event const &e)
hep_hpc::hdf5::Ntuple< unsigned int, double > evt_nt_t
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
QTextStream & endl(QTextStream &s)
void pdune::DataDumpHDF::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 174 of file DataDumpHDF_module.cc.

175 {
176 }
DataDumpHDF& pdune::DataDumpHDF::operator= ( DataDumpHDF const &  )
delete
DataDumpHDF& pdune::DataDumpHDF::operator= ( DataDumpHDF &&  )
delete

Member Data Documentation

double pdune::DataDumpHDF::evttime
protected

Definition at line 75 of file DataDumpHDF_module.cc.

hep_hpc::hdf5::File pdune::DataDumpHDF::hdffile
protected

Definition at line 79 of file DataDumpHDF_module.cc.


The documentation for this class was generated from the following file: