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

 TriCellTrigger (fhicl::ParameterSet const &p)
 
virtual ~TriCellTrigger ()
 
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 _trackModuleLabel
 label of module making the HitList More...
 
std::string _trackInstanceLabel
 instance label making the HitList More...
 
float _minFraction
 
unsigned int _minPlanesCrossed
 minimum planes crossed in a slice to be used More...
 
unsigned _triggerCounts
 prescaling variable More...
 
unsigned _prescale
 holds prescaling variable from fcl file More...
 
unsigned _event_prescale
 holds event prescaling variable from fcl file More...
 

Detailed Description

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

Definition at line 52 of file TriCellTrigger_module.cc.

53  : _trackModuleLabel (p.get<std::string >("TrackModuleLabel" ))
54  , _trackInstanceLabel(p.get<std::string >("TrackInstanceLabel", ""))
55  , _minFraction (p.get<float >("MinFraction" ))
56  , _minPlanesCrossed (p.get<unsigned int>("MinPlanesCrossed" ))
57  , _triggerCounts (0)
58  , _prescale (p.get<unsigned >("prescale" ))
59  , _event_prescale (p.get<unsigned >("EventPrescale" ))
60 {
61  produces< std::vector<novaddt::TriggerDecision> >();
62  produces< art::Assns<novaddt::TriggerDecision, novaddt::HitList> >();
63 }
const char * p
Definition: xmltok.h:285
std::string _trackInstanceLabel
instance label making the HitList
unsigned _prescale
holds prescaling variable from fcl file
std::string _trackModuleLabel
label of module making the HitList
unsigned _event_prescale
holds event prescaling variable from fcl file
unsigned _triggerCounts
prescaling variable
unsigned int _minPlanesCrossed
minimum planes crossed in a slice to be used
enum BeamMode string
novaddt::TriCellTrigger::~TriCellTrigger ( )
virtual

Definition at line 66 of file TriCellTrigger_module.cc.

67 {
68  // Clean up dynamic memory and other resources here.
69 }

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::TriCellTrigger::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 72 of file TriCellTrigger_module.cc.

References _event_prescale, _minFraction, _minPlanesCrossed, _prescale, _trackInstanceLabel, _trackModuleLabel, _triggerCounts, std::abs(), util::CreateAssn(), DEFINE_ART_MODULE(), art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, LOG_DEBUG, art::Event::put(), confusionMatrixTree::t, and daqdataformats::TRIG_ID_DATA_CALMU.

73 {
74  // get the hit lists for this slice
77 
78  // make the vector we are going to write out to the event
79  std::unique_ptr<std::vector<novaddt::TriggerDecision>> td(new std::vector<novaddt::TriggerDecision>);
80  std::unique_ptr<art::Assns<novaddt::TriggerDecision, novaddt::HitList> > assn(new art::Assns<novaddt::TriggerDecision, novaddt::HitList >);
81 
82  std::map<unsigned short, std::set<unsigned short>> planesAndCells;
83 
84  // get the hit list for each track
86  for(size_t t = 0; t < th->size(); ++t){
87 
88  planesAndCells.clear();
89 
90  art::Ptr<novaddt::HitList> hl = fohl.at(t);
91  // first fill the map of planes and cells
92  for(auto const& i : *hl){
93  planesAndCells[i.Plane().val].insert(i.Cell().val);
94 
95  LOG_DEBUG("TriCellTrigger") << "plane: " << i.Plane().val
96  << " cell: " << i.Cell().val;
97  }
98 
99  // if this track doesn't cross enough planes,
100  // or have enough hits continue to the next one and try that
101  if(std::abs(th->at(t).EndZ() - th->at(t).StartZ()) < _minPlanesCrossed ||
102  hl->size() < _minPlanesCrossed) continue;
103 
104  // now loop over the planes and cells to determine
105  // the fraction in this list that have both neighbors also hit
106  float totalCells = 0.;
107  float goodCells = 0.;
108 
109  for(auto const& pcitr : planesAndCells){
110  // get the set for the current plane
111  // sets are presorted, go c++
112  std::set<unsigned short> cellSet = pcitr.second;
113 
114  // put the iterator over the set to the second entry
115  auto citr = cellSet.cbegin();
116  totalCells += 1.;
117  ++citr;
118 
119  // loop over the cells and look to see if there is
120  // a cell in this plane that has both its neighbors also
121  // hit on this track
122  // is it faster to sort the set first and then search?
123  while( citr != cellSet.cend() ){
124  if( cellSet.find(*citr - 1) != cellSet.end() &&
125  cellSet.find(*citr + 1) != cellSet.end() ){
126  goodCells += 1.;
127  }
128  totalCells += 1.;
129 
130  ++citr;
131  }// end iterator over cells for this plane
132 
133  }// end loop to count the tri-cell groupings
134 
135  if(goodCells > _minFraction*totalCells)
136  {
137  ++_triggerCounts;
138  if (_triggerCounts % _prescale == _prescale - 1)
139  {
140  td->emplace_back(hl->front().TDC().val,
141  hl->back().TDC().val - hl->front().TDC().val,
144 
145  util::CreateAssn(*this, e, *td, hl, *assn);
146 
147  LOG_DEBUG("TriCellTrigger") << "make the trigger decision "
148  << td->back().start()
149  << " " << td->back().duration()
150  << " " << goodCells
151  << " " << totalCells
152  << " " << hl->size();
153  }
154 
155  }// end if we have a good trigger with this GHL
156 
157  } // end loop over grouped hit list
158 
159  bool goodTrigger = (td->size() > 0);
160 
161  e.put(std::move(td));
162  e.put(std::move(assn));
163 
164  return goodTrigger;
165 }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
float abs(float number)
Definition: d0nt_math.hpp:39
std::string _trackInstanceLabel
instance label making the HitList
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
unsigned _prescale
holds prescaling variable from fcl file
std::string _trackModuleLabel
label of module making the HitList
unsigned _event_prescale
holds event prescaling variable from fcl file
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
unsigned _triggerCounts
prescaling variable
Definition: fwd.h:28
unsigned int _minPlanesCrossed
minimum planes crossed in a slice to be used
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 novaddt::TriCellTrigger::_event_prescale
private

holds event prescaling variable from fcl file

Definition at line 48 of file TriCellTrigger_module.cc.

Referenced by filter().

float novaddt::TriCellTrigger::_minFraction
private

minimum fraction of usable hits in a slice for the trigger to be written out

Definition at line 43 of file TriCellTrigger_module.cc.

Referenced by filter().

unsigned int novaddt::TriCellTrigger::_minPlanesCrossed
private

minimum planes crossed in a slice to be used

Definition at line 45 of file TriCellTrigger_module.cc.

Referenced by filter().

unsigned novaddt::TriCellTrigger::_prescale
private

holds prescaling variable from fcl file

Definition at line 47 of file TriCellTrigger_module.cc.

Referenced by filter().

std::string novaddt::TriCellTrigger::_trackInstanceLabel
private

instance label making the HitList

Definition at line 42 of file TriCellTrigger_module.cc.

Referenced by filter().

std::string novaddt::TriCellTrigger::_trackModuleLabel
private

label of module making the HitList

Definition at line 41 of file TriCellTrigger_module.cc.

Referenced by filter().

unsigned novaddt::TriCellTrigger::_triggerCounts
private

prescaling variable

Definition at line 46 of file TriCellTrigger_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: