ROOTANA
TAgilentHistogram.cxx
Go to the documentation of this file.
1 #include "TAgilentHistogram.h"
2 
3 #include "TDirectory.h"
4 
5 const int Nchannels = 5;
6 
7 /// Reset the histograms for this canvas
9 
10  SetSubTabName("Agilent");
12 }
13 
14 /// Create Histograms and Fill
16 
17  // Otherwise make histograms
18  clear();
19 
20  std::cout << "Create Agilent Histos" << std::endl;
21  for(int i = 0; i < Nchannels; i++){ // loop over channels
22 
23  char name[100];
24  char title[100];
25  sprintf(name,"Agilent_%i_%i",0,i);
26 
27  // Delete old histograms, if we already have them
28  TH1D *old = (TH1D*)gDirectory->Get(name);
29  if (old){
30  delete old;
31  }
32 
33  // Create new histograms
34  sprintf(title,"Agilent histogram for channel=%i",i);
35 
36  TH1D *tmp = new TH1D(name,title,10000,0,10);
37  tmp->SetXTitle("Current (uA)");
38  push_back(tmp);
39  }
40 
41 }
42 
43 
44  #include <sys/time.h>
45 
46 
47 /// Update the histograms for this canvas.
49 
50 
51 
52  TGenericData *bert = dataContainer.GetEventData<TGenericData>("BERT");
53  if(bert ){
54  for(int i = 0; i < Nchannels; i++){
55  GetHistogram(i)->Fill(100*((double*)bert->GetData64())[i]);
56 
57  }
58  }
59 }
60 
61 
62 
63 /// Take actions at begin run
64 void TAgilentHistograms::BeginRun(int transition,int run,int time){
65 
67 }
68 
69 /// Take actions at end run
70 void TAgilentHistograms::EndRun(int transition,int run,int time){
71  printf("in end run for TAgilent\n");
72 }
const int Nchannels
R__EXTERN TDirectory * gDirectory
TAgilentHistograms()
Reset the histograms for this canvas.
void UpdateHistograms(TDataContainer &dataContainer)
Update the histograms for this canvas.
void BeginRun(int transition, int run, int time)
Take actions at begin run.
void CreateHistograms()
Create Histograms and Fill.
void EndRun(int transition, int run, int time)
Take actions at end run
T * GetEventData(const char *name)
Add a templated function that returns event data in the format that we want.
virtual TObject * Get(const char *namecycle)
const uint64_t * GetData64() const
virtual void SetSubTabName(std::string name)
Set the name of the sub-tab for these plots, if running DaqDisplay.
TH1 * GetHistogram(unsigned i)
A helper method for accessing each histogram. Does bounds checking.