1 #include "WaveformGraph.h" 2 #include "CorrelationFactory.h" 13 static Int_t zoomCounter=0;
19 : TGraph(),fNewCanvas(0)
22 this->SetEditable(kFALSE);
28 : TGraph(N,x,y),fNewCanvas(0)
30 this->SetEditable(kFALSE);
35 : TGraph(N,x,y),fNewCanvas(0)
37 this->SetEditable(kFALSE);
42 : TGraph(N,x,y),fNewCanvas(0)
44 this->SetEditable(kFALSE);
52 void WaveformGraph::ExecuteEvent(Int_t event, Int_t px, Int_t py)
54 static int keyWasPressed=0;
72 if(!fNewCanvas) drawInNewCanvas();
73 else this->TGraph::ExecuteEvent(event,px,py);
84 this->TGraph::ExecuteEvent(event,px,py);
89 void WaveformGraph::drawInNewCanvas()
93 gStyle->SetTitleH(0.1);
94 gStyle->SetOptTitle(1);
95 gStyle->SetPadLeftMargin(0.15);
96 gStyle->SetPadRightMargin(0.1);
97 gStyle->SetPadTopMargin(0.1);
98 gStyle->SetPadBottomMargin(0.1);
99 gStyle->SetCanvasDefW(600);
100 gStyle->SetCanvasDefH(400);
103 thisCopy->GetXaxis()->SetLabelSize(0.06);
104 thisCopy->GetXaxis()->SetTitleSize(0.06);
105 thisCopy->GetYaxis()->SetLabelSize(0.06);
106 thisCopy->GetYaxis()->SetTitleSize(0.06);
107 thisCopy->GetXaxis()->SetTitle(
"Time (ns)");
108 thisCopy->GetYaxis()->SetTitle(
"Voltage (mV-ish)");
112 sprintf(graphTitle,
"Ant %d%c%c (%s Ring -- Phi %d -- SURF %d -- Chan %d)",
117 sprintf(graphTitle,
"Clock SURF %d -- Chan %d",
fSurf+1,
fChan+1);
119 sprintf(graphName,
"grZoom%d",zoomCounter++);
120 thisCopy->SetName(graphName);
121 thisCopy->SetTitle(graphTitle);
123 TCanvas *can =
new TCanvas();
124 can->SetLeftMargin(0.15);
125 can->SetBottomMargin(0.15);
126 can->SetTopMargin(0.1);
127 can->SetRightMargin(0.1);
128 thisCopy->Draw(
"al");
129 int numPoints=thisCopy->GetN();
141 char graphTitle[180];
142 gStyle->SetTitleH(0.1);
143 gStyle->SetLabelSize(0.1,
"xy");
144 gStyle->SetTitleSize(0.1,
"xy");
145 gStyle->SetTitleOffset(0.5,
"y");
146 gStyle->SetOptTitle(1);
147 gStyle->SetCanvasDefW(600);
148 gStyle->SetCanvasDefH(400);
151 TCanvas *can =
new TCanvas();
152 can->SetLeftMargin(0.15);
153 can->SetBottomMargin(0.15);
154 can->SetTopMargin(0.1);
155 can->SetRightMargin(0.1);
157 TGraph *grFFT = this->
getFFT();
158 grFFT->GetXaxis()->SetLabelSize(0.06);
159 grFFT->GetXaxis()->SetTitleSize(0.06);
160 grFFT->GetYaxis()->SetLabelSize(0.06);
161 grFFT->GetYaxis()->SetTitleSize(0.06);
162 grFFT->GetXaxis()->SetTitle(
"Frequency (MHz)");
163 grFFT->GetYaxis()->SetTitle(
"dB (m maybe)");
166 sprintf(graphTitle,
"Ant %d%c%c (%s Ring -- Phi %d -- SURF %d -- Chan %d)",
170 sprintf(graphTitle,
"Clock SURF %d -- Chan %d",
fSurf+1,
fChan+1);
173 grFFT->SetTitle(graphTitle);
180 void WaveformGraph::DrawHilbert()
182 char graphTitle[180];
183 gStyle->SetTitleH(0.1);
184 gStyle->SetLabelSize(0.1,
"xy");
185 gStyle->SetTitleSize(0.1,
"xy");
186 gStyle->SetTitleOffset(0.5,
"y");
187 gStyle->SetOptTitle(1);
188 gStyle->SetCanvasDefW(600);
189 gStyle->SetCanvasDefH(400);
192 TCanvas *can =
new TCanvas();
193 can->SetLeftMargin(0.15);
194 can->SetBottomMargin(0.15);
195 can->SetTopMargin(0.1);
196 can->SetRightMargin(0.1);
199 grHilbert->GetXaxis()->SetLabelSize(0.06);
200 grHilbert->GetXaxis()->SetTitleSize(0.06);
201 grHilbert->GetYaxis()->SetLabelSize(0.06);
202 grHilbert->GetYaxis()->SetTitleSize(0.06);
203 grHilbert->GetXaxis()->SetTitle(
"Time (ns)");
204 grHilbert->GetYaxis()->SetTitle(
"Voltage^2 (mv^2) ");
207 sprintf(graphTitle,
"Ant %d%c%c (%s Ring -- Phi %d -- SURF %d -- Chan %d)",
211 sprintf(graphTitle,
"Clock SURF %d -- Chan %d",
fSurf+1,
fChan+1);
213 grHilbert->SetTitle(graphTitle);
214 grHilbert->Draw(
"al");
221 Double_t newX[248],newY[248];
223 Int_t numSamps=grInt->GetN();
224 Double_t *xVals=grInt->GetX();
225 Double_t *yVals=grInt->GetY();
226 for(
int i=0;i<248;i++) {
232 newX[i]=newX[i-1]+(1./2.6);
236 TGraph *grNew =
new TGraph(248,newX,newY);
237 TGraph *grFFT = FFTtools::makePowerSpectrumMilliVoltsNanoSecondsdB(grNew);
252 void WaveformGraph::AddToCorrelation()
char ringAsChar(AnitaRing::AnitaRing_t ring)
Returns the ring as a character string.
static CorrelationFactory * Instance()
Instance generator.
const char * ringAsString(AnitaRing::AnitaRing_t ring)
Returns the ring as a character string.
char polAsChar(AnitaPol::AnitaPol_t pol)
Returns the polarisation as a character string.
void addWaveformToCorrelation(WaveformGraph *inputWave)
Adds a a waveform to the correlation.