stream  0.10.0
stream analysis framework
SubProcessor.h
1 #ifndef HADAQ_SUBPROCESSOR_H
2 #define HADAQ_SUBPROCESSOR_H
3 
4 #include "base/StreamProc.h"
5 
6 #include "hadaq/definess.h"
7 
8 #include <map>
9 
10 
11 namespace hadaq {
12 
13  class SubProcessor;
14  class TrbProcessor;
15  class HldProcessor;
16 
18  typedef std::map<unsigned,SubProcessor*> SubProcMap;
19 
26  class SubProcessor : public base::StreamProc {
27 
28  friend class TrbProcessor;
29 
30  protected:
32  unsigned fSeqeunceId;
33  bool fIsTDC;
34 
35  base::H1handle *fMsgPerBrd;
36  base::H1handle *fErrPerBrd;
37  base::H1handle *fHitsPerBrd;
38  base::H2handle *fCalHitsPerBrd;
39  base::H2handle *fToTPerBrd;
40 
41  bool fNewDataFlag;
44 
45  SubProcessor(TrbProcessor *trb, const char* nameprefix, unsigned subid);
46 
49  virtual void BeforeFill() {}
50 
53  virtual void AfterFill(SubProcMap* = nullptr) {}
54 
57  virtual void AppendTrbSync(uint32_t) {}
58 
60  void SetNewDataFlag(bool on) { fNewDataFlag = on; }
62  bool IsNewDataFlag() const { return fNewDataFlag; }
63 
64  void AssignPerBrdHistos(TrbProcessor *trb, unsigned seqid);
65 
66  public:
67 
69  virtual ~SubProcessor() {}
70 
71  virtual void UserPreLoop();
72 
74  inline bool IsTDC() const { return fIsTDC; }
75 
77  void SetPrintRawData(bool on = true) { fPrintRawData = on; }
79  bool IsPrintRawData() const { return fPrintRawData; }
80 
82  bool IsCrossProcess() const { return fCrossProcess; }
83 
84  HldProcessor *GetHLD() const;
85 
86  };
87 
88 }
89 
90 #endif
Abstract processor of data streams.
Definition: StreamProc.h:21
HLD processor.
Definition: HldProcessor.h:93
Abstract processor of HADAQ sub-sub-event.
Definition: SubProcessor.h:26
virtual void BeforeFill()
Before fill, used to fill different raw histograms during first scan.
Definition: SubProcessor.h:49
bool IsTDC() const
is TDC
Definition: SubProcessor.h:74
base::H1handle * fHitsPerBrd
! data hits per board - from TRB
Definition: SubProcessor.h:37
void SetNewDataFlag(bool on)
Set new data flag, used by TrbProcessor.
Definition: SubProcessor.h:60
virtual void UserPreLoop()
pre loop
Definition: SubProcessor.cxx:59
base::H1handle * fMsgPerBrd
! messages per board - from TRB
Definition: SubProcessor.h:35
virtual void AppendTrbSync(uint32_t)
Method will be called by TRB processor if SYNC message was found One should change 4 first bytes in t...
Definition: SubProcessor.h:57
base::H2handle * fToTPerBrd
! ToT per board - from TRB
Definition: SubProcessor.h:39
base::H2handle * fCalHitsPerBrd
! calibration hits per board - from TRB
Definition: SubProcessor.h:38
bool IsNewDataFlag() const
is new data flag, used by TrbProcessor
Definition: SubProcessor.h:62
virtual ~SubProcessor()
destructor
Definition: SubProcessor.h:69
SubProcessor(TrbProcessor *trb, const char *nameprefix, unsigned subid)
constructor
Definition: SubProcessor.cxx:8
bool fCrossProcess
! if true, AfterFill will be called by Trb processor
Definition: SubProcessor.h:43
bool fNewDataFlag
! flag used by TRB processor to indicate if new data was added
Definition: SubProcessor.h:41
bool fIsTDC
! indicate when it is TDC, to avoid dynamic_cast
Definition: SubProcessor.h:33
bool IsPrintRawData() const
is print raw data
Definition: SubProcessor.h:79
void AssignPerBrdHistos(TrbProcessor *trb, unsigned seqid)
assign overview histograms
Definition: SubProcessor.cxx:41
void SetPrintRawData(bool on=true)
set print raw data
Definition: SubProcessor.h:77
unsigned fSeqeunceId
! sequence number of processor in TRB
Definition: SubProcessor.h:32
base::H1handle * fErrPerBrd
! errors per board - from TRB
Definition: SubProcessor.h:36
bool fPrintRawData
! if true, raw data will be printed
Definition: SubProcessor.h:42
bool IsCrossProcess() const
is cross process
Definition: SubProcessor.h:82
virtual void AfterFill(SubProcMap *=nullptr)
After fill, used to fill different raw histograms during first scan.
Definition: SubProcessor.h:53
TrbProcessor * fTrb
! pointer on TRB processor
Definition: SubProcessor.h:31
HldProcessor * GetHLD() const
get HLD processor
Definition: SubProcessor.cxx:72
TRB processor.
Definition: TrbProcessor.h:46