Class for making histogram of V1730 waveforms (with DPP event encoding). More...
#include <TV1730DppWaveform.h>
Public Member Functions | |
TV1730DppWaveform () | |
Reset the histogram for this canvas. | |
virtual | ~TV1730DppWaveform () |
void | UpdateHistograms (TDataContainer &dataContainer) |
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. | |
int | GetNumSamples () |
void | SetNumSamples (int numSamples) |
int | GetNsecsPerSample () |
void | SetNanosecsPerSample (int nsecsPerSample) |
void | Reset () |
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 () |
Private Attributes | |
int | numSamples |
int | nanosecsPerSample |
Class for making histogram of V1730 waveforms (with DPP event encoding).
Definition at line 8 of file TV1730DppWaveform.h.
TV1730DppWaveform::TV1730DppWaveform | ( | ) |
Reset the histogram for this canvas.
Definition at line 8 of file TV1730DppWaveform.cxx.
References CreateHistograms(), SetNanosecsPerSample(), and SetNumSamples().
00008 { 00009 00010 SetNumSamples(64); 00011 SetNanosecsPerSample(2); //ADC clock runs at 500Mhz on the v1730 = units of 2 nsecs 00012 00013 CreateHistograms(); 00014 }
virtual TV1730DppWaveform::~TV1730DppWaveform | ( | ) | [inline, virtual] |
Definition at line 11 of file TV1730DppWaveform.h.
void TV1730DppWaveform::BeginRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [virtual] |
Take actions at begin run.
Reimplemented from THistogramArrayBase.
Definition at line 108 of file TV1730DppWaveform.cxx.
References CreateHistograms().
00108 { 00109 00110 CreateHistograms(); 00111 00112 }
void TV1730DppWaveform::CreateHistograms | ( | ) | [private] |
Definition at line 17 of file TV1730DppWaveform.cxx.
References gDirectory, TDirectory::Get(), nanosecsPerSample, and numSamples.
Referenced by BeginRun(), and TV1730DppWaveform().
00017 { 00018 00019 // check if we already have histograms. 00020 char tname[100]; 00021 sprintf(tname,"V1730Dpp_%i_%i",0,0); 00022 00023 TH1D *tmp = (TH1D*)gDirectory->Get(tname); 00024 if (tmp) return; 00025 00026 // Otherwise make histogram 00027 clear(); 00028 00029 for(int i = 0; i < 16; i++){ // loop over 16 channels 00030 00031 char name[100]; 00032 char title[100]; 00033 sprintf(name,"V1730Dpp_%i",i); 00034 00035 sprintf(title,"V1730 Waveform for channel=%i",i); 00036 00037 TH1D *tmp = new TH1D(name, title, this->numSamples, 0, this->numSamples); 00038 tmp->GetXaxis()->SetLimits(0, this->numSamples*this->nanosecsPerSample); 00039 tmp->SetXTitle("ns"); 00040 tmp->SetYTitle("ADC value"); 00041 00042 push_back(tmp); 00043 } 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;}
void TV1730DppWaveform::EndRun | ( | int | transition, | |
int | run, | |||
int | time | |||
) | [virtual] |
Take actions at end run.
Reimplemented from THistogramArrayBase.
Definition at line 115 of file TV1730DppWaveform.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(), Reset(), TV1720Waveform::Reset(), TDT724Waveform::Reset(), TV792Histograms::UpdateHistograms(), TV1730RawWaveform::UpdateHistograms(), 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 }
int TV1730DppWaveform::GetNsecsPerSample | ( | ) | [inline] |
Definition at line 25 of file TV1730DppWaveform.h.
References nanosecsPerSample.
00025 { return nanosecsPerSample; }
const int THistogramArrayBase::GetNumberChannelsInGroup | ( | ) | [inline, inherited] |
Definition at line 62 of file THistogramArrayBase.h.
References THistogramArrayBase::fNumberChannelsInGroups.
00062 { return fNumberChannelsInGroups; }
int TV1730DppWaveform::GetNumSamples | ( | ) | [inline] |
Definition at line 23 of file TV1730DppWaveform.h.
References numSamples.
00023 { return numSamples; }
const bool THistogramArrayBase::HasAutoUpdate | ( | ) | [inline, inherited] |
Definition at line 76 of file THistogramArrayBase.h.
References THistogramArrayBase::fHasAutoUpdate.
00076 { return fHasAutoUpdate; }
void TV1730DppWaveform::Reset | ( | ) |
Definition at line 92 of file TV1730DppWaveform.cxx.
References THistogramArrayBase::GetHistogram().
00092 { 00093 00094 // Loop over all the data, reset histos 00095 for(int iBoard=0; iBoard<32; iBoard++){// Loop over V1730Dpp boards 00096 for(int i = 0; i < 8; i++){ // loop over channels 00097 int index = iBoard*8 + i; 00098 00099 // Reset the histogram... 00100 for(int ib = 0; ib < 2500; ib++) 00101 GetHistogram(index)->SetBinContent(ib,0); 00102 GetHistogram(index)->Reset(); 00103 } 00104 } 00105 }
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 TV1730DppWaveform::SetNanosecsPerSample | ( | int | nsecsPerSample | ) | [inline] |
Definition at line 26 of file TV1730DppWaveform.h.
References nanosecsPerSample.
Referenced by TV1730DppWaveform().
00026 { 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 TV1730DppWaveform::SetNumSamples | ( | int | numSamples | ) | [inline] |
Definition at line 24 of file TV1730DppWaveform.h.
Referenced by TV1730DppWaveform().
00024 { this->numSamples = numSamples; }
void TV1730DppWaveform::UpdateHistograms | ( | TDataContainer & | dataContainer | ) | [virtual] |
Update the histogram for this canvas. This method works, but is generally not used; instead, TDeapAnaManager handles filling this histogram.
Implements THistogramArrayBase.
Definition at line 51 of file TV1730DppWaveform.cxx.
References TDataContainer::GetEventData(), TMidasEvent::GetEventId(), THistogramArrayBase::GetHistogram(), TV1730DppData::GetMeasurements(), TDataContainer::GetMidasData(), TMidasEvent::GetTimeStamp(), and numSamples.
Referenced by TAnaManager::ProcessMidasEvent().
00051 { 00052 00053 int eventid = dataContainer.GetMidasData().GetEventId(); 00054 int timestamp = dataContainer.GetMidasData().GetTimeStamp(); 00055 00056 TV1730DppData *v1730 = dataContainer.GetEventData<TV1730DppData>("V730"); 00057 00058 00059 if(v1730 ){ 00060 00061 00062 std::vector<ChannelMeasurement> measurements = v1730->GetMeasurements(); 00063 00064 for(int i = 0; i < measurements.size(); i++){ 00065 00066 int chan = measurements[i].GetChannel(); 00067 00068 // Reset the histogram... 00069 for(int ib = 0; ib < this->numSamples; ib++) 00070 GetHistogram(chan)->SetBinContent(ib+1,0); 00071 00072 // Hack! 00073 float offset = 0; 00074 if(chan == 1) 00075 offset = 35; 00076 //std::cout << "Nsamples " << measurements[i].GetNSamples() << std::endl; 00077 for(int ib = 0; ib < measurements[i].GetNSamples(); ib++){ 00078 00079 00080 GetHistogram(chan)->SetBinContent(ib+1, measurements[i].GetSample(ib)-offset); 00081 //std::cout << "Setting " << chan << " " << ib << " " << measurements[i].GetSample(ib) << std::endl; 00082 00083 } 00084 00085 } 00086 00087 } 00088 00089 }
int TV1730DppWaveform::nanosecsPerSample [private] |
Definition at line 34 of file TV1730DppWaveform.h.
Referenced by CreateHistograms(), GetNsecsPerSample(), and SetNanosecsPerSample().
int TV1730DppWaveform::numSamples [private] |
Definition at line 33 of file TV1730DppWaveform.h.
Referenced by CreateHistograms(), GetNumSamples(), and UpdateHistograms().