Public Types | Public Member Functions | Static 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::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

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

Public Member Functions

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

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Static Public Attributes

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

Protected Member Functions

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

Private Member Functions

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

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

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

Definition at line 38 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 = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

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

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

Definition at line 161 of file Consumer.h.

References T.

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

Definition at line 171 of file Consumer.h.

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

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDFilter::currentContext ( ) const
protectedinherited
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
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

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

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

Definition at line 189 of file Consumer.h.

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

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

Definition at line 204 of file Consumer.h.

References T.

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

Definition at line 214 of file Consumer.h.

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

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

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

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

Member Data Documentation

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::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.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::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

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


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