LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
nnet::RawWaveformClnSigDump Class Reference
Inheritance diagram for nnet::RawWaveformClnSigDump:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 RawWaveformClnSigDump (fhicl::ParameterSet const &p)
 
 RawWaveformClnSigDump (RawWaveformClnSigDump const &)=delete
 
 RawWaveformClnSigDump (RawWaveformClnSigDump &&)=delete
 
RawWaveformClnSigDumpoperator= (RawWaveformClnSigDump const &)=delete
 
RawWaveformClnSigDumpoperator= (RawWaveformClnSigDump &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 
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)
 
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)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResults > getTriggerResults (Event const &e) const
 
ConsumesCollector & consumesCollector ()
 
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 ()
 

Private Attributes

std::string fDumpWaveformsFileName
 
std::string fDumpCleanSignalFileName
 
std::string fSimulationProducerLabel
 producer that tracked simulated part. through detector More...
 
std::string fSimChannelLabel
 module that made simchannels More...
 
std::string fDigitModuleLabel
 module that made digits More...
 
std::string fCleanSignalDigitModuleLabel
 module that made the signal-only digits More...
 
bool fUseFullWaveform
 
unsigned int fShortWaveformSize
 
int fEstIndFWForOffset
 
int fEstColFWForOffset
 
std::string fSelectGenLabel
 
std::string fSelectProcID
 
int fSelectPDGCode
 
std::string fPlaneToDump
 
double fMinParticleEnergyGeV
 
double fMinEnergyDepositedMeV
 
int fMinNumberOfElectrons
 
int fMaxNumberOfElectrons
 
int fMinPureSignalADCs
 
bool fSaveSignal
 
int fMaxSignalChannelsPerEvent
 
int fMaxNoiseChannelsPerEvent
 
std::string fCollectionPlaneLabel
 
art::ServiceHandle< geo::Geometryfgeom
 
art::ServiceHandle< cheat::ParticleInventoryServicePIS
 
CLHEP::RandFlat fRandFlat
 
c2numpy_writer npywriter
 
c2numpy_writer npywriter2
 

Detailed Description

Definition at line 94 of file RawWaveformClnSigDump_module.cc.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

nnet::RawWaveformClnSigDump::RawWaveformClnSigDump ( fhicl::ParameterSet const &  p)
explicit

Definition at line 188 of file RawWaveformClnSigDump_module.cc.

References art::detail::EngineCreator::createEngine(), fCleanSignalDigitModuleLabel, fCollectionPlaneLabel, fDigitModuleLabel, fDumpCleanSignalFileName, fDumpWaveformsFileName, fEstColFWForOffset, fEstIndFWForOffset, fMaxNoiseChannelsPerEvent, fMaxNumberOfElectrons, fMaxSignalChannelsPerEvent, fMinEnergyDepositedMeV, fMinNumberOfElectrons, fMinParticleEnergyGeV, fMinPureSignalADCs, fPlaneToDump, fRandFlat, fSaveSignal, fSelectGenLabel, fSelectPDGCode, fSelectProcID, fShortWaveformSize, fSimChannelLabel, fSimulationProducerLabel, and fUseFullWaveform.

189  : EDAnalyzer{p}
190  , fDumpWaveformsFileName(p.get<std::string>("DumpWaveformsFileName", "dumpwaveforms"))
191  , fDumpCleanSignalFileName(p.get<std::string>("CleanSignalFileName", "dumpcleansignal"))
192  , fSimulationProducerLabel(p.get<std::string>("SimulationProducerLabel", "larg4Main"))
193  , fSimChannelLabel(p.get<std::string>("SimChannelLabel", "elecDrift"))
194  , fDigitModuleLabel(p.get<std::string>("DigitModuleLabel", "simWire"))
196  p.get<std::string>("CleanSignalDigitModuleLabel", "simWire:signal"))
197  , fUseFullWaveform(p.get<bool>("UseFullWaveform", true))
198  , fShortWaveformSize(p.get<unsigned int>("ShortWaveformSize"))
199  , fEstIndFWForOffset(p.get<int>("EstIndFWForOffset"))
200  , fEstColFWForOffset(p.get<int>("EstIndFWForOffset"))
201  , fSelectGenLabel(p.get<std::string>("SelectGenLabel", "ANY"))
202  , fSelectProcID(p.get<std::string>("SelectProcID", "ANY"))
203  , fSelectPDGCode(p.get<int>("SelectPDGCode", 0))
204  , fPlaneToDump(p.get<std::string>("PlaneToDump"))
205  , fMinParticleEnergyGeV(p.get<double>("MinParticleEnergyGeV", 0.))
206  , fMinEnergyDepositedMeV(p.get<double>("MinEnergyDepositedMeV", 0.))
207  , fMinNumberOfElectrons(p.get<int>("MinNumberOfElectrons", 600))
208  , fMaxNumberOfElectrons(p.get<int>("MaxNumberOfElectrons", -1))
209  , fMinPureSignalADCs(p.get<int>("MinPureSignalADCs", 0))
210  , fSaveSignal(p.get<bool>("SaveSignal", true))
211  , fMaxSignalChannelsPerEvent(p.get<int>("MaxSignalChannelsPerEvent", -1))
212  , fMaxNoiseChannelsPerEvent(p.get<int>("MaxNoiseChannelsPerEvent"))
213  , fCollectionPlaneLabel(p.get<std::string>("CollectionPlaneLabel"))
216  -> declareEngine(instanceName, p, "SeedForRawWaveformDump"),
217  "HepJamesRandom",
218  instanceName)}
219 {
220  if (std::getenv("CLUSTER") && std::getenv("PROCESS")) {
222  string(std::getenv("CLUSTER")) + "-" + string(std::getenv("PROCESS")) + "-";
224  string(std::getenv("CLUSTER")) + "-" + string(std::getenv("PROCESS")) + "-";
225  }
226 
227  if (fDigitModuleLabel.empty() && fCleanSignalDigitModuleLabel.empty()) {
228  throw cet::exception("RawWaveformClnSigDump")
229  << "Both DigitModuleLabel and CleanSignalModuleLabel are empty";
230  }
231 }
base_engine_t & createEngine(seed_t seed)
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
std::string fDigitModuleLabel
module that made digits
std::string fSimChannelLabel
module that made simchannels
std::string fSimulationProducerLabel
producer that tracked simulated part. through detector
std::string fCleanSignalDigitModuleLabel
module that made the signal-only digits
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
nnet::RawWaveformClnSigDump::RawWaveformClnSigDump ( RawWaveformClnSigDump const &  )
delete
nnet::RawWaveformClnSigDump::RawWaveformClnSigDump ( RawWaveformClnSigDump &&  )
delete

Member Function Documentation

void nnet::RawWaveformClnSigDump::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 316 of file RawWaveformClnSigDump_module.cc.

References util::abs(), WireSigInfo::adcpeak, raw::RawDigit::ADCs(), genFinder::add(), util::begin(), c2numpy_float32(), c2numpy_int16(), c2numpy_int32(), c2numpy_string(), c2numpy_uint16(), c2numpy_uint32(), raw::RawDigit::Channel(), raw::RawDigit::Compression(), DEFINE_ART_MODULE, simb::MCParticle::E(), WireSigInfo::edep, util::end(), art::EventID::event(), fCleanSignalDigitModuleLabel, fCollectionPlaneLabel, fDigitModuleLabel, fEstColFWForOffset, fEstIndFWForOffset, fgeom, art::fill_ptr_vector(), fMaxNoiseChannelsPerEvent, fMaxNumberOfElectrons, fMaxSignalChannelsPerEvent, fMinEnergyDepositedMeV, fMinNumberOfElectrons, fMinParticleEnergyGeV, fMinPureSignalADCs, fPlaneToDump, fRandFlat, fSaveSignal, fSelectGenLabel, fSelectPDGCode, fSelectProcID, fShortWaveformSize, fSimChannelLabel, fSimulationProducerLabel, fUseFullWaveform, WireSigInfo::genlab, genFinder::get_gen(), art::ProductRetriever::getByLabel(), art::ProductRetriever::getMany(), raw::RawDigit::GetPedestal(), art::ProductRetriever::getValidHandle(), art::Event::id(), raw::InvalidChannelID, npywriter, npywriter2, WireSigInfo::numel, WireSigInfo::pdgcode, simb::MCParticle::PdgCode(), PIS, simb::MCParticle::Process(), WireSigInfo::procid, art::EventID::run(), raw::RawDigit::Samples(), seed, art::EventID::subRun(), WireSigInfo::tdcmax, WireSigInfo::tdcmin, WireSigInfo::tdcpeak, cheat::ParticleInventoryService::TrackIdToEveTrackId(), cheat::ParticleInventoryService::TrackIdToMotherParticle(), raw::Uncompress(), geo::GeometryCore::View(), and geo::PlaneGeo::ViewName().

317 {
318  cout << "Event "
319  << " " << evt.id().run() << " " << evt.id().subRun() << " " << evt.id().event() << endl;
320 
321  std::unique_ptr<genFinder> gf(new genFinder());
322 
323  // ... Read in the digit List object(s).
325  std::vector<art::Ptr<raw::RawDigit>> rawdigitlist;
326  if (evt.getByLabel(fDigitModuleLabel, digitVecHandle)) {
327  //std::cout << " !!!! RawWaveformClnSigDump: fDigitModuleLabel -> " << fDigitModuleLabel << std::endl;
328  art::fill_ptr_vector(rawdigitlist, digitVecHandle);
329  }
330 
331  // ... Read in the signal-only digit List object(s).
333  std::vector<art::Ptr<raw::RawDigit>> rawdigitlist2;
334  if (evt.getByLabel(fCleanSignalDigitModuleLabel, digitVecHandle2)) {
335  //std::cout << " !!!! RawWaveformClnSigDump: fCleanSignalDigitModuleLabel -> " << fCleanSignalDigitModuleLabel << std::endl;
336  art::fill_ptr_vector(rawdigitlist2, digitVecHandle2);
337  }
338 
339  if (rawdigitlist.empty() && rawdigitlist2.empty()) return;
340 
341  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
342  auto const detProp =
344 
345  // ... Use the handle to get a particular (0th) element of collection.
346  unsigned int dataSize;
347  art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
348  dataSize = digitVec0->Samples(); //size of raw data vectors
349  if (dataSize != detProp.ReadOutWindowSize()) {
350  throw cet::exception("RawWaveformClnSigDump") << "Bad dataSize: " << dataSize;
351  }
352  art::Ptr<raw::RawDigit> digitVec20(digitVecHandle2, 0);
353  unsigned int dataSize2 = digitVec20->Samples();
354  if (dataSize != dataSize2) {
355  throw cet::exception("RawWaveformClnSigDump")
356  << "RawDigits from the 2 data products have different dataSizes: " << dataSize << "not eq to"
357  << dataSize2;
358  }
359 
360  // ... Build a map from channel number -> rawdigitVec
361  std::map<raw::ChannelID_t, art::Ptr<raw::RawDigit>> rawdigitMap;
362  raw::ChannelID_t chnum = raw::InvalidChannelID; // channel number
363  if (rawdigitlist.size()) {
364  for (size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter) {
365  art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
366  chnum = digitVec->Channel();
367  if (chnum == raw::InvalidChannelID) continue;
368  rawdigitMap[chnum] = digitVec;
369  }
370  }
371  std::map<raw::ChannelID_t, art::Ptr<raw::RawDigit>> rawdigitMap2;
372  raw::ChannelID_t chnum2 = raw::InvalidChannelID; // channel number
373  if (rawdigitlist2.size()) {
374  for (size_t rdIter = 0; rdIter < digitVecHandle2->size(); ++rdIter) {
375  art::Ptr<raw::RawDigit> digitVec2(digitVecHandle2, rdIter);
376  chnum2 = digitVec2->Channel();
377  if (chnum2 == raw::InvalidChannelID) continue;
378  rawdigitMap2[chnum2] = digitVec2;
379  }
380  }
381 
382  // ... Read in MC particle list
384  if (!evt.getByLabel(fSimulationProducerLabel, particleHandle)) {
385  throw cet::exception("AnalysisExample")
386  << " No simb::MCParticle objects in this event - "
387  << " Line " << __LINE__ << " in file " << __FILE__ << std::endl;
388  }
389 
390  // ... Read in sim channel list
391  auto simChannelHandle = evt.getValidHandle<std::vector<sim::SimChannel>>(fSimChannelLabel);
392 
393  if (!simChannelHandle->size()) return;
394 
395  // ... Create a map of track IDs to generator labels
396  //Get a list of generator names.
397  //std::vector<art::Handle<std::vector<simb::MCTruth>>> mcHandles;
398  //evt.getManyByType(mcHandles);
399  auto mcHandles = evt.getMany<std::vector<simb::MCTruth>>();
400  std::vector<std::pair<int, std::string>> track_id_to_label;
401 
402  for (auto const& mcHandle : mcHandles) {
403  const std::string& sModuleLabel = mcHandle.provenance()->moduleLabel();
405  std::vector<art::Ptr<simb::MCParticle>> mcParts = findMCParts.at(0);
406  for (const art::Ptr<simb::MCParticle> ptr : mcParts) {
407  int track_id = ptr->TrackId();
408  gf->add(track_id, sModuleLabel);
409  }
410  }
411 
412  std::string dummystr6 = "none ";
413  std::string dummystr7 = "none ";
414 
415  if (fSaveSignal) {
416  // .. create a channel number to trackid-wire signal info map
417  std::map<raw::ChannelID_t, std::map<int, WireSigInfo>> Ch2TrkWSInfoMap;
418 
419  // .. create a track ID to vector of channel numbers (in w/c this track deposited energy) map
420  std::map<int, std::vector<raw::ChannelID_t>> Trk2ChVecMap;
421 
422  // ... Loop over simChannels
423  for (auto const& channel : (*simChannelHandle)) {
424 
425  // .. get simChannel channel number
426  const raw::ChannelID_t ch1 = channel.Channel();
427  if (ch1 == raw::InvalidChannelID) continue;
428  if (geo::PlaneGeo::ViewName(fgeom->View(ch1)) != fPlaneToDump[0]) continue;
429 
430  bool selectThisChannel = false;
431 
432  // .. create a track ID to wire signal info map
433  std::map<int, WireSigInfo> Trk2WSInfoMap;
434 
435  // ... Loop over all ticks with ionization energy deposited
436  auto const& timeSlices = channel.TDCIDEMap();
437  for (auto const& timeSlice : timeSlices) {
438 
439  auto const& energyDeposits = timeSlice.second;
440  auto const tpctime = timeSlice.first;
441  unsigned int tdctick = static_cast<unsigned int>(clockData.TPCTDC2Tick(double(tpctime)));
442  if (tdctick < 0 || tdctick > (dataSize - 1)) continue;
443 
444  // ... Loop over all energy depositions in this tick
445  for (auto const& energyDeposit : energyDeposits) {
446 
447  if (!energyDeposit.trackID) continue;
448  int trkid = energyDeposit.trackID;
449  simb::MCParticle particle = PIS->TrackIdToMotherParticle(trkid);
450  //std::cout << energyDeposit.trackID << " " << trkid << " " << particle.TrackId() << std::endl;
451 
452  // .. ignore this energy deposition if incident particle energy below some threshold
453  if (particle.E() < fMinParticleEnergyGeV) continue;
454 
455  int eve_id = PIS->TrackIdToEveTrackId(trkid);
456  if (!eve_id) continue;
457  std::string genlab = gf->get_gen(eve_id);
458 
459  if (Trk2WSInfoMap.find(trkid) == Trk2WSInfoMap.end()) {
460  WireSigInfo wsinf;
461  wsinf.pdgcode = particle.PdgCode();
462  wsinf.genlab = genlab;
463  wsinf.procid = particle.Process();
464  wsinf.tdcmin = dataSize - 1;
465  wsinf.tdcmax = 0;
466  wsinf.tdcpeak = -1;
467  wsinf.adcpeak = 0;
468  wsinf.edep = 0.;
469  wsinf.numel = 0;
470  Trk2WSInfoMap.insert(std::pair<int, WireSigInfo>(trkid, wsinf));
471  }
472  if (tdctick < Trk2WSInfoMap.at(trkid).tdcmin) Trk2WSInfoMap.at(trkid).tdcmin = tdctick;
473  if (tdctick > Trk2WSInfoMap.at(trkid).tdcmax) Trk2WSInfoMap.at(trkid).tdcmax = tdctick;
474  Trk2WSInfoMap.at(trkid).edep += energyDeposit.energy;
475  Trk2WSInfoMap.at(trkid).numel += energyDeposit.numElectrons;
476  }
477  } // loop over timeSlices
478 
479  auto search2 = rawdigitMap2.find(ch1);
480  if (search2 == rawdigitMap2.end()) continue;
481  art::Ptr<raw::RawDigit> rawdig2 = (*search2).second;
482  std::vector<short> rawadc(dataSize);
483  raw::Uncompress(rawdig2->ADCs(), rawadc, rawdig2->GetPedestal(), rawdig2->Compression());
484  std::vector<short> adcvec2(dataSize);
485  for (size_t j = 0; j < rawadc.size(); ++j) {
486  adcvec2[j] = rawadc[j] - rawdig2->GetPedestal();
487  }
488 
489  if (!Trk2WSInfoMap.empty()) {
490  for (std::pair<int, WireSigInfo> itmap : Trk2WSInfoMap) {
491  // find the peak adc value in the signal-only raw digits within the range tdcmin->tdcmax
492  int pkadc = 0;
493  int pktdc = -1;
494  for (size_t i = itmap.second.tdcmin; i <= itmap.second.tdcmax; i++) {
495  if (abs(adcvec2[i]) > abs(pkadc)) {
496  pkadc = adcvec2[i];
497  pktdc = i;
498  }
499  }
500  Trk2WSInfoMap.at(itmap.first).tdcpeak = pktdc;
501  Trk2WSInfoMap.at(itmap.first).adcpeak = pkadc;
502 
503  if (fSelectGenLabel != "ANY") {
504  if (itmap.second.genlab != fSelectGenLabel) continue;
505  }
506  if (fSelectProcID != "ANY") {
507  if (itmap.second.procid != fSelectProcID) continue;
508  }
509  if (fSelectPDGCode != 0) {
510  if (itmap.second.pdgcode != fSelectPDGCode) continue;
511  }
512  itmap.second.genlab.resize(6, ' ');
513  itmap.second.procid.resize(7, ' ');
514  if (itmap.second.numel >= fMinNumberOfElectrons &&
515  itmap.second.edep >= fMinEnergyDepositedMeV && abs(pkadc) >= fMinPureSignalADCs) {
516  if (fMaxNumberOfElectrons >= 0 && itmap.second.numel >= fMaxNumberOfElectrons) {
517  continue;
518  }
519  else {
520  int trkid = itmap.first;
521  if (Trk2ChVecMap.find(trkid) == Trk2ChVecMap.end()) {
522  std::vector<raw::ChannelID_t> chvec;
523  Trk2ChVecMap.insert(std::pair<int, std::vector<raw::ChannelID_t>>(trkid, chvec));
524  }
525  Trk2ChVecMap.at(trkid).push_back(ch1);
526  selectThisChannel = true;
527  }
528  }
529  } // loop over Trk2WSinfoMap
530  if (selectThisChannel) {
531  Ch2TrkWSInfoMap.insert(
532  std::pair<raw::ChannelID_t, std::map<int, WireSigInfo>>(ch1, Trk2WSInfoMap));
533  }
534  } // if Trk2WSInfoMap not empty
535 
536  } // loop over SimChannels
537 
538  std::set<raw::ChannelID_t> selected_channels;
539 
540  // ... Now write out the signal waveforms for each track
541  if (!Trk2ChVecMap.empty()) {
542  // .. first put each pair of the map in a new vector of pairs, then randomly shuffle that vector;
543  // after that loop over the shuffled vector of pairs
544  using trk2chvecpair = std::pair<const int, std::vector<raw::ChannelID_t>>;
545  std::vector<const trk2chvecpair*> tchpv;
546  for (auto const& ittrk : Trk2ChVecMap) {
547  tchpv.emplace_back(&ittrk);
548  }
549  auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
550  std::shuffle(std::begin(tchpv), std::end(tchpv), std::mt19937(seed));
551 
552  int signalchancount = 0;
553  for (auto const& itpr : tchpv) {
554  if (signalchancount == fMaxSignalChannelsPerEvent) break;
555  int i = fRandFlat.fireInt(
556  itpr->second.size()); // randomly select one channel with a signal from this particle
557  chnum = itpr->second[i];
558 
559  if (not selected_channels.insert(chnum).second) { continue; }
560 
561  std::map<raw::ChannelID_t, std::map<int, WireSigInfo>>::iterator itchn;
562  itchn = Ch2TrkWSInfoMap.find(chnum);
563  if (itchn != Ch2TrkWSInfoMap.end()) {
564 
565  std::vector<short> adcvec(dataSize); // vector to hold zero-padded full waveform
566 
567  auto search = rawdigitMap.find(chnum);
568  if (search == rawdigitMap.end()) continue;
569  art::Ptr<raw::RawDigit> rawdig = (*search).second;
570  std::vector<short> rawadc(dataSize); // vector to hold uncompressed adc values later
571  raw::Uncompress(rawdig->ADCs(), rawadc, rawdig->GetPedestal(), rawdig->Compression());
572  for (size_t j = 0; j < rawadc.size(); ++j) {
573  adcvec[j] = rawadc[j] - rawdig->GetPedestal();
574  }
575 
576  std::vector<short> adcvec2(
577  dataSize); // vector to hold zero-padded full signal-only waveform
578 
579  auto search2 = rawdigitMap2.find(chnum);
580  if (search2 == rawdigitMap2.end()) continue;
581  art::Ptr<raw::RawDigit> rawdig2 = (*search2).second;
582  raw::Uncompress(rawdig2->ADCs(), rawadc, rawdig2->GetPedestal(), rawdig2->Compression());
583  for (size_t j = 0; j < rawadc.size(); ++j) {
584  adcvec2[j] = rawadc[j] - rawdig2->GetPedestal();
585  }
586 
587  // .. write out info for each peak
588  // a full waveform has at least one peak; the output will save up to 5 peaks (if there is
589  // only 1 peak, will fill the other 4 with 0);
590  // for fShortWaveformSize: only use the first peak's start_tick
591 
592  if (fUseFullWaveform) {
593 
594  c2numpy_uint32(&npywriter, evt.id().event());
595  c2numpy_uint32(&npywriter, chnum);
597  c2numpy_uint16(&npywriter, itchn->second.size()); // size of Trk2WSInfoMap, or #peaks
598  unsigned int icnt = 0;
599  for (auto& it : itchn->second) {
600  c2numpy_int32(&npywriter, it.first); // trackid
601  c2numpy_int32(&npywriter, it.second.pdgcode); // pdgcode
602  c2numpy_string(&npywriter, it.second.genlab.c_str()); // genlab
603  c2numpy_string(&npywriter, it.second.procid.c_str()); // procid
604  c2numpy_float32(&npywriter, it.second.edep); // edepo
605  c2numpy_uint32(&npywriter, it.second.numel); // numelec
606 
607  c2numpy_uint16(&npywriter, it.second.tdcmin); // stck1
608  c2numpy_uint16(&npywriter, it.second.tdcmax); // stck2
609  c2numpy_int32(&npywriter, it.second.tdcpeak); // pktdc
610  c2numpy_int32(&npywriter, it.second.adcpeak); // pkadc
611 
612  icnt++;
613  if (icnt == 5) break;
614  }
615 
616  // .. pad with 0's if number of peaks less than 5
617  for (unsigned int i = icnt; i < 5; ++i) {
620  c2numpy_string(&npywriter, dummystr6.c_str());
621  c2numpy_string(&npywriter, dummystr7.c_str());
628  }
629 
630  for (unsigned int itck = 0; itck < dataSize; ++itck) {
631  c2numpy_int16(&npywriter, adcvec[itck]);
632  }
633  for (unsigned int itck = 0; itck < dataSize; ++itck) {
634  c2numpy_int16(&npywriter2, adcvec2[itck]);
635  }
636  ++signalchancount;
637  }
638  else {
639 
640  // .. first loop to find largest signal
641  double EDep = 0.;
642  unsigned int TDCMin, TDCMax;
643  bool foundmaxsig = false;
644  for (auto& it : itchn->second) {
645  if (it.second.edep > EDep && it.second.adcpeak != 0 && it.second.numel > 0) {
646  EDep = it.second.edep;
647  TDCMin = it.second.tdcmin;
648  TDCMax = it.second.tdcmax;
649  foundmaxsig = true;
650  }
651  }
652  if (foundmaxsig) {
653  int sigtdc1, sigtdc2, sighwid, sigfwid, sigtdcm;
655  sigtdc1 = TDCMin - fEstIndFWForOffset / 2;
656  sigtdc2 = TDCMax + 3 * fEstIndFWForOffset / 2;
657  }
658  else {
659  sigtdc1 = TDCMin - fEstColFWForOffset / 2;
660  sigtdc2 = TDCMax + fEstColFWForOffset / 2;
661  }
662  sigfwid = sigtdc2 - sigtdc1;
663  sighwid = sigfwid / 2;
664  sigtdcm = sigtdc1 + sighwid;
665 
666  int start_tick = -1;
667  int end_tick = -1;
668  // .. set window edges to contain the largest signal
669  if (sigfwid < (int)fShortWaveformSize) {
670  // --> case 1: signal range fits within window
671  int dt = fShortWaveformSize - sigfwid;
672  start_tick = sigtdc1 - dt * fRandFlat.fire(0, 1);
673  }
674  else {
675  // --> case 2: signal range larger than window
676  int mrgn = fShortWaveformSize / 20;
677  int dt = fShortWaveformSize - 2 * mrgn;
678  start_tick = sigtdcm - mrgn - dt * fRandFlat.fire(0, 1);
679  }
680  if (start_tick < 0) start_tick = 0;
681  end_tick = start_tick + fShortWaveformSize - 1;
682  if (end_tick > int(dataSize - 1)) {
683  end_tick = dataSize - 1;
684  start_tick = end_tick - fShortWaveformSize + 1;
685  }
686 
687  c2numpy_uint32(&npywriter, evt.id().event());
688  c2numpy_uint32(&npywriter, chnum);
690 
691  // .. second loop to select only signals that are within the window
692 
693  int it_trk[5], it_pdg[5], it_nel[5], pk_tdc[5], pk_adc[5];
694  unsigned int stck_1[5], stck_2[5];
695  std::string it_glb[5], it_prc[5];
696  double it_edp[5];
697 
698  unsigned int icnt = 0;
699 
700  for (auto& it : itchn->second) {
701  if (abs(it.second.adcpeak) < fMinPureSignalADCs) continue;
702  if ((it.second.tdcmin >= (unsigned int)start_tick &&
703  it.second.tdcmin < (unsigned int)end_tick) ||
704  (it.second.tdcmax > (unsigned int)start_tick &&
705  it.second.tdcmax <= (unsigned int)end_tick)) {
706 
707  it_trk[icnt] = it.first;
708  it_pdg[icnt] = it.second.pdgcode;
709  it_glb[icnt] = it.second.genlab;
710  it_prc[icnt] = it.second.procid;
711  it_edp[icnt] = it.second.edep;
712  it_nel[icnt] = it.second.numel;
713 
714  unsigned int mintdc = it.second.tdcmin;
715  unsigned int maxtdc = it.second.tdcmax;
716  if (mintdc < (unsigned int)start_tick) mintdc = start_tick;
717  if (maxtdc > (unsigned int)end_tick) maxtdc = end_tick;
718 
719  stck_1[icnt] = mintdc - start_tick;
720  stck_2[icnt] = maxtdc - start_tick;
721  pk_tdc[icnt] = it.second.tdcpeak - start_tick;
722  pk_adc[icnt] = it.second.adcpeak;
723 
724  icnt++;
725  if (icnt == 5) break;
726  }
727  }
728 
729  c2numpy_uint16(&npywriter, icnt); // number of peaks
730 
731  for (unsigned int i = 0; i < icnt; ++i) {
732  c2numpy_int32(&npywriter, it_trk[i]); // trackid
733  c2numpy_int32(&npywriter, it_pdg[i]); // pdgcode
734  c2numpy_string(&npywriter, it_glb[i].c_str()); // genlab
735  c2numpy_string(&npywriter, it_prc[i].c_str()); // procid
736  c2numpy_float32(&npywriter, it_edp[i]); // edepo
737  c2numpy_uint32(&npywriter, it_nel[i]); // numelec
738  c2numpy_uint16(&npywriter, stck_1[i]); // stck1
739  c2numpy_uint16(&npywriter, stck_2[i]); // stck2
740  c2numpy_int32(&npywriter, pk_tdc[i]); // pktdc
741  c2numpy_int32(&npywriter, pk_adc[i]); // pkadc
742  }
743 
744  // .. pad with 0's if number of peaks less than 5
745  for (unsigned int i = icnt; i < 5; ++i) {
748  c2numpy_string(&npywriter, dummystr6.c_str());
749  c2numpy_string(&npywriter, dummystr7.c_str());
756  }
757 
758  for (unsigned int itck = start_tick; itck < (start_tick + fShortWaveformSize);
759  ++itck) {
760  c2numpy_int16(&npywriter, adcvec[itck]);
761  }
762  for (unsigned int itck = start_tick; itck < (start_tick + fShortWaveformSize);
763  ++itck) {
764  c2numpy_int16(&npywriter2, adcvec2[itck]);
765  }
766  ++signalchancount;
767  } // foundmaxsig
768  }
769  }
770  }
771  }
772  }
773  else {
774  //save noise
775  int noisechancount = 0;
776  std::map<raw::ChannelID_t, bool> signalMap;
777  for (auto const& channel : (*simChannelHandle)) {
778  signalMap[channel.Channel()] = true;
779  }
780  // .. create a vector for shuffling the wire channel indices
781  auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
782  std::vector<size_t> randigitmap;
783  for (size_t i = 0; i < rawdigitlist.size(); ++i)
784  randigitmap.push_back(i);
785  std::shuffle(randigitmap.begin(), randigitmap.end(), std::mt19937(seed));
786 
787  for (size_t rdIter = 0; rdIter < rawdigitlist.size(); ++rdIter) {
788 
789  if (noisechancount == fMaxNoiseChannelsPerEvent) break;
790 
791  std::vector<float> adcvec(dataSize); // vector to wire adc values
792 
793  size_t ranIdx = randigitmap[rdIter];
794  art::Ptr<raw::RawDigit> digitVec(digitVecHandle, ranIdx);
795  if (signalMap[digitVec->Channel()]) continue;
796 
797  std::vector<short> rawadc(dataSize); // vector to hold uncompressed adc values later
798  if (geo::PlaneGeo::ViewName(fgeom->View(digitVec->Channel())) != fPlaneToDump[0]) continue;
799  raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->GetPedestal(), digitVec->Compression());
800  for (size_t j = 0; j < rawadc.size(); ++j) {
801  adcvec[j] = rawadc[j] - digitVec->GetPedestal();
802  }
803  c2numpy_uint32(&npywriter, evt.id().event());
804  c2numpy_uint32(&npywriter, digitVec->Channel());
805  c2numpy_string(&npywriter, geo::PlaneGeo::ViewName(fgeom->View(digitVec->Channel())).c_str());
806 
807  c2numpy_uint16(&npywriter, 0); //number of peaks
808  for (unsigned int i = 0; i < 5; ++i) {
811  c2numpy_string(&npywriter, dummystr6.c_str());
812  c2numpy_string(&npywriter, dummystr7.c_str());
819  }
820 
821  if (fUseFullWaveform) {
822  for (unsigned int itck = 0; itck < dataSize; ++itck) {
823  c2numpy_int16(&npywriter, short(adcvec[itck]));
824  }
825  }
826  else {
827  int start_tick = int((dataSize - fShortWaveformSize) * fRandFlat.fire(0, 1));
828  for (unsigned int itck = start_tick; itck < (start_tick + fShortWaveformSize); ++itck) {
829  c2numpy_int16(&npywriter, short(adcvec[itck]));
830  }
831  }
832 
833  ++noisechancount;
834  }
835  std::cout << "Total number of noise channels " << noisechancount << std::endl;
836  }
837 }
double E(const int i=0) const
Definition: MCParticle.h:234
float GetPedestal() const
Definition: RawDigit.h:221
int c2numpy_int32(c2numpy_writer *writer, int32_t data)
Definition: c2numpy.h:298
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:209
int PdgCode() const
Definition: MCParticle.h:213
static std::string ViewName(geo::View_t view)
Returns the name of the specified view.
Definition: PlaneGeo.cxx:682
unsigned int event
Definition: DataStructs.h:627
unsigned int run
Definition: DataStructs.h:628
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::string Process() const
Definition: MCParticle.h:216
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
std::string fDigitModuleLabel
module that made digits
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
long seed
Definition: chem4.cc:67
int c2numpy_uint32(c2numpy_writer *writer, uint32_t data)
Definition: c2numpy.h:334
std::string fSimChannelLabel
module that made simchannels
std::string fSimulationProducerLabel
producer that tracked simulated part. through detector
int c2numpy_float32(c2numpy_writer *writer, float data)
Definition: c2numpy.h:369
art::ServiceHandle< geo::Geometry > fgeom
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
Definition: RawDigit.h:229
simb::MCParticle TrackIdToMotherParticle(int const id) const
View_t View(PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
int c2numpy_uint16(c2numpy_writer *writer, uint16_t data)
Definition: c2numpy.h:325
int c2numpy_int16(c2numpy_writer *writer, int16_t data)
Definition: c2numpy.h:289
unsigned int subRun
Definition: DataStructs.h:629
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
TCEvent evt
Definition: DataStructs.cxx:8
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::string fCleanSignalDigitModuleLabel
module that made the signal-only digits
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:744
int c2numpy_string(c2numpy_writer *writer, const char *data)
Definition: c2numpy.h:411
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
art::ServiceHandle< cheat::ParticleInventoryService > PIS
void nnet::RawWaveformClnSigDump::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 234 of file RawWaveformClnSigDump_module.cc.

References c2numpy_addcolumn(), C2NUMPY_FLOAT32, c2numpy_init(), C2NUMPY_INT16, C2NUMPY_INT32, C2NUMPY_STRING, C2NUMPY_UINT16, C2NUMPY_UINT32, fDumpCleanSignalFileName, fDumpWaveformsFileName, fShortWaveformSize, fUseFullWaveform, npywriter, and npywriter2.

235 {
236  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob();
237 
243 
244  for (unsigned int i = 0; i < 5; i++) {
245  std::ostringstream name;
246 
247  name.str("");
248  name << "tid" << i;
249  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_INT32);
250 
251  name.str("");
252  name << "pdg" << i;
253  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_INT32);
254 
255  name.str("");
256  name << "gen" << i;
257  c2numpy_addcolumn(&npywriter, name.str().c_str(), (c2numpy_type)((int)C2NUMPY_STRING + 6));
258 
259  name.str("");
260  name << "pid" << i;
261  c2numpy_addcolumn(&npywriter, name.str().c_str(), (c2numpy_type)((int)C2NUMPY_STRING + 7));
262 
263  name.str("");
264  name << "edp" << i;
265  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_FLOAT32);
266 
267  name.str("");
268  name << "nel" << i;
269  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_UINT32);
270 
271  name.str("");
272  name << "sti" << i;
273  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_UINT16);
274 
275  name.str("");
276  name << "stf" << i;
277  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_UINT16);
278 
279  name.str("");
280  name << "stp" << i;
281  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_INT32);
282 
283  name.str("");
284  name << "adc" << i;
285  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_INT32);
286  }
287 
288  for (unsigned int i = 0;
289  i < (fUseFullWaveform ? detProp.ReadOutWindowSize() : fShortWaveformSize);
290  i++) {
291  std::ostringstream name;
292  name << "tck_" << i;
293  c2numpy_addcolumn(&npywriter, name.str().c_str(), C2NUMPY_INT16);
294  }
295 
296  // ... this is for storing the clean signal (no noise) waveform
298 
299  for (unsigned int i = 0;
300  i < (fUseFullWaveform ? detProp.ReadOutWindowSize() : fShortWaveformSize);
301  i++) {
302  std::ostringstream name;
303  name << "tck_" << i;
304  c2numpy_addcolumn(&npywriter2, name.str().c_str(), C2NUMPY_INT16);
305  }
306 }
int c2numpy_init(c2numpy_writer *writer, const std::string outputFilePrefix, int32_t numRowsPerFile)
Definition: c2numpy.h:140
c2numpy_type
Definition: c2numpy.h:29
int c2numpy_addcolumn(c2numpy_writer *writer, const std::string name, c2numpy_type type)
Definition: c2numpy.h:157
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

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

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

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

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
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 68 of file ModuleBase.h.

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

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Analyzer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 25 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

