Diana Software
QGPulse.hh
Go to the documentation of this file.
1 #ifndef _QG_PULSE_HH_
2 #define _QG_PULSE_HH_
3 
11 #include <list>
12 #include <vector>
13 #include "QGGraph.hh"
14 
15 class TEventList;
16 class TMarker;
17 
18 class QGPulse : public QGGraph {
19 public:
21  QGPulse();
22 
24  QGPulse(const QGPulse&);
25 
27  virtual ~QGPulse();
28 
30  void AutoSetStyle();
31 
33  void Display();
34 
36  void DisplayEditWindow();
37 
39  void DrawStylePulse();
40 
42  void Duplicate();
43 
45  void Erase();
46 
48  void FillEventData();
49 
51  void Generate(QChain *chain = 0);
52 
54  const std::vector<std::string>& GetEventData() const {return fEventData;}
55 
57  Int_t GetEventIndex() {return fEventIndex;}
58 
60  Int_t GetNumberOfEvents();
61 
63  const std::string& GetOrderVariable() const {return fOrderVariable;}
64 
66  const std::string& GetSamplesLabel() const {return fSamplesLabel;}
67 
70 
72  bool GetPulseFromChain(Long64_t eventIndex);
73 
75  TGraph *GetStylePulse() {return fStylePulse;}
76 
78  bool IsUseADCUnitsSet() const {return fUseADCUnits;}
79 
81  bool IsShowLegendsSet() const {return fShowLegends;}
82 
84  void MakeStylePlot();
85 
87  bool NeedsReordering() const {return fNeedsReordering;}
88 
90  void Order();
91 
93  void SetEventData(const std::vector<std::string>& eventData) {fEventData = eventData;}
94 
96  void SetEventIndex(Long_t index);
97 
99  void SetName(const char *name = 0);
100 
102  void SetOrderVariable(const std::string& orderVariable);
103 
105  void SetProperty(const std::string& key, const std::string& value);
106 
108  void SetReorder(bool flag = true) {fNeedsReordering = flag;}
109 
111  void SetUseADCUnits(bool flag = true) {fUseADCUnits = flag;}
112 
114  void SetShowLegends(bool flag = true) {fShowLegends = flag;}
115 
117  void SetZeroOffset(bool flag = true) {fZeroOffset = flag;}
118 
120  void SetUnitary(bool flag = true) { fUnitary = flag;}
121 
123  void SetSamplesLabel(const std::string& samplesLabel) { fSamplesLabel = samplesLabel; }
124 
126  void UpdatePulseEditWindow();
127 
128 private:
130  void DisplaySampleMarkers();
131 
133  std::vector<std::string> fEventData;
134 
136  std::string HumanizeEventData(std::string);
137 
139  std::vector<Long64_t>::size_type fEventIndex;
140 
142  TEventList *fEventList;
143 
146 
148  std::vector<Long64_t> fOrderedEvents;
149 
151  std::string fOrderVariable;
152 
154  static std::list<QGPulse*> fPulses;
155 
157  std::vector<TMarker*> fSampleMarkers;
158 
160  TGraph *fStylePulse;
161 
164 
167 
169  bool fUnitary;
170 
173 
175  std::string fSamplesLabel;
176 
177  ClassDef(QGPulse, 0)
178 };
179 
180 #endif
TChain used in diana.
Definition: QChain.hh:23
Base class for scatter plots and pulses.
Definition: QGGraph.hh:14
ClassDef(QGGraph, 0)
Class for GUI pulse plots.
Definition: QGPulse.hh:18
bool NeedsReordering() const
Check whether the pulses need reordering.
Definition: QGPulse.hh:87
std::vector< Long64_t > fOrderedEvents
Ordered collection of events that pass the cuts.
Definition: QGPulse.hh:148
Int_t GetNumberOfEvents()
Get number of events that pass the cuts.
Definition: QGPulse.cc:320
const std::string & GetOrderVariable() const
Get order variable.
Definition: QGPulse.hh:63
std::vector< TMarker * > fSampleMarkers
Sample markers for significant samples.
Definition: QGPulse.hh:157
QGPulse()
Default constructor.
Definition: QGPulse.cc:51
void Erase()
Erase the pulse.
Definition: QGPulse.cc:243
void AutoSetStyle()
Automatically set the pulse style.
Definition: QGPulse.cc:104
std::string HumanizeEventData(std::string)
Humanize the event data to display along with pulse.
Definition: QGPulse.cc:611
void SetEventIndex(Long_t index)
Set event index of displayed pulse.
Definition: QGPulse.cc:525
bool IsShowLegendsSet() const
Return true if pulse info legends added to pulse.
Definition: QGPulse.hh:81
void SetOrderVariable(const std::string &orderVariable)
Set the variable by which pulses are ordered.
Definition: QGPulse.cc:551
static std::list< QGPulse * > fPulses
Collection of pointers to all QGPulses.
Definition: QGPulse.hh:154
bool fNeedsReordering
Indicates whether pulses need to be reordered.
Definition: QGPulse.hh:145
std::string fSamplesLabel
samples to draw
Definition: QGPulse.hh:175
virtual ~QGPulse()
Destructor.
Definition: QGPulse.cc:84
void SetSamplesLabel(const std::string &samplesLabel)
Set the label of samples to draw.
Definition: QGPulse.hh:123
void SetEventData(const std::vector< std::string > &eventData)
Set event data.
Definition: QGPulse.hh:93
const std::vector< std::string > & GetEventData() const
Get event data for displayed pulse.
Definition: QGPulse.hh:54
void SetProperty(const std::string &key, const std::string &value)
Set property (used for opening a session)
Definition: QGPulse.cc:559
void SetShowLegends(bool flag=true)
Set whether to display legends on the pulse.
Definition: QGPulse.hh:114
void SetName(const char *name=0)
Set name of the pulse.
Definition: QGPulse.cc:534
void FillEventData()
Fill event data for the displayed pulse.
Definition: QGPulse.cc:261
std::string fOrderVariable
Variable by which pulses are ordered.
Definition: QGPulse.hh:151
bool IsUseADCUnitsSet() const
Return true if pulse is set to be displayed with ADC units.
Definition: QGPulse.hh:78
bool fShowLegends
Whether or not to show legends on pulse.
Definition: QGPulse.hh:172
void UpdatePulseEditWindow()
Update pulse edit window.
Definition: QGPulse.cc:604
void Display()
Display pulse.
Definition: QGPulse.cc:122
bool fUseADCUnits
Whether or not to use ADC units, otherwise use mV and seconds.
Definition: QGPulse.hh:163
void SetReorder(bool flag=true)
Set whether the pulses need to be reordered.
Definition: QGPulse.hh:108
TGraph * fStylePulse
Mini-pulse to show style of this pulse.
Definition: QGPulse.hh:160
void MakeStylePlot()
Make style plot.
Definition: QGPulse.cc:473
bool fZeroOffset
Subtract first sample to all samples.
Definition: QGPulse.hh:166
std::vector< std::string > fEventData
Event data for displayed pulse.
Definition: QGPulse.hh:133
const std::string & GetSamplesLabel() const
Get samples label.
Definition: QGPulse.hh:66
bool GetPulseFromChain(Long64_t eventIndex)
Get pulse from chain.
Definition: QGPulse.cc:344
void GetParametersFromEditWindow()
Get parameters from edit window.
Definition: QGPulse.cc:325
void DrawStylePulse()
Draw a mini-pulse showing the style of the pulse.
Definition: QGPulse.cc:221
TEventList * fEventList
List of events passing the cuts.
Definition: QGPulse.hh:142
void SetUseADCUnits(bool flag=true)
Set whether to display the pulse using ADC units.
Definition: QGPulse.hh:111
void Duplicate()
Duplicate the pulse.
Definition: QGPulse.cc:236
void SetZeroOffset(bool flag=true)
Set whether subtract first sample to tue pulse.
Definition: QGPulse.hh:117
void Order()
Order the pulses accoring to the order variable.
Definition: QGPulse.cc:489
std::vector< Long64_t >::size_type fEventIndex
Index of current event.
Definition: QGPulse.hh:139
void SetUnitary(bool flag=true)
Set whether normalize pulse.
Definition: QGPulse.hh:120
void DisplayEditWindow()
Display edit window.
Definition: QGPulse.cc:199
void DisplaySampleMarkers()
Display markers for significant samples.
Definition: QGPulse.cc:212
bool fUnitary
Zero offset and unitary amplitude.
Definition: QGPulse.hh:169
void Generate(QChain *chain=0)
Generate the pulse.
Definition: QGPulse.cc:299
TGraph * GetStylePulse()
Get style pulse.
Definition: QGPulse.hh:75
Int_t GetEventIndex()
Get event index of displayed pulse.
Definition: QGPulse.hh:57