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

Public Member Functions

 EventTimeFilter (fhicl::ParameterSet const &)
 
bool filter (art::Event &evt)
 
- 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

UInt_t fDateRangeLow
 
UInt_t fTimeRangeLow
 
UInt_t fDateRangeHigh
 
UInt_t fTimeRangeHigh
 

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 32 of file EventTimeFilter_module.cc.

Constructor & Destructor Documentation

filter::EventTimeFilter::EventTimeFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 51 of file EventTimeFilter_module.cc.

52  : EDFilter{pset}
53 {
54  fDateRangeLow = pset.get<UInt_t>("DateRangeLow", 0); // YYYYMMDD
55  fTimeRangeLow = pset.get<UInt_t>("TimeRangeLow", 0); // HHMMSS
56  fDateRangeHigh = pset.get<UInt_t>("DateRangeHigh", 0); // YYYYMMDD
57  fTimeRangeHigh = pset.get<UInt_t>("TimeRangeHigh", 0); // HHMMSS
58 }
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21

Member Function Documentation

bool filter::EventTimeFilter::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 60 of file EventTimeFilter_module.cc.

60  {
61 
62  // Check that input date is in correct format
63  if (fDateRangeHigh > 99999999 || fDateRangeLow > 99999999) {
64  std::cout << "Warning: please provide date in format YYYYMMDD, event time "
65  << "filter returning false." << std::endl;
66  return false;
67  }
68  if (fDateRangeHigh > 0 && fDateRangeHigh < 10000000) {
69  std::cout << "Warning: please provide date in format YYYYMMDD, event time "
70  << "filter returning false." << std::endl;
71  return false;
72  }
73  if (fDateRangeLow > 0 && fDateRangeLow < 10000000) {
74  std::cout << "Warning: please provide date in format YYYYMMDD, event time "
75  << "filter returning false." << std::endl;
76  return false;
77  }
78 
79  // Check that input times are in correct format
80  if (fTimeRangeHigh > 999999 || fTimeRangeLow > 999999) {
81  std::cout << "Warning: please provide time in format HHMMSS, event time "
82  << "filter returning false." << std::endl;
83  return false;
84  }
85  if (fTimeRangeHigh > 0 && fTimeRangeHigh < 100000) {
86  std::cout << "Warning: please provide time in format HHMMSS, event time "
87  << "filter returning false." << std::endl;
88  return false;
89  }
90  if (fTimeRangeLow > 0 && fTimeRangeLow < 100000) {
91  std::cout << "Warning: please provide time in format HHMMSS, event time "
92  << "filter returning false." << std::endl;
93  return false;
94  }
95 
96  // Event time
97  art::Timestamp evtTime = evt.time();
98  TTimeStamp * evtTTS;
99  if (evtTime.timeHigh() == 0) { evtTTS = new TTimeStamp(evtTime.timeLow()); }
100  else { evtTTS = new TTimeStamp(evtTime.timeHigh(), evtTime.timeLow()); }
101 
102  std::cout << "Event time: " << evtTTS -> AsString() << std::endl;
103 
104  // Requested time range lower end
105  TTimeStamp * ttsLow(nullptr);
106  if (fDateRangeLow != 0) {
107  if (fTimeRangeLow != 0) {
108  ttsLow = new TTimeStamp(fDateRangeLow, fTimeRangeLow, 0u);
109  }
110  else {
111  ttsLow = new TTimeStamp(fDateRangeLow, 0u, 0u);
112  std::cout << "Warning: No start time given for event time filter, "
113  << "assuming 00:00:00" << std::endl;
114  }
115  }
116 
117  // Requested time range higher end
118  TTimeStamp * ttsHigh(nullptr);
119  if (fDateRangeHigh != 0) {
120  if (fTimeRangeHigh != 0) {
121  ttsHigh = new TTimeStamp(fDateRangeHigh, fTimeRangeHigh, 0u);
122  }
123  else {
124  std::cout << "Warning: No end time given for event time filter, assuming "
125  << "23:59:59" << std::endl;
126  ttsHigh = new TTimeStamp(fDateRangeHigh, 235959u, 0u);
127  }
128  }
129 
130  // Filter decision
131  if (ttsLow == nullptr && ttsHigh == nullptr) {
132  std::cout << "Warning: No date range requested for event time filter, "
133  << "returning false." << std::endl;
134  return false;
135  }
136  else if (ttsLow == nullptr) {
137  std::cout << "Warning: No lower limit requested for event time filter, "
138  << "taking all events before " << ttsHigh -> AsString()
139  << std::endl;
140  if (evtTTS -> GetSec() < ttsHigh -> GetSec()) { return true; }
141  else { return false;}
142  }
143  else if (ttsHigh == nullptr) {
144  std::cout << "Warning: No lower limit requested for event time filter, "
145  << "taking all events after " << ttsLow -> AsString()
146  << std::endl;
147  if (evtTTS -> GetSec() > ttsLow -> GetSec()) { return true; }
148  else { return false;}
149  }
150  else {
151  if (evtTTS -> GetSec() > ttsLow -> GetSec() &&
152  evtTTS -> GetSec() < ttsHigh -> GetSec()) { return true; }
153  else { return false; }
154  }
155 
156 }
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
Timestamp time() const
const char * AsString(Resonance_t res)
resonance id -> string
QTextStream & endl(QTextStream &s)

Member Data Documentation

UInt_t filter::EventTimeFilter::fDateRangeHigh
private

Definition at line 44 of file EventTimeFilter_module.cc.

UInt_t filter::EventTimeFilter::fDateRangeLow
private

Definition at line 42 of file EventTimeFilter_module.cc.

UInt_t filter::EventTimeFilter::fTimeRangeHigh
private

Definition at line 45 of file EventTimeFilter_module.cc.

UInt_t filter::EventTimeFilter::fTimeRangeLow
private

Definition at line 43 of file EventTimeFilter_module.cc.


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