Public Member Functions | Private Attributes | List of all members
opdet::OpticalRawDigitReformatter Class Reference
Inheritance diagram for opdet::OpticalRawDigitReformatter:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 OpticalRawDigitReformatter (const fhicl::ParameterSet &)
 
void produce (art::Event &)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
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::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- 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)
 

Private Attributes

std::string fInputModule
 
std::string fGenModule
 
std::vector< std::stringCategoryLabels
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- 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 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  }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
T get(std::string const &key) const
Definition: ParameterSet.h:271

Member Function Documentation

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

Implements art::EDProducer.

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.
98  evt.getByLabel(fInputModule, ordHandle);
99  std::vector<optdata::OpticalRawDigit> const& ord_vec(*ordHandle);
100 
101  auto const clock_data =
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  }
enum optdata::_optical_category_t Optical_Category_t
uint8_t channel
Definition: CRTFragment.hh:201
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
string tmp
Definition: languages.py:63
void err(const char *fmt,...)
Definition: message.cpp:226
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
unsigned int Frame_t
Definition: OpticalTypes.h:21
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
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: