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

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 RawDigit2DAQHit (fhicl::ParameterSet const &p)
 
virtual ~RawDigit2DAQHit ()
 
void produce (art::Event &event) override
 
std::string workerType () const
 
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)
 
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< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Protected Member Functions

void FillDAQHits (art::Handle< std::vector< rawdata::RawDigit > > &RawDigits, std::unique_ptr< std::vector< novaddt::DAQHit > > &DAQHits, unsigned long long event_time)
 
ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (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< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Attributes

std::string fRawDigitLabel
 label of where to find Raw Digits More...
 
std::string fRawTriggerLabel
 label of where to find Raw Triggers More...
 
art::ServiceHandle< novaddt::WaveformProcessorwpr
 

Detailed Description

Definition at line 35 of file RawDigit2DAQHit_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 25 of file Producer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 18 of file EDProducer.h.

Constructor & Destructor Documentation

raw2daq::RawDigit2DAQHit::RawDigit2DAQHit ( fhicl::ParameterSet const &  p)
explicit

Definition at line 53 of file RawDigit2DAQHit_module.cc.

References fRawDigitLabel, fRawTriggerLabel, and art::InEvent.

54  : EDProducer(p),
55  fRawDigitLabel (p.get< std::string >("RawDigitLabel")),
56  fRawTriggerLabel (p.get< std::string >("RawTriggerLabel"))
57 {
58  // Call appropriate Produces<>() functions here.
59  mf::LogInfo("RawDigit2DAQHit") << "=== raw2daq:::RawDigit2DAQHit instantiate";
60  mf::LogInfo("RawDigit2DAQHit") << "\t RawDigitLabel: " << fRawDigitLabel;
61  mf::LogInfo("RawDigit2DAQHit") << "\t RawTriggerLabel: " << fRawTriggerLabel;
62  produces< std::vector<novaddt::DAQHit>, art::InEvent>();
63 
64 }
std::string fRawTriggerLabel
label of where to find Raw Triggers
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const char * p
Definition: xmltok.h:285
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
std::string fRawDigitLabel
label of where to find Raw Digits
enum BeamMode string
raw2daq::RawDigit2DAQHit::~RawDigit2DAQHit ( )
virtual

Definition at line 66 of file RawDigit2DAQHit_module.cc.

67 {
68  // Clean up dynamic memory and other resources here.
69 }

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Producer::doBeginJob ( )
inherited
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Producer::doEndJob ( )
inherited
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::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 
)
inherited
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
void raw2daq::RawDigit2DAQHit::FillDAQHits ( art::Handle< std::vector< rawdata::RawDigit > > &  RawDigits,
std::unique_ptr< std::vector< novaddt::DAQHit > > &  DAQHits,
unsigned long long  event_time 
)
protected

Definition at line 94 of file RawDigit2DAQHit_module.cc.

References rawdata::RawDigit::ADC(), ana::assert(), om::cerr, rawdata::RawDigit::Channel(), visualisationForPaperMasterPlot::cmap, DEFINE_ART_MODULE(), fillBadChanDBTables::det, ds::DetectorService::DetId(), daqchannelmap::DAQChannelMap::encodeDChan(), allTimeWatchdog::endl, novaddt::WaveformProcessor::getADC(), novaddt::WaveformProcessor::getTDC(), cmap::dataprov::CMap::Map(), cet::sqlite::max(), rawdata::RawDigit::NADC(), rh, novaddt::WaveformProcessor::setup(), rawdata::RawDigit::TDC(), and wpr.

Referenced by produce().

