Class for making histograms of V792 ADC data. More...
#include <TV792Histogram.h>
Public Member Functions | |
TV792Histograms () | |
Reset the histograms for this canvas. | |
virtual | ~TV792Histograms () |
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 () |
Class for making histograms of V792 ADC data.
Definition at line 8 of file TV792Histogram.h.
TV792Histograms::TV792Histograms | ( | ) |
Reset the histograms for this canvas.
Definition at line 10 of file TV792Histogram.cxx.
References CreateHistograms().
00010 { 00011 00012 CreateHistograms(); 00013 }
virtual TV792Histograms::~TV792Histograms | ( | ) | [inline, virtual] |
Definition at line 11 of file TV792Histogram.h.
void TV792Histograms::BeginRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [virtual] |
Take actions at begin run.
Reimplemented from THistogramArrayBase.
Definition at line 79 of file TV792Histogram.cxx.
References CreateHistograms().
00079 { 00080 00081 CreateHistograms(); 00082 00083 }
void TV792Histograms::CreateHistograms | ( | ) | [private] |
Definition at line 16 of file TV792Histogram.cxx.
References gDirectory, TDirectory::Get(), and Nchannels.
Referenced by BeginRun(), and TV792Histograms().
00016 { 00017 00018 00019 // Otherwise make histograms 00020 clear(); 00021 00022 for(int i = 0; i < Nchannels; i++){ // loop over channels 00023 00024 char name[100]; 00025 char title[100]; 00026 sprintf(name,"V792_%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 00035 // Create new histograms 00036 00037 sprintf(title,"V792 Waveform for channel=%i",i); 00038 00039 TH1D *tmp = new TH1D(name,title,4200,0,4200); 00040 tmp->SetYTitle("ADC value"); 00041 tmp->SetXTitle("Bin"); 00042 push_back(tmp); 00043 } 00044 00045 }
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 TV792Histograms::EndRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [virtual] |
Take actions at end run.
Reimplemented from THistogramArrayBase.
Definition at line 86 of file TV792Histogram.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(), UpdateHistograms(), TV1730RawWaveform::UpdateHistograms(), TV1730DppWaveform::UpdateHistograms(), TV1720Waveform::UpdateHistograms(), TV1190Histograms::UpdateHistograms(), TL2249Histograms::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 TV792Histograms::UpdateHistograms | ( | TDataContainer & | dataContainer | ) | [virtual] |
Update the histograms for this canvas.
Get the Vector of ADC Measurements.
Implements THistogramArrayBase.
Definition at line 51 of file TV792Histogram.cxx.
References TDataContainer::GetEventData(), THistogramArrayBase::GetHistogram(), TV792Data::GetMeasurements(), and Nchannels.
Referenced by TAnaManager::ProcessMidasEvent().
00051 { 00052 00053 struct timeval start,stop; 00054 gettimeofday(&start,NULL); 00055 //printf ("About to sert rtrequest: %f\n",start.tv_sec 00056 // + 0.000001*start.tv_usec); 00057 00058 TV792Data *data = dataContainer.GetEventData<TV792Data>("ADC0"); 00059 if(!data) return; 00060 00061 /// Get the Vector of ADC Measurements. 00062 std::vector<VADCMeasurement> measurements = data->GetMeasurements(); 00063 for(unsigned int i = 0; i < measurements.size(); i++){ // loop over measurements 00064 00065 int chan = measurements[i].GetChannel(); 00066 uint32_t adc = measurements[i].GetMeasurement(); 00067 00068 if(chan >= 0 && chan < Nchannels) 00069 GetHistogram(chan)->Fill(adc); 00070 00071 00072 } 00073 00074 }