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

 SlowMonopoleFilt (fhicl::ParameterSet const &p)
 
 SlowMonopoleFilt (SlowMonopoleFilt const &)=delete
 
 SlowMonopoleFilt (SlowMonopoleFilt &&)=delete
 
SlowMonopoleFiltoperator= (SlowMonopoleFilt const &)=delete
 
SlowMonopoleFiltoperator= (SlowMonopoleFilt &&)=delete
 
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

TimeWindow calculate_time_window (novaddt::TriggerDecision const &td, unsigned buffer, novaddt::TDC event_time) const
 
void append_cluster (std::map< std::string, rb::Cluster > const &input_clusters, std::unique_ptr< std::vector< rb::Cluster > > &output_clusters, std::string const cluster_name) const
 

Detailed Description

Definition at line 43 of file SlowMonopoleFilt_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

mono::SlowMonopoleFilt::SlowMonopoleFilt ( fhicl::ParameterSet const &  p)
explicit

Definition at line 67 of file SlowMonopoleFilt_module.cc.

68 {
69  produces<std::vector<rb::Cluster> >();
70  produces<std::vector<novaddt::TriggerDecision> >();
71 }
mono::SlowMonopoleFilt::SlowMonopoleFilt ( SlowMonopoleFilt const &  )
delete
mono::SlowMonopoleFilt::SlowMonopoleFilt ( SlowMonopoleFilt &&  )
delete

Member Function Documentation

void mono::SlowMonopoleFilt::append_cluster ( std::map< std::string, rb::Cluster > const &  input_clusters,
std::unique_ptr< std::vector< rb::Cluster > > &  output_clusters,
std::string const  cluster_name 
) const
private

Definition at line 199 of file SlowMonopoleFilt_module.cc.

References DEFINE_ART_MODULE().

Referenced by calculate_time_window(), and filter().

202 {
203  auto cluster = input_clusters.find(cluster_name);
204 
205  if (cluster != input_clusters.end())
206  {
207  if (cluster->second.NCell() > 0)
208  output_clusters->push_back(cluster->second);
209  }
210 }
mono::TimeWindow mono::SlowMonopoleFilt::calculate_time_window ( novaddt::TriggerDecision const &  td,
unsigned  buffer,
novaddt::TDC  event_time 
) const
private

Definition at line 187 of file SlowMonopoleFilt_module.cc.

References append_cluster(), novaddt::TriggerDecision::duration(), make_pair(), and novaddt::TriggerDecision::start().

Referenced by filter().

189 {
190  auto t_start = td.start() + 2 * buffer - event_time;
191  auto t_end = td.start() + td.duration() - 2 * buffer - event_time;
192 
193  return std::make_pair(t_start, t_end);
194 }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
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 mono::SlowMonopoleFilt::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 75 of file SlowMonopoleFilt_module.cc.

References append_cluster(), ana::assert(), calculate_time_window(), om::cerr, ddthelpers::cluster_hits(), gen_flatrecord::config, om::cout, allTimeWatchdog::endl, mono::SlowMonopoleTrigger::essential_hit_lists(), art::Event::event(), srt_file_template::find_if, art::DataViewImpl::getByLabel(), hits(), MECModelEnuComparisons::i, ddthelpers::is_equal(), ddthelpers::print(), art::Event::put(), art::Event::run(), mono::SlowMonopoleTrigger::trigger_decision_time_buffer(), and mono::SlowMonopoleTrigger::trigger_decisions().

