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

 ActivityTriggerAna (fhicl::ParameterSet const &p)
 
virtual ~ActivityTriggerAna ()
 
virtual bool filter (art::Event &e)
 
void beginJob () 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 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 _sliceCounts = 0
 
unsigned int _evtCounts = 0
 
art::ServiceHandle< art::TFileServicetfs
 
TTree * fTree
 
TH1I * fHisto
 
unsigned int fHits
 
unsigned int fXPlanes
 
unsigned int fYPlanes
 
unsigned int fPlanes
 
bool fContinuity
 

Detailed Description

Definition at line 38 of file ActivityTriggerAna_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::ActivityTriggerAna::ActivityTriggerAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 74 of file ActivityTriggerAna_module.cc.

75  : _hitsModuleLabel (p.get<std::string >("HitModuleLabel" ))
76  , _hitsInstanceLabel(p.get<std::string >("HitInstanceLabel"))
77  , _minHits (p.get<unsigned int>("MinHits" ))
78  , _minPlanesView (p.get<unsigned int>("MinPlanesView" ))
79  , _minPlanes (p.get<unsigned int>("MinPlanes" ))
80  , _maxNearWindow (p.get<unsigned int>("MaxNearWindow" ))
81  , _minNearPlanes (p.get<unsigned int>("MinNearPlanes" ))
82  , _prescale (p.get<unsigned int>("prescale" ))
83 {
84  produces< std::vector<novaddt::TriggerDecision> >();
85  //produces< art::Assns<novaddt::TriggerDecision, novaddt::HitList> >();
86 }
unsigned int _minPlanesView
Minimum planes (unique) on each view.
unsigned int _minHits
Minimum number of hits in the slice.
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
std::string _hitsModuleLabel
label of module making the HitList
unsigned int _maxNearWindow
Maximum window where to look for near planes.
unsigned int _minNearPlanes
Minimum number of near planes.
enum BeamMode string
novaddt::ActivityTriggerAna::~ActivityTriggerAna ( )
virtual

Definition at line 89 of file ActivityTriggerAna_module.cc.

90 {
91  // Clean up dynamic memory and other resources here.
92 }

Member Function Documentation

void novaddt::ActivityTriggerAna::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 94 of file ActivityTriggerAna_module.cc.

References fContinuity, fHisto, fHits, fPlanes, fTree, fXPlanes, fYPlanes, art::TFileDirectory::make(), and tfs.

95 {
96  // Output Histogram
97  fHisto = tfs->make<TH1I>("fHisto","Histogram;ADCs;Entries",400,0,4000);
98  fTree = tfs->make<TTree>("fTree","Output tree");
99  fTree->Branch("Hits",&fHits);
100  fTree->Branch("XPlanes",&fXPlanes);
101  fTree->Branch("YPlanes",&fYPlanes);
102  fTree->Branch("Planes",&fPlanes);
103  fTree->Branch("Continuity",&fContinuity);
104 }
art::ServiceHandle< art::TFileService > tfs
T * make(ARGS...args) const
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::ActivityTriggerAna::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 107 of file ActivityTriggerAna_module.cc.

References _evtCounts, _hitsInstanceLabel, _hitsModuleLabel, _maxNearWindow, _minHits, _minNearPlanes, _minPlanes, _minPlanesView, _sliceCounts, _triggerCounts, art::Handle< T >::clear(), om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, fContinuity, fHisto, fHits, fPlanes, fTree, fXPlanes, fYPlanes, art::DataViewImpl::getByLabel(), hits(), MECModelEnuComparisons::i, calib::j, art::Event::put(), std::sqrt(), daqchannelmap::X_VIEW, and daqchannelmap::Y_VIEW.

108 {
109  //std::cout << "--- ActivityTriggerAna filter\n";
110  ++_evtCounts;
111 
112  // Retrieve the (grouped) hit list for this event
115  //std::cout << "\tgot " << hits->n_groups()
116  // << " groups.\n";
117 
118  // Allocate the vector for the trigger decisions that we may make (and write to the event)
119  std::unique_ptr<std::vector<novaddt::TriggerDecision>> td(new std::vector<novaddt::TriggerDecision>);
120 
121  std::unordered_set<int> XplaneList;
122  std::unordered_set<int> YplaneList;
123  std::unordered_set<int> planeList;
124 
125  // Loop over the slices in the event
126  for(unsigned int i=0; i<hits->n_groups(); ++i){
127 
128  // Get the hits for the current slice
129  novaddt::HitList theSliceHits = hits->get(i);
130 
131  XplaneList.clear();
132  YplaneList.clear();
133  planeList.clear();
134  fContinuity = false;
135  // Safety checks in case we mess up the fickle file
137  if(!(_maxNearWindow * _minNearPlanes)) fContinuity = true;
138 
139  ++_sliceCounts;
140 
141  fHits = theSliceHits.size();
142  for(unsigned int j=0; j < theSliceHits.size(); ++j){
143  auto thePlane = theSliceHits.at(j).Plane().val;
144  // Push the plane into the list of unique planes
145  auto theView = theSliceHits.at(j).View().val;
146  if(theView == daqchannelmap::X_VIEW) XplaneList.insert(thePlane);
147  else if(theView == daqchannelmap::Y_VIEW) YplaneList.insert(thePlane);
148  planeList.insert(thePlane);
149 
150  fHisto->Fill(theSliceHits.at(j).ADC().val);
151  } // endfor j
152 
153  fXPlanes = XplaneList.size();
154  fYPlanes = YplaneList.size();
156 
157  for(auto iPlane=planeList.begin(); iPlane!=planeList.end(); ++iPlane)
158  {
159  if(!fContinuity)
160  {
161  unsigned int fNearPlanes = 0;
162  for(unsigned int j=1; j<=_maxNearWindow; ++j)
163  fNearPlanes += planeList.count(*iPlane+j);
164 
165  if(fNearPlanes >= _minNearPlanes)
166  fContinuity = true;
167  }
168  } // end of continuity check
169 
170  // Now the trigger requirements
171  if(fHits >= _minHits)
172  if(fPlanes >= _minPlanes)
173  if(fXPlanes >= _minPlanesView)
174  if(fYPlanes >= _minPlanesView)
175  if(fContinuity)
176  ++_triggerCounts;
177 
178  fTree->Fill();
179  } // end loop on hit groups
180 
181  bool goodTrigger = (td->size() > 0);
182 
183  e.put(std::move(td));
184 
185  std::cout << "Frequency: " << _triggerCounts*1./(_evtCounts*5.e-3) << " pm "
186  << sqrt(_triggerCounts*(_evtCounts-_triggerCounts)*1./_evtCounts)/(_evtCounts*5.e-3) << " Hz" << std::endl; // Binomial Error
187 
188  return goodTrigger;
189 }
unsigned int _minPlanesView
Minimum planes (unique) on each view.
unsigned int _minHits
Minimum number of hits in the slice.
std::vector< DAQHit > HitList
Definition: HitList.h:15
T sqrt(T number)
Definition: d0nt_math.hpp:156
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
OStream cout
Definition: OStream.cxx:6
std::string _hitsModuleLabel
label of module making the HitList
unsigned int _maxNearWindow
Maximum window where to look for near planes.
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 _minNearPlanes
Minimum number of near planes.
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::ActivityTriggerAna::_evtCounts = 0
private

Definition at line 61 of file ActivityTriggerAna_module.cc.

Referenced by filter().

std::string novaddt::ActivityTriggerAna::_hitsInstanceLabel
private

instance label making the HitList

Definition at line 51 of file ActivityTriggerAna_module.cc.

Referenced by filter().

std::string novaddt::ActivityTriggerAna::_hitsModuleLabel
private

label of module making the HitList

Definition at line 50 of file ActivityTriggerAna_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTriggerAna::_maxNearWindow
private

Maximum window where to look for near planes.

Definition at line 55 of file ActivityTriggerAna_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTriggerAna::_minHits
private

Minimum number of hits in the slice.

Definition at line 52 of file ActivityTriggerAna_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTriggerAna::_minNearPlanes
private

Minimum number of near planes.

Definition at line 56 of file ActivityTriggerAna_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTriggerAna::_minPlanes
private

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

Definition at line 54 of file ActivityTriggerAna_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTriggerAna::_minPlanesView
private

Minimum planes (unique) on each view.

Definition at line 53 of file ActivityTriggerAna_module.cc.

Referenced by filter().

unsigned int novaddt::ActivityTriggerAna::_prescale
private

holds prescaling variable from fcl file

Definition at line 57 of file ActivityTriggerAna_module.cc.

unsigned int novaddt::ActivityTriggerAna::_sliceCounts = 0
private

Definition at line 60 of file ActivityTriggerAna_module.cc.

Referenced by filter().

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

Definition at line 59 of file ActivityTriggerAna_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().

bool novaddt::ActivityTriggerAna::fContinuity
private

Definition at line 70 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

TH1I* novaddt::ActivityTriggerAna::fHisto
private

Definition at line 65 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

unsigned int novaddt::ActivityTriggerAna::fHits
private

Definition at line 66 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

unsigned int novaddt::ActivityTriggerAna::fPlanes
private

Definition at line 69 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

TTree* novaddt::ActivityTriggerAna::fTree
private

Definition at line 64 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

unsigned int novaddt::ActivityTriggerAna::fXPlanes
private

Definition at line 67 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

unsigned int novaddt::ActivityTriggerAna::fYPlanes
private

Definition at line 68 of file ActivityTriggerAna_module.cc.

Referenced by beginJob(), and filter().

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

Definition at line 32 of file EDFilter.h.

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

art::ServiceHandle<art::TFileService> novaddt::ActivityTriggerAna::tfs
private

Definition at line 63 of file ActivityTriggerAna_module.cc.

Referenced by beginJob().


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