ROOTANA
Loading...
Searching...
No Matches
TL2249Histogram.cxx
Go to the documentation of this file.
1#include "TL2249Histogram.h"
2#include "TL2249Data.hxx"
3#include "TDirectory.h"
4#include "TTree.h"
5
6const int Nchannels = 4;
7
8/// Reset the histograms for this canvas
15
16/// Create Histograms and set labels and range
18
19 // Otherwise make histograms
20 clear();
21
22 std::cout << "Create Histos" << std::endl;
23 for(int i = 0; i < Nchannels; i++){ // loop over channels
24
25 char name[100];
26 char title[100];
27 sprintf(name,"L2249_%i_%i",0,i);
28
29 // Delete old histograms, if we already have them
30 TH1D *old = (TH1D*)gDirectory->Get(name);
31 if (old){
32 delete old;
33 }
34
35 // Create new histograms
36 sprintf(title,"L2249 histogram for channel=%i",i);
37
38 TH1D *tmp = new TH1D(name,title,2048,0,2047);
39 tmp->SetXTitle("ADC");
40 tmp->SetYTitle("Number of Entries");
41 push_back(tmp);
42 }
43
44}
45
46
47/// Update the histograms for this canvas.
49
50
51 TL2249Data *data = dataContainer.GetEventData<TL2249Data>("ADC0");
52 if(!data) return;
53
54 /// Get the Vector of ADC Measurements.
55 std::vector<LADCMeasurement> measurements = data->GetMeasurements();
56 for(unsigned int i = 0; i < measurements.size(); i++){ // loop over measurements
57
58 int chan = i;
59 GetHistogram(chan)->Fill(measurements[i].GetMeasurement());
60 }
61}
62
63
64
65/// Take actions at begin run
66void TL2249Histograms::BeginRun(int transition,int run,int time){
67
68 printf("in begin run for TL2249\n");
70
71}
72
73/// Take actions at end run
74void TL2249Histograms::EndRun(int transition,int run,int time){
75 printf("in end run for TL2249\n");
76}
const int Nchannels
R__EXTERN TDirectory * gDirectory
const int Nchannels
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)
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.
Class for storing data from LeCroy 2249 module.
std::vector< LADCMeasurement > & GetMeasurements()
Get the Vector of ADC Measurements.
void EndRun(int transition, int run, int time)
Take actions at end run
TL2249Histograms()
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 set labels and range.