REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorSignalEvent.h
1 
19 #ifndef RestDAQ_TRestDetectorSignalEvent
20 #define RestDAQ_TRestDetectorSignalEvent
21 
22 #include <TAxis.h>
23 #include <TGraph.h>
24 #include <TMultiGraph.h>
25 #include <TPad.h>
26 #include <TRestEvent.h>
27 
28 #include <iostream>
29 
30 #include "TRestDetectorSignal.h"
31 
33  protected:
34  Double_t fMinTime;
35  Double_t fMaxTime;
36  Double_t fMinValue;
37  Double_t fMaxValue;
38 
39  std::vector<TRestDetectorSignal> fSignal; // Collection of signals that define the event
40 
41  private:
42  void SetMaxAndMin();
43 
44  public:
45  inline Bool_t signalIDExists(Int_t sID) {
46  if (GetSignalIndex(sID) == -1) {
47  return false;
48  }
49  return true;
50  }
51 
52  inline void SortSignals() {
53  for (int n = 0; n < GetNumberOfSignals(); n++) {
54  fSignal[n].Sort();
55  }
56  }
57 
58  // Setters
59  void AddSignal(const TRestDetectorSignal& signal);
60  void AddChargeToSignal(Int_t signalID, Double_t time, Double_t charge);
61 
62  void RemoveSignalWithId(Int_t sId);
63 
64  // Getters
65  inline Int_t GetNumberOfSignals() const { return fSignal.size(); }
66  inline TRestDetectorSignal* GetSignal(Int_t n) { return &fSignal[n]; }
67 
68  inline TRestDetectorSignal* GetSignalById(Int_t sid) {
69  Int_t index = GetSignalIndex(sid);
70  if (index < 0) {
71  return nullptr;
72  }
73 
74  return &fSignal[index];
75  }
76 
77  Int_t GetSignalIndex(Int_t signalID);
78 
79  Double_t GetIntegral(Int_t startBin = 0, Int_t endBin = 0);
80  Double_t GetMaxValue();
81  Double_t GetMinValue();
82  Double_t GetMinTime();
83  Double_t GetMaxTime();
84 
85  Double_t GetIntegralWithTime(Double_t startTime, Double_t endTime);
86 
87  // Default
88  void Initialize();
89  void PrintEvent();
90 
91  TPad* DrawEvent(const TString& option = "");
92 
93  // Constructor
95  // Destructor
96  virtual ~TRestDetectorSignalEvent();
97 
98  ClassDef(TRestDetectorSignalEvent, 1); // REST event superclass
99 };
100 #endif
TPad * DrawEvent(const TString &option="")
Draw the event.
A base class for any REST event.
Definition: TRestEvent.h:38