Class for making histograms of raw DT724 waveforms;. More...
#include <TDT724Waveform.h>
Public Member Functions | |
TDT724Waveform () | |
Reset the histograms for this canvas. | |
virtual | ~TDT724Waveform () |
void | UpdateHistograms (TDataContainer &dataContainer) |
Update the histograms for this canvas. | |
int | GetNsecsPerSample () |
Getters/setters. | |
void | SetNanosecsPerSample (int nsecsPerSample) |
void | Reset () |
void | CreateHistograms () |
void | BeginRun (int transition, int run, int time) |
Take actions at begin run. | |
TH1 * | GetHistogram (unsigned int i) |
A helper method for accessing each histogram. Does bounds checking. | |
virtual void | EndRun (int transition, int run, int time) |
Take actions at end run. | |
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 Attributes | |
int | nanosecsPerSample |
Class for making histograms of raw DT724 waveforms;.
Definition at line 8 of file TDT724Waveform.h.
TDT724Waveform::TDT724Waveform | ( | ) |
Reset the histograms for this canvas.
Definition at line 8 of file TDT724Waveform.cxx.
References CreateHistograms(), and SetNanosecsPerSample().
00008 { 00009 00010 SetNanosecsPerSample(10); //ADC clock runs at 100Mhz on the 724 = units of 10 nsecs 00011 00012 CreateHistograms(); 00013 00014 }
virtual TDT724Waveform::~TDT724Waveform | ( | ) | [inline, virtual] |
Definition at line 11 of file TDT724Waveform.h.
void TDT724Waveform::BeginRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [inline, virtual] |
Take actions at begin run.
Reimplemented from THistogramArrayBase.
Definition at line 25 of file TDT724Waveform.h.
References CreateHistograms().
00025 { 00026 CreateHistograms(); 00027 }
void TDT724Waveform::CreateHistograms | ( | ) |
Definition at line 17 of file TDT724Waveform.cxx.
References gDirectory, TDirectory::Get(), and nanosecsPerSample.
Referenced by BeginRun(), and TDT724Waveform().
00017 { 00018 00019 // check if we already have histogramss. 00020 char tname[100]; 00021 sprintf(tname,"DT724_%i",0); 00022 00023 TH1D *tmp = (TH1D*)gDirectory->Get(tname); 00024 if (tmp) return; 00025 00026 int fWFLength = 2000; // Need a better way of detecting this... 00027 int numSamples = fWFLength / nanosecsPerSample; 00028 00029 // Otherwise make histograms 00030 clear(); 00031 00032 for(int i = 0; i < 2; i++){ // loop over 2 channels 00033 00034 char name[100]; 00035 char title[100]; 00036 sprintf(name,"DT724_%i",i); 00037 00038 sprintf(title,"DT724 Waveform for channel=%i",i); 00039 00040 TH1D *tmp = new TH1D(name, title, numSamples, 0, fWFLength); 00041 tmp->SetXTitle("ns"); 00042 tmp->SetYTitle("ADC value"); 00043 00044 push_back(tmp); 00045 } 00046 std::cout << "TDT724Waveform done init...... " << std::endl; 00047 00048 }
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;}
virtual void THistogramArrayBase::EndRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [inline, virtual, inherited] |
Take actions at end run.
Reimplemented in TAgilentHistograms, TL2249Histograms, TV1190Histograms, TV1730DppWaveform, TV1730RawWaveform, and TV792Histograms.
Definition at line 57 of file THistogramArrayBase.h.
Referenced by TFancyHistogramCanvas::EndRun().
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(), Reset(), TV792Histograms::UpdateHistograms(), TV1730RawWaveform::UpdateHistograms(), TV1730DppWaveform::UpdateHistograms(), TV1720Waveform::UpdateHistograms(), TV1190Histograms::UpdateHistograms(), TL2249Histograms::UpdateHistograms(), 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 }
int TDT724Waveform::GetNsecsPerSample | ( | ) | [inline] |
Getters/setters.
Definition at line 16 of file TDT724Waveform.h.
References nanosecsPerSample.
00016 { return nanosecsPerSample; }
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 TDT724Waveform::Reset | ( | ) |
Definition at line 85 of file TDT724Waveform.cxx.
References THistogramArrayBase::GetHistogram().
00085 { 00086 00087 00088 for(int i = 0; i < 8; i++){ // loop over channels 00089 int index = i; 00090 00091 // Reset the histogram... 00092 for(int ib = 0; ib < GetHistogram(index)->GetNbinsX(); ib++) { 00093 GetHistogram(index)->SetBinContent(ib, 0); 00094 } 00095 00096 GetHistogram(index)->Reset(); 00097 00098 } 00099 }
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 TDT724Waveform::SetNanosecsPerSample | ( | int | nsecsPerSample | ) | [inline] |
Definition at line 17 of file TDT724Waveform.h.
References nanosecsPerSample.
Referenced by TDT724Waveform().
00017 { this->nanosecsPerSample = nsecsPerSample; }
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 TDT724Waveform::UpdateHistograms | ( | TDataContainer & | dataContainer | ) | [virtual] |
Update the histograms for this canvas.
Implements THistogramArrayBase.
Definition at line 51 of file TDT724Waveform.cxx.
References TDataContainer::GetEventData(), TMidasEvent::GetEventId(), THistogramArrayBase::GetHistogram(), TDT724RawData::GetMeasurements(), TDataContainer::GetMidasData(), and TMidasEvent::GetTimeStamp().
Referenced by TAnaManager::ProcessMidasEvent().
00051 { 00052 00053 int eventid = dataContainer.GetMidasData().GetEventId(); 00054 int timestamp = dataContainer.GetMidasData().GetTimeStamp(); 00055 00056 TDT724RawData *dt724 = dataContainer.GetEventData<TDT724RawData>("D724"); 00057 00058 if(dt724){ 00059 00060 00061 std::vector<RawChannelMeasurement> measurements = dt724->GetMeasurements(); 00062 00063 for(int i = 0; i < measurements.size(); i++){ 00064 00065 int chan = measurements[i].GetChannel(); 00066 00067 std::cout << "TDT724Waveform Handling first... " << std::endl; 00068 00069 // Reset the histogram... 00070 for(int ib = 0; ib < GetHistogram(chan)->GetNbinsX(); ib++) 00071 GetHistogram(chan)->SetBinContent(ib+1,0); 00072 00073 //std::cout << "Nsamples " << measurements[i].GetNSamples() << std::endl; 00074 for(int ib = 0; ib < measurements[i].GetNSamples(); ib++){ 00075 GetHistogram(chan)->SetBinContent(ib+1, measurements[i].GetSample(ib)); 00076 } 00077 00078 } 00079 } 00080 00081 }
int TDT724Waveform::nanosecsPerSample [private] |
Definition at line 30 of file TDT724Waveform.h.
Referenced by CreateHistograms(), GetNsecsPerSample(), and SetNanosecsPerSample().