#include <TV1720Waveform.h>
Public Member Functions | |
TV1720Waveform () | |
Reset the histograms for this canvas. | |
virtual | ~TV1720Waveform () |
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 V1720 waveforms; right now is only for raw or ZLE compressed data.
Definition at line 9 of file TV1720Waveform.h.
TV1720Waveform::TV1720Waveform | ( | ) |
Reset the histograms for this canvas.
Definition at line 8 of file TV1720Waveform.cxx.
References CreateHistograms(), and SetNanosecsPerSample().
00008 { 00009 00010 SetNanosecsPerSample(4); //ADC clock runs at 250Mhz on the v1720 = units of 4 nsecs 00011 00012 CreateHistograms(); 00013 }
virtual TV1720Waveform::~TV1720Waveform | ( | ) | [inline, virtual] |
Definition at line 12 of file TV1720Waveform.h.
void TV1720Waveform::BeginRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [inline, virtual] |
Take actions at begin run.
Reimplemented from THistogramArrayBase.
Definition at line 26 of file TV1720Waveform.h.
References CreateHistograms().
00026 { 00027 CreateHistograms(); 00028 }
void TV1720Waveform::CreateHistograms | ( | ) |
Definition at line 16 of file TV1720Waveform.cxx.
References gDirectory, TDirectory::Get(), and nanosecsPerSample.
Referenced by BeginRun(), and TV1720Waveform().
00016 { 00017 00018 // check if we already have histogramss. 00019 char tname[100]; 00020 sprintf(tname,"V1720_%i",0); 00021 00022 TH1D *tmp = (TH1D*)gDirectory->Get(tname); 00023 if (tmp) return; 00024 00025 int fWFLength = 1000; // Need a better way of detecting this... 00026 int numSamples = fWFLength / nanosecsPerSample; 00027 00028 // Otherwise make histograms 00029 clear(); 00030 00031 for(int i = 0; i < 8; i++){ // loop over 8 channels 00032 00033 char name[100]; 00034 char title[100]; 00035 sprintf(name,"V1720_%i",i); 00036 00037 sprintf(title,"V1720 Waveform for channel=%i",i); 00038 00039 TH1D *tmp = new TH1D(name, title, numSamples, 0, fWFLength); 00040 tmp->SetXTitle("ns"); 00041 tmp->SetYTitle("ADC value"); 00042 00043 push_back(tmp); 00044 } 00045 00046 }
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(), Reset(), TDT724Waveform::Reset(), TV792Histograms::UpdateHistograms(), TV1730RawWaveform::UpdateHistograms(), TV1730DppWaveform::UpdateHistograms(), 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 }
int TV1720Waveform::GetNsecsPerSample | ( | ) | [inline] |
Getters/setters.
Definition at line 17 of file TV1720Waveform.h.
References nanosecsPerSample.
00017 { 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 TV1720Waveform::Reset | ( | ) |
Definition at line 115 of file TV1720Waveform.cxx.
References THistogramArrayBase::GetHistogram().
00115 { 00116 00117 00118 for(int i = 0; i < 8; i++){ // loop over channels 00119 int index = i; 00120 00121 // Reset the histogram... 00122 for(int ib = 0; ib < GetHistogram(index)->GetNbinsX(); ib++) { 00123 GetHistogram(index)->SetBinContent(ib, 0); 00124 } 00125 00126 GetHistogram(index)->Reset(); 00127 00128 } 00129 }
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 TV1720Waveform::SetNanosecsPerSample | ( | int | nsecsPerSample | ) | [inline] |
Definition at line 18 of file TV1720Waveform.h.
References nanosecsPerSample.
Referenced by TV1720Waveform().
00018 { 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 TV1720Waveform::UpdateHistograms | ( | TDataContainer & | dataContainer | ) | [virtual] |
Update the histograms for this canvas.
Implements THistogramArrayBase.
Definition at line 49 of file TV1720Waveform.cxx.
References TV1720RawChannel::GetADCSample(), TV1720RawData::GetChannelData(), TV1720RawData::GetChannelMask(), TDataContainer::GetEventData(), TMidasEvent::GetEventId(), TV1720RawZlePulse::GetFirstBin(), THistogramArrayBase::GetHistogram(), TDataContainer::GetMidasData(), TV1720RawChannel::GetNSamples(), TV1720RawZlePulse::GetNSamples(), TV1720RawChannel::GetNZlePulses(), TV1720RawZlePulse::GetSample(), TMidasEvent::GetTimeStamp(), TV1720RawChannel::GetZlePulse(), and TV1720RawData::IsZLECompressed().
Referenced by TAnaManager::ProcessMidasEvent().
00049 { 00050 00051 int eventid = dataContainer.GetMidasData().GetEventId(); 00052 int timestamp = dataContainer.GetMidasData().GetTimeStamp(); 00053 00054 00055 // char name[100]; 00056 //sprintf(name,"W2%02d",iBoard); 00057 00058 TV1720RawData *v1720 = dataContainer.GetEventData<TV1720RawData>("W200"); 00059 00060 if(v1720 && v1720->IsZLECompressed()){ 00061 00062 for(int i = 0; i < 8; i++){ // loop over channels 00063 00064 // Check if this channel has any data in this event. 00065 int chhex = 1 << i ; 00066 if(!(v1720->GetChannelMask() & chhex)){ 00067 std::cout << "No data ... " << std::endl; 00068 continue; 00069 } 00070 00071 int index = i; 00072 // Reset the histogram... 00073 for(int ib = 0; ib < 250; ib++) 00074 GetHistogram(index)->SetBinContent(ib+1,0); 00075 00076 TV1720RawChannel channelData = v1720->GetChannelData(i); 00077 00078 // Loop over pulses, filling the histogram 00079 for(int j = 0; j < channelData.GetNZlePulses(); j++){ 00080 TV1720RawZlePulse pulse = channelData.GetZlePulse(j); 00081 for(int k = 0; k < pulse.GetNSamples(); k++){ 00082 int bin = pulse.GetFirstBin() + k; 00083 GetHistogram(index)->SetBinContent(bin,pulse.GetSample(k)); 00084 } 00085 } 00086 00087 } 00088 } 00089 00090 if(v1720 && !v1720->IsZLECompressed()){ 00091 00092 for(int i = 0; i < 8; i++){ // loop over channels 00093 00094 int index = i; 00095 00096 // Reset the histogram... 00097 // for(int ib = 0; ib < 2500; ib++) 00098 for(int ib = 0; ib < 250; ib++) 00099 GetHistogram(index)->SetBinContent(ib+1,0); 00100 00101 00102 TV1720RawChannel channelData = v1720->GetChannelData(i); 00103 for(int j = 0; j < channelData.GetNSamples(); j++){ 00104 double adc = channelData.GetADCSample(j); 00105 GetHistogram(index)->SetBinContent(j+1,adc); 00106 00107 } 00108 } 00109 } 00110 00111 }
int TV1720Waveform::nanosecsPerSample [private] |
Definition at line 31 of file TV1720Waveform.h.
Referenced by CreateHistograms(), GetNsecsPerSample(), and SetNanosecsPerSample().