Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
daq2raw::DAQHit2Raw Class Reference
Inheritance diagram for daq2raw::DAQHit2Raw:
daq2raw::NOvAInputDriverBase art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

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

Public Member Functions

 DAQHit2Raw (fhicl::ParameterSet const &p)
 
virtual ~DAQHit2Raw ()
 
void produce (art::Event &e) override
 
void beginRun (art::Run &run)
 
void respondToOpenInputFile (const art::FileBlock &fb)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

int getDetIdFromFilename (const char *filename)
 
void FillRawDigits (const novaddt::HitList &hitlist, std::unique_ptr< std::vector< rawdata::RawDigit > > &rawlist)
 
void PopulateRawTrig (rawdata::RawTrigger &rawtrig, art::Event const &evt)
 
std::string getDetectorGDML (const int detid) const
 
CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

std::string fDAQHitInput
 
bool fAddRunInfo
 
std::string fileName
 
int fDetId
 

Detailed Description

Definition at line 39 of file DAQHit2Raw_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

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

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

daq2raw::DAQHit2Raw::DAQHit2Raw ( fhicl::ParameterSet const &  p)
explicit

Definition at line 72 of file DAQHit2Raw_module.cc.

References fAddRunInfo, and art::InEvent.

73  : fDAQHitInput(p.get< std::string >("DAQHitInput")),
74  fAddRunInfo(p.get< bool >("AddRunInfo"))
75 {
76  produces<rawdata::DAQHeader, art::InEvent>();
77  produces< std::vector<rawdata::RawDigit>, art::InEvent>();
78  produces< std::vector<rawdata::RawTrigger>, art::InEvent>();
79  if (fAddRunInfo)
80  produces<sumdata::RunData, art::InRun>();
81 }
const char * p
Definition: xmltok.h:285
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
daq2raw::DAQHit2Raw::~DAQHit2Raw ( )
virtual

Definition at line 84 of file DAQHit2Raw_module.cc.

85 {
86 }

Member Function Documentation

void daq2raw::DAQHit2Raw::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 95 of file DAQHit2Raw_module.cc.

References runNovaSAM::detector, fAddRunInfo, fileName, daq2raw::NOvAInputDriverBase::getDetectorGDML(), getDetIdFromFilename(), and art::Run::put().

96 {
97  if(fAddRunInfo)
98  {
99  int detector = getDetIdFromFilename(fileName.c_str());
101  std::unique_ptr<sumdata::RunData> rundata(new sumdata::RunData(novadaq::cnv::DetId(detector), detFileBase));
102  run.put(std::move(rundata));
103  }
104 }
std::string getDetectorGDML(const int detid) const
int getDetIdFromFilename(const char *filename)
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDProducer::currentContext ( ) const
protectedinherited
void daq2raw::DAQHit2Raw::FillRawDigits ( const novaddt::HitList hitlist,
std::unique_ptr< std::vector< rawdata::RawDigit > > &  rawlist 
)
protected

Definition at line 200 of file DAQHit2Raw_module.cc.

References novaddt::DAQHit::ADC(), novaddt::DAQHit::Cell(), visualisationForPaperMasterPlot::cmap, DEFINE_ART_MODULE(), daqchannelmap::DAQChannelMap::encodeLChan(), fDetId, compare_h5_caf::idx, cmap::dataprov::CMap::Map(), novaddt::DAQHit::Plane(), rawdata::RawDigit::SetADC(), rawdata::RawDigit::SetChannel(), rawdata::RawDigit::SetMC(), rawdata::RawDigit::SetTDC(), novaddt::DAQHit::TDC(), novaddt::TDC::val, novaddt::ADC::val, novaddt::Plane::val, and novaddt::Cell::val.

Referenced by produce().

