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

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 LArNuCVNZlibMaker (fhicl::ParameterSet const &pset)
 
 ~LArNuCVNZlibMaker ()
 
void beginJob ()
 
void endSubRun (art::SubRun const &sr)
 
void analyze (const art::Event &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
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

template<class T >
void write_files (LArTrainingData< T > td, std::string evtid)=delete
 
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 ()
 

Protected Attributes

std::string fOutputDir
 
std::string fPixelMapInput
 
bool fSetLog
 
std::vector< bool > fReverseViews
 
unsigned int fPlaneLimit
 
unsigned int fTDCLimit
 
std::string out_dir
 
CVNImageUtils fImage
 

Private Member Functions

void write_files (LArTrainingNuData td, std::string evtid)
 

Private Attributes

unsigned int fTopologyHitsCut
 
std::string fGenieGenModuleLabel
 
bool fApplyFidVol
 
std::vector< double > fFidMinCoords
 
std::vector< double > fFidMaxCoords
 
TH1D * hPOT
 
double fPOT
 
int fRun
 
int fSubRun
 

Detailed Description

Definition at line 55 of file LArNuCVNZlibMaker_module.cc.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

lcvn::LArNuCVNZlibMaker::LArNuCVNZlibMaker ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 81 of file LArNuCVNZlibMaker_module.cc.

References reconfigure().

81  : ICVNZlibMaker(pset)
82  {
83  this->reconfigure(pset);
84  }
ICVNZlibMaker(fhicl::ParameterSet const &pset)
void reconfigure(const fhicl::ParameterSet &pset)
lcvn::LArNuCVNZlibMaker::~LArNuCVNZlibMaker ( )

Definition at line 87 of file LArNuCVNZlibMaker_module.cc.

87 {}

Member Function Documentation

void lcvn::LArNuCVNZlibMaker::analyze ( const art::Event evt)

Definition at line 127 of file LArNuCVNZlibMaker_module.cc.

References simb::MCParticle::E(), simb::MCParticle::EndPosition(), art::Event::event(), fApplyFidVol, fFidMaxCoords, fFidMinCoords, fGenieGenModuleLabel, art::fill_ptr_vector(), lcvn::ICVNZlibMaker::fPixelMapInput, fTopologyHitsCut, art::ProductRetriever::getHandle(), lcvn::AssignLabels::GetInteractionType(), simb::MCTruth::GetNeutrino(), lcvn::AssignLabels::GetNNeutrons(), lcvn::AssignLabels::GetNPions(), lcvn::AssignLabels::GetNPizeros(), lcvn::AssignLabels::GetNProtons(), lcvn::AssignLabels::GetPDG(), lcvn::AssignLabels::GetTopology(), lcvn::AssignLabels::GetTopologyType(), lcvn::AssignLabels::GetTopologyTypeAlt(), lcvn::interaction, lcvn::kOther, simb::MCNeutrino::Lepton(), simb::MCNeutrino::Nu(), art::Event::run(), lcvn::TDNuInfo::SetTopologyInformation(), lcvn::TDNuInfo::SetTruthInfo(), art::Event::subRun(), util::to_string(), and write_files().

128  {
129 
130  // Get the pixel maps
131  std::vector<art::Ptr<lcvn::PixelMap>> pixelmaps;
133  auto h_pixelmaps = evt.getHandle<std::vector<lcvn::PixelMap>>(itag1);
134  if (h_pixelmaps) art::fill_ptr_vector(pixelmaps, h_pixelmaps);
135 
136  // If no pixel maps, quit
137  if (pixelmaps.size() == 0) return;
138 
140 
141  // MC information
142  std::vector<art::Ptr<simb::MCTruth>> mctruth_list;
143  auto h_mctruth = evt.getHandle<std::vector<simb::MCTruth>>(fGenieGenModuleLabel);
144  if (h_mctruth) art::fill_ptr_vector(mctruth_list, h_mctruth);
145 
146  art::Ptr<simb::MCTruth> mctruth = mctruth_list[0];
147  simb::MCNeutrino true_neutrino = mctruth->GetNeutrino();
148 
149  // Hard-coding event weight for now
150  // Should probably fix this at some point
151  double event_weight = 1.;
152 
153  AssignLabels labels;
154 
155  interaction = labels.GetInteractionType(true_neutrino);
156  labels.GetTopology(mctruth, fTopologyHitsCut);
157 
158  // True lepton and neutrino energies
159  float nu_energy = true_neutrino.Nu().E();
160  float lep_energy = true_neutrino.Lepton().E();
161 
162  // Put a containment cut here
163  // If outside the fiducial volume don't waste any time filling other variables
164  if (fApplyFidVol) {
165  // Get the interaction vertex from the end point of the neutrino. This is
166  // because the start point of the lepton doesn't make sense for taus as they
167  // are decayed by the generator and not GEANT
168  TVector3 vtx = true_neutrino.Nu().EndPosition().Vect();
169  bool isFid = (vtx.X() > fFidMinCoords[0] && vtx.X() < fFidMaxCoords[0]) &&
170  (vtx.Y() > fFidMinCoords[1] && vtx.Y() < fFidMaxCoords[1]) &&
171  (vtx.Z() > fFidMinCoords[2] && vtx.Z() < fFidMaxCoords[2]);
172  if (!isFid) return;
173  }
174 
175  TDNuInfo info;
176  info.SetTruthInfo(nu_energy, lep_energy, 0., event_weight);
177  info.SetTopologyInformation(labels.GetPDG(),
178  labels.GetNProtons(),
179  labels.GetNPions(),
180  labels.GetNPizeros(),
181  labels.GetNNeutrons(),
182  labels.GetTopologyType(),
183  labels.GetTopologyTypeAlt());
184 
185  LArTrainingNuData train(interaction, *pixelmaps[0], info);
186 
187  std::string evtid = "r" + std::to_string(evt.run()) + "_s" + std::to_string(evt.subRun()) +
188  "_e" + std::to_string(evt.event()) + "_h" + std::to_string(time(0));
189  this->write_files(train, evtid);
190  }
double E(const int i=0) const
Definition: MCParticle.h:234
LArTrainingData< lcvn::TDNuInfo > LArTrainingNuData
SubRunNumber_t subRun() const
Definition: Event.cc:35
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
const TLorentzVector & EndPosition() const
Definition: MCParticle.h:226
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
std::vector< double > fFidMinCoords
std::vector< double > fFidMaxCoords
const simb::MCParticle & Lepton() const
Definition: MCNeutrino.h:147
std::string fPixelMapInput
Definition: ICVNZlibMaker.h:65
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Something else. Tau? Hopefully we don&#39;t use this.
EventNumber_t event() const
Definition: Event.cc:41
void write_files(LArTrainingNuData td, std::string evtid)
Handle< PROD > getHandle(SelectorBase const &) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
RunNumber_t run() const
Definition: Event.cc:29
Event generator information.
Definition: MCNeutrino.h:18
void lcvn::LArNuCVNZlibMaker::beginJob ( )
virtual

Reimplemented from lcvn::ICVNZlibMaker.

Definition at line 118 of file LArNuCVNZlibMaker_module.cc.

References lcvn::ICVNZlibMaker::beginJob(), and hPOT.

119  {
121 
123  hPOT = tfs->make<TH1D>("TotalPOT", "Total POT;; POT", 1, 0, 1);
124  }
void beginJob() override
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 lcvn::LArNuCVNZlibMaker::endSubRun ( art::SubRun const &  sr)
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 102 of file LArNuCVNZlibMaker_module.cc.

References fPOT, fRun, fSubRun, art::ProductRetriever::getByLabel(), hPOT, if(), art::SubRun::run(), art::SubRun::subRun(), and sumdata::POTSummary::totpot.

103  {
104 
105  std::string fPOTModuleLabel = "generator";
106  fRun = sr.run();
107  fSubRun = sr.subRun();
108 
109  art::Handle<sumdata::POTSummary> potListHandle;
110  if (sr.getByLabel(fPOTModuleLabel, potListHandle))
111  fPOT = potListHandle->totpot;
112  else
113  fPOT = 0.;
114  if (hPOT) hPOT->Fill(0.5, fPOT);
115  }
if(nlines<=0)
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
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 lcvn::LArNuCVNZlibMaker::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 90 of file LArNuCVNZlibMaker_module.cc.

References fApplyFidVol, fFidMaxCoords, fFidMinCoords, fGenieGenModuleLabel, fTopologyHitsCut, fhicl::ParameterSet::get(), and lcvn::ICVNZlibMaker::reconfigure().

Referenced by LArNuCVNZlibMaker().

91  {
93 
94  fTopologyHitsCut = pset.get<unsigned int>("TopologyHitsCut");
95  fGenieGenModuleLabel = pset.get<std::string>("GenieGenModuleLabel");
96  fApplyFidVol = pset.get<bool>("ApplyFidVol");
97  fFidMinCoords = pset.get<std::vector<double>>("FidMinCoords");
98  fFidMaxCoords = pset.get<std::vector<double>>("FidMaxCoords");
99  }
std::vector< double > fFidMinCoords
std::vector< double > fFidMaxCoords
void reconfigure(const fhicl::ParameterSet &pset)
T get(std::string const &key) const
Definition: ParameterSet.h:314
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
void lcvn::LArNuCVNZlibMaker::write_files ( LArTrainingNuData  td,
std::string  evtid 
)
private

Definition at line 193 of file LArNuCVNZlibMaker_module.cc.

References lcvn::CVNImageUtils::ConvertPixelMapToPixelArray(), DEFINE_ART_MODULE, art::errors::FileOpenError, lcvn::ICVNZlibMaker::fImage, lcvn::LArTrainingData< T >::fInfo, lcvn::LArTrainingData< T >::fInt, lcvn::ICVNZlibMaker::fPlaneLimit, lcvn::LArTrainingData< T >::fPMap, lcvn::ICVNZlibMaker::fTDCLimit, lcvn::PixelMap::GetTotHits(), lcvn::PixelMap::NTdc(), lcvn::PixelMap::NWire(), lcvn::ICVNZlibMaker::out_dir, and lcvn::CVNImageUtils::SetPixelMapSize().

Referenced by analyze().

194  {
195  // cropped from 2880 x 500 to 500 x 500 here
196  std::vector<unsigned char> pixel_array(3 * fPlaneLimit * fTDCLimit);
197 
198  fImage.SetPixelMapSize(td.fPMap.NWire(), td.fPMap.NTdc());
199  fImage.ConvertPixelMapToPixelArray(td.fPMap, pixel_array);
200 
201  ulong src_len = 3 * fPlaneLimit * fTDCLimit; // pixelArray length
202  ulong dest_len = compressBound(src_len); // calculate size of the compressed data
203  char* ostream = (char*)malloc(dest_len); // allocate memory for the compressed data
204 
205  int res = compress((Bytef*)ostream, &dest_len, (Bytef*)&pixel_array[0], src_len);
206 
207  // Buffer error
208 
209  if (res == Z_BUF_ERROR) std::cout << "Buffer too small!" << std::endl;
210 
211  // Memory error
212  else if (res == Z_MEM_ERROR)
213  std::cout << "Not enough memory for compression!" << std::endl;
214 
215  // Compression ok
216  else {
217 
218  // Create output files
219  std::string image_file_name = out_dir + "/event_" + evtid + ".gz";
220  std::string info_file_name = out_dir + "/event_" + evtid + ".info";
221 
222  std::ofstream image_file(image_file_name, std::ofstream::binary);
223  std::ofstream info_file(info_file_name);
224 
225  if (image_file.is_open() && info_file.is_open()) {
226 
227  // Write compressed data to file
228 
229  image_file.write(ostream, dest_len);
230 
231  image_file.close(); // close file
232 
233  // Write records to file
234 
235  // Category
236 
237  info_file << td.fInt << std::endl;
238  info_file << td.fInfo << std::endl;
239  info_file << td.fPMap.GetTotHits() << std::endl;
240 
241  info_file.close(); // close file
242  }
243  else {
244 
245  if (image_file.is_open())
246  image_file.close();
247  else
249  << "Unable to open file " << image_file_name << "!" << std::endl;
250 
251  if (info_file.is_open())
252  info_file.close();
253  else
255  << "Unable to open file " << info_file_name << "!" << std::endl;
256  }
257  }
258 
259  free(ostream); // free allocated memory
260 
261  } // lcvn::LArNuCVNZlibMaker::write_files
unsigned int fTDCLimit
Definition: ICVNZlibMaker.h:69
std::string out_dir
Definition: ICVNZlibMaker.h:71
void ConvertPixelMapToPixelArray(const PixelMap &pm, std::vector< unsigned char > &pix)
Convert a Pixel Map object into a single pixel array with an image size nWire x nTDC.
void SetPixelMapSize(unsigned int nWires, unsigned int nTDCs)
Set the input pixel map size.
unsigned int fPlaneLimit
Definition: ICVNZlibMaker.h:68
CVNImageUtils fImage
Definition: ICVNZlibMaker.h:72
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
template<class T >
void lcvn::ICVNZlibMaker::write_files ( LArTrainingData< T >  td,
std::string  evtid 
)
protecteddeleteinherited

Member Data Documentation

bool lcvn::LArNuCVNZlibMaker::fApplyFidVol
private

Definition at line 68 of file LArNuCVNZlibMaker_module.cc.

Referenced by analyze(), and reconfigure().

std::vector<double> lcvn::LArNuCVNZlibMaker::fFidMaxCoords
private

Definition at line 70 of file LArNuCVNZlibMaker_module.cc.

Referenced by analyze(), and reconfigure().

std::vector<double> lcvn::LArNuCVNZlibMaker::fFidMinCoords
private

Definition at line 69 of file LArNuCVNZlibMaker_module.cc.

Referenced by analyze(), and reconfigure().

std::string lcvn::LArNuCVNZlibMaker::fGenieGenModuleLabel
private

Definition at line 67 of file LArNuCVNZlibMaker_module.cc.

Referenced by analyze(), and reconfigure().

CVNImageUtils lcvn::ICVNZlibMaker::fImage
protectedinherited

Definition at line 72 of file ICVNZlibMaker.h.

Referenced by lcvn::ICVNZlibMaker::beginJob(), and write_files().

std::string lcvn::ICVNZlibMaker::fOutputDir
protectedinherited
std::string lcvn::ICVNZlibMaker::fPixelMapInput
protectedinherited

Definition at line 65 of file ICVNZlibMaker.h.

Referenced by analyze(), and lcvn::ICVNZlibMaker::reconfigure().

unsigned int lcvn::ICVNZlibMaker::fPlaneLimit
protectedinherited
double lcvn::LArNuCVNZlibMaker::fPOT
private

Definition at line 75 of file LArNuCVNZlibMaker_module.cc.

Referenced by endSubRun().

std::vector<bool> lcvn::ICVNZlibMaker::fReverseViews
protectedinherited
int lcvn::LArNuCVNZlibMaker::fRun
private

Definition at line 76 of file LArNuCVNZlibMaker_module.cc.

Referenced by endSubRun().

bool lcvn::ICVNZlibMaker::fSetLog
protectedinherited
int lcvn::LArNuCVNZlibMaker::fSubRun
private

Definition at line 77 of file LArNuCVNZlibMaker_module.cc.

Referenced by endSubRun().

unsigned int lcvn::ICVNZlibMaker::fTDCLimit
protectedinherited
unsigned int lcvn::LArNuCVNZlibMaker::fTopologyHitsCut
private

Definition at line 66 of file LArNuCVNZlibMaker_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* lcvn::LArNuCVNZlibMaker::hPOT
private

Definition at line 74 of file LArNuCVNZlibMaker_module.cc.

Referenced by beginJob(), and endSubRun().

std::string lcvn::ICVNZlibMaker::out_dir
protectedinherited

Definition at line 71 of file ICVNZlibMaker.h.

Referenced by lcvn::ICVNZlibMaker::beginJob(), and write_files().


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