76 {
77  //
78  // Extract Objects from the Event
79  //
80  // High ADC Filtered Hits
82  e.getByLabel("smmhighadcfilter", "HEHits", ddt_hits);
83 
84  // Raw Trigger Header
86  e.getByLabel("daq", raw_triggers);
87  assert(raw_triggers->size() == 1);
88 
89  // Offline Cell Hits
91  e.getByLabel("calhit", hits);
92  std::vector<art::Ptr<rb::CellHit> > hitptrs;
93  for (unsigned i = 0; i < hits->size(); ++i)
94  hitptrs.emplace_back(hits, i);
95 
96  int16_t adc_cut = 150;
97  unsigned long long
98  event_time(raw_triggers->at(0).fTriggerTimingMarker_TimeStart);
99 
100 
101 
102  //
103  // Run Offline Versions of Trigger
104  //
106  config.max_plane_gap_cut = 30;
107  config.sparsification_factor = 10;
108  SlowMonopoleTrigger smt(*ddt_hits, event_time, config);
109 
110  std::unique_ptr<std::vector<novaddt::TriggerDecision> >
111  trigger_decisions
112  (new std::vector<novaddt::TriggerDecision>(smt.trigger_decisions()));
113 
114  std::cout << "MF: Trigger Decision Report"
115  << "\nMF: Run " << e.run() << " Event " << e.event()
116  << "\nMF: Trigger Decisions Size = " << trigger_decisions->size()
117  << std::endl;
118 
119 
120 
121  //
122  // Extract Clusters from Triggers
123  //
124  unsigned time_buffer = smt.trigger_decision_time_buffer();
125 
126  std::unique_ptr<std::vector<rb::Cluster> >
127  clusters(new std::vector<rb::Cluster>);
128 
129  if (trigger_decisions->size() > 0)
130  {
131  TimeWindow time_window =
132  calculate_time_window(trigger_decisions->at(0), time_buffer, event_time);
134  (hitptrs, time_window.first, time_window.second, adc_cut);
135  // clusters->push_back(mf_cluster);
136  }
137 
138  std::map<std::string, rb::Cluster> essential_clusters;
139  for (auto const& essential_hit_list : smt.essential_hit_lists())
140  {
141  for (auto const& essential_hit : essential_hit_list.second)
142  {
143  // use a subset of hits:
144  // art::PtrVector<rb::CellHit> cluster_hits = mf_cluster.AllCells();
145  // use all of the hits:
146  std::vector<art::Ptr<rb::CellHit> > cluster_hits = hitptrs;
147 
148  auto matched_offline_hit = std::find_if
149  (cluster_hits.begin(), cluster_hits.end(),
150  [&](art::Ptr<rb::CellHit> const& cell_hit)
151  {
152  return ddthelpers::is_equal(essential_hit, cell_hit, event_time);
153  });
154 
155  if (matched_offline_hit != cluster_hits.end())
156  {
157  essential_clusters[essential_hit_list.first].
158  Add(*matched_offline_hit);
159  }
160  else {
161  std::cerr << "MF: No matching hit found for:" << std::endl;
162  ddthelpers::print(essential_hit, event_time);
163  // assert(false);
164  }
165  }
166  }
167 
168  // Color Order:
169  // defined in RecoBaseDrawer::GetClusterColor
170  // https://cdcvs.fnal.gov/redmine/projects/novaart/repository/entry/trunk/EventDisplay/RecoBaseDrawer.cxx#L1130
171  // 1. blue
172  // 2. green
173  // 3. red
174  // 4. yellow
175 
176  append_cluster(essential_clusters, clusters, "some_label");
177 
178  e.put(std::move(trigger_decisions));
179  e.put(std::move(clusters));
180 
181  return true;
182 }
void append_cluster(std::map< std::string, rb::Cluster > const &input_clusters, std::unique_ptr< std::vector< rb::Cluster > > &output_clusters, std::string const cluster_name) const
rb::Cluster cluster_hits(std::vector< art::Ptr< rb::CellHit > > const &hits, int32_t t_start, int32_t t_end, int16_t adc_cut=0)
Definition: DDTHelpers.cxx:13
A collection of associated CellHits.
Definition: Cluster.h:47
OStream cerr
Definition: OStream.cxx:7
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
void print(novaddt::DAQHit const &h, unsigned long long const &event_time=0)
Definition: DDTHelpers.cxx:84
EventNumber_t event() const
Definition: Event.h:67
std::pair< uint32_t, uint32_t > TimeWindow
OStream cout
Definition: OStream.cxx:6
TimeWindow calculate_time_window(novaddt::TriggerDecision const &td, unsigned buffer, novaddt::TDC event_time) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
assert(nhit_max >=nhit_nbins)
RunNumber_t run() const
Definition: Event.h:77
bool is_equal(novaddt::DAQHit const &ddthit, art::Ptr< rb::CellHit > const &cellhit, novaddt::TDC const &event_time)
Definition: DDTHelpers.cxx:30
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
SlowMonopoleFilt& mono::SlowMonopoleFilt::operator= ( SlowMonopoleFilt const &  )
delete
SlowMonopoleFilt& mono::SlowMonopoleFilt::operator= ( SlowMonopoleFilt &&  )
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

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: