Diana Software
MTutorialAmplitudeFilter.cc
Go to the documentation of this file.
1 
12 #include "QEvent.hh"
13 #include "QBaseType.hh"
14 
15 
17 
18 using namespace Diana;
19 
20 // GetCuts method is called before the event loop (like QModule::Init())
22 {
23  // Get cuts from config file
24  fAmplitudeMinimum = GetDouble("AmplitudeMinimum",0);
25  fAmplitudeMaximum = GetDouble("AmplitudeMaximum",10000);
26  // Get from config file the label of the amplitude variable to be used
27  fAmplitudeLabel = GetString("AmplitudeLabel","PulseBasicParameters@MaxBaseline");
28  ev.RequireByLabel<QDouble>(fAmplitudeLabel);
29 
30 }
31 
32 // Filter method is called on each event (like QModule::Do())
34 {
35  // get amplitude from the event
36  const QDouble& amp = ev.GetByLabel<QDouble>(fAmplitudeLabel);
37  // true if amplitude is in the range, false otherwise
38  if(amp > fAmplitudeMinimum && amp < fAmplitudeMaximum) {
39  return true;
40  }
41  return false;
42 }
43 
44 // There is no method called at the end of the event loop, like QModule::Done()
double amp
Definition: CheckOF.C:32
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
bool Filter(const Diana::QEvent &ev)
return true if ev passes the cuts
void GetCuts(const Diana::QEvent &ev)
Get cuts from config file.
base types wrapped into a QObject. Currently implemented types are QInt QDouble and QFloat....
Definition: QBaseType.hh:17
diana event
Definition: QEvent.hh:46
const Q & GetByLabel(const QEventLabel &label) const
Get a QObject in read mode by label.
Definition: QEvent.hh:135
void RequireByLabel(const QEventLabel &label) const
notify the QEvent that we need a QObject, if not found an exception is thrown
Definition: QEvent.hh:242
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...