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::SingletonRejection Class Reference
Inheritance diagram for novaddt::SingletonRejection:
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

 SingletonRejection (fhicl::ParameterSet const &p)
 
virtual ~SingletonRejection ()
 
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 filterNoise (art::Handle< novaddt::HitList > &hits, std::unique_ptr< novaddt::HitList > &product)
 

Private Attributes

std::string fInputLabel
 
std::string fInputInstance
 
int fMinCellSep
 
int fMinPlaneSep
 
int fMinTDCSep
 
int _nEvents = 0
 
int _nHitsIn = 0
 
int _nHitsOut = 0
 

Detailed Description

Definition at line 31 of file SingletonRejection_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::SingletonRejection::SingletonRejection ( fhicl::ParameterSet const &  p)
explicit

Definition at line 52 of file SingletonRejection_module.cc.

References om::cout, allTimeWatchdog::endl, fInputInstance, fInputLabel, fMinCellSep, fMinPlaneSep, and fMinTDCSep.

53 :
54 fInputLabel (p.get< std::string >("InputLabel" )),
55 fInputInstance (p.get< std::string >("InputInstance")),
56 fMinCellSep (p.get< int >("MinCellSep" )),
57 fMinPlaneSep (p.get< int >("MinPlaneSep" )),
58 fMinTDCSep (p.get< int >("MinTDCSep" ))
59 // Initialize member data
60 {
61  std::cout << "--- novaddt::SingletonRejection begin" << std::endl;
62  std::cout << "\t Input hitlists label: " << fInputLabel << std::endl;
63  std::cout << "\t Input hitlists instance " << fInputInstance << std::endl;
64  std::cout << "\t Min X or Y separation: " << fMinCellSep << std::endl;
65  std::cout << "\t Min Z separation: " << fMinPlaneSep << std::endl;
66  std::cout << "\t Min time separation: " << fMinTDCSep << std::endl;
67 
68  // Call appropriate Produces<>() functions
69  produces<novaddt::HitList>("SingletonRejected");
70 }
const char * p
Definition: xmltok.h:285
OStream cout
Definition: OStream.cxx:6
enum BeamMode string
novaddt::SingletonRejection::~SingletonRejection ( )
virtual

Definition at line 72 of file SingletonRejection_module.cc.

73 {
74  // Clean up dynamic memory and other resources here.
75 }

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::SingletonRejection::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 151 of file SingletonRejection_module.cc.

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

152 {
153  std::cout << "--- novaddt::SingletonRejection end " << std::endl;
154  std::cout << "\t# of events: " << _nEvents << std::endl;
155  std::cout << "\t# of hits input: " << _nHitsIn << std::endl;
156  std::cout << "\t# of hits output: " << _nHitsOut << std::endl;
157 }
OStream cout
Definition: OStream.cxx:6
bool novaddt::SingletonRejection::filter ( art::Event event)
virtual

Implements art::EDFilter.

Definition at line 77 of file SingletonRejection_module.cc.

References _nEvents, _nHitsIn, _nHitsOut, filterNoise(), fInputInstance, fInputLabel, and hits().

78 {
79  _nEvents++;
80 
81  // Array of hitlist from event (input)
83  event.getByLabel(fInputLabel, fInputInstance, hits);
84  _nHitsIn+=hits->size();
85 
86  // Array of filtered hits (output)
87  std::unique_ptr< novaddt::HitList >final_product(new novaddt::HitList);
88 
89  // Remove noise
90  filterNoise(hits, final_product);
91 
92 
93  // Add filtered hitlists to event
94  _nHitsOut+=final_product->size();
95  event.put(std::move(final_product),"SingletonRejected");
96 
97  return true;
98 }
void filterNoise(art::Handle< novaddt::HitList > &hits, std::unique_ptr< novaddt::HitList > &product)
std::vector< DAQHit > HitList
Definition: HitList.h:15
void hits()
Definition: readHits.C:15
void novaddt::SingletonRejection::filterNoise ( art::Handle< novaddt::HitList > &  hits,
std::unique_ptr< novaddt::HitList > &  product 
)
private

Definition at line 100 of file SingletonRejection_module.cc.

References stan::math::fabs(), fMinCellSep, fMinPlaneSep, fMinTDCSep, MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, and ConvertToSnowGlobesInput::lower_limit.

Referenced by filter().

101 {
102  unsigned int n_hits = hits->size(); // # of hits in this hitlist
103 
104  unsigned int lower_limit = 0; // the lower index to start checking for a correlated hit at
105 
106  for (unsigned int i=0; i<n_hits; ++i){
107  //std::cout << "\thit[" << i
108  //<< "], TDC: " << hits->at(i).TDC().val
109  //<< ", View: " << hits->at(i).View().val
110  //<< ", Plane: " << hits->at(i).Plane().val
111  //<< ", Cell: " << hits->at(i).Cell().val
112  //<< std::endl;
113  for (unsigned int j=lower_limit; j<n_hits; ++j){
114  if (i == j) continue;
115  // check if hits are causally correlated
116  if (fabs((int)hits->at(i).TDC().val - (int)hits->at(j).TDC().val) > fMinTDCSep){
117  // if they aren't & j is lower than i
118  // then we ignore this hit
119  // & next time we start the inner loop at this point
120  if (j < i){
121  lower_limit = j;
122  continue;
123  // similarly if j is the next hit in the list
124  // then j can also not be correlated with i
125  // so we advance the lower limit now
126  // and break the inner loop
127  } else if (j == i+1){
128  lower_limit = j;
129  break;
130  // else break inner loop here
131  } else {
132  break;
133  }
134  } // end of check on causal correlation
135  // check view correlation
136  if (hits->at(i).View().val != hits->at(j).View().val) continue;
137  // check plane correlation
138  // have to cast these to ints so we can handle negative values
139  if (fabs((int)hits->at(i).Plane().val - (int)hits->at(j).Plane().val) > fMinPlaneSep) continue;
140  // check cell correlation
141  if (fabs((int)hits->at(i).Cell().val - (int)hits->at(j).Cell().val) > fMinCellSep) continue;
142  product->push_back(hits->at(i));
143  break;
144  } // end of inner loop on hits
145  } // end of outer loop on hits
146 
147 
148  return;
149 }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
const double j
Definition: BetheBloch.cxx:29
T product(std::vector< T > dims)
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  }
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

int novaddt::SingletonRejection::_nEvents = 0
private

Definition at line 47 of file SingletonRejection_module.cc.

Referenced by endJob(), and filter().

int novaddt::SingletonRejection::_nHitsIn = 0
private

Definition at line 48 of file SingletonRejection_module.cc.

Referenced by endJob(), and filter().

int novaddt::SingletonRejection::_nHitsOut = 0
private

Definition at line 49 of file SingletonRejection_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().

std::string novaddt::SingletonRejection::fInputInstance
private

Definition at line 40 of file SingletonRejection_module.cc.

Referenced by filter(), and SingletonRejection().

std::string novaddt::SingletonRejection::fInputLabel
private

Definition at line 39 of file SingletonRejection_module.cc.

Referenced by filter(), and SingletonRejection().

int novaddt::SingletonRejection::fMinCellSep
private

Definition at line 41 of file SingletonRejection_module.cc.

Referenced by filterNoise(), and SingletonRejection().

int novaddt::SingletonRejection::fMinPlaneSep
private

Definition at line 42 of file SingletonRejection_module.cc.

Referenced by filterNoise(), and SingletonRejection().

int novaddt::SingletonRejection::fMinTDCSep
private

Definition at line 43 of file SingletonRejection_module.cc.

Referenced by filterNoise(), and SingletonRejection().

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: