#include "TestBenchGUI.h" //#include "VMEUtilities.h" extern map > > fRawData; TestBenchGUI::TestBenchGUI( const TGWindow *mainWindow) { // Initialize the VME Object. Don;t initialize the ADCs yet. That is a button press by the user VME = new VMEUtilities(); VMEOn = false; rawData = NULL; // Draw the GUI as we want it to be displayed // main frame cout << "Drawing MainFrame" << endl; //TGMainFrame *fMainFrame3557 = new TGMainFrame(mainWindow,10,10,kMainFrame | kVerticalFrame) TGMainFrame *fMainFrame3557 = this; // fMainFrame3557->SetName("fMainFrame3557"); // horizontal frame fMainFrame = new TGHorizontalFrame(fMainFrame3557,1410,852,kHorizontalFrame); fMainFrame->SetName("fMainFrame"); // vertical frame fCanvasFrame = new TGVerticalFrame(fMainFrame,1144,848,kVerticalFrame); fCanvasFrame->SetName("fCanvasFrame"); // embedded canvas fRawDataFrame = new TRootEmbeddedCanvas(0,fCanvasFrame,1140,512); fRawDataFrame->SetName("fRawDataFrame"); Int_t wfRawDataFrame = fRawDataFrame->GetCanvasWindowId(); TCanvas *c163 = new TCanvas("c163", 10, 10, wfRawDataFrame); fRawDataFrame->AdoptCanvas(c163); fCanvasFrame->AddFrame(fRawDataFrame, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); /* // horizontal frame fBitsFrame1 = new TGHorizontalFrame(fCanvasFrame,1140,162,kHorizontalFrame); fBitsFrame1->SetName("fBitsFrame1"); // embedded canvas TRootEmbeddedCanvas *fBit1Canvas = new TRootEmbeddedCanvas(0,fBitsFrame1,186,158); fBit1Canvas->SetName("fBit1Canvas"); Int_t wfBit1Canvas = fBit1Canvas->GetCanvasWindowId(); TCanvas *c164 = new TCanvas("c164", 10, 10, wfBit1Canvas); fBit1Canvas->AdoptCanvas(c164); fBitsFrame1->AddFrame(fBit1Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit2Canvas = new TRootEmbeddedCanvas(0,fBitsFrame1,186,158); fBit2Canvas->SetName("fBit2Canvas"); Int_t wfBit2Canvas = fBit2Canvas->GetCanvasWindowId(); TCanvas *c165 = new TCanvas("c165", 10, 10, wfBit2Canvas); fBit2Canvas->AdoptCanvas(c165); fBitsFrame1->AddFrame(fBit2Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit3Canvas = new TRootEmbeddedCanvas(0,fBitsFrame1,186,158); fBit3Canvas->SetName("fBit3Canvas"); Int_t wfBit3Canvas = fBit3Canvas->GetCanvasWindowId(); TCanvas *c166 = new TCanvas("c166", 10, 10, wfBit3Canvas); fBit3Canvas->AdoptCanvas(c166); fBitsFrame1->AddFrame(fBit3Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit4Canvas = new TRootEmbeddedCanvas(0,fBitsFrame1,186,158); fBit4Canvas->SetName("fBit4Canvas"); Int_t wfBit4Canvas = fBit4Canvas->GetCanvasWindowId(); TCanvas *c167 = new TCanvas("c167", 10, 10, wfBit4Canvas); fBit4Canvas->AdoptCanvas(c167); fBitsFrame1->AddFrame(fBit4Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit5Canvas = new TRootEmbeddedCanvas(0,fBitsFrame1,186,158); fBit5Canvas->SetName("fBit5Canvas"); Int_t wfBit5Canvas = fBit5Canvas->GetCanvasWindowId(); TCanvas *c168 = new TCanvas("c168", 10, 10, wfBit5Canvas); fBit5Canvas->AdoptCanvas(c168); fBitsFrame1->AddFrame(fBit5Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit6Canvas = new TRootEmbeddedCanvas(0,fBitsFrame1,186,158); fBit6Canvas->SetName("fBit6Canvas"); Int_t wfBit6Canvas = fBit6Canvas->GetCanvasWindowId(); TCanvas *c169 = new TCanvas("c169", 10, 10, wfBit6Canvas); fBit6Canvas->AdoptCanvas(c169); fBitsFrame1->AddFrame(fBit6Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); fCanvasFrame->AddFrame(fBitsFrame1, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // horizontal frame fBitsFrame2 = new TGHorizontalFrame(fCanvasFrame,1140,162,kHorizontalFrame); fBitsFrame2->SetName("fBitsFrame2"); // embedded canvas TRootEmbeddedCanvas *fBit7Canvas = new TRootEmbeddedCanvas(0,fBitsFrame2,186,158); fBit7Canvas->SetName("fBit7Canvas"); Int_t wfBit7Canvas = fBit7Canvas->GetCanvasWindowId(); TCanvas *c170 = new TCanvas("c170", 10, 10, wfBit7Canvas); fBit7Canvas->AdoptCanvas(c170); fBitsFrame2->AddFrame(fBit7Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit8Canvas = new TRootEmbeddedCanvas(0,fBitsFrame2,186,158); fBit8Canvas->SetName("fBit8Canvas"); Int_t wfBit8Canvas = fBit8Canvas->GetCanvasWindowId(); TCanvas *c171 = new TCanvas("c171", 10, 10, wfBit8Canvas); fBit8Canvas->AdoptCanvas(c171); fBitsFrame2->AddFrame(fBit8Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit9Canvas = new TRootEmbeddedCanvas(0,fBitsFrame2,186,158); fBit9Canvas->SetName("fBit9Canvas"); Int_t wfBit9Canvas = fBit9Canvas->GetCanvasWindowId(); TCanvas *c172 = new TCanvas("c172", 10, 10, wfBit9Canvas); fBit9Canvas->AdoptCanvas(c172); fBitsFrame2->AddFrame(fBit9Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit10Canvas = new TRootEmbeddedCanvas(0,fBitsFrame2,186,158); fBit10Canvas->SetName("fBit10Canvas"); Int_t wfBit10Canvas = fBit10Canvas->GetCanvasWindowId(); TCanvas *c173 = new TCanvas("c173", 10, 10, wfBit10Canvas); fBit10Canvas->AdoptCanvas(c173); fBitsFrame2->AddFrame(fBit10Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit11Canvas = new TRootEmbeddedCanvas(0,fBitsFrame2,186,158); fBit11Canvas->SetName("fBit11Canvas"); Int_t wfBit11Canvas = fBit11Canvas->GetCanvasWindowId(); TCanvas *c174 = new TCanvas("c174", 10, 10, wfBit11Canvas); fBit11Canvas->AdoptCanvas(c174); fBitsFrame2->AddFrame(fBit11Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // embedded canvas TRootEmbeddedCanvas *fBit12Canvas = new TRootEmbeddedCanvas(0,fBitsFrame2,186,158); fBit12Canvas->SetName("fBit12Canvas"); Int_t wfBit12Canvas = fBit12Canvas->GetCanvasWindowId(); TCanvas *c175 = new TCanvas("c175", 10, 10, wfBit12Canvas); fBit12Canvas->AdoptCanvas(c175); fBitsFrame2->AddFrame(fBit12Canvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); fCanvasFrame->AddFrame(fBitsFrame2, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); */ fMainFrame->AddFrame(fCanvasFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2)); // vertical frame fOptionsFrame = new TGVerticalFrame(fMainFrame,258,848,kVerticalFrame); fOptionsFrame->SetName("fOptionsFrame"); // canvas widget fChannelSelectFrame = new TGCanvas(fOptionsFrame,254,320); fChannelSelectFrame->SetName("fChannelSelectFrame"); // canvas viewport TGViewPort *fViewPort2520 = fChannelSelectFrame->GetViewPort(); // list tree TGListTree *fListTree = new TGListTree(fChannelSelectFrame,kHorizontalFrame); fListTree->SetName("fListTree"); TGListTreeItem *main = fListTree->AddItem(NULL,"All Slots",0,0,kTRUE); int NADC = VME->NADCS; for (int iADC = 0; iADC < NADC; iADC++){ int SLOT = iADC + 3; if (SLOT > 10) SLOT = iADC + 5; TGListTreeItem *slot = fListTree->AddItem(main,Form("Slot %i", SLOT),0,0,kTRUE); slot->CheckAllChildren(); TGListTreeItem *connector; int iConnector = 0; for (int iCH = 0; iCH <= 71; iCH++){ if (iCH % 24 == 0){ connector = fListTree->AddItem(slot,Form("Connector %i", iConnector),0,0,kTRUE); iConnector++; } SC *slotChannel = new SC; slotChannel->slot = SLOT; slotChannel->channel = iCH; TGListTreeItem *ch = fListTree->AddItem(connector,Form("Channel %i", iCH), slotChannel ,gClient->GetPicture("f2_t.xpm"),gClient->GetPicture("f2_t.xpm"),kTRUE); // Unfortunately there doesn't seem to be a good way to get at the list of checked items, so we will save our own list. chList.push_back(ch); } } fViewPort2520->AddFrame(fListTree); fListTree->SetLayoutManager(new TGHorizontalLayout(fListTree)); fListTree->MapSubwindows(); fChannelSelectFrame->SetContainer(fListTree); fChannelSelectFrame->MapSubwindows(); fOptionsFrame->AddFrame(fChannelSelectFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2)); // this->listTree = fListTree; // this->listTree->Connect("Checked(TObject*, Bool_t)","TestBenchGUI", this, "DoCheckedEntry(TObject*, Int_t)"); // "fGroupFrame2629" group frame //TGGroupFrame *fADCOptionsFrame = new TGGroupFrame(fOptionsFrame,"fGroupFrame2629"); fADCOptionsFrame = new TGGroupFrame(fOptionsFrame,"VME Options"); //TGTextButton *fTextButton2708 = new TGTextButton(fADCOptionsFrame,"fTextButton2708"); TGTextButton *fTextButton2708 = new TGTextButton(fADCOptionsFrame,"Power On and Init ADCs"); fTextButton2708->SetTextJustify(36); fTextButton2708->SetMargins(1,1,1,1); fTextButton2708->SetWrapLength(-1); fTextButton2708->Resize(97,22); fTextButton2708->Connect("Clicked()","TestBenchGUI",this,"PowerOnADCs()"); fADCOptionsFrame->AddFrame(fTextButton2708, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop,2,2,2,2)); TGTextButton *fTextButton2710 = new TGTextButton(fADCOptionsFrame,"Take One Pulse"); fTextButton2710->SetTextJustify(36); fTextButton2710->SetMargins(1,1,1,1); fTextButton2710->SetWrapLength(-1); fTextButton2710->Resize(97,22); fTextButton2710->Connect("Clicked()","TestBenchGUI",this,"TakePulserData()"); fADCOptionsFrame->AddFrame(fTextButton2710, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop,2,2,2,2)); TGTextButton *fTextButton2709 = new TGTextButton(fADCOptionsFrame,"Power Off ADCs"); fTextButton2709->SetTextJustify(36); fTextButton2709->SetMargins(1,1,1,1); fTextButton2709->SetWrapLength(-1); fTextButton2709->Resize(97,22); fTextButton2709->Connect("Clicked()","TestBenchGUI",this,"PowerOffADCs()"); fADCOptionsFrame->AddFrame(fTextButton2709, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop,2,2,2,2)); fADCOptionsFrame->SetLayoutManager(new TGVerticalLayout(fADCOptionsFrame)); fADCOptionsFrame->Resize(254,247); fOptionsFrame->AddFrame(fADCOptionsFrame, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop | kLHintsExpandX ,2,2,2,2)); // "fPulserOptions" group frame fPulserOptionsFrame = new TGGroupFrame(fOptionsFrame,"VME Options"); TGHorizontalFrame * fADCSampleFrame = new TGHorizontalFrame(fPulserOptionsFrame, 200, 30); fPulserOptionsFrame->AddFrame(fADCSampleFrame, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fADCSampleInput = new TGNumberEntry(fADCSampleFrame, (Double_t) 100,6,-1,(TGNumberFormat::EStyle) 5); TGLabel * fADCSampleLabel = new TGLabel(fADCSampleFrame, "Number of ADC Samples"); fADCSampleFrame->AddFrame(fADCSampleInput, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fADCSampleFrame->AddFrame(fADCSampleLabel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); TGHorizontalFrame * fWindowOffsetFrame = new TGHorizontalFrame(fPulserOptionsFrame, 200, 30); fPulserOptionsFrame->AddFrame(fWindowOffsetFrame, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fWindowOffsetInput = new TGNumberEntry(fWindowOffsetFrame, (Double_t) 110,6,-1,(TGNumberFormat::EStyle) 5); TGLabel * fWindowOffsetLabel = new TGLabel(fWindowOffsetFrame, "Window Offset"); fWindowOffsetFrame->AddFrame(fWindowOffsetInput, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fWindowOffsetFrame->AddFrame(fWindowOffsetLabel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); TGHorizontalFrame * fPulserOffsetFrame = new TGHorizontalFrame(fPulserOptionsFrame, 200, 30); fPulserOptionsFrame->AddFrame(fPulserOffsetFrame, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fPulserOffsetInput = new TGNumberEntry(fPulserOffsetFrame, (Double_t) 0,6,-1,(TGNumberFormat::EStyle) 5); TGLabel * fPulserOffsetLabel = new TGLabel(fPulserOffsetFrame, "Pulser Offset"); fPulserOffsetFrame->AddFrame(fPulserOffsetInput, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fPulserOffsetFrame->AddFrame(fPulserOffsetLabel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); TGHorizontalFrame * fPulseHeightFrame = new TGHorizontalFrame(fPulserOptionsFrame, 200, 30); fPulserOptionsFrame->AddFrame(fPulseHeightFrame, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fPulseHeightInput = new TGNumberEntry(fPulseHeightFrame, (Double_t) 1000000,8,-1,(TGNumberFormat::EStyle) 5); TGLabel * fPulseHeightLabel = new TGLabel(fPulseHeightFrame, "Pulser Magnitude [arb]"); fPulseHeightFrame->AddFrame(fPulseHeightInput, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fPulseHeightFrame->AddFrame(fPulseHeightLabel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); TGHorizontalFrame * fReadoutThresholdFrame = new TGHorizontalFrame(fPulserOptionsFrame, 200, 30); fPulserOptionsFrame->AddFrame(fReadoutThresholdFrame, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fReadoutThresholdInput = new TGNumberEntry(fReadoutThresholdFrame, (Double_t) 0,6,-1,(TGNumberFormat::EStyle) 5); TGLabel * fReadoutThresholdLabel = new TGLabel(fReadoutThresholdFrame, "Readout Threshold"); fReadoutThresholdFrame->AddFrame(fReadoutThresholdInput, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fReadoutThresholdFrame->AddFrame(fReadoutThresholdLabel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); TGTextButton *fCommitButton = new TGTextButton(fPulserOptionsFrame,"Commit Settings"); fCommitButton->SetTextJustify(36); fCommitButton->SetMargins(1,1,1,1); fCommitButton->SetWrapLength(-1); fCommitButton->Resize(97,22); fPulserOptionsFrame->AddFrame(fCommitButton, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop)); fCommitButton->Connect("Clicked()","TestBenchGUI",this,"DoVMESettings()"); TGHorizontalFrame * fDACFrame = new TGHorizontalFrame(fPulserOptionsFrame, 200, 30); fPulserOptionsFrame->AddFrame(fDACFrame, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fDACInput = new TGNumberEntry(fDACFrame, (Double_t) 25000,6,-1,(TGNumberFormat::EStyle) 5); TGLabel * fDACLabel = new TGLabel(fDACFrame, "DAC Value"); fDACFrame->AddFrame(fDACInput, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); fDACFrame->AddFrame(fDACLabel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); TGTextButton *fCommitDACButton = new TGTextButton(fPulserOptionsFrame,"Commit DAC"); fCommitDACButton->SetTextJustify(36); fCommitDACButton->SetMargins(1,1,1,1); fCommitDACButton->SetWrapLength(-1); fCommitDACButton->Resize(97,22); fPulserOptionsFrame->AddFrame(fCommitDACButton, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop)); fCommitDACButton->Connect("Clicked()","TestBenchGUI",this,"DoSetDAC()"); TGTextButton *fDACDefaultButton = new TGTextButton(fPulserOptionsFrame,"Load DAC from CCDB"); fDACDefaultButton->SetTextJustify(36); fDACDefaultButton->SetMargins(1,1,1,1); fDACDefaultButton->SetWrapLength(-1); fDACDefaultButton->Resize(97,22); fPulserOptionsFrame->AddFrame(fDACDefaultButton, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop)); fDACDefaultButton->Connect("Clicked()","TestBenchGUI",this,"DoSetDACDefaults()"); fPulserOptionsFrame->SetLayoutManager(new TGVerticalLayout(fPulserOptionsFrame)); fPulserOptionsFrame->Resize(258,251); fOptionsFrame->AddFrame(fPulserOptionsFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY)); TGTextButton *fCloseButton = new TGTextButton(fOptionsFrame,"Close"); fCloseButton->SetTextJustify(36); fCloseButton->SetMargins(0,0,0,0); fCloseButton->SetWrapLength(-1); fCloseButton->Resize(97,22); fOptionsFrame->AddFrame(fCloseButton, new TGLayoutHints(kLHintsLeft | kLHintsCenterX | kLHintsTop)); fCloseButton->Connect("Clicked()","TestBenchGUI",this,"DoClose()"); fMainFrame->AddFrame(fOptionsFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandY,2,2,2,2)); fMainFrame3557->AddFrame(fMainFrame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,1,1,1,1)); //fMainFrame3557->SetMWMHints(kMWMDecorAll, //kMWMFuncAll, //kMWMInputModeless); //fMainFrame3557->MapSubwindows(); //fMainFrame3557->Resize(fMainFrame3557->GetDefaultSize()); //fMainFrame3557->MapWindow(); //fMainFrame3557->Resize(1412,854); this->listTree = fListTree; this->listTree->Associate(this); this->listTree->Connect("Checked(TObject*, Bool_t)","TestBenchGUI", this, "DoCheckedEntry(TObject*, Int_t)"); this->Connect("CloseWindow()", "TestBenchGUI", this, "DoClose()"); //this->DontCallClose(); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } void TestBenchGUI::PowerOnADCs(){ cout << "Powering On ADCs" << endl; if (VMEOn){ cout << "ADCs already on" << endl; return; } int success = VME->InitializeADCs(); VMEOn = true; if (success) cout << "ADCs Initialized" << endl; return; } void TestBenchGUI::TakePulserData(){ cout << "Taking Pulser data" << endl; if(VMEOn){ float time = VME->TakePulserData(1); PlotWaveforms(); return; } else{ cout << "Turn ADCs On before taking data...I can do this for you" << endl; PowerOnADCs(); TakePulserData(); return; } } void TestBenchGUI::PowerOffADCs(){ cout << "Powering Off ADCs" << endl; if (VMEOn) { VME->PowerDown(); VMEOn = false; } else cout << "ADCs already off" << endl; return; } void TestBenchGUI::DoClose(){ cout << "Powering off ADCs and Closing program" << endl; PowerOffADCs(); gApplication->Terminate(0); } void TestBenchGUI::DoVMESettings(){ if (!VMEOn) PowerOnADCs(); cout << "Sending VME Settings" << endl; int NADCSamples = fADCSampleInput->GetIntNumber(); int windowOffset = fWindowOffsetInput->GetIntNumber(); int pulserOffset = fPulserOffsetInput->GetIntNumber(); int pulseHeight = fPulseHeightInput->GetIntNumber(); int threshold = fReadoutThresholdInput->GetIntNumber(); VME->ChangePulserSettings(NADCSamples, windowOffset, pulserOffset, pulseHeight, threshold); TakePulserData(); TakePulserData(); // First read fails cout << "Settings changed" << endl; } void TestBenchGUI::DoSetDAC(){ if (!VMEOn) PowerOnADCs(); cout << "Setting All DAC values" << endl; int DAC = fDACInput->GetIntNumber(); VME->SetAllDAC(DAC); TakePulserData(); TakePulserData(); //Settings take effect on second event cout << "DAC values set to " << DAC << endl; } void TestBenchGUI::DoSetDACDefaults(){ if (!VMEOn) PowerOnADCs(); cout << "Setting DAC to CCDB values" << endl; VME->SetDACDefaults(); TakePulserData(); TakePulserData(); //Settings take effect on second event } void TestBenchGUI::DoCheckedEntry(TObject* obj, Int_t check) { // Called whenever a checkbox is toggled in listTree. // Unbelievably enough, the value of "obj" is the parent // and NOT the actual item next to the checkbox being clicked. // In order to get the correct item, we have to ask for it // via the mouse location. (What an incredible waste of time // to figure this out!) <<<<< Thanks Sean! //cout << "Entered DoCheckedEntry for FListTree" << listTree << endl; TGListTreeItem *item = listTree->GetSelected(); //TGListTreeItem *item = listTree->GetBelowMouse(); // Not working for some reason?? //TGListTreeItem *item = (TGListTreeItem *) obj; //cout << "Entered DoCheckedEntry for FListTree" << listTree << endl; //cout << "Item is " << item << endl; if(!item) return; //cout << "Trying to check items" << endl; listTree->CheckAllChildren(item, check); //Loop over all children, setting the item_checked //GetChecked(item, false); } void TestBenchGUI::PlotWaveforms(){ //map > > fRawData; //Make out Multigraph if(rawData != NULL){ delete rawData; rawData = 0; } rawData = new TMultiGraph(); // Loop over the selected channels and try to pull their Raw data TList *list = new TList(); listTree->GetChecked(list); //cout << "The list has " << list->GetEntries() << " entries" << endl; for( int i = 0; i < chList.size(); i++){ TGListTreeItem *thisItem = chList.at(i); if(!thisItem->IsChecked()) continue; SC * slotChannel = (SC *) thisItem->GetUserData(); int Slot = slotChannel->slot; int Channel = slotChannel->channel; //cout << "Slot " << Slot << " Channel " << Channel << " selected" << endl; // Now we have the list that we want // Raw data is in this form //map > > fRawData; vector data; try{ data = (fRawData.at(Slot)).at(Channel); } catch (const std::out_of_range& oor){ cout << "WARNING!!! No data for Requested Slot " << Slot << " Channel " << Channel << endl; //cout << "If the sparsification threshold is 0, all samples for this channel are NEGATIVE!" << endl; continue; } vector xAxis; for (unsigned int j = 1; j <=data.size(); j++){ xAxis.push_back(j); } TGraph * g = new TGraph(data.size(), &xAxis[0], &data[0]); g->SetName(Form("Slot%iCH%i" , Slot, Channel)); rawData->Add(g, "cp"); //cout << "Adding Graph " << g->GetName() << endl; } fRawDataFrame->GetCanvas()->cd(); rawData->Draw("a"); fRawDataFrame->GetCanvas()->Update(); cout << "Done Updating Canvas" << endl; } /* //--------------------------------- // GetChecked //--------------------------------- void TestBenchGUI::GetChecked(TGListTreeItem *item, bool check_siblings) { while(item){ // Set checked state, but only if this is currently listed in item_checked // Otherwise, it is probably not a valid hnamepath (just a partial) char str[512] = ""; fListTree->GetPathnameFromItem(item, str); string hnamepath(str); if(item_checked.find(hnamepath) != item_checked.end()) { item_checked[hnamepath] = item->IsChecked(); _DBG_<GetFirstChild()) GetChecked(item->GetFirstChild()); item = check_siblings ? item->GetNextSibling():NULL; } } */