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

Public Member Functions

 ProtoDUNEFembFilter (fhicl::ParameterSet const &pset)
 
virtual ~ProtoDUNEFembFilter ()
 
virtual bool filter (art::Event &e)
 
void beginJob ()
 
- 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 Attributes

protoana::ProtoDUNEDataUtils fDataUtils
 
unsigned int fLogLevel
 
bool fRequireBeamsideFembsOnly
 
bool fRequireBeamsideTimestampConsistencyOnly
 
TH1D * fSelectedEvents
 
TH1D * fTotalEvents
 

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 25 of file ProtoDUNEFembFilter_module.cc.

Constructor & Destructor Documentation

filt::ProtoDUNEFembFilter::ProtoDUNEFembFilter ( fhicl::ParameterSet const &  pset)
explicit
virtual filt::ProtoDUNEFembFilter::~ProtoDUNEFembFilter ( )
inlinevirtual

Definition at line 28 of file ProtoDUNEFembFilter_module.cc.

28 {};

Member Function Documentation

void filt::ProtoDUNEFembFilter::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 69 of file ProtoDUNEFembFilter_module.cc.

69  {
70 
72  fSelectedEvents = tfs->make<TH1D>("fSelectedEvents", "Number of Selected Events", 3, 0, 3); //counts the number of selected events
73  fTotalEvents = tfs->make<TH1D>("fTotalEvents", "Total Events", 3, 0, 3); //counts the initial number of events in the unfiltered root input file
74 
75  }
bool filt::ProtoDUNEFembFilter::filter ( art::Event e)
virtual

Implements art::EDFilter.

Definition at line 77 of file ProtoDUNEFembFilter_module.cc.

77  {
78 
79 
80  fTotalEvents->Fill(1); //count total events
81 
82 
83  if(!evt.isRealData()){
84  fSelectedEvents->Fill(1);
85  return true; //Filter is designed for Data only. Don't want to filter on MC
86  }
87 
88 
89 
90 
91  std::vector<int> BeamsideAPAs;
92  std::vector<int> AllAPAs;
93  std::vector<int> checkedAPAs;
94  std::vector<int> TScheckedAPAs;
95 
96  // Add some elements to myIntVector
97  BeamsideAPAs.push_back(0);
98  BeamsideAPAs.push_back(2);
99  BeamsideAPAs.push_back(4);
100 
101  AllAPAs.push_back(0);
102  AllAPAs.push_back(1);
103  AllAPAs.push_back(2);
104  AllAPAs.push_back(3);
105  AllAPAs.push_back(4);
106  AllAPAs.push_back(5);
107 
108  const std::string myname = "ProtoDUNEFembFilter::filter: ";
109 
111  checkedAPAs=BeamsideAPAs;
112  }
113  else{
114  checkedAPAs=AllAPAs;
115  }
117  TScheckedAPAs=BeamsideAPAs;
118  }
119  else{
120  TScheckedAPAs=AllAPAs;
121  }
122 
123  // make a set out of these for faster lookup by the timestamp checker
124 
125  std::set<int> checkedAPAset;
126  for (size_t i=0; i < checkedAPAs.size(); ++i)
127  {
128  checkedAPAset.emplace(TScheckedAPAs.at(i));
129  }
130 
131  bool keep = true;
132  // Helper utility functions
133 
134  fTotalEvents->Fill(1); //count total events
135  for (auto APA = checkedAPAs.begin(); APA != checkedAPAs.end(); ++APA){ //loop through beam side APAs
136  //std::cout<<"APA:"<<*APA<<std::endl;
137  //std::cout<<fDataUtils.GetNActiveFembsForAPA(evt, *APA)<<std::endl;
138  if (fDataUtils.GetNActiveFembsForAPA(evt, *APA)!=20){ //check if APA has all 20 fembs active
139 
140  if (fLogLevel >=2) std::cout<<"Missing FEMBs on APA: "<<*APA<<std::endl;
141  keep=false; //if not remove event
142  }
143  }
144 
145  // check timestamp consistency
146 
147  ULong64_t timestamp=0;
148  ULong64_t timestamp2=0;
149  int apainconsist=0;
150  if (!fDataUtils.CheckTimeStampConsistencyForAPAs(evt, checkedAPAset, timestamp, timestamp2, apainconsist ))
151  {
152  keep = false;
153  if (fLogLevel >=2) std::cout<<"ProtoDUNEFembFilter Timestamp mismatch: " << timestamp << " vs " << timestamp2 << " on TPC set " << apainconsist << std::endl;
154  }
155 
156  if ( fLogLevel >=2 ) std::cout << myname << (keep ? "Keep" : "Reject") << "ing event." << std::endl;
157  if (keep==true) fSelectedEvents->Fill(1); //count total events
158 
159  return keep;
160 
161  }
protoana::ProtoDUNEDataUtils fDataUtils
std::string string
Definition: nybbler.cc:12
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
bool CheckTimeStampConsistencyForAPAs(art::Event const &evt, std::set< int > apas, ULong64_t &timestamp, ULong64_t &timestamp2, int &apainconsist) const
Check for consistency of timestamp values for a set of APAs. True if consistent, false if there are m...
TCEvent evt
Definition: DataStructs.cxx:7
QTextStream & endl(QTextStream &s)

Member Data Documentation

protoana::ProtoDUNEDataUtils filt::ProtoDUNEFembFilter::fDataUtils
private

Definition at line 33 of file ProtoDUNEFembFilter_module.cc.

unsigned int filt::ProtoDUNEFembFilter::fLogLevel
private

Definition at line 35 of file ProtoDUNEFembFilter_module.cc.

bool filt::ProtoDUNEFembFilter::fRequireBeamsideFembsOnly
private

Definition at line 36 of file ProtoDUNEFembFilter_module.cc.

bool filt::ProtoDUNEFembFilter::fRequireBeamsideTimestampConsistencyOnly
private

Definition at line 37 of file ProtoDUNEFembFilter_module.cc.

TH1D* filt::ProtoDUNEFembFilter::fSelectedEvents
private

Definition at line 39 of file ProtoDUNEFembFilter_module.cc.

TH1D* filt::ProtoDUNEFembFilter::fTotalEvents
private

Definition at line 40 of file ProtoDUNEFembFilter_module.cc.


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