Diana Software
QGPulse.cc
Go to the documentation of this file.
1 #include "QGPulse.hh"
2 #include <algorithm>
3 #include <iostream>
4 #include <map>
5 #include <set>
6 #include <sstream>
7 #include <string>
8 #include <typeinfo>
9 #include <utility>
10 #include <vector>
11 #include "QChain.hh"
12 #include "QGCanvasWindow.hh"
13 #include "QGCutsFrame.hh"
14 #include "QGFileHandler.hh"
15 #include "QGPlotEditWindow.hh"
16 #include "QGPulseEditWindow.hh"
18 #include "QGPlotFrame.hh"
19 #include "QGPlotStyleFrame.hh"
20 #include "QChannelRunData.hh"
21 #include "QGSessionHandler.hh"
22 #include "QSampleInfo.hh"
23 #include "TAxis.h"
24 #include "TCanvas.h"
25 #include "TPaveText.h"
26 #include "TDirectory.h"
27 #include "TEventList.h"
28 #include "TF1.h"
29 #include "TH1F.h"
30 #include "TMarker.h"
31 #include "TRootEmbeddedCanvas.h"
32 #include "TString.h"
33 #include "TTimeStamp.h"
34 
36 
37 using std::cout;
38 using std::endl;
39 using std::flush;
40 using std::list;
41 using std::make_pair;
42 using std::multimap;
43 using std::set;
44 using std::string;
45 using std::stringstream;
46 using std::vector;
47 using Diana::QVector;
48 
49 list<QGPulse*> QGPulse::fPulses;
50 
52 QGGraph(),
53 fEventIndex(0), fEventList(new TEventList()), fNeedsReordering(true),
54 fStylePulse(new TGraph()), fUseADCUnits(false),fZeroOffset(false),fUnitary(false), fShowLegends(false), fSamplesLabel("")
55 {
56  fPulses.push_back(this);
57  SetName();
58  SetBit(kCanDelete, kFALSE);
59  SetEditable(kFALSE);
60  MakeStylePlot();
61  fEventData.push_back("Run");
62  fEventData.push_back("EventNumber");
63  fEventData.push_back("NsTime/1e9");
64  fEventData.push_back("Channel");
65  fEventData.push_back("IsSignal");
66  fEventData.push_back("IsPulser");
67 }
68 
69 QGPulse::QGPulse(const QGPulse &pulse) :
70 QGGraph(pulse),
71 fEventData(pulse.fEventData), fEventIndex(pulse.fEventIndex), fEventList(new TEventList()),
72 fNeedsReordering(pulse.fNeedsReordering), fOrderedEvents(pulse.fOrderedEvents), fOrderVariable(pulse.fOrderVariable),
73 fStylePulse(new TGraph()), fUseADCUnits(pulse.fUseADCUnits), fZeroOffset(pulse.fZeroOffset), fUnitary(pulse.fUnitary), fShowLegends(pulse.fShowLegends),
74 fSamplesLabel(pulse.fSamplesLabel)
75 {
76  *fEventList = *pulse.fEventList;
77  fPulses.push_back(this);
78  SetName();
79  SetBit(kCanDelete, kFALSE);
80  SetEditable(kFALSE);
81  MakeStylePlot();
82 }
83 
85 {
86  if (fPlotEditWindow) {
87  fPlotEditWindow->CloseWindow();
88  fPlotEditWindow = 0;
89  }
90  if (find(fPulses.begin(), fPulses.end(), this) != fPulses.end()) {
91  fPulses.erase(find(fPulses.begin(), fPulses.end(), this));
92  }
93  delete fStylePulse;
94 
95  // delete sample markers
96  for (vector<TMarker*>::iterator marker = fSampleMarkers.begin();
97  marker != fSampleMarkers.end();
98  ++marker) {
99  delete *marker;
100  }
101  fSampleMarkers.clear();
102 }
103 
105 {
106  Color_t color = 4; // blue
107  set<Color_t> existingColors;
108  list<QGPulse*>::const_iterator plotIter;
109  for (plotIter = fPulses.begin(); plotIter != fPulses.end(); ++plotIter) {
110  existingColors.insert((*plotIter)->GetLineColor());
111  }
112  while (existingColors.count(color) != 0) {
113  ++color;
114  if (color == 5 || color == 10) { // yellow and white
115  ++color;
116  }
117  }
118  SetLineColor(color);
119  MakeStylePlot();
120 }
121 
123 {
124  Reset();
125  if (NeedsReordering()) {
126  Order();
127  SetReorder(false);
128  }
129  bool isPulse = true;
130  if (fEventIndex < fOrderedEvents.size()) {
132  } else {
133  SetPoints(0, 0, 0);
134  }
135 
136  delete fHistogram;
137  fHistogram = 0;
138  if (fStylePulse) {
139  fStylePulse->TAttFill::Copy(*this);
140  fStylePulse->TAttLine::Copy(*this);
141  fStylePulse->TAttMarker::Copy(*this);
142  }
143  string xAxisLabel = "Time (" + GetXUnits() + ")";
144  string yAxisLabel = "Voltage (" + GetYUnits() + ")";
145  GetXaxis()->SetTitle(xAxisLabel.c_str());
146  GetYaxis()->SetTitle(yAxisLabel.c_str());
147  GetYaxis()->SetTitleOffset(1.35);
148  FillEventData();
149  if (fCanvasWindow && isPulse) {
150  bool drawSuperimpose = false;
151  if (fSuperimpose) {
152  if (fCanvasWindow->GetDrawnPlots().size() != 0) {
153  if (typeid(*fCanvasWindow->GetDrawnPlots().back()) == typeid(*this)) {
154  drawSuperimpose = true;
155  }
156  }
157  }
158  if (drawSuperimpose) {
159 
160  fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->RecursiveRemove(this);
161  if ( GetN() > 0) {
162  Draw("L");
164  }
167  } else {
168  fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->Clear();
169  if (isPulse && GetN() > 0) {
170  Draw("AL");
172  }
175  }
176  if(fShowLegends && fEventData.size() != 0){
177  float topEdge = 1- fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->GetTopMargin() ;
178  float rightEdge = 1- fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->GetRightMargin()-0.01;
179 
180  int n = fEventData.size(); // n lines, each line is 0.05 NDC.
181 
182  TPaveText* eventTxt = new TPaveText(rightEdge *2/3, topEdge - 0.05*n , rightEdge, topEdge, "NDC");
183  eventTxt->SetFillStyle(0); // transparent bkg.
184  eventTxt->SetBorderSize(0); // no border
185  eventTxt->SetTextAlign(13); //align left, bottom
186  for (vector<string>::iterator tlIter = fEventData.begin(); tlIter != fEventData.end(); ++tlIter) {
187  eventTxt->AddText((HumanizeEventData(*tlIter)).c_str());
188  }
189  eventTxt->Draw();
190  }
191 
192  if (gPad) {
193  gPad->Update();
194  }
195  }
197 }
198 
200 {
201  if (!fPlotEditWindow) {
203  fPlotEditWindow->SetPlot(this);
204 
205  fPlotEditWindow->GetPlotStyleFrame()->GetEmbeddedCanvas()->GetCanvas()->SetEditable(kTRUE);
206  fPlotEditWindow->GetPlotStyleFrame()->GetEmbeddedCanvas()->GetCanvas()->cd();
207  DrawStylePulse();
208  fPlotEditWindow->GetPlotStyleFrame()->GetEmbeddedCanvas()->GetCanvas()->SetEditable(kFALSE);
209  }
210 }
211 
213 {
214  for (vector<TMarker*>::const_iterator marker = fSampleMarkers.begin();
215  marker != fSampleMarkers.end();
216  ++marker) {
217  (*marker)->Draw();
218  }
219 }
220 
222 {
223  MakeStylePlot();
224  TH1F *supportHistogram = new TH1F();
225  supportHistogram->SetBit(kCanDelete, kTRUE);
226  supportHistogram->SetStats(kFALSE);
227  supportHistogram->SetBins(1, 0, 5);
228  supportHistogram->GetYaxis()->SetRangeUser(0, 5);
229  supportHistogram->Draw("AH");
230  fStylePulse->Draw("L");
231  if (gPad) {
232  gPad->Update();
233  }
234 }
235 
237 {
238  QGPulse *pulse = new QGPulse(*this);
239  pulse->AutoSetStyle();
240  pulse->DisplayEditWindow();
241 }
242 
244 {
245  if (fCanvasWindow) {
246  fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->cd();
247  fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->RecursiveRemove(this);
249 
250  for (vector<TMarker*>::const_iterator marker = fSampleMarkers.begin();
251  marker != fSampleMarkers.end();
252  ++marker) {
253  fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->RecursiveRemove(*marker);
254  }
255 
256  fCanvasWindow->GetPlotFrame()->GetEmbeddedCanvas()->GetCanvas()->Update();
257  // check whether this was the first drawn plot and if so redraw remaining plots in order to have axes
258  }
259 }
260 
262 {
263  if (fEventIndex < fOrderedEvents.size()) {
264  vector<string>::iterator cutIter;
265  for (cutIter = fEventData.begin(); cutIter != fEventData.end(); ++cutIter) {
266  string::size_type beginPosition = cutIter->find_first_not_of(" ");
267  if (beginPosition == string::npos) {
268  *cutIter = cutIter->substr(beginPosition);
269  }
270  string::size_type endPosition = cutIter->find_first_of(" !=<>");
271  if (endPosition != string::npos) {
272  *cutIter = cutIter->substr(0, endPosition);
273  }
276  if (chain) {
277  chain->Draw(cutIter->c_str(), "", "goff", 1, fOrderedEvents[fEventIndex]);
278  if (chain->GetSelectedRows() == 1) {
279  stringstream ss;
280  if (*cutIter == "NsTime/1e9") {
281  ss.flags(std::ios::fixed);
282  ss.precision(3);
283  }
284  else if (cutIter->find("UnixTime") != string::npos){
285  ss.precision(13);
286  }
287  else {
288  ss.precision(6);
289  }
290  ss << " == " << chain->GetV1()[0] << flush;
291  cutIter->append(ss.str());
292  }
293  }
294  }
295  }
296  }
297 }
298 
300 {
301  if (chain == 0) {
304  chain = fCanvasWindow->GetFileHandler()->GetQChain();
305  } else {
306  cout << "Cannot generate the pulse because there is no file open" << endl;
307  }
308  }
309  }
310  if (chain) {
311  chain->Draw(">>eventList", fCutsString.c_str()); // NOTE: this will create a TEntryList in future versions of ROOT
312  TEventList *eventList;
313  gDirectory->GetObject("eventList", eventList);
314  *fEventList = *eventList;
315  delete eventList;
316  Order();
317  }
318 }
319 
321 {
322  return fEventList->GetN();
323 }
324 
326 {
327  if (fPlotEditWindow) {
328  if (QGPulseEditWindow *pulseEditWindow = dynamic_cast<QGPulseEditWindow*>(fPlotEditWindow)) {
329  SetEventData(pulseEditWindow->GetEventDataFrame()->GetCuts());
330  SetOrderVariable(pulseEditWindow->GetPulseParametersFrame()->GetOrderVariable());
331  SetEventIndex(pulseEditWindow->GetPulseParametersFrame()->GetEventIndex());
332  SetSuperimpose(pulseEditWindow->GetPulseParametersFrame()->IsSuperimposeSet());
333  SetUseADCUnits(pulseEditWindow->GetPulseParametersFrame()->IsUseADCUnitsSet());
334  SetZeroOffset(pulseEditWindow->GetPulseParametersFrame()->IsZeroOffsetSet());
335  SetUnitary(pulseEditWindow->GetPulseParametersFrame()->IsUnitarySet());
336  SetShowLegends(pulseEditWindow->GetPulseParametersFrame()->IsShowLegendsSet());
337  SetSamplesLabel(pulseEditWindow->GetPulseParametersFrame()->GetSamplesLabel());
338  } else {
339  cout << "QGPulse::GetParametersFromEditWindow() Warning: dynamic_cast<QGPulseEditWindow*> failed" << endl;
340  }
341  }
342 }
343 
344 bool QGPulse::GetPulseFromChain(Long64_t eventIndex)
345 {
346  // delete existing sample markers
347  for (vector<TMarker*>::iterator marker = fSampleMarkers.begin();
348  marker != fSampleMarkers.end();
349  ++marker) {
350  delete *marker;
351  }
352  fSampleMarkers.clear();
353 
356  TObject* generic = fCanvasWindow->GetFileHandler()->GetGenericObject(eventIndex,fSamplesLabel);
357  if(generic) {
358  generic->Draw();
359  return false;
360  } else {
361 
362  const QVector& pulse = fCanvasWindow->GetFileHandler()->GetPulse(eventIndex,fSamplesLabel);
363  const QChannelRunData *runData = fCanvasWindow->GetFileHandler()->GetChannelRunData(eventIndex);
364  Double_t ADC2mV = 1;
365  bool useADC2mV = false;
366  Double_t samplingPeriod = 1;
367  bool useSamplingPeriod = false;
368  if (runData) {
369  ADC2mV = runData->fADC2mV;
370  useADC2mV = true;
371  const Double_t samplingFrequency = runData->fSamplingFrequency;
372  if (samplingFrequency != 0) {
373  samplingPeriod = 1.0 / samplingFrequency;
374  useSamplingPeriod = true;
375  }
376  }
377 
378  Double_t *V = new Double_t[pulse.Size()];
379  Double_t *t = new Double_t[pulse.Size()];
380  double amplitude;
381  if(fUnitary) amplitude = pulse.GetMax()-pulse[0];
382  for (Int_t i = 0; i < (Int_t)pulse.Size(); ++i) {
383  V[i] = pulse[i];
384  if(fZeroOffset) {
385  V[i] -= pulse[0];
386  }
387  if(fUnitary && amplitude > 0) {
388  V[i] /= amplitude;
389  } else if (!fUseADCUnits && useADC2mV) {
390  V[i] *= ADC2mV;
391  }
392  t[i] = i;
393  if (!fUseADCUnits && useSamplingPeriod) {
394  t[i] *= samplingPeriod;
395  }
396  }
397  if(fUnitary) {
398  SetYUnits("A.U.");
399  }
400  else if (!fUseADCUnits && useADC2mV) {
401  SetYUnits("mV");
402  }
403 
404  else {
405  SetYUnits("ADC");
406  }
407  if (!fUseADCUnits && useSamplingPeriod) {
408  SetXUnits("s");
409  }
410  else {
411  SetXUnits("ADC");
412  }
413  SetPoints(pulse.Size(), t, V);
414 
415  // make marker for master sample
416  const QSampleInfo& masterSample
417  = fCanvasWindow->GetFileHandler()->GetMasterSample(eventIndex);
418  Int_t index = masterSample.GetSampleIndex();
419  if (index < (Int_t)pulse.Size()) {
420  TMarker *marker = new TMarker();
421  marker->SetMarkerStyle(23); // triangle, point down
422  marker->SetX(t[index]);
423  marker->SetY(V[index]);
424  fSampleMarkers.push_back(marker);
425  }
426 
427  // make sample markers for significant samples
428  const vector<QSampleInfo>& significantSamples
430  for (vector<QSampleInfo>::const_iterator sample = significantSamples.begin();
431  sample != significantSamples.end();
432  ++sample) {
433  Int_t index = sample->GetSampleIndex();
434  if (index < (Int_t)pulse.Size()) {
435  TMarker *marker = new TMarker();
436  marker->SetMarkerStyle(23); // triangle, point down
437  if (sample->GetIsNoise()) {
438  marker->SetMarkerColor(kYellow);
439  }
440  else if (sample->GetIsPulser()) {
441  marker->SetMarkerColor(kRed);
442  }
443  else if (sample->GetIsSignal()) {
444  marker->SetMarkerColor(kGreen);
445  }
446  else if (sample->GetIsLED()) {
447  marker->SetMarkerColor(kMagenta);
448  }
449  else if (sample->GetIsReversed()) {
450  marker->SetMarkerStyle(22); // arrow up
451  marker->SetMarkerSize(1.5); // a little bigger
452  marker->SetMarkerColor(kGreen+2);
453  }
454  else if (sample->GetIsVeto()) {
455  marker->SetMarkerStyle(29); // star
456  marker->SetMarkerSize(2); // a little bigger
457  marker->SetMarkerColor(kOrange + 1);
458  }
459  marker->SetX(t[index]);
460  marker->SetY(V[index]);
461  fSampleMarkers.push_back(marker);
462  }
463  }
464 
465  delete [] V;
466  delete [] t;
467 }
468  }
469  }
470 return true;
471 }
472 
474 {
475  TF1 *styleFunction = new TF1("styleFunction", "1.2*TMath::Exp(-1.2*(x-1)) + 0.8*TMath::Exp(-0.4*(x-1)) - 2*TMath::Exp(-12*(x-1))", 0, 5);
476  Int_t N = 50;
477  fStylePulse->Set(N);
478  for (Int_t i = 0; i < N; ++i) {
479  Double_t x = 5.0/N*i;
480  Double_t y = x < 1 ? 1.0 : 1.0 + 2.25*styleFunction->Eval(x);
481  fStylePulse->SetPoint(i, x, y);
482  }
483  delete styleFunction;
484  TAttFill::Copy(*fStylePulse);
485  TAttLine::Copy(*fStylePulse);
486  TAttMarker::Copy(*fStylePulse);
487 }
488 
490 {
491  Int_t currentEventNumber = -1;
492  if (fEventIndex < fOrderedEvents.size()) {
493  currentEventNumber = fOrderedEvents[fEventIndex];
494  }
495  fEventIndex = 0;
496  fOrderedEvents.clear();
497  if (fOrderVariable == "") {
498  for (Int_t index = 0; index < fEventList->GetN(); ++index) {
499  fOrderedEvents.push_back(fEventList->GetEntry(index));
500  }
501  } else {
504  fCanvasWindow->GetFileHandler()->GetQChain()->SetEventList(fEventList);
505  fCanvasWindow->GetFileHandler()->GetQChain()->Draw(fOrderVariable.c_str(), "", "goff");
506  fCanvasWindow->GetFileHandler()->GetQChain()->SetEventList(0);
507  Double_t *orderVariableArray = fCanvasWindow->GetFileHandler()->GetQChain()->GetV1();
508  multimap<Double_t, Long64_t> eventMap;
509  Long64_t index;
510  for (index = 0; index < fEventList->GetN(); ++index) {
511  eventMap.insert(make_pair(orderVariableArray[index], fEventList->GetEntry(index)));
512  }
513  multimap<Double_t, Long64_t>::const_iterator iter;
514  index = 0;
515  for (iter = eventMap.begin(); iter != eventMap.end(); ++iter, ++index) {
516  fOrderedEvents.push_back(iter->second);
517  if (iter->second == currentEventNumber) fEventIndex = index;
518  }
519  }
520  }
521  }
522  SetReorder(false);
523 }
524 
525 void QGPulse::SetEventIndex(Long_t index)
526 {
527  if (0 <= index && index < fEventList->GetN()) {
528  fEventIndex = index;
529  } else {
530  fEventIndex = 0;
531  }
532 }
533 
534 void QGPulse::SetName(const char *name)
535 {
536  if (name) {
537  string oldName = TGraph::GetName();
538  string newName = name;
539  if (newName != oldName) {
540  if (IsNameInUse(name)) {
541  TGraph::SetName(GeneratePlotName(newName).c_str());
542  } else {
543  TGraph::SetName(name);
544  }
545  }
546  } else {
547  TGraph::SetName(GeneratePlotName("Pulse").c_str());
548  }
549 }
550 
551 void QGPulse::SetOrderVariable(const string& orderVariable)
552 {
553  if (fOrderVariable != orderVariable) {
554  fOrderVariable = orderVariable;
555  SetReorder();
556  }
557 }
558 
559 void QGPulse::SetProperty(const string& key, const string& value)
560 {
561  QGPlot::SetProperty(key, value);
562  TString valueTString(value);
563  if (key == ORDER_VARIABLE_KEY) {
564  SetOrderVariable(value);
565  } else if (key == PULSE_VARIABLE_KEY) {
566  SetSamplesLabel(value);
567  } else if (key == EVENT_INDEX_KEY) {
568  if (valueTString.IsFloat()) {
569  SetEventIndex(valueTString.Atoi());
570  }
571  }
572  else if (key == LINE_COLOR_KEY) {
573  if (valueTString.IsFloat()) {
574  SetLineColor(valueTString.Atoi());
575  }
576  }
577  else if (key == LINE_STYLE_KEY) {
578  if (valueTString.IsFloat()) {
579  SetLineStyle(valueTString.Atoi());
580  }
581  }
582  else if (key == LINE_WIDTH_KEY) {
583  if (valueTString.IsFloat()) {
584  SetLineWidth(valueTString.Atoi());
585  }
586  }
587  else if (key == MARKER_COLOR_KEY) {
588  if (valueTString.IsFloat()) {
589  SetMarkerColor(valueTString.Atoi());
590  }
591  }
592  else if (key == MARKER_SIZE_KEY) {
593  if (valueTString.IsFloat()) {
594  SetMarkerSize(valueTString.Atof());
595  }
596  }
597  else if (key == MARKER_STYLE_KEY) {
598  if (valueTString.IsFloat()) {
599  SetMarkerStyle(valueTString.Atoi());
600  }
601  }
602 }
603 
605 {
606  if (QGPulseEditWindow *pulseEditWindow = dynamic_cast<QGPulseEditWindow*>(fPlotEditWindow)) {
607  pulseEditWindow->UpdateEventData();
608  }
609 }
610 
611 string QGPulse::HumanizeEventData(string eventDatum)
612 {
613  if(eventDatum.find("StartRunUnixTime") != string::npos){
614  //Time stamp found, converted the rhs to time string
615  string rhs = eventDatum.substr(eventDatum.find(" == ")+4);
616  std::istringstream ss(rhs);
617  long timeSeconds;
618  ss >> timeSeconds;
619  TTimeStamp timeStamp (timeSeconds, 0);
620  eventDatum.erase(eventDatum.find(" == ")+4);
621  eventDatum.append(timeStamp.AsString("s"));
622  }
623 
624  size_t eventStamp = eventDatum.find("StartRunUnixTime+NsTime/1e9 ");
625  if (eventStamp != string::npos)
626  eventDatum.replace(eventStamp, 27, "Event Time Stamp");
627 
628  size_t runStamp = eventDatum.find("StartRunUnixTime ");
629  if (runStamp != string::npos)
630  eventDatum.replace(runStamp, 16, "Run Time Stamp");
631 
632  // " == " should always present by default. So no checking is needed.
633  eventDatum.replace(eventDatum.find(" == "), 4, ": ");
634 
635  return eventDatum;
636 }
637 
int N
Definition: CheckOF.C:24
ahisto2 SetLineColor(kRed)
ahisto2 Draw()
#define ORDER_VARIABLE_KEY
#define EVENT_INDEX_KEY
#define MARKER_SIZE_KEY
#define MARKER_COLOR_KEY
#define LINE_STYLE_KEY
#define LINE_WIDTH_KEY
#define PULSE_VARIABLE_KEY
#define LINE_COLOR_KEY
#define MARKER_STYLE_KEY
ClassImp(QObject)
TChain used in diana.
Definition: QChain.hh:23
basic channel and run based info. Used in the QRunData object.
double fSamplingFrequency
sampling frequency in Hz
double fADC2mV
conversion: mV = ADC * fADC2mV
void RemoveFromDrawnPlots(QGPlot *plot)
Remove pointer to a plot from the list of drawn plots.
void AddToDrawnPlots(QGPlot *plot)
Add pointer to a plot to the list of drawn plots.
QGPlotFrame * GetPlotFrame()
Get pointer to the plot frame.
QGFileHandler * GetFileHandler() const
Get pointer to file handler.
void ClearDrawnPlots()
Clears the collection of drawn plots.
std::list< QGPlot * > & GetDrawnPlots()
Get collection of drawn plots.
const QChannelRunData * GetChannelRunData(const Long64_t eventNumber)
Get the run data for an event.
const Diana::QVector & GetPulse(const Long64_t eventNumber, const std::string &samplesName)
Get the pulse of an event.
bool IsFileOpen()
Check whether a file is open.
TObject * GetGenericObject(const Long64_t eventNumber, const std::string &samplesName)
const std::vector< QSampleInfo > & GetSignificantSamples(const Long64_t eventNumber)
Get significant samples of an event.
const QSampleInfo & GetMasterSample(const Long64_t eventNumber)
Get master sample of an event.
QChain * GetQChain()
Get a pointer to the chian.
Base class for scatter plots and pulses.
Definition: QGGraph.hh:14
virtual void Reset()
Reset the graph to an empty state.
Definition: QGGraph.cc:26
virtual void SetPoints(Int_t n, const Double_t *x, const Double_t *y)
Set the points of the graph.
Definition: QGGraph.cc:31
QGPlotStyleFrame * GetPlotStyleFrame()
Get pointer to the plot style frame.
virtual void SetPlot(QGPlot *plot)=0
Set plot, pure virtual function must be overriden by derived classes.
TRootEmbeddedCanvas * GetEmbeddedCanvas()
Get pointer to canvas.
Definition: QGPlotFrame.hh:26
TRootEmbeddedCanvas * GetEmbeddedCanvas()
Get pointer to embedded canvas.
virtual void SetSuperimpose(bool flag=false)
Set whether the plot should be superimposed.
Definition: QGPlot.hh:132
virtual std::string GeneratePlotName(const std::string &baseName) const
Generate a name for the plot.
Definition: QGPlot.cc:98
virtual const std::string & GetYUnits() const
Get y-axis units.
Definition: QGPlot.hh:93
virtual bool IsNameInUse(const std::string &name) const
Check whether string is the name of any plot.
Definition: QGPlot.cc:168
QGPlotEditWindow * fPlotEditWindow
Pointer to plot edit window.
Definition: QGPlot.hh:163
virtual const std::string & GetXUnits() const
Get x-axis units.
Definition: QGPlot.hh:87
virtual void SetProperty(const std::string &key, const std::string &value)
Set property (used for opening a session)
Definition: QGPlot.cc:245
std::string fCutsString
Cuts in a single string.
Definition: QGPlot.hh:157
bool fSuperimpose
Indicates whether plot should be superimposed on existing plot.
Definition: QGPlot.hh:169
QGCanvasWindow * fCanvasWindow
Canvas window to which plot is associated.
Definition: QGPlot.hh:151
virtual void SetXUnits(const std::string &units)
Set X-axis units.
Definition: QGPlot.hh:138
virtual void SetYUnits(const std::string &units)
Set Y-axis units.
Definition: QGPlot.hh:144
Class for pulse edit window.
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
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
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
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
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 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
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
contains information on flagged samples
Definition: QSampleInfo.hh:24
Int_t GetSampleIndex() const
Get SampleIndex from the beginning of the waveform.
Definition: QSampleInfo.hh:51
Interface for vectors in Diana analysis.
Definition: QVector.hh:30
UInt_t Size() const
size of QVector
Definition: QVector.hh:54
double GetMax() const
get maximum element
Definition: QVector.hh:355