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