ROOTANA
Loading...
Searching...
No Matches
TV1190Histogram.cxx
Go to the documentation of this file.
1#include "TV1190Histogram.h"
2
3#include "TV1190Data.hxx"
4#include "TDirectory.h"
5
6const int Nchannels = 64;
7
8/// Reset the histograms for this canvas
14
15
17
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,"V1190_%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
36 // Create new histograms
37
38 sprintf(title,"V1190 histogram for channel=%i",i);
39
40 TH1D *tmp = new TH1D(name,title,5000,0,500000);
41 tmp->SetXTitle("TDC value");
42 tmp->SetYTitle("Number of Entries");
43 push_back(tmp);
44 }
45
46}
47
48
49
50
51/// Update the histograms for this canvas.
53
54
55 TV1190Data *data = dataContainer.GetEventData<TV1190Data>("TDC0");
56 if(!data) return;
57
58 /// Get the Vector of ADC Measurements.
59 std::vector<TDCMeasurement> measurements = data->GetMeasurements();
60 for(unsigned int i = 0; i < measurements.size(); i++){ // loop over measurements
61
62 int chan = measurements[i].GetChannel();
63 GetHistogram(chan)->Fill(measurements[i].GetMeasurement());
64 }
65
66}
67
68
69
70/// Take actions at begin run
71void TV1190Histograms::BeginRun(int transition,int run,int time){
72
74
75}
76
77/// Take actions at end run
78void TV1190Histograms::EndRun(int transition,int run,int time){
79
80}
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.
std::vector< TDCMeasurement > & GetMeasurements()
Get the Vector of TDC Measurements.
void CreateHistograms()
Function to create histograms; users will want to implement this function.
void EndRun(int transition, int run, int time)
Take actions at end run
void UpdateHistograms(TDataContainer &dataContainer)
Update the histograms for this canvas.
TV1190Histograms()
Reset the histograms for this canvas.
void BeginRun(int transition, int run, int time)
Take actions at begin run.