203 {
205 
206  // Loop over all hits in the HitList
207  const int nHits = hitlist.size();
208  for(int idx = 0; idx< nHits; idx++){
209  // instance of each DAQHit
210  const novaddt::DAQHit dhit = hitlist[idx];
211 
213  dhit.Plane().val,
214  dhit.Cell().val);
215 
216  // instance of RawDigit
217  rawdata::RawDigit rawdig;
218 
219  // Fill RawDigits
220  rawdig.SetChannel(lchan);
221  rawdig.SetTDC(dhit.TDC().val);
222  rawdig.SetADC(0,dhit.ADC().val);
223  rawdig.SetMC();
224 
225  rawlist->push_back(rawdig);
226  }
227 
228 }
value_type val
Definition: BaseProducts.h:34
void SetTDC(int32_t iTDC)
Definition: RawDigit.cxx:116
novaddt::Plane const & Plane() const
Definition: DAQHit.h:70
novaddt::TDC const & TDC() const
Definition: DAQHit.h:74
value_type val
Definition: BaseProducts.h:109
void SetChannel(uint32_t iChan)
Definition: RawDigit.h:99
const daqchannelmap::DAQChannelMap * Map() const
Definition: CMap.h:57
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
void SetADC(uint32_t i, int16_t iADC)
Definition: RawDigit.cxx:108
novaddt::ADC const & ADC() const
Definition: DAQHit.h:73
value_type val
Definition: BaseProducts.h:84
void SetMC(bool isMC=true)
Definition: RawDigit.h:106
novaddt::Cell const & Cell() const
Definition: DAQHit.h:71
value_type val
Definition: BaseProducts.h:65
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
std::string daq2raw::NOvAInputDriverBase::getDetectorGDML ( const int  detid) const
protectedinherited

Definition at line 22 of file NOvAInputDriverBase.cxx.

References daq2raw::NOvAInputDriverBase::fGDMLBase, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, and novadaq::cnv::kTESTBEAM.

Referenced by beginRun(), daq2raw::NOvARawInputDriver::readNext(), daq2raw::NOvASocketInputDriver::readNext(), and daq2raw::TestBeamRawInputDriver::readNext().

22  {
23 
24  // get the base form of the geometry file for the current detector
25  if(!fGDMLBase.empty()) return fGDMLBase;
26 
27  //\todo at some point we should query a database to get this, especially
28  //\todo when we have instances of only part of a detector working
29  std::string detFileBase("");
30  if (detid == novadaq::cnv::kNDOS)
31  detFileBase = "ndos-2x3-4block_nomc-xtru-vacuum";
32  else if (detid == novadaq::cnv::kNEARDET)
33  detFileBase = "neardet-3x3-8block-xtru-vacuum-stagger";
34  else if(detid == novadaq::cnv::kFARDET)
35  detFileBase = "fardet-12x12-28block-xtru-vacuum-stagger-pivoter";
36  else if(detid == novadaq::cnv::kTESTBEAM)
37  detFileBase = "testbeam-2x2-2block-xtru-vacuum-stagger";
38 
39  return detFileBase;
40  }
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
Near Detector in the NuMI cavern.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
int daq2raw::DAQHit2Raw::getDetIdFromFilename ( const char *  filename)
protected

Definition at line 148 of file DAQHit2Raw_module.cc.

References fDetId, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, and novadaq::cnv::kUNKNOWN_DET.

Referenced by beginRun().

149 {
151 
152  if (boost::find_first(filename, "ndos") || boost::find_first(filename, "NDOS")){
154  }
155  else if(boost::find_first(filename, "fardet") || boost::find_first(filename, "FarDet")){
157  }
158  else if(boost::find_first(filename, "neardet") || boost::find_first(filename, "NearDet")){
160  }
161  return fDetId;
162 }
string filename
Definition: shutoffs.py:106
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
Near Detector in the NuMI cavern.
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void daq2raw::DAQHit2Raw::PopulateRawTrig ( rawdata::RawTrigger rawtrig,
art::Event const &  evt 
)
protected

Definition at line 165 of file DAQHit2Raw_module.cc.

References art::Event::event(), rawdata::RawTrigger::fTriggerMask_MCBit, rawdata::RawTrigger::fTriggerRange_TriggerLength, rawdata::RawTrigger::fTriggerTimingMarker_TimeStart, art::Event::run(), and art::Event::subRun().

Referenced by produce().

