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

Public Member Functions

 ProtoDUNEUnstableHVFilter (fhicl::ParameterSet const &)
 
virtual ~ProtoDUNEUnstableHVFilter ()
 
uint64_t GetRawDecoderInfo (art::Event &e)
 
bool filter (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
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 Attributes

std::vector< std::pair< UInt_t, UInt_t > > fTimeRanges
 
UInt_t fTimeRangeLow
 
UInt_t fTimeRangeHigh
 
bool fDebug
 
long long RDTSTime
 
double RDTSTimeSec
 
int RDTSTrigger
 
art::Handle< std::vector< raw::RDTimeStamp > > RDTimeStampHandle
 
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 45 of file ProtoDUNEUnstableHVFilter_module.cc.

Constructor & Destructor Documentation

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

Definition at line 88 of file ProtoDUNEUnstableHVFilter_module.cc.

89 : EDFilter(pset) {
90  this->reconfigure(pset);
91 }
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
void reconfigure(fhicl::ParameterSet const &p)
filter::ProtoDUNEUnstableHVFilter::~ProtoDUNEUnstableHVFilter ( )
virtual

Definition at line 92 of file ProtoDUNEUnstableHVFilter_module.cc.

92 { }

Member Function Documentation

void filter::ProtoDUNEUnstableHVFilter::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 72 of file ProtoDUNEUnstableHVFilter_module.cc.

72  {
73 
75  fSelectedEvents = tfs->make<TH1D>("fSelectedEvents", "Number of Selected Events", 3, 0, 3); //counts the number of selected events
76  fTotalEvents = tfs->make<TH1D>("fTotalEvents", "Total Events", 3, 0, 3); //counts the initial number of events in the unfiltered root input file
77 }
void filter::ProtoDUNEUnstableHVFilter::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 78 of file ProtoDUNEUnstableHVFilter_module.cc.

78 { }
bool filter::ProtoDUNEUnstableHVFilter::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 133 of file ProtoDUNEUnstableHVFilter_module.cc.

133  {
134 
135 
136  fTotalEvents->Fill(1);
137 
138 
139 
140  if(!evt.isRealData()){
141  fSelectedEvents->Fill(1);
142  return true; //Filter is designed for Data only. Don't want to filter on MC
143  }
144 
145 
146 
147  const std::string myname = "ProtoDUNEUnstableHVFilter::filter: ";
148  bool keep = true;
149  TTimeStamp * evtTTS;
150  evtTTS = new TTimeStamp(GetRawDecoderInfo(evt));
151  // if (evtTime.timeHigh() == 0) { evtTTS = new TTimeStamp(evtTime.timeLow()); }
152  // else { evtTTS = new TTimeStamp(evtTime.timeHigh(), evtTime.timeLow()); }
153  if (fDebug) std::cout << "Event time: " << evtTTS -> AsString() << std::endl;
154  // Requested time range lower end
155 
156  for (auto TimeRange : fTimeRanges){ //loop through unstable hv time ranges
157 
158  fTimeRangeLow=TimeRange.first;
159  fTimeRangeHigh=TimeRange.second;
160 
161 
162  // Check that input time is in correct format
163 
164 
165  // Check that input times are in correct format
166  if (fTimeRangeHigh < 1000000000 || fTimeRangeLow < 1000000000 ) {
167  std::cout << "Warning: please provide time in POSIX foramt, event time "
168  << "filter returning false." << std::endl;
169  return false;
170 
171  }
172 
173 
174 
175  if (fTimeRangeHigh < fTimeRangeLow ) {
176  std::cout << "Warning: Lower limit bigger than lower limit "
177  << "filter returning false." << std::endl;
178  return false;
179 
180  }
181  //no idea what this is supposed to be doing!! will reject any times before 10am
182  //
183  // if (fTimeRangeHigh > 0 && fTimeRangeHigh < 100000) {
184  // std::cout << "Warning: please provide time in format HHMMSS, event time "
185  // << "filter returning false.2" << std::endl;
186  // return false;
187  // }
188  // if (fTimeRangeLow > 0 && fTimeRangeLow < 100000) {
189  // std::cout << "Warning: please provide time in format HHMMSS, event time "
190  // << "filter returning false.3" << std::endl;
191  // return false;
192  // }
193  // Event time
194  //art::Timestamp evtTime = evt.time();
195 
196 
197  // all the checking he dies then ask if its in the correct range
198 
199  TTimeStamp * ttsLow(nullptr);
200 
201 
202  ttsLow = new TTimeStamp(fTimeRangeLow);
203  // Requested time range higher end
204  TTimeStamp * ttsHigh(nullptr);
205 
206  ttsHigh = new TTimeStamp(fTimeRangeHigh);
207 
208  // Filter decision
209  if(fDebug){
210  std::cout << "Lower Limit: " << ttsLow -> AsString() << std::endl;
211  std::cout << "Upper Limit: " << ttsHigh -> AsString() << std::endl;
212  }
213 
214 
215  if (evtTTS -> GetSec() > ttsLow -> GetSec() &&
216  evtTTS -> GetSec() < ttsHigh -> GetSec()) { keep=false; }
217 
218 
219  }
220  if ( fDebug ) std::cout << myname << (keep ? "Keep" : "Reject") << "ing event." << std::endl;
221  if (keep==true) fSelectedEvents->Fill(1); //count total events
222  //keep=false; //for testing
223  return keep; //need this to stop the get to end error make sure to check this is working as intended
224 }
std::string string
Definition: nybbler.cc:12
std::vector< std::pair< UInt_t, UInt_t > > fTimeRanges
bool isRealData() const
const char * AsString(Resonance_t res)
resonance id -> string
QTextStream & endl(QTextStream &s)
uint64_t filter::ProtoDUNEUnstableHVFilter::GetRawDecoderInfo ( art::Event e)

Definition at line 95 of file ProtoDUNEUnstableHVFilter_module.cc.

95  {
96  MF_LOG_INFO("BeamEvent") << "\n";
97  MF_LOG_INFO("BeamEvent") << "Getting Raw Decoder Info" << "\n";
98 
99  art::InputTag itag1("timingrawdecoder","daq");
100  RDTimeStampHandle = e.getHandle< std::vector<raw::RDTimeStamp> >(itag1);
101  MF_LOG_INFO("BeamEvent") << "RDTS valid? " << RDTimeStampHandle.isValid() << "\n";
102  for (auto const & RDTS : *RDTimeStampHandle){
103  MF_LOG_INFO("BeamEvent") << "High: " << RDTS.GetTimeStamp_High() << "\n";
104  MF_LOG_INFO("BeamEvent") << "Low: " << RDTS.GetTimeStamp_Low() << "\n";
105 
106  uint64_t high = RDTS.GetTimeStamp_High();
107  uint64_t low = RDTS.GetTimeStamp_Low();
108 
109  high = high << 32;
110  uint64_t joined = (high | low);
111 
112  MF_LOG_INFO("BeamEvent") << "Raw Decoder Timestamp: " << joined << "\n";
113 
114  RDTSTime = joined;
115  RDTSTrigger = RDTS.GetFlags();
116  MF_LOG_INFO("BeamEvent") << "Trigger: " << RDTSTrigger << "\n";
117 
118  //Separates seconds portion of the ticks
119  //From the nanoseconds
120  long long RDTSTickSec = (RDTSTime * 2) / (int)(TMath::Power(10,8));
121  RDTSTickSec = RDTSTickSec * (int)(TMath::Power(10,8)) / 2;
122  //long long RDTSTickNano = RDTSTime - RDTSTickSec;
123 
124  //Units are 20 nanoseconds ticks
125  RDTSTimeSec = 20.e-9 * RDTSTickSec;
126  //RDTSTimeNano = 20. * RDTSTickNano;
127 
128 
129  }
130  return RDTSTimeSec;
131 }
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
art::Handle< std::vector< raw::RDTimeStamp > > RDTimeStampHandle
bool isValid() const noexcept
Definition: Handle.h:191
#define MF_LOG_INFO(category)
void filter::ProtoDUNEUnstableHVFilter::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 81 of file ProtoDUNEUnstableHVFilter_module.cc.

81  {
82  fTimeRanges = p.get<std::vector <std::pair<UInt_t,UInt_t >>>("TimeRanges");
83  fDebug = p.get<int>("Debug");
84 
85 }
std::vector< std::pair< UInt_t, UInt_t > > fTimeRanges
p
Definition: test.py:223

Member Data Documentation

bool filter::ProtoDUNEUnstableHVFilter::fDebug
private

Definition at line 59 of file ProtoDUNEUnstableHVFilter_module.cc.

TH1D* filter::ProtoDUNEUnstableHVFilter::fSelectedEvents
private

Definition at line 66 of file ProtoDUNEUnstableHVFilter_module.cc.

UInt_t filter::ProtoDUNEUnstableHVFilter::fTimeRangeHigh
private

Definition at line 58 of file ProtoDUNEUnstableHVFilter_module.cc.

UInt_t filter::ProtoDUNEUnstableHVFilter::fTimeRangeLow
private

Definition at line 57 of file ProtoDUNEUnstableHVFilter_module.cc.

std::vector<std::pair<UInt_t,UInt_t> > filter::ProtoDUNEUnstableHVFilter::fTimeRanges
private

Definition at line 56 of file ProtoDUNEUnstableHVFilter_module.cc.

TH1D* filter::ProtoDUNEUnstableHVFilter::fTotalEvents
private

Definition at line 67 of file ProtoDUNEUnstableHVFilter_module.cc.

art::Handle< std::vector<raw::RDTimeStamp> > filter::ProtoDUNEUnstableHVFilter::RDTimeStampHandle
private

Definition at line 63 of file ProtoDUNEUnstableHVFilter_module.cc.

long long filter::ProtoDUNEUnstableHVFilter::RDTSTime
private

Definition at line 60 of file ProtoDUNEUnstableHVFilter_module.cc.

double filter::ProtoDUNEUnstableHVFilter::RDTSTimeSec
private

Definition at line 61 of file ProtoDUNEUnstableHVFilter_module.cc.

int filter::ProtoDUNEUnstableHVFilter::RDTSTrigger
private

Definition at line 62 of file ProtoDUNEUnstableHVFilter_module.cc.


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