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

 FEBFlashFilter (fhicl::ParameterSet const &p)
 
 FEBFlashFilter (FEBFlashFilter const &)=delete
 
 FEBFlashFilter (FEBFlashFilter &&)=delete
 
FEBFlashFilteroperator= (FEBFlashFilter const &)=delete
 
FEBFlashFilteroperator= (FEBFlashFilter &&)=delete
 
bool filter (art::Event &event) 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 _addToMap (const novaddt::DAQHit &Hit)
 
bool _isItAFlasher (const novaddt::DAQHit &Hit)
 
unsigned int _febNum (const novaddt::DAQHit &Hit)
 

Private Attributes

std::string _sortedListLabel
 
std::string _sortedListInstance
 
unsigned int _saturatedADC
 
unsigned int _flasherADC
 
unsigned int _FEBDeadTime
 
unsigned int _numFlasherHits
 
std::map< unsigned int, std::vector< uint64_t > > _saturatedFEBMap
 

Detailed Description

Definition at line 30 of file FEBFlashFilter_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::FEBFlashFilter::FEBFlashFilter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 63 of file FEBFlashFilter_module.cc.

References _FEBDeadTime, _flasherADC, _saturatedADC, _sortedListInstance, _sortedListLabel, om::cout, and allTimeWatchdog::endl.

63  :
64 // Initialize member data here.
65 _sortedListLabel (p.get< std::string >("hits_label")),
66 _sortedListInstance (p.get< std::string >("instance")),
67 _saturatedADC (p.get< unsigned int >("saturated_ADC")),
68 _flasherADC (p.get< unsigned int >("flasher_ADC")),
69 _FEBDeadTime (p.get< unsigned int >("FEB_dead_time"))
70 {
71  std::cout << "--- novaddt::FEBFlashFilter Runtime Configuration" << std::endl;
72  std::cout << "\t Input hitlists label: " << _sortedListLabel << std::endl;
73  std::cout << "\t Input hitlists instance: " << _sortedListInstance << std::endl;
74  std::cout << "\t ADC Saturation Threshold: " << _saturatedADC << std::endl;
75  std::cout << "\t Flasher ADC Threshold: " << _flasherADC << std::endl;
76  std::cout << "\t FEB Masked off time: " << _FEBDeadTime << std::endl;
77 
78  // Call appropriate produces<>() functions here.
79  produces<HitList>("FEBFlashFiltered");
80 }
const char * p
Definition: xmltok.h:285
OStream cout
Definition: OStream.cxx:6
enum BeamMode string
novaddt::FEBFlashFilter::FEBFlashFilter ( FEBFlashFilter const &  )
delete
novaddt::FEBFlashFilter::FEBFlashFilter ( FEBFlashFilter &&  )
delete

Member Function Documentation

void novaddt::FEBFlashFilter::_addToMap ( const novaddt::DAQHit Hit)
private

Definition at line 139 of file FEBFlashFilter_module.cc.

References _febNum(), _saturatedFEBMap, it, novaddt::DAQHit::TDC(), and novaddt::TDC::val.

Referenced by filter().

140 {
141  // Need FEB and TDC of hit
142  auto hitTDC = Hit.TDC().val;
143  //double hitTDC = Hit.TDC().val;
144  unsigned int hitFEB = _febNum(Hit);
145  // OK will have to compute FEB from Plane and Cell
146  // Efficient inserting into maps (with hint position)
147  if(_saturatedFEBMap.count(hitFEB) > 0) _saturatedFEBMap.at(hitFEB).push_back(hitTDC);
148  else {
149  auto it = _saturatedFEBMap.begin();
150  std::vector<uint64_t> temp_insert (1,hitTDC);
151  _saturatedFEBMap.insert(it, std::pair<unsigned int, std::vector<uint64_t>>(hitFEB,temp_insert));
152  }
153 
154 }
set< int >::iterator it
value_type val
Definition: BaseProducts.h:34
novaddt::TDC const & TDC() const
Definition: DAQHit.h:74
std::map< unsigned int, std::vector< uint64_t > > _saturatedFEBMap
unsigned int _febNum(const novaddt::DAQHit &Hit)
unsigned int novaddt::FEBFlashFilter::_febNum ( const novaddt::DAQHit Hit)
private

Definition at line 182 of file FEBFlashFilter_module.cc.

References novaddt::DAQHit::Cell(), DEFINE_ART_MODULE(), novaddt::DAQHit::Plane(), novaddt::Plane::val, and novaddt::Cell::val.

Referenced by _addToMap(), and _isItAFlasher().

183 {
184  // Let's define the FEB number as:
185  // Cell number div 32 plus plane number * 12
186  unsigned int febnum;
187  unsigned int hitCell = Hit.Cell().val;
188  unsigned int hitPlane = Hit.Plane().val;
189 
190  febnum = hitPlane*100 + hitCell/32;
191 
192  return febnum;
193 }
novaddt::Plane const & Plane() const
Definition: DAQHit.h:70
value_type val
Definition: BaseProducts.h:109
value_type val
Definition: BaseProducts.h:84
novaddt::Cell const & Cell() const
Definition: DAQHit.h:71
bool novaddt::FEBFlashFilter::_isItAFlasher ( const novaddt::DAQHit Hit)
private

Definition at line 156 of file FEBFlashFilter_module.cc.

References _FEBDeadTime, _febNum(), _flasherADC, _numFlasherHits, _saturatedFEBMap, novaddt::DAQHit::ADC(), novaddt::DAQHit::TDC(), novaddt::TDC::val, and novaddt::ADC::val.

Referenced by filter().

