Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
highe::HighEnergyFilt Class Reference
Inheritance diagram for highe::HighEnergyFilt:
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

 HighEnergyFilt (fhicl::ParameterSet const &p)
 
virtual ~HighEnergyFilt ()
 
virtual bool filter (art::Event &e) 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

bool send_trigger (unsigned const sum_adc, unsigned const n_hits_total) const
 

Private Attributes

std::string slice_label_
 
std::string slice_instance_
 
unsigned prescale_
 
unsigned trigger_counts_
 
unsigned sum_adc_trigger_threshold_
 
unsigned n_hits_trigger_threshold_
 

Detailed Description

Definition at line 25 of file HighEnergyFilt_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

highe::HighEnergyFilt::HighEnergyFilt ( fhicl::ParameterSet const &  p)
explicit

Definition at line 42 of file HighEnergyFilt_module.cc.

42  :
43  slice_label_(p.get<std::string>("slice_label")),
44  slice_instance_(p.get<std::string>("slice_instance")),
45  prescale_(p.get<unsigned>("prescale")),
46  trigger_counts_(0),
48  (p.get<unsigned>("sum_adc_trigger_threshold")),
50  (p.get<unsigned>("n_hits_trigger_threshold"))
51 {
52  produces<std::vector<novaddt::TriggerDecision>>();
53 }
const char * p
Definition: xmltok.h:285
enum BeamMode string
highe::HighEnergyFilt::~HighEnergyFilt ( )
virtual

Definition at line 55 of file HighEnergyFilt_module.cc.

References om::cout, allTimeWatchdog::endl, and trigger_counts_.

56 {
57  std::cout << "\n\tNumber of High Energy Filt Triggers = " << trigger_counts_
58  << "\n" << std::endl;
59 }
OStream cout
Definition: OStream.cxx:6

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
bool highe::HighEnergyFilt::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 61 of file HighEnergyFilt_module.cc.

References om::cout, allTimeWatchdog::endl, art::EventID::event(), art::Event::event(), novadaq::HexUtils::format(), art::DataViewImpl::getByLabel(), art::Event::id(), prescale_, art::Event::put(), fillBadChanDBTables::result, send_trigger(), slice_instance_, slice_label_, getGoodRuns4SAM::t0, getGoodRuns4SAM::t1, daqdataformats::TRIG_ID_DATA_ENERGY, and trigger_counts_.

62 {
63  bool result = false;
64 
65  std::unique_ptr<std::vector<novaddt::TriggerDecision>>
66  trigger_decisions(new std::vector<novaddt::TriggerDecision>);
67 
70 
71  // We need to subtract off the trigger time, so that we know what
72  // time stamp in the EVD this corresponds to:
73  // art::Handle<std::vector<rawdata::RawTrigger>> RawTriggers;
74  // e.getByLabel("daq", RawTriggers);
75  // assert(RawTriggers->size() == 1);
76  // TDC event_time(RawTriggers->at(0).fTriggerTimingMarker_TimeStart);
77  // boost::format hitform("%4u %4u %5u %20u");
78 
79  unsigned n_slice = 0;
80  unsigned n_triggered_slices = 0;
81  for (auto const& slice : *slices)
82  {
83  unsigned sum_adc = 0;
84 
85  for (auto const& hit : slice)
86  sum_adc += hit.ADC().val;
87 
88  double n_hits_total = slice.size();
89 
90  boost::format form("%5u %3u %8u %8.2f");
91  std::cout << "MF: " <<
92  form % e.id().event() % ++n_slice % n_hits_total % sum_adc
93  << std::endl;
94 
95  if (send_trigger(sum_adc, n_hits_total))
96  {
97  ++n_triggered_slices;
98 
100  if (trigger_counts_ % prescale_ == prescale_ - 1)
101  {
102  auto time_interval =
103  std::minmax_element(slice.begin(), slice.end(),
105  auto t0 = time_interval.first->TDC();
106  auto t1 = time_interval.second->TDC();
107  auto dt = t1 - t0;
108 
109  // double tdc_to_us = 1.0 / 64e6 * 1e6;
110  // std::cout << "\nRun " << e.run()
111  // << "\nSubrun " << e.subRun()
112  // << "\nEvent " << e.id().event()
113  // << "\nt0 = " << (t0 - event_time) * tdc_to_us
114  // << "\nt1 = " << (t1 - event_time) * tdc_to_us
115  // << "\ndt = " << dt
116  // << std::endl;
117 
118  trigger_decisions->emplace_back
120 
121  result = true;
122  }
123  }
124  }
125 
126  std::cout << "MF: Event " << e.event() << " has " << n_triggered_slices
127  << " triggered slices (Space Slice)."
128  << std::endl;
129 
130  e.put(std::move(trigger_decisions));
131  return result;
132 }
bool send_trigger(unsigned const sum_adc, unsigned const n_hits_total) const
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
Definition: Cand.cxx:23
EventNumber_t event() const
Definition: Event.h:67
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
OStream cout
Definition: OStream.cxx:6
EventNumber_t event() const
Definition: EventID.h:116
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: structs.h:12
EventID id() const
Definition: Event.h:56
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
bool highe::HighEnergyFilt::send_trigger ( unsigned const  sum_adc,
unsigned const  n_hits_total 
) const
private

Definition at line 135 of file HighEnergyFilt_module.cc.

References DEFINE_ART_MODULE(), n_hits_trigger_threshold_, and sum_adc_trigger_threshold_.

Referenced by filter().

137 {
138  if (sum_adc < sum_adc_trigger_threshold_)
139  return false;
140 
141  if (n_hits_total < n_hits_trigger_threshold_)
142  return false;
143 
144  return true;
145 }
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

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

Definition at line 33 of file EDFilter.h.

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

unsigned highe::HighEnergyFilt::n_hits_trigger_threshold_
private

Definition at line 39 of file HighEnergyFilt_module.cc.

Referenced by send_trigger().

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

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

unsigned highe::HighEnergyFilt::prescale_
private

Definition at line 37 of file HighEnergyFilt_module.cc.

Referenced by filter().

std::string highe::HighEnergyFilt::slice_instance_
private

Definition at line 36 of file HighEnergyFilt_module.cc.

Referenced by filter().

std::string highe::HighEnergyFilt::slice_label_
private

Definition at line 36 of file HighEnergyFilt_module.cc.

Referenced by filter().

unsigned highe::HighEnergyFilt::sum_adc_trigger_threshold_
private

Definition at line 38 of file HighEnergyFilt_module.cc.

Referenced by send_trigger().

unsigned highe::HighEnergyFilt::trigger_counts_
private

Definition at line 37 of file HighEnergyFilt_module.cc.

Referenced by filter(), and ~HighEnergyFilt().


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