Class for making histograms of L2249 ADC data. More...
#include <TL2249Histogram.h>
Public Member Functions | |
TL2249Histograms () | |
Reset the histograms for this canvas. | |
virtual | ~TL2249Histograms () |
void | UpdateHistograms (TDataContainer &dataContainer) |
Update the histograms for this canvas. | |
void | BeginRun (int transition, int run, int time) |
Take actions at begin run. | |
void | EndRun (int transition, int run, int time) |
Take actions at end run. | |
TH1 * | GetHistogram (unsigned int i) |
A helper method for accessing each histogram. Does bounds checking. | |
void | SetNumberChannelsInGroup (int numberChannelsInGroups) |
const int | GetNumberChannelsInGroup () |
void | SetGroupName (std::string name) |
Set name for the 'group'. | |
const std::string | GetGroupName () |
void | SetChannelName (std::string name) |
Set name for the 'channel'. | |
const std::string | GetChannelName () |
void | DisableAutoUpdate (bool DisableautoUpdate=true) |
const bool | GetDisableAutoUpdate () |
const bool | HasAutoUpdate () |
Private Member Functions | |
void | CreateHistograms () |
Create Histograms and set labels and range. |
Class for making histograms of L2249 ADC data.
Definition at line 8 of file TL2249Histogram.h.
TL2249Histograms::TL2249Histograms | ( | ) |
Reset the histograms for this canvas.
Definition at line 9 of file TL2249Histogram.cxx.
References CreateHistograms().
00009 { 00010 00011 CreateHistograms(); 00012 00013 }
virtual TL2249Histograms::~TL2249Histograms | ( | ) | [inline, virtual] |
Definition at line 11 of file TL2249Histogram.h.
void TL2249Histograms::BeginRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [virtual] |
Take actions at begin run.
Reimplemented from THistogramArrayBase.
Definition at line 65 of file TL2249Histogram.cxx.
References CreateHistograms().
00065 { 00066 00067 printf("in begin run for TL2249\n"); 00068 CreateHistograms(); 00069 00070 }
void TL2249Histograms::CreateHistograms | ( | ) | [private] |
Create Histograms and set labels and range.
Definition at line 16 of file TL2249Histogram.cxx.
References gDirectory, TDirectory::Get(), and Nchannels.
Referenced by BeginRun(), and TL2249Histograms().
00016 { 00017 00018 // Otherwise make histograms 00019 clear(); 00020 00021 std::cout << "Create Histos" << std::endl; 00022 for(int i = 0; i < Nchannels; i++){ // loop over channels 00023 00024 char name[100]; 00025 char title[100]; 00026 sprintf(name,"L2249_%i_%i",0,i); 00027 00028 // Delete old histograms, if we already have them 00029 TH1D *old = (TH1D*)gDirectory->Get(name); 00030 if (old){ 00031 delete old; 00032 } 00033 00034 // Create new histograms 00035 sprintf(title,"L2249 histogram for channel=%i",i); 00036 00037 TH1D *tmp = new TH1D(name,title,2048,0,2047); 00038 tmp->SetXTitle("ADC"); 00039 tmp->SetYTitle("Number of Entries"); 00040 push_back(tmp); 00041 } 00042 00043 }
void THistogramArrayBase::DisableAutoUpdate | ( | bool | DisableautoUpdate = true |
) | [inline, inherited] |
Define whether the histogram gets automatically updated by rootana display. 'True' means that rootana display will NOT call UpdateHistograms automatically.
Definition at line 74 of file THistogramArrayBase.h.
References THistogramArrayBase::fDisableAutoUpdate, and THistogramArrayBase::fHasAutoUpdate.
Referenced by TAnaManager::TAnaManager().
00074 { fDisableAutoUpdate = DisableautoUpdate; fHasAutoUpdate = true;}
void TL2249Histograms::EndRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [virtual] |
Take actions at end run.
Reimplemented from THistogramArrayBase.
Definition at line 73 of file TL2249Histogram.cxx.
const std::string THistogramArrayBase::GetChannelName | ( | ) | [inline, inherited] |
Definition at line 70 of file THistogramArrayBase.h.
References THistogramArrayBase::fChannelName.
00070 { return fChannelName; }
const bool THistogramArrayBase::GetDisableAutoUpdate | ( | ) | [inline, inherited] |
Definition at line 75 of file THistogramArrayBase.h.
References THistogramArrayBase::fDisableAutoUpdate.
00075 { return fDisableAutoUpdate; }
const std::string THistogramArrayBase::GetGroupName | ( | ) | [inline, inherited] |
Definition at line 66 of file THistogramArrayBase.h.
References THistogramArrayBase::fGroupName.
00066 { return fGroupName; }
TH1* THistogramArrayBase::GetHistogram | ( | unsigned int | i | ) | [inline, inherited] |
A helper method for accessing each histogram. Does bounds checking.
Definition at line 44 of file THistogramArrayBase.h.
Referenced by TV1730RawWaveform::Reset(), TV1730DppWaveform::Reset(), TV1720Waveform::Reset(), TDT724Waveform::Reset(), TV792Histograms::UpdateHistograms(), TV1730RawWaveform::UpdateHistograms(), TV1730DppWaveform::UpdateHistograms(), TV1720Waveform::UpdateHistograms(), TV1190Histograms::UpdateHistograms(), UpdateHistograms(), TDT724Waveform::UpdateHistograms(), and TAgilentHistograms::UpdateHistograms().
00044 { 00045 if(i < 0 || i >= size()){ 00046 std::cerr << "Invalid index (=" << i 00047 << ") requested in THistogramArrayBase::GetHistogram(int i) " << std::endl; 00048 return 0; 00049 } 00050 return (*this)[i]; 00051 }
const int THistogramArrayBase::GetNumberChannelsInGroup | ( | ) | [inline, inherited] |
Definition at line 62 of file THistogramArrayBase.h.
References THistogramArrayBase::fNumberChannelsInGroups.
00062 { return fNumberChannelsInGroups; }
const bool THistogramArrayBase::HasAutoUpdate | ( | ) | [inline, inherited] |
Definition at line 76 of file THistogramArrayBase.h.
References THistogramArrayBase::fHasAutoUpdate.
00076 { return fHasAutoUpdate; }
void THistogramArrayBase::SetChannelName | ( | std::string | name | ) | [inline, inherited] |
Set name for the 'channel'.
Definition at line 69 of file THistogramArrayBase.h.
References THistogramArrayBase::fChannelName.
00069 { fChannelName = name; }
void THistogramArrayBase::SetGroupName | ( | std::string | name | ) | [inline, inherited] |
Set name for the 'group'.
Definition at line 65 of file THistogramArrayBase.h.
References THistogramArrayBase::fGroupName.
00065 { fGroupName = name; }
void THistogramArrayBase::SetNumberChannelsInGroup | ( | int | numberChannelsInGroups | ) | [inline, inherited] |
Function to define the number of channels in group and allow user to treat the array as 2D array.
Definition at line 61 of file THistogramArrayBase.h.
References THistogramArrayBase::fNumberChannelsInGroups.
00061 { fNumberChannelsInGroups = numberChannelsInGroups; }
void TL2249Histograms::UpdateHistograms | ( | TDataContainer & | dataContainer | ) | [virtual] |
Update the histograms for this canvas.
Get the Vector of ADC Measurements.
Implements THistogramArrayBase.
Definition at line 47 of file TL2249Histogram.cxx.
References TDataContainer::GetEventData(), THistogramArrayBase::GetHistogram(), and TL2249Data::GetMeasurements().
Referenced by TAnaManager::ProcessMidasEvent().
00047 { 00048 00049 00050 TL2249Data *data = dataContainer.GetEventData<TL2249Data>("ADC0"); 00051 if(!data) return; 00052 00053 /// Get the Vector of ADC Measurements. 00054 std::vector<LADCMeasurement> measurements = data->GetMeasurements(); 00055 for(unsigned int i = 0; i < measurements.size(); i++){ // loop over measurements 00056 00057 int chan = i; 00058 GetHistogram(chan)->Fill(measurements[i].GetMeasurement()); 00059 } 00060 }