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

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

std::string _hitsModuleLabel
 label of module making the HitList More...
 
std::string _hitsInstanceLabel
 instance label making the HitList More...
 
unsigned int _minHits
 Minimum number of hits in the slice. More...
 
unsigned int _minPlanesView
 Minimum planes (unique) on each view. More...
 
unsigned int _minPlanes
 Minimum planes (unique) the hits are spread in any view. More...
 
unsigned int _maxNearWindow
 Maximum window where to look for near planes. More...
 
unsigned int _minNearPlanes
 Minimum number of near planes. More...
 
unsigned int _prescale
 holds prescaling variable from fcl file More...
 
unsigned int _triggerCounts = 0
 
unsigned int _evtCounts = 0
 

Detailed Description

Definition at line 33 of file ActivityTrigger_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::ActivityTrigger::ActivityTrigger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 57 of file ActivityTrigger_module.cc.

58  : _hitsModuleLabel (p.get<std::string >("HitModuleLabel" ))
59  , _hitsInstanceLabel(p.get<std::string >("HitInstanceLabel"))
60  , _minHits (p.get<unsigned int>("MinHits" ))
61  , _minPlanesView (p.get<unsigned int>("MinPlanesView" ))
62  , _minPlanes (p.get<unsigned int>("MinPlanes" ))
63  , _maxNearWindow (p.get<unsigned int>("MaxNearWindow" ))
64  , _minNearPlanes (p.get<unsigned int>("MinNearPlanes" ))
65  , _prescale (p.get<unsigned int>("prescale" ))
66 {
67  produces< std::vector<novaddt::TriggerDecision> >();
68  //produces< art::Assns<novaddt::TriggerDecision, novaddt::HitList> >();
69 }
unsigned int _prescale
holds prescaling variable from fcl file
const char * p
Definition: xmltok.h:285
unsigned int _minPlanes
Minimum planes (unique) the hits are spread in any view.
std::string _hitsInstanceLabel
instance label making the HitList
unsigned int _maxNearWindow
Maximum window where to look for near planes.
std::string _hitsModuleLabel
label of module making the HitList
unsigned int _minNearPlanes
Minimum number of near planes.
unsigned int _minPlanesView
Minimum planes (unique) on each view.
unsigned int _minHits
Minimum number of hits in the slice.
enum BeamMode string
novaddt::ActivityTrigger::~ActivityTrigger ( )
virtual

Definition at line 72 of file ActivityTrigger_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
bool novaddt::ActivityTrigger::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 78 of file ActivityTrigger_module.cc.

References _evtCounts, _hitsInstanceLabel, _hitsModuleLabel, _maxNearWindow, _minHits, _minNearPlanes, _minPlanes, _minPlanesView, _prescale, _triggerCounts, art::Handle< T >::clear(), DEFINE_ART_MODULE(), art::DataViewImpl::getByLabel(), hits(), MECModelEnuComparisons::i, calib::j, art::Event::put(), daqdataformats::TRIG_ID_DATA_ACTIVITY_1, daqchannelmap::X_VIEW, and daqchannelmap::Y_VIEW.

