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

Public Member Functions

 PTBToOffline (fhicl::ParameterSet const &pset)
 
 PTBToOffline (PTBToOffline const &)=delete
 
 PTBToOffline (PTBToOffline &&)=delete
 
PTBToOfflineoperator= (PTBToOffline const &)=delete
 
PTBToOfflineoperator= (PTBToOffline &&)=delete
 
void produce (art::Event &evt) override
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void printParameterSet ()
 
- 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 ()
 
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 fFragType
 
std::string fRawDataLabel
 
std::string fOutputDataLabel
 
double fNOvAClockFrequency
 
std::string fPTBMapFile
 
std::string fPTBMapDir
 
std::map< int, int > fPTBMap
 

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 46 of file PTBToOffline_module.cc.

Constructor & Destructor Documentation

DAQToOffline::PTBToOffline::PTBToOffline ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 74 of file PTBToOffline_module.cc.

75 : EDProducer(pset)
76 {
77 
78  this->reconfigure(pset);
79 
80  produces< std::vector<raw::ExternalTrigger> > (fOutputDataLabel);
81 
82  //first_FirstSample = -1;
83  //first_TimeStamp = -1;
84 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void reconfigure(fhicl::ParameterSet const &pset)
DAQToOffline::PTBToOffline::PTBToOffline ( PTBToOffline const &  )
delete
DAQToOffline::PTBToOffline::PTBToOffline ( PTBToOffline &&  )
delete

Member Function Documentation

PTBToOffline& DAQToOffline::PTBToOffline::operator= ( PTBToOffline const &  )
delete
PTBToOffline& DAQToOffline::PTBToOffline::operator= ( PTBToOffline &&  )
delete
void DAQToOffline::PTBToOffline::printParameterSet ( )

Definition at line 100 of file PTBToOffline_module.cc.

100  {
101 
102  mf::LogDebug("PTBToOffline") << "====================================" << "\n"
103  << "Parameter Set" << "\n"
104  << "====================================" << "\n"
105  << "fFragType: " << fFragType << "\n"
106  << "fRawDataLabel: " << fRawDataLabel << "\n"
107  << "fOutputDataLabel: " << fOutputDataLabel << "\n"
108  << "====================================" << "\n";
109 }
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
void DAQToOffline::PTBToOffline::produce ( art::Event evt)
overridevirtual

Implements art::EDProducer.

Definition at line 112 of file PTBToOffline_module.cc.

113 {
114 
115  art::Handle<artdaq::Fragments> rawFragments;
116  evt.getByLabel(fRawDataLabel, fFragType, rawFragments);
117 
118  // Check if there is PTB data in this event
119  // Don't crash code if not present, just don't save anything
120  try { rawFragments->size(); }
121  catch(std::exception const&) {
122  mf::LogWarning("PTBToOffline") << "WARNING: Raw PTB data not found in event " << evt.event();
123  std::vector<raw::ExternalTrigger> Triggers;
124  evt.put(std::make_unique<std::vector<raw::ExternalTrigger>>(std::move(Triggers)), fOutputDataLabel);
125  return;
126  }
127 
128  // Check that the data is valid
129  if(!rawFragments.isValid()){
130  mf::LogError("PTBToOffline") << "Run: " << evt.run()
131  << ", SubRun: " << evt.subRun()
132  << ", Event: " << evt.event()
133  << " is NOT VALID";
134  throw cet::exception("raw NOT VALID");
135  return;
136  }
137 
138  lbne::PennMicroSlice::Payload_Timestamp *FirstPTBTimestamp = nullptr;
139  auto triggers = PennFragmentToExternalTrigger(*rawFragments, fPTBMap, FirstPTBTimestamp);
140 
141  std::cout << "Returned from PennFragmentToExternalTriggers and triggers has size " << triggers.size() << std::endl;
142 
143  evt.put(std::make_unique<decltype(triggers)>(std::move(triggers)), fOutputDataLabel);
144 }
EventNumber_t event() const
Definition: DataViewImpl.cc:96
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool isValid() const
Definition: Handle.h:183
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
def move(depos, offset)
Definition: depos.py:107
std::map< int, int > fPTBMap
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:89
RunNumber_t run() const
Definition: DataViewImpl.cc:82
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< raw::ExternalTrigger > PennFragmentToExternalTrigger(artdaq::Fragments const &Fragments, std::map< int, int > &channelMap, lbne::PennMicroSlice::Payload_Timestamp *&FirstPTBTimestamp)
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
void DAQToOffline::PTBToOffline::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 86 of file PTBToOffline_module.cc.

86  {
87 
88  fFragType = pset.get<std::string>("FragType");
89  fRawDataLabel = pset.get<std::string>("RawDataLabel");
90  fOutputDataLabel = pset.get<std::string>("OutputDataLabel");
91  fNOvAClockFrequency = pset.get<double>("NOvAClockFrequency"); // in MHz
92  fPTBMapFile = pset.get<std::string>("PTBMapFile");
93  fPTBMapDir = pset.get<std::string>("PTBMapDir");
94 
96 
97  BuildPTBChannelMap(fPTBMapDir, fPTBMapFile, fPTBMap);
98 }
std::string string
Definition: nybbler.cc:12
void BuildPTBChannelMap(std::string MapDir, std::string MapFile, std::map< int, int > &channelMap)
std::map< int, int > fPTBMap

Member Data Documentation

std::string DAQToOffline::PTBToOffline::fFragType
private

Definition at line 63 of file PTBToOffline_module.cc.

double DAQToOffline::PTBToOffline::fNOvAClockFrequency
private

Definition at line 66 of file PTBToOffline_module.cc.

std::string DAQToOffline::PTBToOffline::fOutputDataLabel
private

Definition at line 65 of file PTBToOffline_module.cc.

std::map<int,int> DAQToOffline::PTBToOffline::fPTBMap
private

Definition at line 70 of file PTBToOffline_module.cc.

std::string DAQToOffline::PTBToOffline::fPTBMapDir
private

Definition at line 68 of file PTBToOffline_module.cc.

std::string DAQToOffline::PTBToOffline::fPTBMapFile
private

Definition at line 67 of file PTBToOffline_module.cc.

std::string DAQToOffline::PTBToOffline::fRawDataLabel
private

Definition at line 64 of file PTBToOffline_module.cc.


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