1 #include "AnitaAveragePowerSpectrum.h" 14 fName =
"AnitaAveragePowerSpectrum";
15 fTitle =
"Anita Average Power Spectrum";
18 for(Int_t polInd = 0; polInd < AnitaPol::kNotAPol; polInd++){
19 for(Int_t ant=0; ant<NUM_SEAVEYS; ant++){
20 avePowSpecs[polInd][ant] = NULL;
55 deleteAllAvePowSpecs();
66 void AnitaAveragePowerSpectrum::deleteAllAvePowSpecs(){
68 for(Int_t polInd = 0; polInd < AnitaPol::kNotAPol; polInd++){
69 for(Int_t ant=0; ant<NUM_SEAVEYS; ant++){
71 if(avePowSpecs[polInd][ant]!=NULL){
72 delete avePowSpecs[polInd][ant];
73 avePowSpecs[polInd][ant] = NULL;
89 void AnitaAveragePowerSpectrum::initAllAvePowSpecs(){
92 for(Int_t polInd = 0; polInd < AnitaPol::kNotAPol; polInd++){
93 for(Int_t ant=0; ant<NUM_SEAVEYS; ant++){
95 TString name = fName + TString::Format(
"_%d_%d", polInd, ant);
119 if(ant >= 0 && ant < NUM_SEAVEYS){
120 avePowSpecPtr = avePowSpecs[pol][ant];
122 return avePowSpecPtr;
140 avePowSpecPtr->
add(gr);
153 deleteAllAvePowSpecs();
154 initAllAvePowSpecs();
172 TMultiGraph* mg =
new TMultiGraph();
174 TString grTitle = TString::Format(
"%s PSDs", fTitle.Data());
177 case AnitaRing::kTopRing:
178 grTitle +=
" Top ring";
180 case AnitaRing::kMiddleRing:
181 grTitle +=
" Middle ring";
183 case AnitaRing::kBottomRing:
184 grTitle +=
" Bottom ring";
186 case AnitaRing::kNotARing:
190 grTitle += pol == AnitaPol::kHorizontal ?
" HPol " :
" VPol ";
192 grTitle +=
";Frequency (MHz); PSD (mV^{2}/MHz)";
195 mg->SetTitle(grTitle);
196 for(
int phi=0; phi<NUM_PHI; phi++){
197 Int_t ant = ring*NUM_PHI + phi;
200 gr->SetLineColor(gStyle->GetColorPalette(phi*Int_t(254./(NUM_PHI-1))));
201 gr->SetFillColorAlpha(0, 0);
void add(AnitaPol::AnitaPol_t pol, Int_t ant, TGraph *gr)
Add a waveform TGraph to an internal AveragePowerSpectrum.
void reset()
Deletes and reinitializes all internal AveragePowerSpectrums.
AveragePowerSpectrum * get(AnitaPol::AnitaPol_t pol, Int_t ant)
Access internal AveragePowerSpectrum.
TMultiGraph * drawSpectralSummary(AnitaPol::AnitaPol_t pol, AnitaRing::AnitaRing_t ring)
Get a ring of TGraphs of a single polarization as a TMultiGraph.
TGraph * makeAvePowSpecTGraph_dB()
Creates a TGraph of the average power spectrum with a dB scale.
size_t add(TGraph *gr)
Function for the user to add the voltage/time waveform to all the stored averages.
AnitaAveragePowerSpectrum()
Constructor.
Takes in waveforms and averages averages their power spectra.
~AnitaAveragePowerSpectrum()
Destructor.