79 {
80  //std::cout << "--- ActivityTrigger filter\n";
81  ++_evtCounts;
82 
83  // Retrieve the (grouped) hit list for this event
86 
87  // Allocate the vector for the trigger decisions that we may make (and write to the event)
88  std::unique_ptr<std::vector<novaddt::TriggerDecision>> td(new std::vector<novaddt::TriggerDecision>);
89 
90  /**************************************************************************
91  * Activity Trigger Algorithm *
92  * *
93  * Essentially all we do is count the number of hits we have in slice *
94  * if it is over a given threshold then we write it out. *
95  * *
96  * Overlaps with the beam (numi) trigger are handled via an inhibit at *
97  * the global trigger level *
98  * *
99  * However there are a couple of additional cuts we put on the data, *
100  * first in addition to having at least N hits we require that they *
101  * extend over at least Mx planes in the X view, and analogously with *
102  * the Y view. We also require the total number of planes to be larger *
103  * than P. Finally, we perform a continuity check, asking for K planes *
104  * with hits whithin a W window. *
105  * *
106  * This allows the trigger to be tuned in the following manners *
107  * Increase: N = more hits (more activity, larger showers) *
108  * Increase: Mx and P = more "horizontal" (z-aligned) activity *
109  * Decrease M or P = more "vertical" (x/y-aligned activity) *
110  * Increase K: longer continuous tracks *
111  * Decrease W: less gaps are allowed. If W<K or any of them is set to 0 *
112  * no continuity check is performed *
113  **************************************************************************/
114 
115  std::unordered_set<int> XplaneList;
116  std::unordered_set<int> YplaneList;
117  std::unordered_set<int> planeList;
118 
119  // Loop over the slices in the event
120  for(unsigned int i=0; i<hits->n_groups(); ++i){
121 
122  // Get the hits for the current slice
123  novaddt::HitList theSliceHits = hits->get(i);
124 
125  XplaneList.clear();
126  YplaneList.clear();
127  planeList.clear();
128  bool fContinuity = false;
129  // Safety checks in case we mess up the fickle file
130  if(_maxNearWindow < _minNearPlanes) fContinuity = true;
131  if(!(_maxNearWindow * _minNearPlanes)) fContinuity = true;
132 
133  // Test to see how many hits are in the slice
134  if (theSliceHits.size() >= _minHits){
135  // Fill the unique planes
136  for(unsigned int j=0; j < theSliceHits.size(); ++j){
137  auto thePlane = theSliceHits.at(j).Plane().val;
138  auto theView = theSliceHits.at(j).View().val;
139  // Push the plane into list of unique planes in the proper view
140  if(theView == daqchannelmap::X_VIEW) XplaneList.insert(thePlane);
141  else if(theView == daqchannelmap::Y_VIEW) YplaneList.insert(thePlane);
142  planeList.insert(thePlane);
143  } // endfor j
144 
145  if((XplaneList.size() + YplaneList.size()) >= _minPlanes){
146  // If there are enough planes, check by view
147  if(XplaneList.size() >= _minPlanesView){
148  if(YplaneList.size() >= _minPlanesView){
149  /**********************************************************
150  * Check for continuity. This means a minimum number of *
151  * planes _minNearPlanes within a window of _maxNearPlanes *
152  * (e.g., 4 out of 5 planes, a la MINOS) *
153  **********************************************************/
154  for(auto iPlane=planeList.begin(); iPlane!=planeList.end(); ++iPlane)
155  {
156  if(!fContinuity)
157  {
158  unsigned int fNearPlanes = 0;
159  for(unsigned int j=1; j<=_maxNearWindow; ++j)
160  fNearPlanes += planeList.count(*iPlane+j);
161 
162  if(fNearPlanes >= _minNearPlanes)
163  fContinuity = true;
164  }
165  } // end of continuity check
166 
167  if(fContinuity)
168  {
169  /******************************************************
170  * EVENTS THAT MAKE IT HERE SHOULD GENERATE A TRIGGER *
171  ******************************************************/
172  // Internal prescale
173  ++_triggerCounts;
174  if (_triggerCounts % _prescale == _prescale - 1){
175  // Store a trigger decision for this slice
176  td->emplace_back(theSliceHits.front().TDC().val,
177  theSliceHits.back().TDC().val - theSliceHits.front().TDC().val,
179  _prescale);
180  } // end of issue trigger decision
181  } // end of cointinuity check
182  } // endif gt minYPlanes
183  } // endif gt minXPlanes
184  } // endif gt minPlanes
185  } // end of check on hit list size
186  } // end loop on hit groups
187 
188  bool goodTrigger = (td->size() > 0);
189 
190  e.put(std::move(td));
191  //e.put(std::move(assn));
192 
193  //std::cout << "Frequency: " << _triggerCounts*1./(_evtCounts*5.e-3) << " pm " // Fraction of passing per event. One event lasts 5 ms
194  // << sqrt(_triggerCounts*(_evtCounts-_triggerCounts)*1./_evtCounts)/(_evtCounts*5.e-3) << " Hz" << std::endl; // Binomial Error
195 
196  return goodTrigger;
197 }
unsigned int _prescale
holds prescaling variable from fcl file
std::vector< DAQHit > HitList
Definition: HitList.h:15
unsigned int _minPlanes
Minimum planes (unique) the hits are spread in any view.
std::string _hitsInstanceLabel
instance label making the HitList
Identifier for the Y measuring view of the detector (side)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
Identifier for the X measuring view of the detector (top)
const double j
Definition: BetheBloch.cxx:29
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void clear()
Definition: Handle.h:236
unsigned int _maxNearWindow
Maximum window where to look for near planes.
std::string _hitsModuleLabel
label of module making the HitList
unsigned int _minNearPlanes
Minimum number of near planes.
unsigned int _minPlanesView
Minimum planes (unique) on each view.
unsigned int _minHits
Minimum number of hits in the slice.
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

unsigned int novaddt::ActivityTrigger::_evtCounts = 0
private

Definition at line 53 of file ActivityTrigger_module.cc.

Referenced by filter().

std::string novaddt::ActivityTrigger::_hitsInstanceLabel
private

instance label making the HitList

Definition at line 44 of file ActivityTrigger_module.cc.

Referenced by filter().

std::string novaddt::ActivityTrigger::_hitsModuleLabel
private

label of module making the HitList

Definition at line 43 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_maxNearWindow
private

Maximum window where to look for near planes.

Definition at line 48 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_minHits
private

Minimum number of hits in the slice.

Definition at line 45 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_minNearPlanes
private

Minimum number of near planes.

Definition at line 49 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_minPlanes
private

Minimum planes (unique) the hits are spread in any view.

Definition at line 47 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_minPlanesView
private

Minimum planes (unique) on each view.

Definition at line 46 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_prescale
private

holds prescaling variable from fcl file

Definition at line 50 of file ActivityTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTrigger::_triggerCounts = 0
private

Definition at line 52 of file ActivityTrigger_module.cc.

Referenced by 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: