Public Member Functions | Private Member Functions | Private Attributes | List of all members
dune::CounterFilter Class Reference
Inheritance diagram for dune::CounterFilter:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 CounterFilter (fhicl::ParameterSet const &p)
 
 CounterFilter (CounterFilter const &)=delete
 
 CounterFilter (CounterFilter &&)=delete
 
CounterFilteroperator= (CounterFilter const &)=delete
 
CounterFilteroperator= (CounterFilter &&)=delete
 
bool filter (art::Event &e) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

bool OppositeEW (std::vector< unsigned int > c)
 

Private Attributes

std::string fT0ModuleLabel
 

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 28 of file CounterFilter_module.cc.

Constructor & Destructor Documentation

dune::CounterFilter::CounterFilter ( fhicl::ParameterSet const &  p)
explicit

Definition at line 55 of file CounterFilter_module.cc.

55  : EDFilter{p}
56 {
57  this->reconfigure(p);
58 }
p
Definition: test.py:223
void reconfigure(fhicl::ParameterSet const &p)
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
dune::CounterFilter::CounterFilter ( CounterFilter const &  )
delete
dune::CounterFilter::CounterFilter ( CounterFilter &&  )
delete

Member Function Documentation

bool dune::CounterFilter::filter ( art::Event e)
overridevirtual

Implements art::EDFilter.

Definition at line 60 of file CounterFilter_module.cc.

61 {
62  bool valid = false;
63 
64  auto t0Handle = e.getHandle< std::vector< anab::T0> >(fT0ModuleLabel);
65  if (t0Handle)
66  {
67 
68  art::FindManyP<raw::ExternalTrigger> triggers(t0Handle,e,fT0ModuleLabel);
69 
70  for (size_t i_t0 = 0; i_t0 < t0Handle->size(); i_t0++)
71  {
72  art::Ptr<anab::T0> pt0(t0Handle,i_t0);
73  std::vector< art::Ptr<raw::ExternalTrigger> > trigvec = triggers.at(i_t0);
74  if (trigvec.size() != 3) continue;
75 
76  int contains_111 = 0, contains_112 = 0, contains_113 = 0;
77  int contains_Ntrigs = 0, contains_NU = 0, contains_NL = 0, contains_SU = 0, contains_SL = 0;
78  int contains_EL = 0, contains_WU = 0, contains_TEL = 0;
79  for (auto const &trig : trigvec)
80  {
81  unsigned int trigID = trig->GetTrigID();
82  // for c2: unsigned int trigID is always >= 0
83  //if (trigID >= 0 && trigID <= 5) contains_SL++;
84  if (trigID <= 5) contains_SL++;
85  if (trigID >= 6 && trigID <= 15) contains_EL++;
86  if (trigID >= 16 && trigID <= 21) contains_NL++;
87  if (trigID >= 22 && trigID <= 27) contains_NU++;
88  if (trigID >= 28 && trigID <= 37) contains_WU++;
89  if (trigID >= 38 && trigID <= 43) contains_SU++;
90  if (trigID >= 44 && trigID <= 92) contains_TEL++;
91  if (trigID == 111) contains_111++;
92  if (trigID == 112) contains_112++;
93  if (trigID == 113) contains_113++;
94  contains_Ntrigs++;
95  } // end loop over trigvec
96  if (contains_111 + contains_112 + contains_113 != 1) continue; // too many/few coincidences!
97  if (contains_TEL &&
98  (contains_NU || contains_NL || contains_SU || contains_SL || contains_EL || contains_WU)) continue; // track probably doesn't go through detector
99  if (contains_Ntrigs != 3) continue; // too much/little going on!
100  if (contains_111 && (contains_NU || contains_NL || contains_SU || contains_SL)) continue; // 111 should not have NU/NL/SU/SL
101  if (contains_112 && (contains_EL || contains_WU || contains_SU || contains_NL)) continue; // 112 should not have EL/WU/SU/NL
102  if (contains_113 && (contains_EL || contains_WU || contains_NU || contains_SL)) continue; // 113 should not have EL/WU/NU/SL
103  if (contains_111 && (!contains_EL || !contains_WU)) continue; // incomplete trigger
104  if (contains_112 && (!contains_NU || !contains_SL)) continue; // incomplete trigger
105  if (contains_113 && (!contains_SU || !contains_NL)) continue; // incomplete trigger
106 
107  std::vector<unsigned int> counterIDs;
108  unsigned int trignum = 0;
109  for (auto const &trig : trigvec)
110  {
111  unsigned int trigID = trig->GetTrigID();
112  if (trigID >= 44 && trigID <= 100) continue;
113  if (trigID >= 111 && trigID <= 113)
114  {
115  trignum = trigID;
116  continue;
117  }
118  counterIDs.push_back(trigID);
119  }
120  if (counterIDs.size() != 2) continue;
121  if (trignum == 0) continue;
122 
123  if (trignum == 111 && OppositeEW(counterIDs))
124  {
125  std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
126  std::cout << "Event # " << e.event() << std::endl;
127  std::cout << " counter IDs " << counterIDs[0] << " and " << counterIDs[1] << std::endl;
128  std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
129  valid = true;
130 
131  }
132  }
133  }
134  return valid;
135 }
EventNumber_t event() const
Definition: DataViewImpl.cc:85
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
bool OppositeEW(std::vector< unsigned int > c)
Definition: fwd.h:31
QTextStream & endl(QTextStream &s)
CounterFilter& dune::CounterFilter::operator= ( CounterFilter const &  )
delete
CounterFilter& dune::CounterFilter::operator= ( CounterFilter &&  )
delete
bool dune::CounterFilter::OppositeEW ( std::vector< unsigned int >  c)
private

Definition at line 137 of file CounterFilter_module.cc.

138 {
139  if (c.size() != 2) return false;
140  unsigned int c1 = c[0];
141  unsigned int c2 = c[1];
142  if (c1==c2) return false;
143  if (c1%22 == c2 || c2%22 == c1) return true;
144  return false;
145 }
void dune::CounterFilter::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 147 of file CounterFilter_module.cc.

148 {
149  fT0ModuleLabel = p.get<std::string>("T0ModuleLabel");
150 }
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223

Member Data Documentation

std::string dune::CounterFilter::fT0ModuleLabel
private

Definition at line 50 of file CounterFilter_module.cc.


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