Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
NovaDDTHitProducer Class Reference
Inheritance diagram for NovaDDTHitProducer:
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

 NovaDDTHitProducer (fhicl::ParameterSet const &p)
 
virtual ~NovaDDTHitProducer ()
 
virtual void produce (art::Event &e)
 
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

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

size_t populateMilliBlock (void const *image, RawMilliBlock &mb, novaddt::EventHeader *evt_header)
 
bool passes_MCS_filter (daqdataformats::RawNanoSlice *fNano) const
 

Private Attributes

art::ServiceHandle< novaddt::WaveformProcessorwpr
 
std::string const raw_label_
 
bool offline_
 

Detailed Description

Definition at line 33 of file NovaDDTHitProducer_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

NovaDDTHitProducer::NovaDDTHitProducer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 51 of file NovaDDTHitProducer_module.cc.

52  :
53  raw_label_(p.get<std::string>("raw_label"))
54  , offline_(p.get<bool>("offline_mode", false))
55 {
56  produces<std::vector<novaddt::DAQHit>>("AllHits");
57  produces<novaddt::EventHeader>("DDTdaq");
58  // produces<std::vector<novaddt::DAQHit>>("MCSHits");
59 #ifdef NEED_MILLIBLOCK_IN_EVENT
60  produces<RawMilliBlock>();
61 #endif
62 }
const char * p
Definition: xmltok.h:285
enum BeamMode string
NovaDDTHitProducer::~NovaDDTHitProducer ( )
virtual

Definition at line 64 of file NovaDDTHitProducer_module.cc.

References populateMilliBlock().

65 {
66 }