157 {
158  unsigned int febnum = _febNum(Hit);
159  unsigned int hitADC = Hit.ADC().val;
160 
161  // If the ADC of the hit are above flasher threshold, it's not a flasher
162  if(hitADC >= _flasherADC) return false;
163 
164  // if the hit doesn't have it's FEB in the map yet, it's not a flasher
165  else if(_saturatedFEBMap.count(febnum) < 1) return false;
166 
167  // if the FEB is in the map, have to check timestamps to determine flasher status
168  auto hitTDC = Hit.TDC().val;
169  uint64_t conv = 15625; //15.625 ns per TDC tick
170 
171  for(auto& elem: _saturatedFEBMap.at(febnum)){
172  if((hitTDC >= elem) && (hitTDC <= (elem + (conv*_FEBDeadTime)))) {
173  _numFlasherHits++;
174  return true;
175  }
176  }
177 
178  // If we got to this point it's not a flasher
179  return false;
180 }
value_type val
Definition: BaseProducts.h:34
novaddt::TDC const & TDC() const
Definition: DAQHit.h:74
std::map< unsigned int, std::vector< uint64_t > > _saturatedFEBMap
novaddt::ADC const & ADC() const
Definition: DAQHit.h:73
unsigned int _febNum(const novaddt::DAQHit &Hit)
value_type val
Definition: BaseProducts.h:65
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
bool novaddt::FEBFlashFilter::filter ( art::Event event)
overridevirtual

Implements art::EDFilter.

Definition at line 82 of file FEBFlashFilter_module.cc.

References _addToMap(), _isItAFlasher(), _numFlasherHits, _saturatedADC, _sortedListInstance, _sortedListLabel, hits(), and stan::io::product().

83 {
84  // Implementation of required member function here.
85  // Start by reading in the hit list
87  event.getByLabel(_sortedListLabel, _sortedListInstance, hits);
88 
89  // Make a hitlist out of hits that survive the FEBFlashFilter
90  std::unique_ptr<novaddt::HitList>product(new novaddt::HitList);
91 
92  // If the hitlist is empty, bail at this point
93  if(hits->empty()) {
94  event.put(std::move(product),"FEBFlashFiltered");
95  return false;
96  }
97 
98  // initialize number of flashers to be updated
99  _numFlasherHits = 0;
100 
101  // Now do the actual heavy lifting
102  // If there is a saturated hit, add the FEB to a list/map
103  // Add the time of the hit so we can reject subsequent hits
104  for(auto ihit = hits->begin(); ihit < hits->end(); ++ihit){
105 
106  unsigned int hitADC = ihit->ADC().val;
107 
108  // If it's a saturated hit, add the info to the map
109  if(hitADC >= _saturatedADC) {
110  _addToMap(*ihit);
111 // std::cout << "FEB hit: " << _febNum(*ihit) << " with Charge: " << hitADC << " at time: " << ihit->TDC().val << std::endl;
112  }
113 
114  // If it's a flasher, don't add it to the product, just continue
115  else if(_isItAFlasher(*ihit)) continue;
116 
117  // At this point we have saturated hits, and non flashers, so add them to the product
118  product->push_back(*ihit);
119  }
120 
121  // Put the filtered list into the event and we're done
122  event.put(std::move(product),"FEBFlashFiltered");
123 
124 /* Uncomment this block if you'd like some debug output about the Flasher Map
125 
126  for(auto it= _saturatedFEBMap.cbegin(); it != _saturatedFEBMap.cend(); ++it){
127  std::cout << "Key: " << it->first << std::endl << "Values: " << std::endl;
128  for(auto vit = it->second.begin(); vit != it->second.end(); ++vit) {
129  std::cout << " " << *vit << std::endl;
130  }
131  }
132 
133  std::cout << "Removed " << _numFlasherHits << " from the event" << std::endl;
134 */
135 
136  return true;
137 }
std::vector< DAQHit > HitList
Definition: HitList.h:15
void _addToMap(const novaddt::DAQHit &Hit)
bool _isItAFlasher(const novaddt::DAQHit &Hit)
void hits()
Definition: readHits.C:15
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
FEBFlashFilter& novaddt::FEBFlashFilter::operator= ( FEBFlashFilter const &  )
delete
FEBFlashFilter& novaddt::FEBFlashFilter::operator= ( FEBFlashFilter &&  )
delete
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

unsigned int novaddt::FEBFlashFilter::_FEBDeadTime
private

Definition at line 53 of file FEBFlashFilter_module.cc.

Referenced by _isItAFlasher(), and FEBFlashFilter().

unsigned int novaddt::FEBFlashFilter::_flasherADC
private

Definition at line 52 of file FEBFlashFilter_module.cc.

Referenced by _isItAFlasher(), and FEBFlashFilter().

unsigned int novaddt::FEBFlashFilter::_numFlasherHits
private

Definition at line 54 of file FEBFlashFilter_module.cc.

Referenced by _isItAFlasher(), and filter().

unsigned int novaddt::FEBFlashFilter::_saturatedADC
private

Definition at line 51 of file FEBFlashFilter_module.cc.

Referenced by FEBFlashFilter(), and filter().

std::map<unsigned int, std::vector<uint64_t> > novaddt::FEBFlashFilter::_saturatedFEBMap
private

Definition at line 55 of file FEBFlashFilter_module.cc.

Referenced by _addToMap(), and _isItAFlasher().

std::string novaddt::FEBFlashFilter::_sortedListInstance
private

Definition at line 50 of file FEBFlashFilter_module.cc.

Referenced by FEBFlashFilter(), and filter().

std::string novaddt::FEBFlashFilter::_sortedListLabel
private

Definition at line 49 of file FEBFlashFilter_module.cc.

Referenced by FEBFlashFilter(), and filter().

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

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

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: