Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
novaddt::Slicer3D Class Reference
Inheritance diagram for novaddt::Slicer3D:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 

Public Member Functions

 Slicer3D (fhicl::ParameterSet const &p)
 
virtual ~Slicer3D ()
 
virtual bool filter (art::Event &event)
 
void endJob () override
 
std::string workerType () const
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

void makeSlice (HitList &hits, std::vector< HitList > &hitlistcol)
 

Private Attributes

std::string _InputLabel
 
std::string _InputInstance
 
unsigned fMaxCellGap
 
unsigned fMinHit
 
int _nEvents = 0
 
int _nInputSlices = 0
 
int _nOutputSlices = 0
 
int _nHitsIn = 0
 
int _nHitsOut = 0
 

Detailed Description

Definition at line 26 of file Slicer3D_module.cc.

Member Typedef Documentation

Definition at line 19 of file EDFilter.h.

template<typename UserConfig >
using art::detail::Filter::Table = Modifier::Table<UserConfig>
inherited

Definition at line 29 of file Filter.h.

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

Definition at line 20 of file EDFilter.h.

Constructor & Destructor Documentation

novaddt::Slicer3D::Slicer3D ( fhicl::ParameterSet const &  p)
explicit

Definition at line 49 of file Slicer3D_module.cc.

50 :
51 _InputLabel (p.get< std::string >("InputLabel" )),
52 _InputInstance (p.get< std::string >("InputInstance")),
53 fMaxCellGap (p.get< int >("MaxCellGap" )),
54 fMinHit (p.get< int >("MinHit" ))
55 
56 // Initialize member data
57 {
58  // Call appropriate Produces<>() functions
59  produces<std::vector<HitList> >("Zuk3DSlicer");
60 }
const char * p
Definition: xmltok.h:285
std::string _InputLabel
std::string _InputInstance
enum BeamMode string
novaddt::Slicer3D::~Slicer3D ( )
virtual

Definition at line 62 of file Slicer3D_module.cc.

63 {
64  // Clean up dynamic memory and other resources here.
65 }

Member Function Documentation

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

Definition at line 55 of file ModuleBase.h.

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

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

Definition at line 69 of file ModuleBase.h.

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

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

Definition at line 62 of file ModuleBase.h.

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

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Filter::doBeginJob ( )
inherited
bool art::detail::Filter::doBeginRun ( RunPrincipal rp,
ModuleContext const &   
)
inherited
bool art::detail::Filter::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Filter::doEndJob ( )
inherited
bool art::detail::Filter::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited
void art::detail::Filter::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
void novaddt::Slicer3D::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 139 of file Slicer3D_module.cc.

References _nEvents, _nHitsIn, _nHitsOut, _nInputSlices, _nOutputSlices, om::cout, DEFINE_ART_MODULE(), and allTimeWatchdog::endl.

140 {
141  std::cout << "=== novaddt::Slicer3D end ===" << std::endl;
142  std::cout << "\t# of events: " << _nEvents << std::endl;
143  std::cout << "\t# of slices input: " << _nInputSlices << std::endl;
144  std::cout << "\t# of slices output: " << _nOutputSlices << std::endl;
145  std::cout << "\t# of hits input: " << _nHitsIn << std::endl;
146  std::cout << "\t# of hits output: " << _nHitsOut << std::endl;
147 }
OStream cout
Definition: OStream.cxx:6
bool novaddt::Slicer3D::filter ( art::Event event)
virtual

Implements art::EDFilter.

Definition at line 67 of file Slicer3D_module.cc.

References _InputInstance, _InputLabel, _nEvents, _nHitsIn, _nInputSlices, _nOutputSlices, fMinHit, hits(), MECModelEnuComparisons::i, makeSlice(), and daqchannelmap::X_VIEW.

