19 #include "RtypesCore.h"
21 #include "TTimeStamp.h"
24 #include "art/Framework/Core/ModuleMacros.h"
25 #include "art/Framework/Core/EDFilter.h"
26 #include "art/Framework/Principal/Event.h"
27 #include "fhiclcpp/ParameterSet.h"
54 fDateRangeLow = pset.get<UInt_t>(
"DateRangeLow", 0);
55 fTimeRangeLow = pset.get<UInt_t>(
"TimeRangeLow", 0);
56 fDateRangeHigh = pset.get<UInt_t>(
"DateRangeHigh", 0);
57 fTimeRangeHigh = pset.get<UInt_t>(
"TimeRangeHigh", 0);
63 if (fDateRangeHigh > 99999999 || fDateRangeLow > 99999999) {
64 std::cout <<
"Warning: please provide date in format YYYYMMDD, event time "
65 <<
"filter returning false." << std::endl;
68 if (fDateRangeHigh > 0 && fDateRangeHigh < 10000000) {
69 std::cout <<
"Warning: please provide date in format YYYYMMDD, event time "
70 <<
"filter returning false." << std::endl;
73 if (fDateRangeLow > 0 && fDateRangeLow < 10000000) {
74 std::cout <<
"Warning: please provide date in format YYYYMMDD, event time "
75 <<
"filter returning false." << std::endl;
80 if (fTimeRangeHigh > 999999 || fTimeRangeLow > 999999) {
81 std::cout <<
"Warning: please provide time in format HHMMSS, event time "
82 <<
"filter returning false." << std::endl;
85 if (fTimeRangeHigh > 0 && fTimeRangeHigh < 100000) {
86 std::cout <<
"Warning: please provide time in format HHMMSS, event time "
87 <<
"filter returning false." << std::endl;
90 if (fTimeRangeLow > 0 && fTimeRangeLow < 100000) {
91 std::cout <<
"Warning: please provide time in format HHMMSS, event time "
92 <<
"filter returning false." << std::endl;
97 art::Timestamp evtTime = evt.time();
99 if (evtTime.timeHigh() == 0) { evtTTS =
new TTimeStamp(evtTime.timeLow()); }
100 else { evtTTS =
new TTimeStamp(evtTime.timeHigh(), evtTime.timeLow()); }
102 std::cout <<
"Event time: " << evtTTS -> AsString() << std::endl;
105 TTimeStamp * ttsLow(
nullptr);
106 if (fDateRangeLow != 0) {
107 if (fTimeRangeLow != 0) {
108 ttsLow =
new TTimeStamp(fDateRangeLow, fTimeRangeLow, 0u);
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;
118 TTimeStamp * ttsHigh(
nullptr);
119 if (fDateRangeHigh != 0) {
120 if (fTimeRangeHigh != 0) {
121 ttsHigh =
new TTimeStamp(fDateRangeHigh, fTimeRangeHigh, 0u);
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);
131 if (ttsLow ==
nullptr && ttsHigh ==
nullptr) {
132 std::cout <<
"Warning: No date range requested for event time filter, "
133 <<
"returning false." << std::endl;
136 else if (ttsLow ==
nullptr) {
137 std::cout <<
"Warning: No lower limit requested for event time filter, "
138 <<
"taking all events before " << ttsHigh -> AsString()
140 if (evtTTS -> GetSec() < ttsHigh -> GetSec()) {
return true; }
141 else {
return false;}
143 else if (ttsHigh ==
nullptr) {
144 std::cout <<
"Warning: No lower limit requested for event time filter, "
145 <<
"taking all events after " << ttsLow -> AsString()
147 if (evtTTS -> GetSec() > ttsLow -> GetSec()) {
return true; }
148 else {
return false;}
151 if (evtTTS -> GetSec() > ttsLow -> GetSec() &&
152 evtTTS -> GetSec() < ttsHigh -> GetSec()) {
return true; }
153 else {
return false; }
bool filter(art::Event &evt)
EventTimeFilter(fhicl::ParameterSet const &)
BEGIN_PROLOG could also be cout