Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EvtDispFilter.cxx
Go to the documentation of this file.
1 #include <sstream>
2 //#include <TSystem.h>
7 #include <phool/PHNodeIterator.h>
8 #include <phool/PHIODataNode.h>
9 #include <phool/getClass.h>
10 #include "EvtDispFilter.h"
11 using namespace std;
12 
13 EvtDispFilter::EvtDispFilter(const int n_step, const int n_max)
14  : SubsysReco("EvtDispFilter")
15  , m_n_step(n_step)
16  , m_n_max(n_max)
17  , m_sq_evt(0)
18  , m_sq_hv(0)
19 {
20  ;
21 }
22 
24 {
25  ;
26 }
27 
29 {
31 }
32 
34 {
35  m_sq_evt = findNode::getClass<SQEvent >(topNode, "SQEvent" );
36  m_sq_hv = findNode::getClass<SQHitVector>(topNode, "SQHitVector");
37  if (!m_sq_evt || !m_sq_hv) return Fun4AllReturnCodes::ABORTEVENT;
39 }
40 
42 {
43  static int spill_id_pre = -1;
44  static int event_id_pre = -1;
45  static int n_evt_sp = 0;
46 
47  int spill_id = m_sq_evt->get_spill_id();
48  if (spill_id_pre < 0 || spill_id != spill_id_pre) { // 1st or new spill
49  n_evt_sp = 0;
50  spill_id_pre = spill_id;
51  }
52  if (n_evt_sp >= m_n_max) return Fun4AllReturnCodes::DISCARDEVENT;
53 
54  int event_id = m_sq_evt->get_event_id();
55  if (event_id - event_id_pre < m_n_step) return Fun4AllReturnCodes::DISCARDEVENT;
56 
57  if (m_sq_evt->get_trigger(SQEvent::NIM1 ) ||
58  m_sq_evt->get_trigger(SQEvent::NIM2 ) ||
59 // m_sq_evt->get_trigger(SQEvent::MATRIX1) ||
60  m_sq_evt->get_trigger(SQEvent::NIM4 ) ) {
61  event_id_pre = event_id;
62  n_evt_sp++;
64  }
66 }
67 
69 {
71 }
virtual ~EvtDispFilter()
virtual bool get_trigger(const SQEvent::TriggerMask i) const =0
Return the trigger bit (fired or not) of the selected trigger channel.
int process_event(PHCompositeNode *topNode)
virtual int get_event_id() const =0
Return the event ID, which is unique per run.
virtual int get_spill_id() const =0
Return the spill ID.
int End(PHCompositeNode *topNode)
Called at the end of all processing.
EvtDispFilter(const int n_step=1000, const int n_max=3)
int InitRun(PHCompositeNode *topNode)
int Init(PHCompositeNode *topNode)