All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
opdet::OpticalRawDigitReformatter Class Reference
Inheritance diagram for opdet::OpticalRawDigitReformatter:

Public Member Functions

 OpticalRawDigitReformatter (const fhicl::ParameterSet &)
 
void produce (art::Event &)
 

Private Attributes

std::string fInputModule
 
std::string fGenModule
 
std::vector< std::string > CategoryLabels
 

Detailed Description

Definition at line 25 of file OpticalRawDigitReformatter_module.cc.

Constructor & Destructor Documentation

opdet::OpticalRawDigitReformatter::OpticalRawDigitReformatter ( const fhicl::ParameterSet &  pset)
explicit

Definition at line 51 of file OpticalRawDigitReformatter_module.cc.

52  : EDProducer{pset}
53  {
54  // Indicate that the Input Module comes from .fcl
55  fInputModule = pset.get<std::string>("InputModule");
56  fGenModule = pset.get<std::string>("GenModule");
57 
58  CategoryLabels.push_back("Undefined");
59  CategoryLabels.push_back("HighGain");
60  CategoryLabels.push_back("LowGain");
61  CategoryLabels.push_back("LogicPulse");
62  CategoryLabels.push_back("FEMCosmicHighGain");
63  CategoryLabels.push_back("FEMCosmicLowGain");
64  CategoryLabels.push_back("FEMCosmicLogicPulse");
65  CategoryLabels.push_back("FEMBeamHighGain");
66  CategoryLabels.push_back("FEMBeamLowGain");
67  CategoryLabels.push_back("FEMBeamLogicPulse");
68  CategoryLabels.push_back("BeamPMTTrigger");
69  CategoryLabels.push_back("CosmicPMTTrigger");
70 
71  // One for each category
72  for (auto label : CategoryLabels)
73  produces<std::vector<raw::OpDetWaveform>>(label);
74  }

Member Function Documentation

void opdet::OpticalRawDigitReformatter::produce ( art::Event &  evt)

Definition at line 78 of file OpticalRawDigitReformatter_module.cc.

79  {
80 
81  // These are the storage pointers we will put in the event, one per category
82  std::vector<std::unique_ptr<std::vector<raw::OpDetWaveform>>> RawOpDetVecs;
83  for (unsigned int i = 0; i < CategoryLabels.size(); i++) {
84  std::unique_ptr<std::vector<raw::OpDetWaveform>> tmp(new std::vector<raw::OpDetWaveform>);
85  RawOpDetVecs.push_back(std::move(tmp));
86  }
87 
88  std::vector<const sim::BeamGateInfo*> beamGateArray;
89  try {
90  evt.getView(fGenModule, beamGateArray);
91  }
92  catch (art::Exception const& err) {
93  if (err.categoryCode() != art::errors::ProductNotFound) throw;
94  }
95 
96  // Read in the OpticalRawDigit collection from the event.
97  art::Handle<std::vector<optdata::OpticalRawDigit>> ordHandle;
98  evt.getByLabel(fInputModule, ordHandle);
99  std::vector<optdata::OpticalRawDigit> const& ord_vec(*ordHandle);
100 
101  auto const clock_data =
102  art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
103 
104  for (auto ord : ord_vec) {
105  optdata::Channel_t channel = ord.ChannelNumber();
106  optdata::TimeSlice_t timeSlice = ord.TimeSlice();
107  optdata::Frame_t frame = ord.Frame();
108  optdata::Optical_Category_t category = ord.Category();
109 
110  // Use the optical clock to conver timeSlice and frame
111  // to an absolute time
112  double timeStamp = clock_data.OpticalClock().Time(timeSlice, frame);
113 
114  RawOpDetVecs[category]->push_back(raw::OpDetWaveform(timeStamp, channel, ord));
115  }
116 
117  // Store results into the event
118  for (unsigned int i = 0; i < CategoryLabels.size(); i++) {
119  // Only store collections which contain waveforms, assign the label
120  if (RawOpDetVecs[i]->size() > 0) { evt.put(std::move(RawOpDetVecs[i]), CategoryLabels[i]); }
121  }
122  }
EResult err(const char *call)
enum optdata::_optical_category_t Optical_Category_t
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
unsigned int Frame_t
Definition: OpticalTypes.h:21
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int Channel_t
Definition: OpticalTypes.h:19

Member Data Documentation

std::vector<std::string> opdet::OpticalRawDigitReformatter::CategoryLabels
private

Definition at line 38 of file OpticalRawDigitReformatter_module.cc.

std::string opdet::OpticalRawDigitReformatter::fGenModule
private

Definition at line 36 of file OpticalRawDigitReformatter_module.cc.

std::string opdet::OpticalRawDigitReformatter::fInputModule
private

Definition at line 35 of file OpticalRawDigitReformatter_module.cc.


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