168 {
169  // Say this is MC:
170  rawtrig.fTriggerMask_MCBit = 1;
171 
172  // Units of DDT data are 5ms = 5*10^6ns
173  // This will need to be addressed in EventDisplay
174  // rawtrig.fTriggerRange_TriggerLength = fClocktick*fNumClockticksInSpill/5.e6;
175  // Hard-code for testing purposes
176  rawtrig.fTriggerRange_TriggerLength = 62.5*8000/5.e6;
177 
178  // Set the trigger time such that it increments by 0.1 seconds
179  // every event (to mimic calibration triggers, though not beam
180  // triggers). Also, add one "day" per subrun and one "year" per
181  // run, just to keep the times in different files different.
182  // I'm not making these FHICL parameters because we will want
183  // to do this properly (e.g., have each MC file representing a
184  // specific timestamp drawn to match real data).
185  //
186  // The TDC ticks run at 64 MHz
187 
188  static const unsigned long long ticksPerYear = (unsigned long long)(64000000) * 31556926;
189  static const unsigned long long ticksPerDay = (unsigned long long)(64000000) * 86400;
190  static const unsigned long long ticksPerEvent = (unsigned long long)(64000000) / 10; // 10 Hz trigger
191 
193  evt.run() * ticksPerYear +
194  evt.subRun() * ticksPerDay +
195  evt.event() * ticksPerEvent;
196 
197 }
int evt
unsigned long long fTriggerTimingMarker_TimeStart
Definition: RawTrigger.h:38
uint32_t fTriggerRange_TriggerLength
Definition: RawTrigger.h:40
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void daq2raw::DAQHit2Raw::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 107 of file DAQHit2Raw_module.cc.

References fDAQHitInput, FillRawDigits(), art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, PopulateRawTrig(), and art::Event::put().

108 {
109  // get the vector of DAQHits (HitList)
111  e.getByLabel(fDAQHitInput,hlcol);
112 
113  novaddt::HitList hitlist;
114  for(unsigned int i = 0; i < hlcol->size(); ++i){
115  hitlist.push_back((*hlcol)[i]);
116  }
117 
118  //////////////////////////////////////////////
119  // Define data structures that we want to fill
120 
121  // Digitized data
122  std::unique_ptr<std::vector<rawdata::RawDigit> > digits(new std::vector<rawdata::RawDigit>);
123  // Trigger data:
124  std::unique_ptr<std::vector<rawdata::RawTrigger> > rtcol(new std::vector<rawdata::RawTrigger>);
125  // DAQ header:
126  // std::unique_ptr<rawdata::DAQHeader > daqcol(new rawdata::DAQHeader(daq_header));
127 
128 
129  // Write digitized data into the event
130  rawdata::RawDigit rawdig;
131  FillRawDigits(hitlist, digits);
132 
133  e.put(std::move(digits)); // Put RawDigits into event
134 
135  // Write the raw trigger into the event
136  rawdata::RawTrigger rawtrig;
137  PopulateRawTrig(rawtrig, e);
138  rtcol->push_back(rawtrig);
139 
140  e.put(std::move(rtcol)); // Put RawTrigger into event
141 
142  //Write the DAQHeader - for now don't bother
143  //e.put(std::move(daqcol), "daq"); // Module label
144 
145 }
std::vector< DAQHit > HitList
Definition: HitList.h:15
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void FillRawDigits(const novaddt::HitList &hitlist, std::unique_ptr< std::vector< rawdata::RawDigit > > &rawlist)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void PopulateRawTrig(rawdata::RawTrigger &rawtrig, art::Event const &evt)
void daq2raw::DAQHit2Raw::respondToOpenInputFile ( const art::FileBlock fb)

Definition at line 89 of file DAQHit2Raw_module.cc.

References art::FileBlock::fileName(), and fileName.

90 {
91  fileName = basename((char*)fb.fileName().c_str());
92 }
std::string const & fileName() const
Definition: FileBlock.h:38
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

bool daq2raw::DAQHit2Raw::fAddRunInfo
private

Definition at line 52 of file DAQHit2Raw_module.cc.

Referenced by beginRun(), and DAQHit2Raw().

std::string daq2raw::DAQHit2Raw::fDAQHitInput
private

Definition at line 51 of file DAQHit2Raw_module.cc.

Referenced by produce().

int daq2raw::DAQHit2Raw::fDetId
private

Definition at line 55 of file DAQHit2Raw_module.cc.

Referenced by FillRawDigits(), and getDetIdFromFilename().

std::string daq2raw::DAQHit2Raw::fileName
private

Definition at line 54 of file DAQHit2Raw_module.cc.

Referenced by beginRun(), and respondToOpenInputFile().


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