98 {
99  const unsigned int nDigits = RawDigits->size();
101 
103  const novadaq::cnv::DetId det = rh->DetId();
104 
105  // loop over digits
106  for(unsigned int iDigit=0; iDigit < nDigits; ++iDigit){
107  const rawdata::RawDigit* digit = &(*RawDigits)[iDigit];
108  const daqchannelmap::lchan channel = digit->Channel();
109  const daqchannelmap::dchan daqchannel = cmap->Map()->encodeDChan(channel);
110 
111  if (digit->NADC() < 4) // use DCS
112  DAQHits->emplace_back(det,
113  daqchannel,
114  novaddt::ADC(digit->ADC()),
115  novaddt::TDC(digit->TDC() + event_time));
116 
117  else { // using WaveformProcessor
118  novaddt::TDC theTDC;
119  novaddt::ADC theADC;
120  int16_t adc1 = digit->ADC(1) - digit->ADC(0);
121  int16_t adc2 = digit->ADC(2) - digit->ADC(0);
122  int16_t adc3 = digit->ADC(3) - digit->ADC(0);
123 
124 
125  //
126  // Time Conversion: Offline TDC -> Raw TDC
127  //
128  if (event_time > std::numeric_limits<int64_t>::max())
129  {
130  std::cerr << "\n\tThe event time is too large to fit into int64_t.\n"
131  << std::endl;
132  assert(false);
133  }
134 
135  int32_t offline_tdc = digit->TDC();
136  // This casting of uint64 to int64 is okay because our event time only
137  // goes up to 56 bits and we checked above.
138  int64_t integer_raw_tdc =
139  static_cast<int64_t>(event_time) + static_cast<int64_t>(offline_tdc);
140  unsigned long long raw_tdc = static_cast<unsigned long long>(integer_raw_tdc);
141  uint32_t raw_tdc_low = raw_tdc & 0x00000000FFFFFFFF;
142  unsigned long long raw_tdc_high = raw_tdc >> 32;
143 
144 
145  wpr->setup(raw_tdc_low, raw_tdc_high, adc1, adc2, adc3, digit->ADC());
146 
147  DAQHits->emplace_back(det,
148  daqchannel,
149  wpr->getADC(),
150  wpr->getTDC());
151  }
152  } // end of loop on raw digits
153 }
novadaq::cnv::DetId DetId() const
What detector are we in?
TH2 * rh
Definition: drawXsec.C:5
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
OStream cerr
Definition: OStream.cxx:7
const daqchannelmap::DAQChannelMap * Map() const
Definition: CMap.h:57
void setup(daqdataformats::RawMicroSlice *theMicro, daqdataformats::RawNanoSlice *theNano)
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
uint32_t NADC() const
Definition: RawDigit.h:81
uint32_t Channel() const
Definition: RawDigit.h:84
assert(nhit_max >=nhit_nbins)
dchan encodeDChan(int detID, diblock_t diblock, dcm_id_t dcm, feb_t feb, pixel_t pixel) const
uint32_t dchan
< DAQ Channel Map Package
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:66
art::ServiceHandle< novaddt::WaveformProcessor > wpr
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
void raw2daq::RawDigit2DAQHit::produce ( art::Event event)
overridevirtual

Implements art::EDProducer.

Definition at line 71 of file RawDigit2DAQHit_module.cc.

References ana::assert(), FillDAQHits(), fRawDigitLabel, and fRawTriggerLabel.

72 {
73  // Implementation of required member function here.
74  // get the RawDigit list
76  event.getByLabel(fRawDigitLabel, RawDigits);
77  // make a vector to store the DAQHits into
78  std::unique_ptr<std::vector<novaddt::DAQHit> > DAQHits(new std::vector<novaddt::DAQHit>);
79 
80  // Get the raw trigger to get the event time
82  event.getByLabel(fRawTriggerLabel, RawTriggers);
83  // Currently no triggers should be configured to have more than one raw trigger per event
84  // The vector nature is reserved for exotic supernovae triggers
85  assert(RawTriggers->size()==1);
86  unsigned long long event_time = RawTriggers->at(0).fTriggerTimingMarker_TimeStart;
87 
88  // Make a DAQHit for every RawDigit and write it out
89  FillDAQHits(RawDigits, DAQHits, event_time);
90  // add DAQHits into the event
91  event.put(std::move(DAQHits));
92 }
std::string fRawTriggerLabel
label of where to find Raw Triggers
void FillDAQHits(art::Handle< std::vector< rawdata::RawDigit > > &RawDigits, std::unique_ptr< std::vector< novaddt::DAQHit > > &DAQHits, unsigned long long event_time)
std::string fRawDigitLabel
label of where to find Raw Digits
assert(nhit_max >=nhit_nbins)
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDProducer::workerType ( ) const
inherited

Member Data Documentation

std::string raw2daq::RawDigit2DAQHit::fRawDigitLabel
private

label of where to find Raw Digits

Definition at line 42 of file RawDigit2DAQHit_module.cc.

Referenced by produce(), and RawDigit2DAQHit().

std::string raw2daq::RawDigit2DAQHit::fRawTriggerLabel
private

label of where to find Raw Triggers

Definition at line 43 of file RawDigit2DAQHit_module.cc.

Referenced by produce(), and RawDigit2DAQHit().

art::ServiceHandle<novaddt::WaveformProcessor> raw2daq::RawDigit2DAQHit::wpr
private

Definition at line 44 of file RawDigit2DAQHit_module.cc.

Referenced by FillDAQHits().


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