ARA ROOT v3.10 Software

AraDisplay/AraIcrrCanvasMaker.cxx

00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include <fstream>
00009 #include <iostream>
00010 #include "AraIcrrCanvasMaker.h"
00011 #include "AraGeomTool.h"
00012 #include "UsefulIcrrStationEvent.h"
00013 #include "AraWaveformGraph.h"
00014 #include "AraEventCorrelator.h"
00015 #include "AraFFTGraph.h"
00016 #include "araIcrrDefines.h"
00017 
00018 
00019 #include "TString.h"
00020 #include "TObjArray.h"
00021 #include "TObjString.h"
00022 #include "TVector3.h"
00023 #include "TROOT.h"
00024 #include "TPaveText.h"
00025 #include "TPad.h"
00026 #include "TText.h"
00027 #include "TLatex.h"
00028 #include "TGraph.h"
00029 #include "TStyle.h"
00030 #include "TCanvas.h"
00031 #include "TAxis.h"
00032 #include "TH1.h"
00033 #include "TH2.h"
00034 #include "TList.h"
00035 #include "TFile.h"
00036 #include "TObject.h"
00037 #include "TTimeStamp.h"
00038 #include "TGeoManager.h"
00039 #include "TGeoVolume.h"
00040 #include "TView3D.h"
00041 
00042 #include "FFTtools.h"
00043 
00044 
00045 AraIcrrCanvasMaker*  AraIcrrCanvasMaker::fgInstance = 0;
00046 AraGeomTool *fIcrrACMGeomTool=0;
00047 
00048 
00049 
00050 
00051 AraWaveformGraph *grIcrrElec[NUM_DIGITIZED_ICRR_CHANNELS]={0}; 
00052 AraWaveformGraph *grIcrrElecFiltered[NUM_DIGITIZED_ICRR_CHANNELS]={0};
00053 AraWaveformGraph *grIcrrElecHilbert[NUM_DIGITIZED_ICRR_CHANNELS]={0};
00054 AraFFTGraph *grIcrrElecFFT[NUM_DIGITIZED_ICRR_CHANNELS]={0};
00055 AraFFTGraph *grIcrrElecAveragedFFT[NUM_DIGITIZED_ICRR_CHANNELS]={0};
00056 
00057 AraWaveformGraph *grIcrrRFChan[MAX_RFCHANS_PER_ICRR]={0};
00058 AraWaveformGraph *grIcrrRFChanFiltered[MAX_RFCHANS_PER_ICRR]={0};
00059 AraWaveformGraph *grIcrrRFChanHilbert[MAX_RFCHANS_PER_ICRR]={0};
00060 AraFFTGraph *grIcrrRFChanFFT[MAX_RFCHANS_PER_ICRR]={0};
00061 AraFFTGraph *grIcrrRFChanAveragedFFT[MAX_RFCHANS_PER_ICRR]={0};
00062 
00063 
00064 TH1D *AraIcrrCanvasMaker::getFFTHisto(int ant)
00065 {
00066   if(ant<0 || ant>=RFCHANS_PER_ICRR) return NULL;
00067   if(grIcrrRFChan[ant])
00068     return grIcrrRFChan[ant]->getFFTHisto();
00069     return NULL;
00070 
00071 }
00072 
00073 AraIcrrCanvasMaker::AraIcrrCanvasMaker(AraCalType::AraCalType_t calType)
00074 {
00075   //Default constructor
00076   fIcrrACMGeomTool=AraGeomTool::Instance();
00077   fNumAntsInMap=4;
00078   fWebPlotterMode=0;
00079   fPassBandFilter=0;
00080   fNotchFilter=0;
00081   fLowPassEdge=200;
00082   fHighPassEdge=1200;
00083   fLowNotchEdge=235;
00084   fHighNotchEdge=500;
00085   fMinVoltLimit=-60;
00086   fMaxVoltLimit=60;
00087   fPhiMax=0;
00088   fMinClockVoltLimit=-200;
00089   fMaxClockVoltLimit=200;
00090   fAutoScale=1;
00091   fMinTimeLimit=0;
00092   fMaxTimeLimit=0;
00093   // if(AraCalType::hasCableDelays(calType)) {
00094   //   fMinTimeLimit=-200;
00095   //   fMaxTimeLimit=150;
00096   // }
00097   fMinPowerLimit=-60;
00098   fMaxPowerLimit=60;
00099   fMinFreqLimit=0;
00100   fMaxFreqLimit=1200;
00101   fWaveformOption=AraDisplayFormatOption::kWaveform;
00102   fRedoEventCanvas=0;
00103   //fRedoSurfCanvas=0;
00104   fLastWaveformFormat=AraDisplayFormatOption::kWaveform;
00105   fNewEvent=1;
00106   fCalType=calType;
00107   fCorType=AraCorrelatorType::kSphericalDist40;
00108   fgInstance=this;
00109   memset(grIcrrElec,0,sizeof(AraWaveformGraph*)*NUM_DIGITIZED_ICRR_CHANNELS);
00110   memset(grIcrrElecFiltered,0,sizeof(AraWaveformGraph*)*NUM_DIGITIZED_ICRR_CHANNELS);
00111   memset(grIcrrElecHilbert,0,sizeof(AraWaveformGraph*)*NUM_DIGITIZED_ICRR_CHANNELS);
00112   memset(grIcrrElecFFT,0,sizeof(AraFFTGraph*)*NUM_DIGITIZED_ICRR_CHANNELS);
00113   memset(grIcrrElecAveragedFFT,0,sizeof(AraFFTGraph*)*NUM_DIGITIZED_ICRR_CHANNELS);
00114 
00115   memset(grIcrrRFChan,0,sizeof(AraWaveformGraph*)*MAX_RFCHANS_PER_ICRR);
00116   memset(grIcrrRFChanFiltered,0,sizeof(AraWaveformGraph*)*MAX_RFCHANS_PER_ICRR);
00117   memset(grIcrrRFChanHilbert,0,sizeof(AraWaveformGraph*)*MAX_RFCHANS_PER_ICRR);
00118   memset(grIcrrRFChanFFT,0,sizeof(AraFFTGraph*)*MAX_RFCHANS_PER_ICRR);
00119   memset(grIcrrRFChanAveragedFFT,0,sizeof(AraFFTGraph*)*MAX_RFCHANS_PER_ICRR);  
00120   switch(fCalType) {
00121   case AraCalType::kNoCalib:
00122     fMaxVoltLimit=3000;
00123     fMinVoltLimit=1000;
00124   case AraCalType::kJustUnwrap:
00125     fMinTimeLimit=0;
00126     fMaxTimeLimit=260;
00127     break;
00128   default:
00129     break;
00130   }
00131 
00132 
00133 }
00134 
00135 AraIcrrCanvasMaker::~AraIcrrCanvasMaker()
00136 {
00137    //Default destructor
00138 }
00139 
00140 
00141 
00142 //______________________________________________________________________________
00143 AraIcrrCanvasMaker*  AraIcrrCanvasMaker::Instance()
00144 {
00145    //static function
00146    return (fgInstance) ? (AraIcrrCanvasMaker*) fgInstance : new AraIcrrCanvasMaker();
00147 }
00148 
00149 
00150 TPad *AraIcrrCanvasMaker::getEventInfoCanvas(UsefulIcrrStationEvent *evPtr,  TPad *useCan, Int_t runNumber)
00151 {
00152    static UInt_t lastEventNumber=0;
00153    static TPaveText *leftPave=0;
00154    static TPaveText *midLeftPave=0;
00155    static TPaveText *midRightPave=0;
00156    static TPaveText *rightPave=0;
00157 
00158 
00159    if(!fIcrrACMGeomTool)
00160       fIcrrACMGeomTool=AraGeomTool::Instance();
00161    char textLabel[180];
00162    TPad *topPad;
00163    if(!useCan) {
00164       topPad = new TPad("padEventInfo","padEventInfo",0.2,0.9,0.8,1);
00165       topPad->Draw();
00166    }
00167    else {
00168       topPad=useCan;
00169    } 
00170    if(1) {
00171      fNewEvent=1;
00172      topPad->Clear();
00173      topPad->SetTopMargin(0.05);
00174      topPad->Divide(4,1);
00175      topPad->cd(1);
00176      if(leftPave) delete leftPave;
00177      leftPave = new TPaveText(0,0.1,1,0.9);
00178      leftPave->SetName("leftPave");
00179      leftPave->SetBorderSize(0);
00180      leftPave->SetFillColor(0);
00181      leftPave->SetTextAlign(13);
00182      if(runNumber) {
00183        sprintf(textLabel,"Run: %d",runNumber);
00184        TText *runText = leftPave->AddText(textLabel);
00185        runText->SetTextColor(50);
00186      }
00187      if(evPtr->stationId==0) sprintf(textLabel,"TestBed Event: %d",evPtr->head.eventNumber);
00188      else if(evPtr->stationId==1) sprintf(textLabel,"Station1 Event: %d",evPtr->head.eventNumber);
00189      else sprintf(textLabel,"Event: %d",evPtr->head.eventNumber);
00190 
00191      TText *eventText = leftPave->AddText(textLabel);
00192      eventText->SetTextColor(50);
00193      leftPave->Draw();
00194 
00195 
00196      topPad->cd(2);
00197      gPad->SetRightMargin(0);
00198      gPad->SetLeftMargin(0);
00199      if(midLeftPave) delete midLeftPave;
00200      midLeftPave = new TPaveText(0,0.1,0.99,0.9);
00201      midLeftPave->SetName("midLeftPave");
00202      midLeftPave->SetBorderSize(0);
00203      midLeftPave->SetTextAlign(13);
00204      TTimeStamp trigTime((time_t)evPtr->head.unixTime,(Int_t)1000*evPtr->head.unixTimeUs);
00205      sprintf(textLabel,"Time: %s",trigTime.AsString("s"));
00206      TText *timeText = midLeftPave->AddText(textLabel);
00207      timeText->SetTextColor(1);
00208      sprintf(textLabel,"Sub: %f",(trigTime.GetNanoSec()/1e9));
00209      TText *timeText2 = midLeftPave->AddText(textLabel);
00210      timeText2->SetTextColor(1);
00211      midLeftPave->Draw();
00212      //     midLeftPave->Modified();
00213      gPad->Modified();
00214      gPad->Update();
00215      
00216      topPad->cd(3);
00217      if(midRightPave) delete midRightPave;
00218      midRightPave = new TPaveText(0,0.1,1,0.95);
00219      midRightPave->SetBorderSize(0);
00220      midRightPave->SetTextAlign(13);
00221      sprintf(textLabel,"PPS Num %d",
00222              evPtr->trig.ppsNum);
00223      midRightPave->AddText(textLabel);
00224      sprintf(textLabel,"Trig Type %d%d%d",
00225              evPtr->trig.isInTrigType(2),
00226              evPtr->trig.isInTrigType(1),
00227              evPtr->trig.isInTrigType(0));
00228      midRightPave->AddText(textLabel);
00229      sprintf(textLabel,"Pattern %d%d%d%d%d%d%d%d",
00230              evPtr->trig.isInTrigPattern(7),
00231              evPtr->trig.isInTrigPattern(6),
00232              evPtr->trig.isInTrigPattern(5),
00233              evPtr->trig.isInTrigPattern(4),
00234              evPtr->trig.isInTrigPattern(3),
00235              evPtr->trig.isInTrigPattern(2),
00236              evPtr->trig.isInTrigPattern(1),
00237              evPtr->trig.isInTrigPattern(0));
00238      midRightPave->AddText(textLabel);
00239      midRightPave->Draw();
00240 
00241      
00242      topPad->cd(4);
00243      if(rightPave) delete rightPave;
00244      rightPave = new TPaveText(0,0.1,1,0.95);
00245      rightPave->SetBorderSize(0);
00246      rightPave->SetTextAlign(13); 
00247      rightPave->Draw();
00248      topPad->Update();
00249      topPad->Modified();
00250                
00251      lastEventNumber=evPtr->head.eventNumber;
00252    }
00253       
00254    return topPad;
00255 }
00256 
00257 
00258 TPad *AraIcrrCanvasMaker::quickGetEventViewerCanvasForWebPlottter(UsefulIcrrStationEvent *evPtr,  TPad *useCan)
00259 {
00260   TPad *retCan=0;
00261   fWebPlotterMode=1;
00262   //  static Int_t lastEventView=0;
00263 
00264   if(fAutoScale) {
00265     fMinVoltLimit=1e9;
00266     fMaxVoltLimit=-1e9;
00267     fMinClockVoltLimit=1e9;
00268     fMaxClockVoltLimit=-1e9;
00269   }
00270 
00271 
00272 
00273   for(int chan=0;chan<NUM_DIGITIZED_ICRR_CHANNELS;chan++) {
00274     if(grIcrrElec[chan]) delete grIcrrElec[chan];
00275     if(grIcrrElecFFT[chan]) delete grIcrrElecFFT[chan];
00276     if(grIcrrElecHilbert[chan]) delete grIcrrElecHilbert[chan];
00277     grIcrrElec[chan]=0;
00278     grIcrrElecFFT[chan]=0;
00279     grIcrrElecHilbert[chan]=0;
00280     //    if(grIcrrElecAveragedFFT[chan]) delete grIcrrElecAveragedFFT[chan];
00281     
00282     TGraph *grTemp = evPtr->getGraphFromElecChan(chan);
00283     grIcrrElec[chan] = new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00284     grIcrrElec[chan]->setElecChan(chan);
00285       //      std::cout << evPtr->head.eventNumber << "\n";
00286       //      std::cout << surf << "\t" << chan << "\t" 
00287       //                << grIcrrElec[chan]->GetRMS(2) << std::endl;
00288     
00289     if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT) {
00290       TGraph *grTempFFT = grIcrrElec[chan]->getFFT();
00291       grIcrrElecFFT[chan]=new AraFFTGraph(grTempFFT->GetN(),
00292                                       grTempFFT->GetX(),
00293                                       grTempFFT->GetY());
00294       if(!grIcrrElecAveragedFFT[chan]) {
00295         grIcrrElecAveragedFFT[chan]=new AraFFTGraph(grTempFFT->GetN(),
00296                                       grTempFFT->GetX(),
00297                                       grTempFFT->GetY());
00298       }
00299       else {
00300         grIcrrElecAveragedFFT[chan]->AddFFT(grIcrrElecFFT[chan]);
00301       }
00302       delete grTempFFT;      
00303     }
00304 
00305 
00306     if(fAutoScale) {
00307       Int_t numPoints=grTemp->GetN();
00308       Double_t *yVals=grTemp->GetY();
00309         
00310       for(int i=0;i<numPoints;i++) {    
00311         if(yVals[i]<fMinVoltLimit)
00312           fMinVoltLimit=yVals[i];
00313         if(yVals[i]>fMaxVoltLimit)
00314           fMaxVoltLimit=yVals[i];       
00315       }      
00316     }
00317 
00318     delete grTemp;
00319   }
00320 
00321   
00322 
00323   for(int rfchan=0;rfchan<RFCHANS_PER_ICRR;rfchan++) {
00324     if(grIcrrRFChan[rfchan]) delete grIcrrRFChan[rfchan];
00325     if(grIcrrRFChanFFT[rfchan]) delete grIcrrRFChanFFT[rfchan];
00326     if(grIcrrRFChanHilbert[rfchan]) delete grIcrrRFChanHilbert[rfchan];
00327     grIcrrRFChan[rfchan]=0;
00328     grIcrrRFChanFFT[rfchan]=0;
00329     grIcrrRFChanHilbert[rfchan]=0;
00330     //    if(grIcrrRFChanAveragedFFT[chan]) delete grIcrrRFChanAveragedFFT[chan];
00331     //Need to work out how to do this
00332     TGraph *grTemp = evPtr->getGraphFromRFChan(rfchan);
00333     grIcrrRFChan[rfchan] = new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00334     grIcrrRFChan[rfchan]->setRFChan(rfchan, evPtr->stationId);
00335       //      std::cout << evPtr->head.eventNumber << "\n";
00336       //      std::cout << surf << "\t" << chan << "\t" 
00337       //                << grIcrrElec[chan]->GetRMS(2) << std::endl;
00338     
00339  
00340     if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT) {
00341       TGraph *grTempFFT = grIcrrRFChan[rfchan]->getFFT();
00342       grIcrrRFChanFFT[rfchan]=new AraFFTGraph(grTempFFT->GetN(),
00343                                       grTempFFT->GetX(),
00344                                       grTempFFT->GetY());
00345       if(!grIcrrRFChanAveragedFFT[rfchan]) {
00346         grIcrrRFChanAveragedFFT[rfchan]=new AraFFTGraph(grTempFFT->GetN(),
00347                                       grTempFFT->GetX(),
00348                                       grTempFFT->GetY());
00349       }
00350       else {
00351         grIcrrRFChanAveragedFFT[rfchan]->AddFFT(grIcrrRFChanFFT[rfchan]);
00352       }
00353       delete grTempFFT;      
00354     }
00355 
00356 
00357 
00358     if(fAutoScale) {
00359       Int_t numPoints=grTemp->GetN();
00360       Double_t *yVals=grTemp->GetY();
00361         
00362       for(int i=0;i<numPoints;i++) {    
00363         if(yVals[i]<fMinVoltLimit)
00364           fMinVoltLimit=yVals[i];
00365         if(yVals[i]>fMaxVoltLimit)
00366           fMaxVoltLimit=yVals[i];       
00367       }      
00368     }
00369     delete grTemp;
00370   }
00371 
00372 
00373   if(fAutoScale) {
00374     if(fCalType!=AraCalType::kNoCalib && fCalType!=AraCalType::kJustUnwrap) {
00375       if(fMaxVoltLimit>-1*fMinVoltLimit) {
00376         fMinVoltLimit=-1*fMaxVoltLimit;
00377       }
00378       else {
00379         fMaxVoltLimit=-1*fMinVoltLimit;
00380       }
00381     }
00382   
00383 
00384    if(fMaxClockVoltLimit>-1*fMinClockVoltLimit) {
00385       fMinClockVoltLimit=-1*fMaxClockVoltLimit;
00386     }
00387     else {
00388       fMaxClockVoltLimit=-1*fMinClockVoltLimit;
00389     }
00390   }
00391     
00392 
00393   fRedoEventCanvas=0;
00394 
00395   retCan=AraIcrrCanvasMaker::getCanvasForWebPlotter(evPtr,useCan);
00396 
00397  
00398 
00399   return retCan;
00400 
00401 }
00402 
00403 TPad *AraIcrrCanvasMaker::getEventViewerCanvas(UsefulIcrrStationEvent *evPtr,
00404                                            TPad *useCan)
00405 {
00406   TPad *retCan=0;
00407 
00408   static UInt_t lastEventNumber=0;
00409 
00410   if(fAutoScale) {
00411     fMinVoltLimit=1e9;
00412     fMaxVoltLimit=-1e9;
00413     fMinClockVoltLimit=0;
00414     fMaxClockVoltLimit=0;
00415   }
00416 
00417 
00418 
00419   for(int chan=0;chan<NUM_DIGITIZED_ICRR_CHANNELS;chan++) {
00420     if(grIcrrElec[chan]) delete grIcrrElec[chan];
00421     if(grIcrrElecFFT[chan]) delete grIcrrElecFFT[chan];
00422     if(grIcrrElecHilbert[chan]) delete grIcrrElecHilbert[chan];
00423     grIcrrElec[chan]=0;
00424     grIcrrElecFFT[chan]=0;
00425     grIcrrElecHilbert[chan]=0;
00426     
00427     TGraph *grTemp = evPtr->getGraphFromElecChan(chan);
00428     grIcrrElec[chan] = new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00429     grIcrrElec[chan]->setElecChan(chan);
00430 
00431 
00432     if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT) {
00433       TGraph *grTempFFT = grIcrrElec[chan]->getFFT();
00434       grIcrrElecFFT[chan]=new AraFFTGraph(grTempFFT->GetN(),
00435                                       grTempFFT->GetX(),
00436                                       grTempFFT->GetY());
00437       if(!grIcrrElecAveragedFFT[chan]) {
00438         grIcrrElecAveragedFFT[chan]=new AraFFTGraph(grTempFFT->GetN(),
00439                                       grTempFFT->GetX(),
00440                                       grTempFFT->GetY());
00441       }
00442       else {
00443         grIcrrElecAveragedFFT[chan]->AddFFT(grIcrrElecFFT[chan]);
00444       }
00445       delete grTempFFT;      
00446     }
00447 
00448 
00449     if(fAutoScale) {
00450       Int_t numPoints=grTemp->GetN();
00451       Double_t *yVals=grTemp->GetY();
00452         
00453       if(chan%9==8) {
00454         //Clock channel
00455         for(int i=0;i<numPoints;i++) {  
00456           if(yVals[i]<fMinClockVoltLimit)
00457             fMinClockVoltLimit=yVals[i];
00458           if(yVals[i]>fMaxClockVoltLimit)
00459             fMaxClockVoltLimit=yVals[i];        
00460         }      
00461       }
00462       else{
00463         for(int i=0;i<numPoints;i++) {  
00464           if(yVals[i]<fMinVoltLimit)
00465             fMinVoltLimit=yVals[i];
00466           if(yVals[i]>fMaxVoltLimit)
00467             fMaxVoltLimit=yVals[i];     
00468         }      
00469       }
00470     }
00471 
00472     delete grTemp;
00473   }
00474   //  std::cout << "Limits\t" << fMinVoltLimit << "\t" << fMaxVoltLimit << "\n";
00475 
00476 
00477   for(int rfchan=0;rfchan<(evPtr->numRFChans);rfchan++) {
00478     if(grIcrrRFChan[rfchan]) delete grIcrrRFChan[rfchan];
00479     if(grIcrrRFChanFFT[rfchan]) delete grIcrrRFChanFFT[rfchan];
00480     if(grIcrrRFChanHilbert[rfchan]) delete grIcrrRFChanHilbert[rfchan];
00481     grIcrrRFChan[rfchan]=0;
00482     grIcrrRFChanFFT[rfchan]=0;
00483     grIcrrRFChanHilbert[rfchan]=0;
00484     //Need to work out how to do this
00485     TGraph *grTemp = evPtr->getGraphFromRFChan(rfchan);
00486     grIcrrRFChan[rfchan] = new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00487 
00488     
00489 
00490     grIcrrRFChan[rfchan]->setRFChan(rfchan, evPtr->stationId);
00491       //      std::cout << evPtr->head.eventNumber << "\n";
00492       //      std::cout << surf << "\t" << chan << "\t" 
00493       //                << grIcrrElec[chan]->GetRMS(2) << std::endl;
00494     
00495     if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT) {
00496       TGraph *grTempFFT = grIcrrRFChan[rfchan]->getFFT();
00497       grIcrrRFChanFFT[rfchan]=new AraFFTGraph(grTempFFT->GetN(),
00498                                       grTempFFT->GetX(),
00499                                       grTempFFT->GetY());
00500       if(!grIcrrRFChanAveragedFFT[rfchan]) {
00501         grIcrrRFChanAveragedFFT[rfchan]=new AraFFTGraph(grTempFFT->GetN(),
00502                                       grTempFFT->GetX(),
00503                                       grTempFFT->GetY());
00504       }
00505       else {
00506         grIcrrRFChanAveragedFFT[rfchan]->AddFFT(grIcrrRFChanFFT[rfchan]);
00507       }
00508       delete grTempFFT;      
00509     }
00510     if(fAutoScale) {
00511       Int_t numPoints=grTemp->GetN();
00512       Double_t *yVals=grTemp->GetY();
00513         
00514       for(int i=0;i<numPoints;i++) {    
00515         if(yVals[i]<fMinVoltLimit)
00516           fMinVoltLimit=yVals[i];
00517         if(yVals[i]>fMaxVoltLimit)
00518           fMaxVoltLimit=yVals[i];       
00519       }      
00520     }
00521     delete grTemp;
00522   }
00523 
00524   if(fAutoScale) {
00525 
00526     if(fCalType!=AraCalType::kNoCalib && fCalType!=AraCalType::kJustUnwrap) {
00527       if(fMaxVoltLimit>-1*fMinVoltLimit) {
00528         fMinVoltLimit=-1*fMaxVoltLimit;
00529       }
00530       else {
00531         fMaxVoltLimit=-1*fMinVoltLimit;
00532       }
00533       if(fMaxClockVoltLimit>-1*fMinClockVoltLimit) {
00534         fMinClockVoltLimit=-1*fMaxClockVoltLimit;
00535       }
00536       else {
00537         fMaxClockVoltLimit=-1*fMinClockVoltLimit;
00538       }
00539     }
00540   }
00541     
00542   //  std::cout << "Limits\t" << fMinVoltLimit << "\t" << fMaxVoltLimit << "\n";
00543 
00544 
00545   fRedoEventCanvas=0;
00546   fNewEvent=0;
00547 
00548   fRedoEventCanvas=0;
00549   if(fLastWaveformFormat!=fWaveformOption) fRedoEventCanvas=1;
00550 
00551   
00552   if(fCanvasLayout==AraDisplayCanvasLayoutOption::kElectronicsView) {
00553     retCan=AraIcrrCanvasMaker::getElectronicsCanvas(evPtr,useCan);
00554   }
00555   else if(fCanvasLayout==AraDisplayCanvasLayoutOption::kRFChanView) {
00556     retCan=AraIcrrCanvasMaker::getRFChannelCanvas(evPtr,useCan);
00557   }
00558   else if(fCanvasLayout==AraDisplayCanvasLayoutOption::kAntennaView) {
00559     retCan=AraIcrrCanvasMaker::getAntennaCanvas(evPtr,useCan);
00560   }
00561   else if(fCanvasLayout==AraDisplayCanvasLayoutOption::kIntMapView) {
00562     retCan=AraIcrrCanvasMaker::getIntMapCanvas(evPtr,useCan);
00563   }
00564 
00565 
00566   fLastWaveformFormat=fWaveformOption;
00567   fLastCanvasView=fCanvasLayout;
00568 
00569   return retCan;
00570 
00571 }
00572 
00573 
00574 TPad *AraIcrrCanvasMaker::getElectronicsCanvas(UsefulIcrrStationEvent *evPtr,TPad *useCan)
00575 {
00576   //  gStyle->SetTitleH(0.1);
00577   gStyle->SetOptTitle(0); 
00578   
00579   if(!fIcrrACMGeomTool)
00580     fIcrrACMGeomTool=AraGeomTool::Instance();
00581   char textLabel[180];
00582   char padName[180];
00583   TPad *canElec=0;
00584   TPad *plotPad=0;
00585   if(!useCan) {
00586     canElec = (TPad*) gROOT->FindObject("canElec");
00587     if(!canElec) {
00588       canElec = new TCanvas("canElec","canElec",1000,600);
00589     }
00590     canElec->Clear();
00591     canElec->SetTopMargin(0);
00592     TPaveText *leftPave = new TPaveText(0.05,0.92,0.95,0.98);
00593     leftPave->SetBorderSize(0);
00594     sprintf(textLabel," Event %d",evPtr->head.eventNumber);
00595     TText *eventText = leftPave->AddText(textLabel);
00596     eventText->SetTextColor(50);
00597     leftPave->Draw();
00598     plotPad = new TPad("canElecMain","canElecMain",0,0,1,0.9);
00599     plotPad->Draw();
00600   }
00601   else {
00602     plotPad=useCan;
00603   }
00604   plotPad->cd();
00605   setupElecPadWithFrames(plotPad);
00606 
00607 
00608 
00609   int count=0;
00610 
00611   // A
00612   // 1 3 5 7 9 
00613   // 2 4 6 8 
00614   // B
00615   // 1 3 5 7 9 
00616   // 2 4 6 8 
00617   // C
00618   // 1 3 5 7 9 
00619   // 2 4 6 8 
00620 
00621   for(int row=0;row<6;row++) {    
00622     for(int column=0;column<5;column++) {
00623       plotPad->cd();
00624       int labChip=(row/2); //0, 1 or 2
00625       int channel=(row%2)+2*column;
00626       int chanIndex=channel+9*labChip;
00627       if(channel>8) continue;
00628 
00629       sprintf(padName,"elecChanPad%d",column+row*5);
00630       //      std::cout << chanIndex << "\t" << labChip << "\t" << channel << "\t" << padName << "\n";
00631       TPad *paddy1 = (TPad*) plotPad->FindObject(padName);
00632       paddy1->SetEditable(kTRUE);
00633       deleteTGraphsFromElecPad(paddy1,chanIndex);
00634 
00635 
00636 
00637       if(fWaveformOption==AraDisplayFormatOption::kPowerSpectralDensity){
00638         if(!grIcrrElecFFT[chanIndex]) {
00639           TGraph *grTemp=grIcrrElec[chanIndex]->getFFT();
00640           grIcrrElecFFT[chanIndex]=new AraFFTGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00641           delete grTemp;
00642         }
00643         grIcrrElecFFT[chanIndex]->Draw("l");
00644       }
00645       else if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT){
00646         grIcrrElecAveragedFFT[chanIndex]->Draw("l");
00647       }
00648       else if(fWaveformOption==AraDisplayFormatOption::kHilbertEnvelope) {
00649         if(!grIcrrElecHilbert[chanIndex]) {
00650           TGraph *grTemp=grIcrrElec[chanIndex]->getHilbert();
00651           grIcrrElecHilbert[chanIndex]=new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00652           delete grTemp;
00653         }
00654         grIcrrElecHilbert[chanIndex]->Draw("l");
00655       }
00656       else if(fWaveformOption==AraDisplayFormatOption::kWaveform){
00657 
00658         grIcrrElec[chanIndex]->Draw("l");
00659         
00660         
00661         if(fAutoScale) {
00662           TList *listy = gPad->GetListOfPrimitives();
00663           for(int i=0;i<listy->GetSize();i++) {
00664             TObject *fred = listy->At(i);
00665             TH1F *tempHist = (TH1F*) fred;
00666             if(tempHist->InheritsFrom("TH1")) {
00667               if(channel<8) {
00668                 tempHist->GetYaxis()->SetRangeUser(fMinVoltLimit,fMaxVoltLimit);
00669               }
00670               else {
00671                 tempHist->GetYaxis()->SetRangeUser(fMinClockVoltLimit,fMaxClockVoltLimit);
00672               }
00673             }
00674           }
00675         }
00676       }
00677 
00678 
00679       count++;
00680       paddy1->SetEditable(kFALSE);
00681     }
00682   }
00683 
00684   if(!useCan)
00685     return canElec;
00686   else
00687     return plotPad;
00688   
00689 
00690 }
00691 
00692 
00693 TPad *AraIcrrCanvasMaker::getCanvasForWebPlotter(UsefulIcrrStationEvent *evPtr,
00694                                              TPad *useCan)
00695 {
00696   //  gStyle->SetTitleH(0.1);
00697   gStyle->SetOptTitle(0); 
00698 
00699   if(!fIcrrACMGeomTool)
00700     fIcrrACMGeomTool=AraGeomTool::Instance();
00701   char textLabel[180];
00702   char padName[180];
00703   TPad *canRFChan=0;
00704   TPad *plotPad=0;
00705   if(!useCan) {
00706     canRFChan = (TPad*) gROOT->FindObject("canRFChan");
00707     if(!canRFChan) {
00708       canRFChan = new TCanvas("canRFChan","canRFChan",1000,600);
00709     }
00710     canRFChan->Clear();
00711     canRFChan->SetTopMargin(0);
00712     TPaveText *leftPave = new TPaveText(0.05,0.92,0.95,0.98);
00713     leftPave->SetBorderSize(0);
00714     sprintf(textLabel,"Event %d",evPtr->head.eventNumber);
00715     TText *eventText = leftPave->AddText(textLabel);
00716     eventText->SetTextColor(50);
00717     leftPave->Draw();
00718     plotPad = new TPad("canRFChanMain","canRFChanMain",0,0,1,0.9);
00719     plotPad->Draw();
00720   }
00721   else {
00722     plotPad=useCan;
00723   }
00724   plotPad->cd();
00725   setupRFChanPadWithFrames(plotPad, evPtr->stationId);
00726 
00727 
00728 
00729   int count=0;
00730 
00731 
00732   //  1  2  3  4
00733   //  5  6  7  8
00734   //  9 10 11 12
00735   // 13 14 15 16
00736 
00737   for(int column=0;column<4;column++) {
00738     for(int row=0;row<4;row++) {
00739       plotPad->cd();
00740       int rfChan=column+4*row;
00741 
00742       sprintf(padName,"rfChanPad%d",column+4*row);
00743       TPad *paddy1 = (TPad*) plotPad->FindObject(padName);
00744       paddy1->SetEditable(kTRUE);
00745       deleteTGraphsFromRFPad(paddy1,rfChan);
00746       paddy1->cd();
00747      
00748       grIcrrRFChan[rfChan]->Draw("l");
00749 
00750       if(fAutoScale) {
00751         TList *listy = gPad->GetListOfPrimitives();
00752         for(int i=0;i<listy->GetSize();i++) {
00753             TObject *fred = listy->At(i);
00754             TH1F *tempHist = (TH1F*) fred;
00755             if(tempHist->InheritsFrom("TH1")) {
00756               tempHist->GetYaxis()->SetRangeUser(fMinVoltLimit,fMaxVoltLimit);
00757 
00758             }
00759         }
00760       }
00761 
00762 
00763       count++;
00764       paddy1->SetEditable(kFALSE);
00765     }
00766   }
00767 
00768   if(!useCan)
00769     return canRFChan;
00770   else
00771     return plotPad;
00772   
00773 
00774 }
00775 
00776 TPad *AraIcrrCanvasMaker::getRFChannelCanvas(UsefulIcrrStationEvent *evPtr,
00777                                          TPad *useCan)
00778 {
00779    //  gStyle->SetTitleH(0.1);
00780   gStyle->SetOptTitle(0); 
00781 
00782   if(!fIcrrACMGeomTool)
00783     fIcrrACMGeomTool=AraGeomTool::Instance();
00784   char textLabel[180];
00785   char padName[180];
00786   TPad *canRFChan=0;
00787   TPad *plotPad=0;
00788   if(!useCan) {
00789     canRFChan = (TPad*) gROOT->FindObject("canRFChan");
00790     if(!canRFChan) {
00791       canRFChan = new TCanvas("canRFChan","canRFChan",1000,600);
00792     }
00793     canRFChan->Clear();
00794     canRFChan->SetTopMargin(0);
00795     TPaveText *leftPave = new TPaveText(0.05,0.92,0.95,0.98);
00796     leftPave->SetBorderSize(0);
00797     sprintf(textLabel,"Event %d",evPtr->head.eventNumber);
00798     TText *eventText = leftPave->AddText(textLabel);
00799     eventText->SetTextColor(50);
00800     leftPave->Draw();
00801     plotPad = new TPad("canRFChanMain","canRFChanMain",0,0,1,0.9);
00802     plotPad->Draw();
00803   }
00804   else {
00805     plotPad=useCan;
00806   }
00807   plotPad->cd();
00808 
00809   //FIXME -- jpd - this is where we will set the fMaxTime and fMinTime
00810 
00811   TGraph *tempGraph=0;
00812   Double_t *tempX;
00813   
00814   for(int rfChan=0; rfChan<evPtr->getNumRFChannels();++rfChan){
00815     tempGraph=evPtr->getGraphFromRFChan(rfChan);
00816     int nEntries=tempGraph->GetN();
00817     tempX=tempGraph->GetX();
00818     if(tempX[0]<fMinTimeLimit) fMinTimeLimit=tempX[0];
00819     if(tempX[nEntries-1]>fMaxTimeLimit) fMaxTimeLimit=tempX[nEntries-1];
00820     //    fprintf(stderr, "getRFChannelCanvas() -- rfChan %i fMinTimeLimit %f tempX[0] %f fMaxTimeLimit %f tempX[N-1] %f\n", rfChan, fMinTimeLimit, tempX[0], fMaxTimeLimit, tempX[nEntries-1]);
00821 
00822 
00823     delete tempGraph;
00824   }
00825 
00826   //  fprintf(stderr, "\nfMinTimeLimit %f fMaxTimeLimit %f\n", fMinTimeLimit, fMaxTimeLimit);//DEBUG
00827 
00828   setupRFChanPadWithFrames(plotPad, evPtr->stationId);
00829   int maxColumns=0;
00830   int maxRows=0;
00831 
00832   if(evPtr->stationId==1){//FIXME --This should be something like if num antennas is 20 or something
00833     maxColumns=4;
00834     maxRows=5;
00835   }
00836   else {
00837     maxColumns=4;
00838     maxRows=4;
00839   }
00840 
00841   
00842   for(int column=0;column<maxColumns;column++) {
00843     for(int row=0;row<maxRows;row++) {
00844       plotPad->cd();
00845       int rfChan=column+4*row;
00846       
00847       sprintf(padName,"rfChanPad%d",column+4*row);
00848       TPad *paddy1 = (TPad*) plotPad->FindObject(padName);
00849       paddy1->SetEditable(kTRUE);
00850       deleteTGraphsFromRFPad(paddy1,rfChan);
00851       paddy1->cd();
00852       
00853       if(fWaveformOption==AraDisplayFormatOption::kPowerSpectralDensity){
00854         if(!grIcrrRFChanFFT[rfChan]) {
00855           TGraph *grTemp=grIcrrRFChan[rfChan]->getFFT();
00856           grIcrrRFChanFFT[rfChan]=new AraFFTGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00857           delete grTemp;
00858         }
00859         grIcrrRFChanFFT[rfChan]->Draw("l");
00860       }
00861       else if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT){
00862         grIcrrRFChanAveragedFFT[rfChan]->Draw("l");
00863       }
00864       else if(fWaveformOption==AraDisplayFormatOption::kHilbertEnvelope) {
00865         if(!grIcrrRFChanHilbert[rfChan])  {
00866           TGraph *grTemp=grIcrrRFChan[rfChan]->getHilbert();
00867           grIcrrRFChanHilbert[rfChan]=new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
00868           delete grTemp;
00869         }
00870         grIcrrRFChanHilbert[rfChan]->Draw("l");
00871       }
00872       else if(fWaveformOption==AraDisplayFormatOption::kWaveform) {
00873         grIcrrRFChan[rfChan]->Draw("l");
00874 
00875         if(fAutoScale) {
00876           TList *listy = gPad->GetListOfPrimitives();
00877           for(int i=0;i<listy->GetSize();i++) {
00878             TObject *fred = listy->At(i);
00879             TH1F *tempHist = (TH1F*) fred;
00880             if(tempHist->InheritsFrom("TH1")) {
00881               tempHist->GetYaxis()->SetRangeUser(fMinVoltLimit,fMaxVoltLimit);
00882             }
00883           }
00884         }
00885       }
00886 
00887       paddy1->SetEditable(kFALSE);
00888     }
00889   }
00890   
00891   
00892   if(!useCan)
00893     return canRFChan;
00894   else 
00895     return plotPad;
00896   
00897 }
00898 
00899 //FIXME //jpd This needs to be tested and or fixed to comply with station1
00900 TPad *AraIcrrCanvasMaker::getAntennaCanvas(UsefulIcrrStationEvent *evPtr,
00901                                        TPad *useCan)
00902 {
00903    //  gStyle->SetTitleH(0.1);
00904   gStyle->SetOptTitle(0); 
00905 
00906   if(!fIcrrACMGeomTool)
00907     fIcrrACMGeomTool=AraGeomTool::Instance();
00908   char textLabel[180];
00909   char padName[180];
00910   TPad *canRFChan=0;
00911   TPad *plotPad=0;
00912   if(!useCan) {
00913     canRFChan = (TPad*) gROOT->FindObject("canRFChan");
00914     if(!canRFChan) {
00915       canRFChan = new TCanvas("canRFChan","canRFChan",1000,600);
00916     }
00917     canRFChan->Clear();
00918     canRFChan->SetTopMargin(0);
00919     TPaveText *leftPave = new TPaveText(0.05,0.92,0.95,0.98);
00920     leftPave->SetBorderSize(0);
00921     sprintf(textLabel,"Event %d",evPtr->head.eventNumber);
00922     TText *eventText = leftPave->AddText(textLabel);
00923     eventText->SetTextColor(50);
00924     leftPave->Draw();
00925     plotPad = new TPad("canRFChanMain","canRFChanMain",0,0,1,0.9);
00926     plotPad->Draw();
00927   }
00928   else {
00929     plotPad=useCan;
00930   }
00931   plotPad->cd();
00932 
00933   //FIXME -- jpd - this is where we will set the fMaxTime and fMinTime
00934 
00935   TGraph *tempGraph=0;
00936   Double_t *tempX;
00937   
00938   for(int rfChan=0; rfChan<evPtr->getNumRFChannels();++rfChan){
00939     tempGraph=evPtr->getGraphFromRFChan(rfChan);
00940     int nEntries=tempGraph->GetN();
00941     tempX=tempGraph->GetX();
00942     if(tempX[0]<fMinTimeLimit) fMinTimeLimit=tempX[0];
00943     if(tempX[nEntries-1]>fMaxTimeLimit) fMaxTimeLimit=tempX[nEntries-1];
00944     //    fprintf(stderr, "getRFChannelCanvas() -- rfChan %i fMinTimeLimit %f tempX[0] %f fMaxTimeLimit %f tempX[N-1] %f\n", rfChan, fMinTimeLimit, tempX[0], fMaxTimeLimit, tempX[nEntries-1]);
00945 
00946 
00947     delete tempGraph;
00948   }
00949 
00950   //  fprintf(stderr, "\nfMinTimeLimit %f fMaxTimeLimit %f\n", fMinTimeLimit, fMaxTimeLimit);//DEBUG
00951 
00952   setupAntPadWithFrames(plotPad, evPtr->stationId);
00953 
00954   // TestBed
00955   // V V V V
00956   // V V S S
00957   // H H H H
00958   // H H H H
00959   // Station 1
00960   // V V V V
00961   // V V V V
00962   // H H H H
00963   // H H H H
00964   // S S S S
00965 
00966 
00967   AraAntPol::AraAntPol_t polMap[5][4]={{AraAntPol::kVertical}}; //Temp value
00968   int antPolNumMap[5][4]={{0}};
00969   
00970   if(evPtr->stationId==0){
00971     polMap[0][0]=AraAntPol::kVertical;
00972     polMap[0][1]=AraAntPol::kVertical;
00973     polMap[0][2]=AraAntPol::kVertical;
00974     polMap[0][3]=AraAntPol::kVertical;
00975     antPolNumMap[0][0]=0;
00976     antPolNumMap[0][1]=1;
00977     antPolNumMap[0][2]=2;
00978     antPolNumMap[0][3]=3;
00979 
00980     polMap[1][0]=AraAntPol::kVertical;
00981     polMap[1][1]=AraAntPol::kVertical;
00982     polMap[1][2]=AraAntPol::kSurface;
00983     polMap[1][3]=AraAntPol::kSurface;
00984     antPolNumMap[1][0]=4;
00985     antPolNumMap[1][1]=5;
00986     antPolNumMap[1][2]=0;
00987     antPolNumMap[1][3]=1;
00988 
00989     polMap[2][0]=AraAntPol::kHorizontal;
00990     polMap[2][1]=AraAntPol::kHorizontal;
00991     polMap[2][2]=AraAntPol::kHorizontal;
00992     polMap[2][3]=AraAntPol::kHorizontal;
00993     antPolNumMap[2][0]=0;
00994     antPolNumMap[2][1]=1;
00995     antPolNumMap[2][2]=2;
00996     antPolNumMap[2][3]=3;
00997 
00998     polMap[3][0]=AraAntPol::kHorizontal;
00999     polMap[3][1]=AraAntPol::kHorizontal;
01000     polMap[3][2]=AraAntPol::kHorizontal;
01001     polMap[3][3]=AraAntPol::kHorizontal;
01002     antPolNumMap[3][0]=4;
01003     antPolNumMap[3][1]=5;
01004     antPolNumMap[3][2]=6;
01005     antPolNumMap[3][3]=7;
01006 
01007   }
01008 
01009   if(evPtr->stationId==1){
01010  
01011     polMap[0][0]=AraAntPol::kVertical;
01012     polMap[0][1]=AraAntPol::kVertical;
01013     polMap[0][2]=AraAntPol::kVertical;
01014     polMap[0][3]=AraAntPol::kVertical;
01015     antPolNumMap[0][0]=0;
01016     antPolNumMap[0][1]=1;
01017     antPolNumMap[0][2]=2;
01018     antPolNumMap[0][3]=3;
01019 
01020     polMap[1][0]=AraAntPol::kVertical;
01021     polMap[1][1]=AraAntPol::kVertical;
01022     polMap[1][2]=AraAntPol::kVertical;
01023     polMap[1][3]=AraAntPol::kVertical;
01024     antPolNumMap[1][0]=4;
01025     antPolNumMap[1][1]=5;
01026     antPolNumMap[1][2]=6;
01027     antPolNumMap[1][3]=7;
01028 
01029     polMap[2][0]=AraAntPol::kHorizontal;
01030     polMap[2][1]=AraAntPol::kHorizontal;
01031     polMap[2][2]=AraAntPol::kHorizontal;
01032     polMap[2][3]=AraAntPol::kHorizontal;
01033     antPolNumMap[2][0]=0;
01034     antPolNumMap[2][1]=1;
01035     antPolNumMap[2][2]=2;
01036     antPolNumMap[2][3]=3;
01037 
01038     polMap[3][0]=AraAntPol::kHorizontal;
01039     polMap[3][1]=AraAntPol::kHorizontal;
01040     polMap[3][2]=AraAntPol::kHorizontal;
01041     polMap[3][3]=AraAntPol::kHorizontal;
01042     antPolNumMap[3][0]=4;
01043     antPolNumMap[3][1]=5;
01044     antPolNumMap[3][2]=6;
01045     antPolNumMap[3][3]=7;
01046 
01047     polMap[4][0]=AraAntPol::kSurface;
01048     polMap[4][1]=AraAntPol::kSurface;
01049     polMap[4][2]=AraAntPol::kSurface;
01050     polMap[4][3]=AraAntPol::kSurface;
01051     antPolNumMap[4][0]=0;
01052     antPolNumMap[4][1]=1;
01053     antPolNumMap[4][2]=2;
01054     antPolNumMap[4][3]=3;
01055 
01056   }
01057 
01058   int maxColumns=0;
01059   int maxRows=0;
01060 
01061   if(evPtr->stationId==1){//FIXME --This should be something like if num antennas is 20 or something
01062     maxColumns=4;
01063     maxRows=5;
01064   }
01065   else {
01066     maxColumns=4;
01067     maxRows=4;
01068   }
01069 
01070   
01071 
01072   //FIXME //polandant
01073   
01074   for(int row=0;row<maxRows;row++) {
01075     for(int column=0;column<maxColumns;column++) {
01076       plotPad->cd();
01077       int rfChan=fIcrrACMGeomTool->getRFChanByPolAndAnt(polMap[row][column],antPolNumMap[row][column], evPtr->stationId);
01078       //      std::cout << row << "\t" << column << "\t" << rfChan << "\n";
01079       
01080       sprintf(padName,"antPad%d", column + 4*row );
01081       TPad *paddy1 = (TPad*) plotPad->FindObject(padName);
01082       paddy1->SetEditable(kTRUE);
01083       deleteTGraphsFromRFPad(paddy1,rfChan);
01084       paddy1->cd();
01085       
01086       if(fWaveformOption==AraDisplayFormatOption::kPowerSpectralDensity){
01087         if(!grIcrrRFChanFFT[rfChan]) {    
01088           TGraph *grTemp=grIcrrRFChan[rfChan]->getFFT();
01089           grIcrrRFChanFFT[rfChan]=new AraFFTGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
01090           delete grTemp;
01091         }
01092         grIcrrRFChanFFT[rfChan]->Draw("l");
01093       }
01094       else if(fWaveformOption==AraDisplayFormatOption::kAveragedFFT){
01095         grIcrrRFChanAveragedFFT[rfChan]->Draw("l");
01096       }
01097       else if(fWaveformOption==AraDisplayFormatOption::kHilbertEnvelope) {
01098         if(!grIcrrRFChanHilbert[rfChan]) {        
01099           TGraph *grTemp=grIcrrRFChan[rfChan]->getHilbert();
01100           grIcrrRFChanHilbert[rfChan]=new AraWaveformGraph(grTemp->GetN(),grTemp->GetX(),grTemp->GetY());
01101           delete grTemp;
01102         }
01103         grIcrrRFChanHilbert[rfChan]->Draw("l");
01104       }
01105       else if(fWaveformOption==AraDisplayFormatOption::kWaveform) {
01106         grIcrrRFChan[rfChan]->Draw("l");
01107 
01108         if(fAutoScale) {
01109           TList *listy = gPad->GetListOfPrimitives();
01110           for(int i=0;i<listy->GetSize();i++) {
01111             TObject *fred = listy->At(i);
01112             TH1F *tempHist = (TH1F*) fred;
01113             if(tempHist->InheritsFrom("TH1")) {
01114               tempHist->GetYaxis()->SetRangeUser(fMinVoltLimit,fMaxVoltLimit);
01115             }
01116           }
01117         }
01118       }
01119 
01120       paddy1->SetEditable(kFALSE);
01121     }
01122   }
01123   
01124   
01125   if(!useCan)
01126     return canRFChan;
01127   else 
01128     return plotPad;
01129   
01130 }
01131 
01132 
01133 TPad *AraIcrrCanvasMaker::getIntMapCanvas(UsefulIcrrStationEvent *evPtr,
01134                                        TPad *useCan)
01135 {
01136   static UInt_t lastEventNumber=0;
01137   static UInt_t lastUnixTime=0;
01138   static UInt_t lastUnixTimeUs=0;
01139   Int_t sameEvent=0;
01140   if(lastEventNumber==evPtr->head.eventNumber) {
01141     if(lastUnixTime==evPtr->head.unixTime) {
01142       if(lastUnixTimeUs==evPtr->head.unixTimeUs) {
01143         sameEvent=1;
01144       }
01145     }
01146   }
01147   lastEventNumber=evPtr->head.eventNumber;
01148   lastUnixTime=evPtr->head.unixTime;
01149   lastUnixTimeUs=evPtr->head.unixTimeUs;
01150   
01151 
01152    //  gStyle->SetTitleH(0.1);
01153   gStyle->SetOptTitle(0); 
01154 
01155   if(!fIcrrACMGeomTool)
01156     fIcrrACMGeomTool=AraGeomTool::Instance();
01157   char textLabel[180];
01158   char padName[180];
01159   TPad *canIntMap=0;
01160   TPad *plotPad=0;
01161   if(!useCan) {
01162     canIntMap = (TPad*) gROOT->FindObject("canIntMap");
01163     if(!canIntMap) {
01164       canIntMap = new TCanvas("canIntMap","canIntMap",1000,600);
01165     }
01166     canIntMap->Clear();
01167     canIntMap->SetTopMargin(0);
01168     TPaveText *leftPave = new TPaveText(0.05,0.92,0.95,0.98);
01169     leftPave->SetBorderSize(0);
01170     sprintf(textLabel,"Event %d",evPtr->head.eventNumber);
01171     TText *eventText = leftPave->AddText(textLabel);
01172     eventText->SetTextColor(50);
01173     leftPave->Draw();
01174     plotPad = new TPad("canIntMapMain","canIntMapMain",0,0,1,0.9);
01175     plotPad->Draw();
01176   }
01177   else {
01178     plotPad=useCan;
01179   }
01180   plotPad->cd();
01181   plotPad->Clear();
01182   AraEventCorrelator *araCorPtr = AraEventCorrelator::Instance(fNumAntsInMap, evPtr->stationId);
01183   static TH2D* histMapH=0;  
01184   static TH2D* histMapV=0;  
01185   plotPad->Divide(1,2);
01186   plotPad->cd(1);
01187   
01188   if(histMapV) {
01189     if(!sameEvent) {
01190       delete histMapV;
01191       histMapV=0;
01192     }
01193   }
01194 
01195   
01196   if(!histMapV)
01197     histMapV =araCorPtr->getInterferometricMap(evPtr,AraAntPol::kVertical,fCorType);
01198   histMapV->SetName("histMapV");
01199   histMapV->SetTitle("Vertical Polarisation");
01200   histMapV->SetXTitle("Azimuth (Degrees)");
01201   histMapV->SetYTitle("Elevation (Degrees)");
01202   histMapV->SetStats(0);
01203   //  histMapV->SetMaximum(1);
01204   //  histMapV->SetMinimum(-1);
01205   histMapV->Draw("colz");
01206 
01207   plotPad->cd(2);
01208   if(histMapH) {
01209     if(!sameEvent) {
01210       delete histMapH;
01211       histMapH=0;
01212     }
01213   }
01214   if(!histMapH)
01215     histMapH =araCorPtr->getInterferometricMap(evPtr,AraAntPol::kHorizontal,fCorType);
01216   histMapH->SetName("histMapH");
01217   histMapH->SetTitle("Hertical Polarisation");
01218   histMapH->SetXTitle("Azimuth (Degrees)");
01219   histMapH->SetYTitle("Elevation (Degrees)");
01220   histMapH->SetStats(0);
01221   //  histMapH->SetMaximum(1);
01222   //  histMapH->SetMinimum(-1);
01223   histMapH->Draw("colz");
01224   
01225   
01226 
01227 
01228   
01229   if(!useCan)
01230     return canIntMap;
01231   else 
01232     return plotPad;
01233   
01234 }
01235 
01236 
01237 
01238 
01239 
01240 
01241 
01242 void AraIcrrCanvasMaker::setupElecPadWithFrames(TPad *plotPad)
01243 {
01244   char textLabel[180];
01245   char padName[180];
01246   plotPad->cd();
01247   if(fLastCanvasView!=AraDisplayCanvasLayoutOption::kElectronicsView) {
01248     plotPad->Clear();
01249   } 
01250   if(fRedoEventCanvas){
01251     plotPad->Clear();
01252   }
01253 
01254   fLastCanvasView=AraDisplayCanvasLayoutOption::kElectronicsView; 
01255 
01256   static int elecPadsDone=0;
01257   if(elecPadsDone && !fRedoEventCanvas) {
01258     int errors=0;
01259     for(int i=0;i<30;i++) {
01260       sprintf(padName,"elecChanPad%d",i);
01261       TPad *paddy = (TPad*) plotPad->FindObject(padName);
01262       if(!paddy)
01263         errors++;
01264     }
01265     if(!errors)
01266       return;
01267   }
01268 
01269   elecPadsDone=1;
01270     
01271 
01272   Double_t left[5]={0.04,0.23,0.42,0.61,0.80};
01273   Double_t right[5]={0.23,0.42,0.61,0.80,0.99};
01274   Double_t top[6]={0.93,0.78,0.63,0.48,0.33,0.18};
01275   Double_t bottom[6]={0.78,0.63,0.48,0.33,0.18,0.03};
01276   
01277   //Now add some labels around the plot
01278   TLatex texy;
01279   texy.SetTextSize(0.03); 
01280   texy.SetTextAlign(12);  
01281   for(int column=0;column<5;column++) {
01282     sprintf(textLabel,"Chan %d/%d",1+(2*column),2+(2*column));
01283     if(column==4)
01284       texy.DrawTextNDC(right[column]-0.1,0.97,textLabel);
01285     else
01286       texy.DrawTextNDC(right[column]-0.09,0.97,textLabel);
01287   }
01288   texy.SetTextAlign(21);  
01289   texy.SetTextAngle(90);
01290   texy.DrawTextNDC(left[0]-0.01,bottom[0],"A");
01291   texy.DrawTextNDC(left[0]-0.01,bottom[2],"B");
01292   texy.DrawTextNDC(left[0]-0.01,bottom[4],"C");
01293 
01294   // A
01295   // 1 3 5 7 9 
01296   // 2 4 6 8 
01297   // B
01298   // 1 3 5 7 9 
01299   // 2 4 6 8 
01300   // C
01301   // 1 3 5 7 9 
01302   // 2 4 6 8 
01303 
01304   int count=0;
01305 
01306 
01307 
01308 
01309   for(int row=0;row<6;row++) {
01310     for(int column=0;column<5;column++) {
01311       plotPad->cd();
01312       //      if(row%2==1 && column==4) continue;
01313       sprintf(padName,"elecChanPad%d",column+5*row);
01314       TPad *paddy1 = new TPad(padName,padName,left[column],bottom[row],right[column],top[row]);   
01315       paddy1->SetTopMargin(0);
01316       paddy1->SetBottomMargin(0);
01317       paddy1->SetLeftMargin(0);
01318       paddy1->SetRightMargin(0);
01319       if(column==4)
01320         paddy1->SetRightMargin(0.01);
01321       if(column==0)
01322         paddy1->SetLeftMargin(0.1);
01323       if(row==5)
01324         paddy1->SetBottomMargin(0.1);
01325       paddy1->Draw();
01326       paddy1->cd();
01327 
01328       TH1F *framey=0;
01329       
01330 
01331       //      std::cout << "Limits\t" << fMinVoltLimit << "\t" << fMaxVoltLimit << "\n";
01332   
01333 
01334       if(fWaveformOption==AraDisplayFormatOption::kWaveform || fWaveformOption==AraDisplayFormatOption::kHilbertEnvelope) 
01335         framey = (TH1F*) paddy1->DrawFrame(0,fMinVoltLimit,250,fMaxVoltLimit);
01336         //      framey = (TH1F*) paddy1->DrawFrame(fMinTimeLimit,fMinVoltLimit,fMaxTimeLimit,fMaxVoltLimit);
01337       else if(fWaveformOption==AraDisplayFormatOption::kFFT || fWaveformOption==AraDisplayFormatOption::kAveragedFFT)
01338         framey = (TH1F*) paddy1->DrawFrame(fMinFreqLimit,fMinPowerLimit,fMaxFreqLimit,fMaxPowerLimit); 
01339 
01340       framey->GetYaxis()->SetLabelSize(0.08);
01341       framey->GetYaxis()->SetTitleSize(0.1);
01342       framey->GetYaxis()->SetTitleOffset(0.5);
01343          
01344       if(row==4) {
01345         framey->GetXaxis()->SetLabelSize(0.09);
01346         framey->GetXaxis()->SetTitleSize(0.09);
01347         framey->GetYaxis()->SetLabelSize(0.09);
01348         framey->GetYaxis()->SetTitleSize(0.09);
01349       }
01350       if(fWebPlotterMode && column!=0) {
01351          framey->GetYaxis()->SetLabelSize(0);
01352          framey->GetYaxis()->SetTitleSize(0);
01353          framey->GetYaxis()->SetTitleOffset(0);
01354       }
01355       count++;
01356     }
01357   }
01358 
01359 }
01360 
01361 
01362 
01363 void AraIcrrCanvasMaker::setupRFChanPadWithFrames(TPad *plotPad, Int_t stationId)
01364 {
01365   int maxColumns=0;
01366   int maxRows=0;
01367   int numRFChans=0;
01368   Double_t left[4]={0.04,0.27,0.50,0.73};
01369   Double_t right[4]={0.27,0.50,0.73,0.96};
01370   Double_t top[5]={0};
01371   Double_t bottom[5]={0};
01372   if(stationId==0){ //FIXME -- stationID
01373     maxColumns=4;
01374     maxRows=4;
01375     numRFChans=maxRows*maxColumns;
01376 
01377     top[0]=0.95;
01378     top[1]=0.72;
01379     top[2]=0.49;
01380     top[3]=0.26;
01381     bottom[0]=0.72;
01382     bottom[1]=0.49;
01383     bottom[2]=0.26;
01384     bottom[3]=0.03;
01385   }
01386 
01387   if(stationId==1){//FIXME -- Station ID
01388     maxColumns=4;
01389     maxRows=5;
01390     numRFChans=maxRows*maxColumns;
01391 
01392     top[0]=0.95;
01393     top[1]=0.77;
01394     top[2]=0.59;
01395     top[3]=0.41;
01396     top[4]=0.23;
01397     bottom[0]=0.77;
01398     bottom[1]=0.59;
01399     bottom[2]=0.41;
01400     bottom[3]=0.23;
01401     bottom[4]=0.05;
01402   }
01403 
01404   static int rfChanPadsDone=0;
01405   char textLabel[180];
01406   char padName[180];
01407   plotPad->cd();
01408   if(fLastCanvasView!=AraDisplayCanvasLayoutOption::kRFChanView) {
01409     plotPad->Clear();
01410   }
01411 
01412   if(fRedoEventCanvas && rfChanPadsDone){
01413     plotPad->Clear();
01414   }
01415 
01416   fLastCanvasView=AraDisplayCanvasLayoutOption::kRFChanView;
01417 
01418   if(rfChanPadsDone && !fRedoEventCanvas) {
01419     int errors=0;
01420     for(int rfChan=0;rfChan<numRFChans;rfChan++) {
01421         sprintf(padName,"rfChanPad%d",rfChan);
01422         TPad *paddy = (TPad*) plotPad->FindObject(padName);
01423         if(!paddy)
01424           errors++;
01425     }
01426     if(!errors)
01427       return;
01428   }
01429   
01430   
01431   rfChanPadsDone=1;
01432   
01433   
01434   //Now add some labels around the plot
01435   TLatex texy;
01436   texy.SetTextSize(0.03); 
01437   texy.SetTextAlign(12);  
01438   for(int column=0;column<maxColumns;column++) {
01439     sprintf(textLabel,"%d/%d",1+column,5+column);
01440     if(column==3)
01441       texy.DrawTextNDC(right[column]-0.12,0.97,textLabel);
01442     else
01443       texy.DrawTextNDC(right[column]-0.12,0.97,textLabel);
01444   }
01445   texy.SetTextAlign(21);  
01446   texy.SetTextAngle(90);
01447   texy.DrawTextNDC(left[0]-0.01,bottom[0]+0.1,"1-4");
01448   texy.DrawTextNDC(left[0]-0.01,bottom[1]+0.1,"5-8");
01449   texy.DrawTextNDC(left[0]-0.01,bottom[2]+0.1,"9-12");
01450   texy.DrawTextNDC(left[0]-0.01,bottom[3]+0.1,"13-16");
01451   if(stationId==1) texy.DrawTextNDC(left[0]-0.01,bottom[4]+0.1,"17-20");//FIXME -- station ID
01452   
01453 
01454  
01455   int count=0;
01456 
01457   //  1  2  3  4
01458   //  5  6  7  8
01459   //  9 10 11 12
01460   // 13 14 15 16
01461 
01462   for(int column=0;column<maxColumns;column++) {
01463     for(int row=0;row<maxRows;row++) {
01464       plotPad->cd();
01465       //      int rfChan=column+4*row;
01466       sprintf(padName,"rfChanPad%d",column+4*row);
01467       TPad *paddy1 = new TPad(padName,padName,left[column],bottom[row],right[column],top[row]);   
01468       paddy1->SetTopMargin(0);
01469       paddy1->SetBottomMargin(0);
01470       paddy1->SetLeftMargin(0);
01471       paddy1->SetRightMargin(0);
01472       if(column==3)
01473         paddy1->SetRightMargin(0.01);
01474       if(column==0)
01475         paddy1->SetLeftMargin(0.1);
01476       if(row==3&&stationId==0) //FIXME -- stationId
01477         paddy1->SetBottomMargin(0.1);
01478       if(row==4&&stationId==1)
01479         paddy1->SetBottomMargin(0.1);
01480       paddy1->Draw();
01481       paddy1->cd();
01482       TH1F *framey=0;
01483       if(fWaveformOption==AraDisplayFormatOption::kFFT || fWaveformOption==AraDisplayFormatOption::kAveragedFFT){
01484           framey = (TH1F*) paddy1->DrawFrame(fMinFreqLimit,fMinPowerLimit,fMaxFreqLimit,fMaxPowerLimit);
01485       }
01486       else if(fWaveformOption==AraDisplayFormatOption::kWaveform || 
01487               fWaveformOption==AraDisplayFormatOption::kHilbertEnvelope) {
01488         if(row<3) { //FIXME -- maybe stationId case?
01489           framey = (TH1F*) paddy1->DrawFrame((10*(int)fMinTimeLimit)/10 - 40, fMinVoltLimit, (10*(int)fMaxTimeLimit)/10 + 40,fMaxVoltLimit);
01490         }
01491         else{
01492           framey = (TH1F*) paddy1->DrawFrame((10*(int)fMinTimeLimit)/10 - 40,fMinClockVoltLimit,(10*(int)fMaxTimeLimit)/10 + 40,fMaxClockVoltLimit);
01493         }
01494       }
01495 
01496       framey->GetYaxis()->SetLabelSize(0.1);
01497       framey->GetYaxis()->SetTitleSize(0.1);
01498       framey->GetYaxis()->SetTitleOffset(0.5);
01499       if(row==4&&stationId==1) { //FIXME -- station ID
01500         framey->GetXaxis()->SetLabelSize(0.09);
01501         framey->GetXaxis()->SetTitleSize(0.09);
01502         framey->GetYaxis()->SetLabelSize(0.09);
01503         framey->GetYaxis()->SetTitleSize(0.09);
01504       }
01505       if(row==3&&stationId==0) { //FIXME -- station ID
01506         framey->GetXaxis()->SetLabelSize(0.09);
01507         framey->GetXaxis()->SetTitleSize(0.09);
01508         framey->GetYaxis()->SetLabelSize(0.09);
01509         framey->GetYaxis()->SetTitleSize(0.09);
01510       }
01511 
01512       if(fWebPlotterMode && column!=0) {
01513          framey->GetYaxis()->SetLabelSize(0);
01514          framey->GetYaxis()->SetTitleSize(0);
01515          framey->GetYaxis()->SetTitleOffset(0);
01516       }
01517 
01518       count++;
01519     }
01520   }
01521 }
01522 
01523 
01524 
01525 void AraIcrrCanvasMaker::setupAntPadWithFrames(TPad *plotPad, Int_t stationId)
01526 {
01527 
01528   //First we must set up the pad sizes according to the station ID
01529   int maxColumns=0;
01530   int maxRows=0;
01531   int numRFChans=0;
01532   Double_t left[4]={0.04,0.27,0.50,0.73};
01533   Double_t right[4]={0.27,0.50,0.73,0.96};
01534   Double_t top[5]={0};
01535   Double_t bottom[5]={0};
01536   if(stationId==0){ //FIXME -- stationID
01537     maxColumns=4;
01538     maxRows=4;
01539     numRFChans=maxRows*maxColumns;
01540 
01541     top[0]=0.95;
01542     top[1]=0.72;
01543     top[2]=0.49;
01544     top[3]=0.26;
01545     bottom[0]=0.72;
01546     bottom[1]=0.49;
01547     bottom[2]=0.26;
01548     bottom[3]=0.03;
01549   }
01550 
01551   if(stationId==1){//FIXME -- Station ID
01552     maxColumns=4;
01553     maxRows=5;
01554     numRFChans=maxRows*maxColumns;
01555 
01556     top[0]=0.95;
01557     top[1]=0.77;
01558     top[2]=0.59;
01559     top[3]=0.41;
01560     top[4]=0.23;
01561     bottom[0]=0.77;
01562     bottom[1]=0.59;
01563     bottom[2]=0.41;
01564     bottom[3]=0.23;
01565     bottom[4]=0.05;
01566   }
01567 
01568 
01569 
01570   static int antPadsDone=0;
01571   char textLabel[180];
01572   char padName[180];
01573   plotPad->cd();
01574   if(fLastCanvasView!=AraDisplayCanvasLayoutOption::kAntennaView) {
01575     plotPad->Clear();
01576   }
01577 
01578   if(fRedoEventCanvas && antPadsDone){
01579     plotPad->Clear();
01580   }
01581 
01582   fLastCanvasView=AraDisplayCanvasLayoutOption::kAntennaView;
01583 
01584   if(antPadsDone && !fRedoEventCanvas) {
01585     int errors=0;
01586     for(int rfChan=0; rfChan<numRFChans;rfChan++){
01587       sprintf(padName,"antPad%d", rfChan);
01588       TPad *paddy = (TPad*) plotPad->FindObject(padName);
01589       if(!paddy)
01590         errors++;
01591     }
01592     if(!errors)
01593       return;
01594   }
01595   
01596   
01597   antPadsDone=1;
01598   
01599   
01600   //Now add some labels around the plot
01601   TLatex texy;
01602   texy.SetTextSize(0.03); 
01603   texy.SetTextAlign(12);  
01604   for(int column=0;column<maxColumns;column++) {
01605     sprintf(textLabel,"%d/%d",1+column,5+column);
01606     if(column==3)
01607       texy.DrawTextNDC(right[column]-0.12,0.97,textLabel);
01608     else
01609       texy.DrawTextNDC(right[column]-0.12,0.97,textLabel);
01610   }
01611   texy.SetTextAlign(21);  
01612   texy.SetTextAngle(90);
01613 
01614   if(stationId==0){
01615     texy.DrawTextNDC(left[0]-0.01,bottom[0]+0.1,"V");
01616     texy.DrawTextNDC(left[0]-0.01,bottom[1]+0.1,"V/S");
01617     texy.DrawTextNDC(left[0]-0.01,bottom[2]+0.1,"H");
01618     texy.DrawTextNDC(left[0]-0.01,bottom[3]+0.1,"H");
01619   }
01620   if(stationId==1){
01621     texy.DrawTextNDC(left[0]-0.01,bottom[0]+0.1,"V");
01622     texy.DrawTextNDC(left[0]-0.01,bottom[1]+0.1,"V");
01623     texy.DrawTextNDC(left[0]-0.01,bottom[2]+0.1,"H");
01624     texy.DrawTextNDC(left[0]-0.01,bottom[3]+0.1,"H");
01625     texy.DrawTextNDC(left[0]-0.01,bottom[4]+0.1,"S");
01626   }
01627   //TestBed
01628   // V V V V
01629   // V V S S
01630   // H H H H
01631   // H H H H
01632   //Station1
01633   // V V V V
01634   // V V V V
01635   // H H H H
01636   // H H H H
01637   // S S S S 
01638  
01639   int count=0;
01640   
01641   for(int column=0;column<maxColumns;column++) {
01642     for(int row=0;row<maxRows;row++) {
01643       plotPad->cd();
01644       sprintf(padName,"antPad%d", column+4*row);
01645     
01646       TPad *paddy1 = new TPad(padName,padName,left[column],bottom[row],right[column],top[row]);   
01647       paddy1->SetTopMargin(0);
01648       paddy1->SetBottomMargin(0);
01649       paddy1->SetLeftMargin(0);
01650       paddy1->SetRightMargin(0);
01651       if(column==3)
01652         paddy1->SetRightMargin(0.01);
01653       if(column==0)
01654         paddy1->SetLeftMargin(0.1);
01655       if(row==3&&stationId==0) //FIXME stationId
01656         paddy1->SetBottomMargin(0.1);
01657       if(row==4&&stationId==1)
01658         paddy1->SetBottomMargin(0.1);
01659 
01660       paddy1->Draw();
01661       paddy1->cd();
01662       TH1F *framey=0;
01663       if(fWaveformOption==AraDisplayFormatOption::kFFT || fWaveformOption==AraDisplayFormatOption::kAveragedFFT){
01664           framey = (TH1F*) paddy1->DrawFrame(fMinFreqLimit,fMinPowerLimit,fMaxFreqLimit,fMaxPowerLimit);
01665       }
01666       else if(fWaveformOption==AraDisplayFormatOption::kWaveform || 
01667               fWaveformOption==AraDisplayFormatOption::kHilbertEnvelope) {
01668         if((row<3&&stationId==0)||(row<4&&stationId==1)) { //FIXME
01669           framey = (TH1F*) paddy1->DrawFrame((10*(int)fMinTimeLimit)/10 - 40,fMinVoltLimit,(10*(int)fMaxTimeLimit)/10 + 40,fMaxVoltLimit);
01670         }
01671         else{
01672           framey = (TH1F*) paddy1->DrawFrame((10*(int)fMinTimeLimit)/10 - 40,fMinClockVoltLimit,(10*(int)fMaxTimeLimit)/10 + 40,fMaxClockVoltLimit);
01673         }
01674       }
01675 
01676       framey->GetYaxis()->SetLabelSize(0.1);
01677       framey->GetYaxis()->SetTitleSize(0.1);
01678       framey->GetYaxis()->SetTitleOffset(0.5);
01679       if(row==3&&stationId==0) {
01680         framey->GetXaxis()->SetLabelSize(0.09);
01681         framey->GetXaxis()->SetTitleSize(0.09);
01682         framey->GetYaxis()->SetLabelSize(0.09);
01683         framey->GetYaxis()->SetTitleSize(0.09);
01684       }
01685 
01686       if(row==4&&stationId==1) {
01687         framey->GetXaxis()->SetLabelSize(0.09);
01688         framey->GetXaxis()->SetTitleSize(0.09);
01689         framey->GetYaxis()->SetLabelSize(0.09);
01690         framey->GetYaxis()->SetTitleSize(0.09);
01691       }
01692       if(fWebPlotterMode && column!=0) {
01693          framey->GetYaxis()->SetLabelSize(0);
01694          framey->GetYaxis()->SetTitleSize(0);
01695          framey->GetYaxis()->SetTitleOffset(0);
01696       }
01697       count++;
01698     }
01699   }
01700 }
01701 
01702 
01703 
01704 void AraIcrrCanvasMaker::deleteTGraphsFromElecPad(TPad *paddy,int chan)
01705 {
01706   paddy->cd();
01707   if(fLastWaveformFormat==AraDisplayFormatOption::kWaveform) paddy->GetListOfPrimitives()->Remove(grIcrrElec[chan]);
01708   else if(fLastWaveformFormat==AraDisplayFormatOption::kFFT) paddy->GetListOfPrimitives()->Remove(grIcrrElecFFT[chan]); 
01709   else if(fLastWaveformFormat==AraDisplayFormatOption::kAveragedFFT) paddy->GetListOfPrimitives()->Remove(grIcrrElecAveragedFFT[chan]); 
01710   else if(fLastWaveformFormat==AraDisplayFormatOption::kHilbertEnvelope) paddy->GetListOfPrimitives()->Remove(grIcrrElecHilbert[chan]);  
01711   //  paddy->Update();
01712 }
01713 
01714 
01715 void AraIcrrCanvasMaker::deleteTGraphsFromRFPad(TPad *paddy,int rfchan)
01716 {
01717   paddy->cd();
01718   if(fLastWaveformFormat==AraDisplayFormatOption::kWaveform) paddy->GetListOfPrimitives()->Remove(grIcrrRFChan[rfchan]);
01719   else if(fLastWaveformFormat==AraDisplayFormatOption::kFFT) paddy->GetListOfPrimitives()->Remove(grIcrrRFChanFFT[rfchan]); 
01720   else if(fLastWaveformFormat==AraDisplayFormatOption::kAveragedFFT) paddy->GetListOfPrimitives()->Remove(grIcrrRFChanAveragedFFT[rfchan]); 
01721   else if(fLastWaveformFormat==AraDisplayFormatOption::kHilbertEnvelope) paddy->GetListOfPrimitives()->Remove(grIcrrRFChanHilbert[rfchan]);  
01722   //  paddy->Update();
01723 }
01724 
01725 
01726 void AraIcrrCanvasMaker::resetAverage() 
01727 {
01728   for(int chan=0;chan<NUM_DIGITIZED_ICRR_CHANNELS;chan++) {
01729     if(grIcrrElecAveragedFFT[chan]) {
01730       delete grIcrrElecAveragedFFT[chan];
01731       grIcrrElecAveragedFFT[chan]=0;
01732     }
01733   }
01734   for(int rfchan=0;rfchan<RFCHANS_PER_ICRR;rfchan++) {
01735     if(grIcrrRFChanAveragedFFT[rfchan]) {
01736       delete grIcrrRFChanAveragedFFT[rfchan];
01737       grIcrrRFChanAveragedFFT[rfchan]=0;
01738     }
01739   }
01740 }
01741 
01742 
01743 

Generated on Tue Jul 16 16:58:01 2013 for ARA ROOT v3.10 Software by doxygen 1.4.7