Diana Software
MFilterSideAmplitude.cc
Go to the documentation of this file.
2 #include "QEvent.hh"
3 #include "QEventList.hh"
4 #include "QBaseType.hh"
5 #include <cmath>
6 
7 
9 
10 using namespace Diana;
11 
12 
14 {
15  fNSigma = GetDouble("NumberOfSigma",3,false);
16  fSideAmplitudeOwner = GetString("SideAmplitudeOwner","SideAmplitude",false);
17 
18  ev.RequireByLabel<QDouble>(QEventLabel(fSideAmplitudeOwner.c_str(),"Amplitude"));
19  ev.RequireByLabel<QDouble>(QEventLabel(fSideAmplitudeOwner.c_str(),"NSigma"));
20 }
21 
22 bool MFilterSideAmplitude::Filter(const QEvent& ev, const QEventList& neighbours)
23 {
24 
25  bool passed = true;
26 
27  for(size_t i = 0; i < neighbours.Size(); i++) {
28  const QDouble& n_amplitude = neighbours[i].GetByLabel<QDouble>(QEventLabel(fSideAmplitudeOwner.c_str(),"Amplitude"));
29  const QDouble& n_nsigma = neighbours[i].GetByLabel<QDouble>(QEventLabel(fSideAmplitudeOwner.c_str(),"NSigma"));
30  if (n_amplitude>0. && n_nsigma>fNSigma) passed = false;
31  }
32 
33  return passed;
34 }
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
Filter to rejct main events when at least one side pulse has SideAmplitude above a certain threshold ...
bool Filter(const Diana::QEvent &ev, const Diana::QEventList &neighbours)
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
label for QObject in the QEvent
Definition: QEventLabel.hh:23
list of references to const QEvent (s)
Definition: QEventList.hh:21
size_t Size() const
number of QEvent (s)
Definition: QEventList.hh:36
diana event
Definition: QEvent.hh:46
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...