26  {
27  setupQueues(resources);
28  ProcessingFrame const frame{ScheduleID{}};
29  beginJobWithFrame(frame);
30  }
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual void setupQueues(SharedResources const &)=0
bool art::detail::Analyzer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 68 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

69  {
70  ProcessingFrame const frame{mc.scheduleID()};
71  beginRunWithFrame(std::as_const(rp).makeRun(mc), frame);
72  return true;
73  }
virtual void beginRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 84 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

85  {
86  ProcessingFrame const frame{mc.scheduleID()};
87  beginSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
88  return true;
89  }
virtual void beginSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doEndJob ( )
inherited

Definition at line 33 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

34  {
35  ProcessingFrame const frame{ScheduleID{}};
36  endJobWithFrame(frame);
37  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 76 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

77  {
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(std::as_const(rp).makeRun(mc), frame);
80  return true;
81  }
virtual void endRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 92 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

93  {
94  ProcessingFrame const frame{mc.scheduleID()};
95  endSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
96  return true;
97  }
virtual void endSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::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

Definition at line 100 of file Analyzer.cc.

References e, and art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

105  {
106  auto const e = std::as_const(ep).makeEvent(mc);
107  if (wantEvent(mc.scheduleID(), e)) {
108  ++counts_run;
109  ProcessingFrame const frame{mc.scheduleID()};
110  analyzeWithFrame(e, frame);
111  ++counts_passed;
112  }
113  return true;
114  }
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
Float_t e
Definition: plot.C:35
virtual void analyzeWithFrame(Event const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 47 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

48  {
49  ProcessingFrame const frame{ScheduleID{}};
51  }
TFile fb("Li6.root")
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 61 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

62  {
63  ProcessingFrame const frame{ScheduleID{}};
65  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Analyzer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 40 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

41  {
42  ProcessingFrame const frame{ScheduleID{}};
44  }
TFile fb("Li6.root")
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 54 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

55  {
56  ProcessingFrame const frame{ScheduleID{}};
58  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void nnet::RawWaveformClnSigDump::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 309 of file RawWaveformClnSigDump_module.cc.

References c2numpy_close(), npywriter, and npywriter2.

310 {
313 }
int c2numpy_close(c2numpy_writer *writer)
Definition: c2numpy.h:425
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
Handle< TriggerResults > art::Observer::getTriggerResults ( Event const &  e) const
protectedinherited

Definition at line 75 of file Observer.cc.

References art::ProductRetriever::get(), and art::Observer::selectors_.

Referenced by art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

76  {
77  if (selectors_) {
78  return selectors_->getOneTriggerResults(e);
79  }
80 
81  // The following applies for cases where no SelectEvents entries
82  // exist.
83  Handle<TriggerResults> h;
84  if (e.get(empty_process_name, h)) {
85  return h;
86  }
87  return Handle<TriggerResults>{};
88  }
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

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

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

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

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
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 89 of file ModuleBase.h.

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

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
RawWaveformClnSigDump& nnet::RawWaveformClnSigDump::operator= ( RawWaveformClnSigDump const &  )
delete
RawWaveformClnSigDump& nnet::RawWaveformClnSigDump::operator= ( RawWaveformClnSigDump &&  )
delete
string const & art::Observer::processName ( ) const
protectedinherited

Definition at line 57 of file Observer.cc.

References art::Observer::process_name_.

Referenced by art::FileDumperOutput::printPrincipal().

58  {
59  return process_name_;
60  }
std::string process_name_
Definition: Observer.h:76
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)
bool art::Observer::wantAllEvents ( ) const
inlineprotectednoexceptinherited

Definition at line 31 of file Observer.h.

References e, art::Observer::getTriggerResults(), art::Observer::wantAllEvents_, and art::Observer::wantEvent().

32  {
33  return wantAllEvents_;
34  }
bool wantAllEvents_
Definition: Observer.h:75
bool art::Observer::wantEvent ( ScheduleID  id,
Event const &  e 
) const
protectedinherited

Definition at line 63 of file Observer.cc.

References art::Observer::rejectors_, art::Observer::selectors_, and art::Observer::wantAllEvents_.

Referenced by art::OutputModule::doEvent(), art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

64  {
65  if (wantAllEvents_) {
66  return true;
67  }
68  bool const select_event = selectors_ ? selectors_->matchEvent(id, e) : true;
69  bool const reject_event =
70  rejectors_ ? rejectors_->matchEvent(id, e) : false;
71  return select_event and not reject_event;
72  }
bool wantAllEvents_
Definition: Observer.h:75
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79

Member Data Documentation

std::string nnet::RawWaveformClnSigDump::fCleanSignalDigitModuleLabel
private

module that made the signal-only digits

Definition at line 120 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fCollectionPlaneLabel
private

Definition at line 138 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fDigitModuleLabel
private

module that made digits

Definition at line 119 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fDumpCleanSignalFileName
private

Definition at line 115 of file RawWaveformClnSigDump_module.cc.

Referenced by beginJob(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fDumpWaveformsFileName
private

Definition at line 114 of file RawWaveformClnSigDump_module.cc.

Referenced by beginJob(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fEstColFWForOffset
private

Definition at line 124 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fEstIndFWForOffset
private

Definition at line 123 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

art::ServiceHandle<geo::Geometry> nnet::RawWaveformClnSigDump::fgeom
private

Definition at line 139 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze().

int nnet::RawWaveformClnSigDump::fMaxNoiseChannelsPerEvent
private

Definition at line 137 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fMaxNumberOfElectrons
private

Definition at line 133 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fMaxSignalChannelsPerEvent
private

Definition at line 136 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

double nnet::RawWaveformClnSigDump::fMinEnergyDepositedMeV
private

Definition at line 131 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fMinNumberOfElectrons
private

Definition at line 132 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

double nnet::RawWaveformClnSigDump::fMinParticleEnergyGeV
private

Definition at line 130 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fMinPureSignalADCs
private

Definition at line 134 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fPlaneToDump
private

Definition at line 129 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

CLHEP::RandFlat nnet::RawWaveformClnSigDump::fRandFlat
private

Definition at line 142 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

bool nnet::RawWaveformClnSigDump::fSaveSignal
private

Definition at line 135 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fSelectGenLabel
private

Definition at line 126 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

int nnet::RawWaveformClnSigDump::fSelectPDGCode
private

Definition at line 128 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fSelectProcID
private

Definition at line 127 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

unsigned int nnet::RawWaveformClnSigDump::fShortWaveformSize
private

Definition at line 122 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), beginJob(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fSimChannelLabel
private

module that made simchannels

Definition at line 118 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

std::string nnet::RawWaveformClnSigDump::fSimulationProducerLabel
private

producer that tracked simulated part. through detector

Definition at line 117 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), and RawWaveformClnSigDump().

bool nnet::RawWaveformClnSigDump::fUseFullWaveform
private

Definition at line 121 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), beginJob(), and RawWaveformClnSigDump().

c2numpy_writer nnet::RawWaveformClnSigDump::npywriter
private

Definition at line 144 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), beginJob(), and endJob().

c2numpy_writer nnet::RawWaveformClnSigDump::npywriter2
private

Definition at line 145 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze(), beginJob(), and endJob().

art::ServiceHandle<cheat::ParticleInventoryService> nnet::RawWaveformClnSigDump::PIS
private

Definition at line 140 of file RawWaveformClnSigDump_module.cc.

Referenced by analyze().


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