68 {
69  _nEvents++;
70 
71  // Array of hitlists from event (input)
72  art::Handle<std::vector<HitList> > hit_lists; // from HitList
73  event.getByLabel(_InputLabel, _InputInstance, hit_lists);
74 
75  // Array of filtered hitlists (output)
76  std::unique_ptr< std::vector<HitList> >hitList_col(new std::vector<HitList>);
77 
78  // Loop over grouped hitlists (slices) to extract hitlists
79  for(unsigned int i=0; i < hit_lists->size(); ++i){
80  HitList xHits,yHits;
81 
82  _nInputSlices++;
83  HitList const &hits = hit_lists->at(i);
84  _nHitsIn += hits.size(); // # of hits in input .root file
85 
86  for (auto hit = hits.begin(); hit != hits.end(); ++hit) {
87 
88  //Check View:
89  if (hit->View().val == daqchannelmap::X_VIEW)
90  xHits.emplace_back(*hit);
91  else yHits.emplace_back(*hit);
92  }
93 
94  if (xHits.size()>=fMinHit) makeSlice(xHits,*hitList_col);
95  if (yHits.size()>=fMinHit) makeSlice(yHits,*hitList_col);
96 
97  } // End of hitlists loop
98 
99  // Add filtered hitlists to event
100  _nOutputSlices+=hitList_col->size();
101  event.put(std::move(hitList_col),"Zuk3DSlicer");
102 
103  return true;
104 }
std::vector< DAQHit > HitList
Definition: HitList.h:15
std::string _InputLabel
std::string _InputInstance
void makeSlice(HitList &hits, std::vector< HitList > &hitlistcol)
void hits()
Definition: readHits.C:15
Identifier for the X measuring view of the detector (top)
Definition: structs.h:12
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
void novaddt::Slicer3D::makeSlice ( HitList hits,
std::vector< HitList > &  hitlistcol 
)
private

Definition at line 106 of file Slicer3D_module.cc.

References _nHitsOut, fMaxCellGap, and fMinHit.

Referenced by filter().

107 {
108  //Sort this hitlist by cell (it is already sliced by plane and time)
109  std::sort(hits.begin(),hits.end(),CompareDAQHit<Cell>());
110 
111  auto itStart = hits.begin();
112  auto itEnd = hits.begin();
113 
114  while (itEnd != hits.end()) {
115  const unsigned endCell = (*itEnd).Cell().val;
116  ++itEnd;
117  const unsigned nextCell = (*itEnd).Cell().val;
118 
119  if (nextCell - endCell > fMaxCellGap) {
120  if (itEnd - itStart > fMinHit-2) {
121  HitList frag(itStart, itEnd);
122  _nHitsOut+=frag.size();
123  hitlistcol.push_back(frag);
124  }
125  itStart = itEnd;
126  }
127  }
128 
129  if (itEnd-itStart > fMinHit-2) {
130  HitList frag(itStart, itEnd);
131  _nHitsOut+=frag.size();
132  hitlistcol.push_back(frag);
133  }
134 
135 
136  return;
137 }
std::vector< DAQHit > HitList
Definition: HitList.h:15
void hits()
Definition: readHits.C:15
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

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

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

Definition at line 90 of file ModuleBase.h.

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

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

Definition at line 83 of file ModuleBase.h.

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

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDFilter::workerType ( ) const
inherited

Referenced by art::EDFilter::EDFilter().

Member Data Documentation

std::string novaddt::Slicer3D::_InputInstance
private

Definition at line 35 of file Slicer3D_module.cc.

Referenced by filter().

std::string novaddt::Slicer3D::_InputLabel
private

Definition at line 34 of file Slicer3D_module.cc.

Referenced by filter().

int novaddt::Slicer3D::_nEvents = 0
private

Definition at line 42 of file Slicer3D_module.cc.

Referenced by endJob(), and filter().

int novaddt::Slicer3D::_nHitsIn = 0
private

Definition at line 45 of file Slicer3D_module.cc.

Referenced by endJob(), and filter().

int novaddt::Slicer3D::_nHitsOut = 0
private

Definition at line 46 of file Slicer3D_module.cc.

Referenced by endJob(), and makeSlice().

int novaddt::Slicer3D::_nInputSlices = 0
private

Definition at line 43 of file Slicer3D_module.cc.

Referenced by endJob(), and filter().

int novaddt::Slicer3D::_nOutputSlices = 0
private

Definition at line 44 of file Slicer3D_module.cc.

Referenced by endJob(), and filter().

constexpr bool art::detail::Filter::Fail {false}
staticinherited

Definition at line 26 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().

unsigned novaddt::Slicer3D::fMaxCellGap
private

Definition at line 36 of file Slicer3D_module.cc.

Referenced by makeSlice().

unsigned novaddt::Slicer3D::fMinHit
private

Definition at line 37 of file Slicer3D_module.cc.

Referenced by filter(), and makeSlice().

constexpr bool art::detail::Filter::Pass {true}
staticinherited

Definition at line 25 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().


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