Member Function Documentation

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
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
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(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
bool NovaDDTHitProducer::passes_MCS_filter ( daqdataformats::RawNanoSlice fNano) const
private

Definition at line 194 of file NovaDDTHitProducer_module.cc.

References DEFINE_ART_MODULE(), daqdataformats::RawNanoSlice::getHeader(), daqdataformats::NanoSliceVersionConvention::getNPretriggeredSamples(), daqdataformats::NanoSliceVersionConvention::getNSamples(), and MECModelEnuComparisons::i.

195 {
196  //check that multipoint can be used
197  const uint32_t version = fNano->getHeader()->getVersion();
199  const unsigned int nSamples = conv.getNSamples(version);
200  const unsigned int nPretrig = conv.getNPretriggeredSamples(version);
201 
202  //MCS filter will not work under this case, use normal way:
203  if (nPretrig<3 || nSamples <= nPretrig || version==0) return false;
204 
205  //I require all the ADC values monotonously increase before trigger:
206  for (unsigned i = 1; i!= nPretrig; ++i) {
207  int16_t adc_pre = fNano->getValue(i-1);
208  int16_t adc_cur = fNano->getValue(i);
209  if (adc_pre > adc_cur) return false;
210  }
211 
212  return true;
213 
214 }
IMPLEMENT_MAIN_STANDARD IMPLEMENT_MAIN_setBufferSource daqdataformats::RawNanoSliceHeader * getHeader() const
Get the NanoSlice header pointer.
Definition: RawNanoSlice.h:57
uint32_t getNSamples(const version_t ver) const
Get the number of samples.
uint32_t getNPretriggeredSamples(const version_t ver) const
Get number of pretriggered samples.
const XML_Char * version
Definition: expat.h:187
size_t NovaDDTHitProducer::populateMilliBlock ( void const *  image,
RawMilliBlock mb,
novaddt::EventHeader evt_header 
)
private

Definition at line 69 of file NovaDDTHitProducer_module.cc.

References ana::assert(), novaddt::EventHeader::datablockCount, novaddt::EventHeader::eventNumber, RawMilliBlockHeader::flags, confusionMatrixTree::image, RawMilliBlockHeader::incomplete, RawMilliBlockHeader::millislice_count, daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::MILLISLICEHEADER_SIZE, novaddt::EventHeader::missingData, RawMilliBlockHeader::overflowCorruption, RawMilliBlockHeader::seqNum, RawMilliBlock::set(), RawMilliBlock::set_ovrwrt(), RawMilliBlock::slices, RawMilliBlockHeader::timeEnd, RawMilliBlockHeader::timeStart, novaddt::EventHeader::timeStart, novaddt::EventHeader::totalBytes, and RawMilliBlockHeader::truncated.

Referenced by produce(), and ~NovaDDTHitProducer().

70 {
71  // This code follows the code in Ron R's getMilliBlock, but omits the part
72  // where the data is read out of the shared memory. Instead, the data is
73  // assumed to be here in *image.
74  size_t total_bytes = 0;
75  std::vector<RawMilliSlice> rms_vec;
77  mb.set_ovrwrt(false);
78  RawMilliBlockHeader const * rmbhp =
79  reinterpret_cast<RawMilliBlockHeader const *>(image);
80  RawMilliBlockHeader const & rmbh(*rmbhp);
81  assert(rmbh.millislice_count > 0);
82  rms_vec.reserve(rmbh.millislice_count);
83  if (rmbh.flags.overflowCorruption == 1) {
84  mb.set_ovrwrt(true);
85  return 0;
86  }
87 
88  void * msdataptr = const_cast<void *>(reinterpret_cast<void const *>(rmbhp + 1));
89  uint32_t retrieved_millislice = 0;
90  for (; retrieved_millislice < rmbh.millislice_count; ++retrieved_millislice) {
91  rms_vec.push_back(rms_tmp);
92  msdataptr = rms_vec.at(retrieved_millislice).readData(msdataptr);
93  // the readData method figures how much data to copy, puts it
94  // into the millislice, and returns the pointer advanced to the end
95  // of that data.
96  total_bytes += rms_vec.at(retrieved_millislice).sizeofdata() * sizeof(uint32_t);
97  }
98  assert(retrieved_millislice > 0);
99  mb.set(rmbh.seqNum, rmbh.timeStart, rmbh.timeEnd, rmbh.flags.truncated);
100 
101  // This code will add the EventHeader to the live data stream events as well
102  evt_header->totalBytes = total_bytes;
103  evt_header->eventNumber = rmbh.seqNum;
104  evt_header->timeStart = rmbh.timeStart;
105  evt_header->missingData = rmbh.flags.incomplete;
106  evt_header->datablockCount = rmbh.millislice_count;
107 
108  mb.slices.swap(rms_vec); // swap vectors to get data into the mb.
109 
110  return total_bytes;
111 } // populateMilliBlock
uint32_t datablockCount
Definition: EventHeader.h:26
std::vector< daqdataformats::RawMilliSlice > slices
Definition: RawMilliBlock.h:35
void set_ovrwrt(bool ovrwrt)
Definition: RawMilliBlock.h:33
assert(nhit_max >=nhit_nbins)
int set(uint32_t sn, uint64_t start, uint64_t end, bool ovrflw)
Definition: RawMilliBlock.h:26
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void NovaDDTHitProducer::produce ( art::Event e)
virtual

Implements art::EDProducer.

Definition at line 113 of file NovaDDTHitProducer_module.cc.

References ana::assert(), novaddt::WaveformProcessor::getADC(), art::DataViewImpl::getByLabel(), daqdataformats::RawMicroSlice::getFloatingNanoSlice(), daqdataformats::RawMilliSlice::getHeader(), daqdataformats::RawNanoSlice::getHeader(), daqchannelmap::DAQChannelMap::getInstance(), daqdataformats::RawMicroSlice::getNumNanoSlices(), novaddt::WaveformProcessor::getTDC(), hits(), getGoodRuns4SAM::n, offline_, populateMilliBlock(), art::Event::put(), raw_label_, daqdataformats::RawMicroSlice::setFloatingNanoSlice(), novaddt::WaveformProcessor::setup(), and wpr.

114 {
115  // If we want to test offline the hits should already exist so we can just return here
116  if (offline_) return;
117 
118  typedef novaddt::DAQHit Hit;
119  // Obtain the fragments from the event.
121  e.getByLabel(raw_label_, handle);
122  // Sanity check.
123  assert(handle->size() == 1);
124  // Now initialize a RawMilliBlock with the fragment payload.
125  // Not quite -- do the work to do so, but the data on the heap has to be
126  // just the HitData, and we don't want to do two copies. So we interrupt
127  // the work at a key point, to make and push_back DAQHits.
128  std::unique_ptr<RawMilliBlock> mbp(new RawMilliBlock);
129  novaddt::EventHeader evt_header;
130 
131  size_t total_bytes =
132  populateMilliBlock(&*(handle->front().dataBegin()), *mbp, &evt_header);
133  std::unique_ptr<std::vector<Hit>> hits(new std::vector<Hit>);
134  std::unique_ptr<novaddt::EventHeader > mbhead(new novaddt::EventHeader(evt_header));
135 
136  // std::unique_ptr<std::vector<Hit>> MCShits(new std::vector<Hit>);
137 
138 
139  size_t const nanoSliceSize = 12; // Each nano-slice is *at least* 12 bytes
140  hits->reserve(total_bytes / nanoSliceSize); // definitely enough.
141  // Now code taken from A. Norman's GetDAQHits-SHM
142  // First Loop over the MilliBlock to get the millislices
143 
144  // for (auto & millislice : mbp->slices) {
145  for (unsigned n = 0; n != mbp->slices.size(); ++n)
146  {
147  // Now for each millislice we loop over the microslices
148  // I would LOVE to do this without the weird floating micro slice but...
149  for (uint32_t imicro = 0; mbp->slices.at(n).setFloatingMicroSlice(imicro); ++imicro) {
150  RawMicroSlice * theSlice = mbp->slices.at(n).getFloatingMicroSlice();
151  for (uint32_t inano = 0; inano < theSlice->getNumNanoSlices(); ++inano) {
152  theSlice->setFloatingNanoSlice(inano);
153  //new way
154  daqdataformats::RawMilliSlice* theMilli = &mbp->slices.at(n);
155  daqdataformats::RawNanoSlice* theNano = theSlice->getFloatingNanoSlice();
156  int detID = theMilli->getHeader()->getDetId();
157  wpr->setup(theSlice, theNano);
158  hits->emplace_back( detID,
160  ->encodeDChan(detID,
161  theMilli->getHeader()->getDiblockId(),
162  theMilli->getHeader()->getDCMId(),
163  theNano->getHeader()->getFEBId(),
164  theNano->getHeader()->getPixelAddr()),
165  wpr->getADC(),
166  wpr->getTDC() );
167 
168  // if (passes_MCS_filter(theNano))
169  // {
170  // MCShits->emplace_back( detID,
171  // daqchannelmap::DAQChannelMap::getInstance(detID)
172  // ->encodeDChan(detID,
173  // theMilli->getHeader()->getDiblockId(),
174  // theMilli->getHeader()->getDCMId(),
175  // theNano->getHeader()->getFEBId(),
176  // theNano->getHeader()->getPixelAddr()),
177  // wpr->getADC(),
178  // wpr->getTDC() );
179  // }
180 
181  //old way
182  //hits->emplace_back(&mbp->slices.at(n),
183  // theSlice->getFloatingNanoSlice());
184  } // Loop over microslices (imicro, as ranged using setFloatingNanoSlice)
185  } // Loop over microslices (inano, as ranged using setFloatingMicroSlice)
186  } // Loop over millislices {millislice ranged over mb.slices}
187  e.put(std::move(hits),"AllHits");
188  e.put(std::move(mbhead),"DDTdaq");
189  // e.put(std::move(MCShits),"MCSHits");
190 #ifdef NEED_MILLIBLOCK_IN_EVENT
191  e.put(std::move(mbp));
192 #endif
193 }
IMPLEMENT_MAIN_STANDARD IMPLEMENT_MAIN_setBufferSource daqdataformats::RawNanoSliceHeader * getHeader() const
Get the NanoSlice header pointer.
Definition: RawNanoSlice.h:57
size_t populateMilliBlock(void const *image, RawMilliBlock &mb, novaddt::EventHeader *evt_header)
uint32_t getNumNanoSlices() const
Get current Hit Probability (for a microslice generation)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
bool setFloatingNanoSlice(const uint32_t inano) const
Set the SIM flag.
daqdataformats::RawMilliSliceHeader * getHeader() const
Definition: RawMilliSlice.h:47
static DAQChannelMap * getInstance(int detID)
void setup(daqdataformats::RawMicroSlice *theMicro, daqdataformats::RawNanoSlice *theNano)
art::ServiceHandle< novaddt::WaveformProcessor > wpr
Class to hold the MicroSlice data.
Definition: RawMicroSlice.h:48
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
assert(nhit_max >=nhit_nbins)
daqdataformats::RawNanoSlice * getFloatingNanoSlice() const
Get the MicroSlice Timing Marker.
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 NovaDDTHitProducer::offline_
private

Definition at line 47 of file NovaDDTHitProducer_module.cc.

Referenced by produce().

std::string const NovaDDTHitProducer::raw_label_
private

Definition at line 45 of file NovaDDTHitProducer_module.cc.

Referenced by produce().

art::ServiceHandle<novaddt::WaveformProcessor> NovaDDTHitProducer::wpr
private

Definition at line 43 of file NovaDDTHitProducer_module.cc.

Referenced by produce().


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