removed jctb, use repository instead

This commit is contained in:
bergamaschi 2016-08-16 14:34:56 +02:00
parent b9d42d274c
commit de8f04a058
22 changed files with 0 additions and 7598 deletions

View File

@ -1,157 +0,0 @@
#include <TApplication.h>
#include <TColor.h>
#include <TStyle.h>
#include <TROOT.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "multiSlsDetector.h"
#include "sls_detector_defs.h"
#include "sls_receiver_defs.h"
#include "jctbMain.h"
using namespace std;
int main(int argc, char **argv) {
string afname, cfname, pfname;
int id=0;
int af=0, cf=0, pf=0;
cout << " *** " << argc << endl;
for (int ia=0; ia<argc; ia++) {
if (strcmp(argv[ia],"-alias")==0) {
if (ia+1<argc) {
afname=argv[ia+1];
ia++;
af=1;
}
} else if (strcmp(argv[ia],"-config")==0) {
if (ia+1<argc) {
cfname=argv[ia+1];
ia++;
cf=1;
}
} else if (strcmp(argv[ia],"-par")==0) {
if (ia+1<argc) {
pfname=argv[ia+1];
ia++;
pf=1;
}
} else if (strcmp(argv[ia],"-id")==0) {
if (ia+1<argc) {
id=atoi(argv[ia+1]);
ia++;
}
}
}
cout << " *** " << endl;
/****** Create detector ****************/
multiSlsDetector *myDet=new multiSlsDetector(id);
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
if (cf) {
myDet->readConfigurationFile(cfname);
} else
cout << "No config file specified" << endl;
cout << "Created multi detector id " << id << " hostname " << myDet->getHostname() << endl;
if (pf) {
myDet->retrieveDetectorSetup(pfname);
} else
cout << "No parameter file specified" << endl;
/***********Create GUI stuff *******************/
TApplication theApp("App",&argc,argv);
gStyle->SetDrawBorder(0);
gStyle->SetCanvasColor(kWhite);
gStyle->SetCanvasDefH(800);
gStyle->SetCanvasDefW(800);
gStyle->SetCanvasBorderMode(0);
gStyle->SetPadBorderMode(0);
gStyle->SetPaintTextFormat("5.2f");
gStyle->SetLineWidth(2);
gStyle->SetTextSize(1.1);
gStyle->SetLabelSize(0.04,"xy");
gStyle->SetTitleSize(0.05,"xy");
gStyle->SetTitleOffset(1.0,"x");
gStyle->SetTitleOffset(1.1,"y");
gStyle->SetPadTopMargin(0.15);
gStyle->SetPadRightMargin(0.15);
gStyle->SetPadBottomMargin(0.15);
gStyle->SetPadLeftMargin(0.15);
gStyle->SetLegendBorderSize(1);
gStyle->SetFrameBorderMode(0);
gStyle->SetFrameFillColor(kWhite);
// gStyle->SetLegendFillColor(kWhite);
gStyle->SetTitleFillColor(kWhite);
gStyle->SetFillColor(kWhite);
gStyle->SetStatFontSize(0.03);
gStyle->SetStatBorderSize(1);
gStyle->SetStatFormat("6.4g");
gStyle->SetStatX(0.95);
gStyle->SetStatY(0.95);
gStyle->SetStatW(0.2);
gStyle->SetStatH(0.2);
gStyle->SetTitleX(0.1);
gStyle->SetTitleY(0.95);
gStyle->SetTitleBorderSize(0);
gStyle->SetTitleFontSize(0.05);
gROOT->SetStyle("Default");
TColor::InitializeColors();
const Int_t NRGBs = 5;
const Int_t NCont = 90;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
gROOT->ForceStyle();
jctbMain *mf=new jctbMain(gClient->GetRoot(),myDet);
cout << " *** " << argc << endl;
for (int ia=0; ia<argc; ia++)
cout << argv[ia] << endl;
cout << " *** " << endl;
if (af)
mf->loadAlias(afname);
else
cout << "no alias specified" << endl;
theApp.Run();
return 0;
}

View File

@ -1,29 +0,0 @@
SRC=jctbDict.cpp jctbMain.cpp jctbDacs.cpp jctbDac.cpp jctbPattern.cpp jctbSignals.cpp jctbSignal.cpp jctbAdcs.cpp jctbAcquisition.cpp
INCS=jctbSignals.h jctbSignal.h jctbPattern.h jctbDacs.h jctbDac.h jctbMain.h jctbAdcs.h jctbAcquisition.h
LINKDEF=jctbLinkDef.h
INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/multiSlsDetector/ -I../slsDetectorSoftware/slsDetector -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetectorAnalysis -I../slsDetectorSoftware/slsDetectorUsers -I../slsDetectorSoftware/usersFunctions
LDFLAG=-L../bin -lSlsDetector -L/usr/lib64/ -lpthread
MAIN=JCTBGui.cpp
DESTDIR?=../bin
all: $(DESTDIR)/JCTBGui
doc:
cd manual && make DESTDIR=$(DESTDIR)
htmldoc:
cd manual && make html DESTDIR=$(DESTDIR)
jctbDict.cpp: $(INCS) $(LINKDEF)
rootcint -f jctbDict.cpp -c $(INCS) $(LINKDEF)
$(DESTDIR)/JCTBGui: $(SRC) $(MAIN) $(LINKDEF) $(INCS)
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit $(LDFLAG) -o JCTBGui $(INCDIR) $(SRC) $(MAIN)
mv JCTBGui $(DESTDIR)
clean:
rm -f JCTBGui *.o jctbDict.*

View File

@ -1,176 +0,0 @@
# this is a comment (every line starting with no keyword is such)
# space in label not allowed (tbf)
#BITX bitName plotFlag plotColorRGB (from 0!)
#BIT1 compTestOUT 1 2 #you can put comments also here (leave a space bef. #)
BIT1 compTestIN
BIT32 curON
BIT2 side_clk
BIT3 side_din
BIT4 clear_shr
BIT5 bottom_din
BIT6 bottom_clk
BIT7 gHF
BIT31 bypassCDS
BIT8 ENprechPRE
BIT9 res
BIT30 pulseOFF
BIT27 connCDS #INVERTED NAME to match logical behaviour, chipname disconnCDS
BIT24 Dsg_1
BIT25 Dsg_2
BIT23 Dsg_3
BIT10 sto0
BIT11 sto1
BIT12 sto2
BIT13 resCDS
BIT14 prechargeConnect
BIT15 pulse
BIT21 PCT_mode
BIT16 res_DGS
#BIT26 dbit1
#BIT27 dbit0
#CMOS_IN
#CMOS_IN1 out_DGS
#LVDS_IN
# now the names of ADC channels (lt. 12 characters)
ADC1 T_boa.(C)
ADC2 Va+
ADC3 Vdd_ps
ADC4 Vsh
ADC5 Vcc_int
ADC6 Vcc_iochip
ADC7 Vcc1.8A
ADC8 Vcc1.8D
ADC9 T_chip
ADC10 _nc
ADC11 _nc
ADC12 _Vcc_io # 0.068 ohm resistor
ADC13 _nc # 0.068 ohm resistor
ADC14 _Va # 0.068 ohm resistor
ADC15 _nc
ADC16 _vdd_ana
I1 _I_va(mA) # this values are computed as spec.
I1a 2 #by the following lines ((ADCa-ADCb)/R)
I1b 14 # all the values comes mainly from the adapter board
I1r 0.068
I2 _I_vdd(mA) #
I2a 3
I2b 16
I2r 0.068 #
I3 _nn
I3a 14
I3b 2
I3r 0.068
I4 _I_io(mA)
I4a 6
I4b 12
I4r 0.068 #shuld be 5000000 for mA readout
# now the names of DAC channels (lt. 12 characters)
DAC7 vbp_colbuf
DAC8 vIpreCDS
DAC9 vIpre
DAC10 VprechPre
DAC11 prechargeV
DAC12 ibias_SFP
DAC1 vcasc_SFP
DAC3 VPH
DAC4 VPL
DAC2 ibias_CS
DAC5 vrefDGS
DAC6 vIpreDGS
DAC1 vcascSFP
DAC13 s2d_vcascp
#POT1 s2d_vcascn
DAC14 vin_com
DAC15 vout_com
DAC16 vb_sda
# number (1-16) of the adc "reading" the pot controlled VR. (should be always 2)
DACFORPOTVR 2
#SCHEMATIC jungfrau01_ADP.pdf #those files are located in doc/ folder

View File

@ -1,228 +0,0 @@
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TThread.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "jctbAcquisition.h"
#include "multiSlsDetector.h"
#include "sls_detector_defs.h"
using namespace std;
jctbAcquisition::jctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det) {
page->AddFrame(this,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
TGHorizontalFrame *hframe=new TGHorizontalFrame(this, 800,50);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
hframe->MapWindow();
char tit[100];
cFileSave= new TGCheckButton(hframe, "Output file: ");
hframe->AddFrame(cFileSave,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
cFileSave->MapWindow();
cFileSave->SetTextJustify(kTextRight);
cFileSave->Connect("Toggled(Bool_t)","jctbAcquisition",this,"setFsave(Bool_t)");
eFname = new TGTextEntry(hframe, (myDet->getFileName()).c_str());
hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
eFname->MapWindow();
eFname->Resize(150,30);
eFname->Connect("ReturnPressed()","jctbAcquisition",this,"setFname()");
TGLabel *label=new TGLabel(hframe,"index: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
label->MapWindow();
label->SetTextJustify(kTextRight);
eFindex = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame( eFindex,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eFindex->MapWindow();
eFindex->Resize(150,30);
TGTextEntry *e= eFindex->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbAcquisition",this,"setFindex()");
hframe=new TGHorizontalFrame(this, 800,50);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
hframe->MapWindow();
label=new TGLabel(hframe,"Output directory: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
label->MapWindow();
label->SetTextJustify(kTextRight);
eOutdir = new TGTextEntry(hframe, (myDet->getFilePath()).c_str());
hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
eOutdir->MapWindow();
eOutdir->Resize(150,30);
eOutdir->Connect("ReturnPressed()","jctbAcquisition",this,"setOutdir()");
hframe=new TGHorizontalFrame(this, 800,50);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
hframe->MapWindow();
bStatus=new TGTextButton(hframe, "Start");
hframe->AddFrame(bStatus,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
bStatus->MapWindow();
bStatus->Connect("Clicked()","jctbAcquisition",this,"toggleAcquisition()");
acqThread = new TThread("acqThread",
jctbAcquisition::ThreadHandle,(void*)this);
// acqThread->Run();
myDet->registerProgressCallback(&progressCallback,(void*)this);
myDet->registerDataCallback(&dataCallback, (void*)this);
}
int jctbAcquisition::dataCallback(detectorData *data, int index, void* pArgs) {
cout <<"------"<< index << " " << data->npoints << " "<< data->npy << endl;
}
void jctbAcquisition::setOutdir() {
myDet->setFilePath(eOutdir->GetText());
// // cout << "setting dac! "<< id << endl;
// myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
// getValue();
}
void jctbAcquisition::setFname() {
myDet->setFileName(eFname->GetText());
// int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
// char s[100];
// sprintf(s,"%d",val);
// dacsValue->SetText(s);
// return val;
}
void jctbAcquisition::setFindex() {
myDet->setFileIndex(eFindex->GetNumber());
}
void jctbAcquisition::setFsave(Bool_t b) {
myDet->enableWriteToFile(b);
eFname->SetState(b);
eOutdir->SetState(b);
}
void jctbAcquisition::update() {
eFname->SetText((myDet->getFileName()).c_str());
eOutdir->SetText((myDet->getFilePath()).c_str());
eFindex->SetNumber(myDet->getFileIndex());
cFileSave->SetOn(myDet->enableWriteToFile());
eFname->SetState(cFileSave->IsOn());
eOutdir->SetState(cFileSave->IsOn());
eFindex->SetState(cFileSave->IsOn());
}
void jctbAcquisition::toggleAcquisition() {
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
bStatus->SetText("Stop");
acqThread->Run();
//myDet->startAcquisition();
StopFlag=0;
} else {
StopFlag=1;
myDet->stopAcquisition();
bStatus->SetText("Start");
// acqThread->Kill();
}
}
void jctbAcquisition::acquisitionFinished() {
bStatus->SetText("Start");
}
void jctbAcquisition::startAcquisition(){
cout << "Detector started " << endl;
myDet->acquire();
}
void* jctbAcquisition::ThreadHandle(void *arg)
{
jctbAcquisition *acq = static_cast<jctbAcquisition*>(arg);
int i=0;
acq->startAcquisition();
acq->acquisitionFinished();
// while(!(classInstance->StopFlag))
// {
// cout << "thread " << i++ << endl;
// usleep(100000);
// }
//myDet->readFrame();
}
int jctbAcquisition::progressCallback(double f,void* arg) {
// jctbAcquisition *acq = static_cast<jctbAcquisition*>(arg);
cout << "*********" << f << "*******" << endl;
}

View File

@ -1,60 +0,0 @@
#ifndef JCTBACQUISITION_H
#define JCTBACQUISITION_H
#include <TGFrame.h>
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
class TThread;
class TGTextButton;
class multiSlsDetector;
class detectorData;
#include <string>
using namespace std;
class jctbAcquisition : public TGGroupFrame {
private:
TGTextEntry *eOutdir;
TGTextEntry *eFname;
TGNumberEntry *eFindex;
TGCheckButton *cFileSave;
TGTextButton *bStatus;
// TGTextButton
TThread *acqThread;
multiSlsDetector* myDet;
public:
jctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
void setOutdir();
void setFname();
void setFsave(Bool_t);
void setFindex();
void toggleAcquisition();
static void* ThreadHandle(void *arg);
void update();
void acquisitionFinished();
void startAcquisition();
static int progressCallback(double,void*);
static int dataCallback(detectorData*, int, void*);
int StopFlag;
ClassDef(jctbAcquisition,0)
};
#endif

View File

@ -1,215 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <TGColorSelect.h>
#include <THStack.h>
#include <TGTab.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "jctbAdcs.h"
#include "multiSlsDetector.h"
using namespace std;
jctbAdc::jctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det)
: TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
TGHorizontalFrame *hframe=this;
char tit[100];
page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
sprintf(tit, "ADC%d", id);
sAdcLabel= new TGLabel(hframe, tit);
hframe->AddFrame(sAdcLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sAdcLabel->MapWindow();
sAdcLabel->SetTextJustify(kTextLeft);
sAdcEnable= new TGCheckButton(hframe, "Enable");
hframe->AddFrame( sAdcEnable,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sAdcEnable->MapWindow();
sAdcEnable->SetOn(kTRUE);
sAdcEnable->SetEnabled(kFALSE);
sAdcPlot= new TGCheckButton(hframe, "Plot");
hframe->AddFrame( sAdcPlot,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sAdcPlot->MapWindow();
sAdcPlot->Connect("Toggled(Bool_t)","jctbAdc",this,"ToggledPlot(Bool_t)");
fColorSel = new TGColorSelect(hframe, id+1, 0);
hframe->AddFrame(fColorSel, new TGLayoutHints(kLHintsTop |
kLHintsLeft, 2, 0, 2, 2));
fColorSel->SetColor(TColor::Number2Pixel(id+1));
};
void jctbAdc::setAdcAlias(char *tit, int plot, int color) {
if (tit)
sAdcLabel->SetText(tit);
if (plot)
sAdcPlot->SetOn(kTRUE,kTRUE);
else
sAdcPlot->SetOn(kFALSE,kTRUE);
if (color>=0)
fColorSel->SetColor(color);
fColorSel->SetEnabled(sAdcPlot->IsOn());
}
string jctbAdc::getAdcAlias() {
char line[1000];
sprintf(line,"ADC%d %s %d %x\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
return string(line);
}
void jctbAdc::update() {
}
void jctbAdc::ToggledPlot(Bool_t b){
Long_t mask=b<<id;
ToggledAdcPlot(mask);
fColorSel->SetEnabled(b);
}
void jctbAdc::ToggledAdcPlot(Int_t b){
Emit("ToggledAdcPlot(Int_t)", id);
}
jctbAdcs::jctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
: TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
char tit[100];
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
int idac=0;
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hhframe->MapWindow();
TGVerticalFrame *vframe;
for (idac=0; idac<NADCS; idac++) {
if (idac%16==0) {
vframe=new TGVerticalFrame(hhframe, 400,800);
hhframe->AddFrame(vframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
vframe->MapWindow();
}
sAdc[idac]=new jctbAdc(vframe,idac,myDet);
}
}
void jctbAdcs::update() {
;
}
int jctbAdcs::setAdcAlias(string line) {
int is=-1, plot=0, color=-1;
char tit[100];
int narg=sscanf(line.c_str(),"ADC%d %s %d %x",&is,tit,&plot, &color);
if (narg<2)
return -1;
if (narg!=3)
color=-1;
if (is>=0 && is<NADCS) {
sAdc[is]->setAdcAlias(tit,plot,color);
}
return is;
}
string jctbAdcs::getAdcAlias() {
ostringstream line;
for (int is=0; is<NADCS; is++)
line << sAdc[is]->getAdcAlias();
return line.str();
}

View File

@ -1,83 +0,0 @@
#ifndef JCTBADCS_H
#define JCTBADCS_H
#include <TGFrame.h>
#define NADCS 32
class TRootEmbeddedCanvas;
class TGButtonGroup;
class TGVerticalFrame;
class TGHorizontalFrame;
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TH2F;
class TGComboBox;
class TGCheckButton;
class TGColorSelect;
class THStack;
class TGraphErrors;
class TGTextButton;
class TGTab;
class TGraph;
class multiSlsDetector;
#include <string>
using namespace std;
class jctbAdc : public TGHorizontalFrame {
private:
TGLabel *sAdcLabel;
TGCheckButton *sAdcEnable;
TGCheckButton *sAdcPlot;
TGColorSelect *fColorSel;
TGraph *gADC;
int id;
multiSlsDetector *myDet;
public:
jctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det);
void setAdcAlias(char *tit, int plot, int color);
string getAdcAlias();
void ToggledAdcPlot(Int_t b);
void ToggledPlot(Bool_t b);
void update();
ClassDef(jctbAdc,0)
};
class jctbAdcs : public TGGroupFrame {
private:
jctbAdc *sAdc[NADCS];
multiSlsDetector *myDet;
public:
jctbAdcs(TGVerticalFrame *page, multiSlsDetector *det);
int setAdcAlias(string line);
string getAdcAlias();
void update();
ClassDef(jctbAdcs,0)
};
#endif

View File

@ -1,122 +0,0 @@
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "jctbDac.h"
#include "multiSlsDetector.h"
#include "sls_detector_defs.h"
using namespace std;
jctbDac::jctbDac(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
TGHorizontalFrame *hframe=this;
page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
char tit[100];
sprintf(tit, "DAC %d:",idac);
dacsLabel= new TGLabel(hframe, tit);
hframe->AddFrame(dacsLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
dacsLabel->MapWindow();
dacsLabel->SetTextJustify(kTextLeft);
dacsEntry = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 65535);
hframe->AddFrame(dacsEntry,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
dacsEntry->MapWindow();
dacsEntry->Resize(150,30);
dacsUnit= new TGCheckButton(hframe, "mV");
hframe->AddFrame( dacsUnit,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
dacsUnit->MapWindow();
sprintf(tit, "xxx");
dacsValue= new TGLabel(hframe, tit);
hframe->AddFrame( dacsValue,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
dacsValue->MapWindow();
dacsValue->SetTextJustify(kTextLeft);
TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbDac",this,"setValue()");
// cout << "(((((((((((((((((((((((((((((((" << dacsEntry->GetListOfSignals()->At(0)->IsA() << endl;
}
int jctbDac::setLabel(char *tit, int mv) {
if(tit)
dacsLabel->SetText(tit);
if (mv>0)
dacsUnit->SetOn(kTRUE,kTRUE);
else if (mv==0)
dacsUnit->SetOn(kFALSE,kTRUE);
return id;
}
string jctbDac::getLabel() {
ostringstream line;
line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
return line.str();
}
void jctbDac::setValue() {
// cout << "setting dac! "<< id << endl;
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
getValue();
}
int jctbDac::getValue() {
int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
char s[100];
cout << "dac " << id << " " << val << endl;
sprintf(s,"%d",val);
dacsValue->SetText(s);
return val;
}

View File

@ -1,44 +0,0 @@
#ifndef JCTBDAC_H
#define JCTBDAC_H
#include <TGFrame.h>
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
class multiSlsDetector;
#include <string>
using namespace std;
class jctbDac : public TGHorizontalFrame {
private:
TGLabel *dacsLabel;
TGNumberEntry *dacsEntry;
TGCheckButton *dacsUnit;
TGLabel *dacsValue;
int id;
multiSlsDetector* myDet;
public:
jctbDac(TGGroupFrame*, int , multiSlsDetector*);
void setValue();
int getValue();
int setLabel(char *tit, int mv);
string getLabel();
ClassDef(jctbDac,0)
};
#endif

View File

@ -1,88 +0,0 @@
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "jctbDac.h"
#include "jctbDacs.h"
#include "multiSlsDetector.h"
#include "sls_detector_defs.h"
using namespace std;
jctbDacs::jctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
// cout << "window mapped " << endl;
for (int idac=0; idac<NDACS; idac++) {
dacs[idac]=new jctbDac(this, idac, myDet);
}
}
int jctbDacs::setDacAlias(string line) {
int is=-1, mv=0;
char tit[100];
int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
if (narg<2)
return -1;
if (is>=0 && is<NDACS)
dacs[is]->setLabel(tit,mv);
return is;
}
string jctbDacs::getDacAlias() {
ostringstream line;
for (int i=0; i<NDACS; i++)
line << dacs[i]->getLabel() << endl;
return line.str();
}
string jctbDacs::getDacParameters() {
ostringstream line;
for (int i=0; i<NDACS; i++) {
//line << "dacs:" << i << " " << dacs[i]->getValue << endl;
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
}
return line.str();
}
void jctbDacs::update() {
for (int idac=0; idac<NDACS; idac++) {
dacs[idac]->getValue();
}
}

View File

@ -1,40 +0,0 @@
#ifndef JCTBDACS_H
#define JCTBDACS_H
#include <TGFrame.h>
#define NDACS 16
class multiSlsDetector;
class jctbDac;
#include <string>
using namespace std;
class jctbDacs : public TGGroupFrame {
private:
jctbDac *dacs[NDACS];
multiSlsDetector* myDet;
public:
jctbDacs(TGVerticalFrame *page, multiSlsDetector*);
int setDacAlias(string line);
string getDacAlias();
string getDacParameters();
void update();
ClassDef(jctbDacs,0)
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,98 +0,0 @@
/********************************************************************
* jctbDict.h
* CAUTION: DON'T CHANGE THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED
* FROM HEADER FILES LISTED IN G__setup_cpp_environmentXXX().
* CHANGE THOSE HEADER FILES AND REGENERATE THIS FILE.
********************************************************************/
#ifdef __CINT__
#error jctbDict.h/C is only for compilation. Abort cint.
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define G__ANSIHEADER
#define G__DICTIONARY
#define G__PRIVATE_GVALUE
#include "G__ci.h"
#include "FastAllocString.h"
extern "C" {
extern void G__cpp_setup_tagtablejctbDict();
extern void G__cpp_setup_inheritancejctbDict();
extern void G__cpp_setup_typetablejctbDict();
extern void G__cpp_setup_memvarjctbDict();
extern void G__cpp_setup_globaljctbDict();
extern void G__cpp_setup_memfuncjctbDict();
extern void G__cpp_setup_funcjctbDict();
extern void G__set_cpp_environmentjctbDict();
}
#include "TObject.h"
#include "TMemberInspector.h"
#include "jctbSignals.h"
#include "jctbSignal.h"
#include "jctbPattern.h"
#include "jctbDacs.h"
#include "jctbDac.h"
#include "jctbMain.h"
#include "jctbAdcs.h"
#include "jctbAcquisition.h"
#include <algorithm>
namespace std { }
using namespace std;
#ifndef G__MEMFUNCBODY
#endif
extern G__linked_taginfo G__jctbDictLN_TClass;
extern G__linked_taginfo G__jctbDictLN_TBuffer;
extern G__linked_taginfo G__jctbDictLN_TMemberInspector;
extern G__linked_taginfo G__jctbDictLN_TObject;
extern G__linked_taginfo G__jctbDictLN_string;
extern G__linked_taginfo G__jctbDictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR;
extern G__linked_taginfo G__jctbDictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR;
extern G__linked_taginfo G__jctbDictLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR;
extern G__linked_taginfo G__jctbDictLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR;
extern G__linked_taginfo G__jctbDictLN_TGObject;
extern G__linked_taginfo G__jctbDictLN_TQObject;
extern G__linked_taginfo G__jctbDictLN_TGWindow;
extern G__linked_taginfo G__jctbDictLN_TGFrame;
extern G__linked_taginfo G__jctbDictLN_TGCompositeFrame;
extern G__linked_taginfo G__jctbDictLN_TGLayoutHints;
extern G__linked_taginfo G__jctbDictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR;
extern G__linked_taginfo G__jctbDictLN_TGTextButton;
extern G__linked_taginfo G__jctbDictLN_TGVerticalFrame;
extern G__linked_taginfo G__jctbDictLN_TGHorizontalFrame;
extern G__linked_taginfo G__jctbDictLN_TGMainFrame;
extern G__linked_taginfo G__jctbDictLN_TGGroupFrame;
extern G__linked_taginfo G__jctbDictLN_TGNumberEntry;
extern G__linked_taginfo G__jctbDictLN_multiSlsDetector;
extern G__linked_taginfo G__jctbDictLN_jctbSignal;
extern G__linked_taginfo G__jctbDictLN_jctbSignals;
extern G__linked_taginfo G__jctbDictLN_TGTextEntry;
extern G__linked_taginfo G__jctbDictLN_TGLabel;
extern G__linked_taginfo G__jctbDictLN_TGCheckButton;
extern G__linked_taginfo G__jctbDictLN_TH1I;
extern G__linked_taginfo G__jctbDictLN_TGColorSelect;
extern G__linked_taginfo G__jctbDictLN_TRootEmbeddedCanvas;
extern G__linked_taginfo G__jctbDictLN_TGButtonGroup;
extern G__linked_taginfo G__jctbDictLN_TGTab;
extern G__linked_taginfo G__jctbDictLN_jctbLoop;
extern G__linked_taginfo G__jctbDictLN_jctbWait;
extern G__linked_taginfo G__jctbDictLN_jctbPattern;
extern G__linked_taginfo G__jctbDictLN_jctbDac;
extern G__linked_taginfo G__jctbDictLN_jctbDacs;
extern G__linked_taginfo G__jctbDictLN_TGMenuBar;
extern G__linked_taginfo G__jctbDictLN_TGPopupMenu;
extern G__linked_taginfo G__jctbDictLN_TGDockableFrame;
extern G__linked_taginfo G__jctbDictLN_jctbAdcs;
extern G__linked_taginfo G__jctbDictLN_jctbAcquisition;
extern G__linked_taginfo G__jctbDictLN_jctbMain;
extern G__linked_taginfo G__jctbDictLN_TGraph;
extern G__linked_taginfo G__jctbDictLN_jctbAdc;
extern G__linked_taginfo G__jctbDictLN_TThread;
extern G__linked_taginfo G__jctbDictLN_detectorData;
/* STUB derived class for protected member access */

View File

@ -1,11 +0,0 @@
#pragma link C++ class jctbMain;
#pragma link C++ class jctbDacs;
#pragma link C++ class jctbDac;
#pragma link C++ class jctbSignals;
#pragma link C++ class jctbSignal;
#pragma link C++ class jctbAdc;
#pragma link C++ class jctbAdcs;
#pragma link C++ class jctbLoop;
#pragma link C++ class jctbWait;
#pragma link C++ class jctbPattern;
#pragma link C++ class jctbAcquisition;

View File

@ -1,665 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <THStack.h>
#include <TGTab.h>
#include <TApplication.h>
#include <TGMenu.h>
#include <TGDockableFrame.h>
//#include <TGMenuBar.h>
//#include <TGPopupMenu.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "multiSlsDetector.h"
#include "jctbMain.h"
#include "jctbDacs.h"
#include "jctbSignals.h"
#include "jctbPattern.h"
#include "jctbAdcs.h"
#include "jctbAcquisition.h"
using namespace std;
jctbMain::jctbMain(const TGWindow *p, multiSlsDetector *det)
: TGMainFrame(p,800,800) {
myDet=det;
Connect("CloseWindow()", "jctbMain", this, "CloseWindow()");
// fMenuDock = new TGDockableFrame(this);
// AddFrame(fMenuDock, new TGLayoutHints(kLHintsExpandX, 0, 0, 1, 0));
// fMenuDock->SetWindowName("GuiTest Menu");
fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX);
fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
fMenuFile = new TGPopupMenu(gClient->GetRoot());
int im=0;
fMenuFile->AddEntry("Open Alias", im++);
fMenuFile->AddEntry("Save Alias", im++);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("Open Parameters", im++);
fMenuFile->AddEntry("Save Parameters", im++);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("Open Configuration", im++);
fMenuFile->AddEntry("Save Configuration", im++);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("Open Pattern", im++);
fMenuFile->AddEntry("Save Pattern", im++);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("Exit", im++);
fMenuFile->Connect("Activated(Int_t)", "jctbMain", this,
"HandleMenu(Int_t)");
// fMenuFile->Connect("PoppedUp()", "TestMainFrame", this, "HandlePopup()");
// fMenuFile->Connect("PoppedDown()", "TestMainFrame", this, "HandlePopdown()");
// fCascade2Menu = new TGPopupMenu(gClient->GetRoot());
// fCascade2Menu->AddEntry("ID = 2&3", im++);
// fCascade2Menu->AddEntry("ID = 2&4", im++);
// fCascade2Menu->AddEntry("ID = 2&5", im++);
// fCascade1Menu = new TGPopupMenu(gClient->GetRoot());
// fCascade1Menu->AddEntry("ID = 4&1", 41);
// fCascade1Menu->AddEntry("ID = 4&2", 42);
// fCascade1Menu->AddEntry("ID = 4&3", 43);
// fCascade1Menu->AddSeparator();
// fCascade1Menu->AddPopup("Cascade&d 2", fCascade2Menu);
// fCascadeMenu = new TGPopupMenu(gClient->GetRoot());
// fCascadeMenu->AddEntry("ID = 5&1", 51);
// fCascadeMenu->AddEntry("ID = 5&2", 52);
// fCascadeMenu->AddEntry("ID = 5&3", 53);
// fCascadeMenu->AddSeparator();
// fCascadeMenu->AddPopup("&Cascaded 1", fCascade1Menu);
// fMenuTest = new TGPopupMenu(gClient->GetRoot());
// fMenuTest->AddLabel("Test different features...");
// fMenuTest->AddSeparator();
// fMenuTest->AddEntry("&Dialog...", im++);
// fMenuTest->AddEntry("&Message Box...", im++);
// fMenuTest->AddEntry("&Sliders...", im++);
// fMenuTest->AddEntry("Sh&utter...", im++);
// fMenuTest->AddEntry("&List Directory...", im++);
// fMenuTest->AddEntry("&File List...", im++);
// fMenuTest->AddEntry("&Progress...", im++);
// fMenuTest->AddEntry("&Number Entry...", im++);
// fMenuTest->AddEntry("F&ont Dialog...", im++);
// fMenuTest->AddSeparator();
// fMenuTest->AddEntry("Add New Menus", im++);
// fMenuTest->AddSeparator();
// fMenuTest->AddPopup("&Cascaded menus", fCascadeMenu);
// fMenuView = new TGPopupMenu(gClient->GetRoot());
// fMenuView->AddEntry("&Dock", im++);
// fMenuView->AddEntry("&Undock", im++);
// fMenuView->AddSeparator();
// fMenuView->AddEntry("Enable U&ndock", im++);
// fMenuView->AddEntry("Enable &Hide", im++);
// fMenuView->DisableEntry(im);
// fMenuDock->EnableUndock(kTRUE);
// fMenuDock->EnableHide(kTRUE);
// fMenuView->CheckEntry(im);
// fMenuView->CheckEntry(im);
// // When using the DockButton of the MenuDock,
// // the states 'enable' and 'disable' of menus have to be updated.
// fMenuDock->Connect("Undocked()", "TestMainFrame", this, "HandleMenu(=M_VIEW_UNDOCK)");
// fMenuHelp = new TGPopupMenu(gClient->GetRoot());
// fMenuHelp->AddEntry("&Contents", im++);
// fMenuHelp->AddEntry("&Search...", im++);
// fMenuHelp->AddSeparator();
// fMenuHelp->AddEntry("&About", im++);
// fMenuNew1 = new TGPopupMenu();
// fMenuNew1->AddEntry("Remove New Menus", im++);
// fMenuNew2 = new TGPopupMenu();
// fMenuNew2->AddEntry("Remove New Menus", im++);
// Menu button messages are handled by the main frame (i.e. "this")
// HandleMenu() method.
// fMenuFile->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fMenuFile->Connect("PoppedUp()", "TestMainFrame", this, "HandlePopup()");
// fMenuFile->Connect("PoppedDown()", "TestMainFrame", this, "HandlePopdown()");
// fMenuTest->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fMenuView->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fMenuHelp->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fCascadeMenu->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fCascade1Menu->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fCascade2Menu->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fMenuNew1->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
// fMenuNew2->Connect("Activated(Int_t)", "TestMainFrame", this,
// "HandleMenu(Int_t)");
TGVerticalFrame *vframe=new TGVerticalFrame(this, 800,1200); //main frame
fMenuBar = new TGMenuBar(vframe, 1, 1, kHorizontalFrame);
fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
// fMenuBar->AddPopup("&Test", fMenuTest, fMenuBarItemLayout);
// fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
// fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
vframe->AddFrame(fMenuBar, fMenuBarLayout);
TGHorizontalFrame* hpage=new TGHorizontalFrame(vframe, 800,1200); //horizontal frame. Inside there should be the tab and the canvas
mtab=new TGTab(hpage, 1500, 1200); //tab!
// page=new TGVerticalFrame(mtab, 1500,1200);
TGCompositeFrame *tf = mtab->AddTab("DACs");
TGVerticalFrame *page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
dacs=new jctbDacs(page, myDet);
tf = mtab->AddTab("Signals");
page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
sig=new jctbSignals(page, myDet);
tf = mtab->AddTab("ADCs");
page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
adcs=new jctbAdcs(page, myDet);
tf = mtab->AddTab("Pattern");
page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
pat=new jctbPattern(page, myDet);
tf = mtab->AddTab("Acquisition");
page=new TGVerticalFrame(tf, 1500,1200);
tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
acq=new jctbAcquisition(page, myDet);
hpage->AddFrame(mtab,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
vframe->AddFrame(hpage,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
AddFrame(vframe,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
vframe->MapWindow();
hpage->MapWindow();
mtab->MapWindow();
page->MapWindow();
// Sets window name and shows the main frame
SetWindowName("JCTB Gui");
MapSubwindows();
MapWindow();
Resize(1500,1200);
// // Creates widgets of the example
fEcanvas = new TRootEmbeddedCanvas ("Ecanvas",hpage,800,800);
fEcanvas->Resize();
fEcanvas->GetCanvas()->Update();
hpage->AddFrame(fEcanvas, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
fEcanvas->MapWindow();
hpage->MapSubwindows();
mtab->Connect("Selected(Int_t)","jctbMain",this,"tabSelected(Int_t)");
tabSelected(0);
}
void jctbMain::CloseWindow() {
gApplication->Terminate();
}
void jctbMain::HandleMenu(Int_t id)
{
// Handle menu items.
switch (id) {
case 0: // fMenuFile->AddEntry("Open Alias", im++);
cout << "Open Alias" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename);
// dir = fi.fIniDir;
loadAlias(fi.fFilename);
}
break;
case 1: // fMenuFile->AddEntry("Save Alias", im++);
cout << "Save Alias" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Save file: %s (dir: %s)\n", fi.fFilename);
// dir = fi.fIniDir;
saveAlias(fi.fFilename);
}
break;
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
cout << "Open Parameters" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
loadParameters(fi.fFilename);
}
break;
case 3: //fMenuFile->AddEntry("Save Parameters", im++);
cout << "Save Parameters" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
saveParameters(fi.fFilename);
}
break;
case 4: // fMenuFile->AddEntry("Open Configuration", im++);
cout << "Open configuration" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
}
break;
case 5: // fMenuFile->AddEntry("Save Configuration", im++);
cout << "Save configuration" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
}
break;
case 6: //fMenuFile->AddEntry("Open Pattern", im++);
cout << "Open pattern" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
}
break;
case 7: //fMenuFile->AddEntry("Save Pattern", im++);
cout << "Save pattern" << endl;
{
static TString dir(".");
TGFileInfo fi;
//fi.fFileTypes = filetypes;
fi.fIniDir = StrDup(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
// dir = fi.fIniDir;
}
break;
case 8: // fMenuFile->AddEntry("Exit", im++);
CloseWindow();
default:
printf("Menu item %d selected\n", id);
break;
}
}
int jctbMain::loadConfiguration(string fname) {
myDet->readConfigurationFile(fname);
// string line;
// int i;
// ifstream myfile (fname.c_str());
// if (myfile.is_open())
// {
// while ( getline (myfile,line) )
// {
// }
// myfile.close();
// }
// else cout << "Unable to open file";
return 0;
}
int jctbMain::saveConfiguration(string fname) {
string line;
int i;
ofstream myfile (fname.c_str());
if (myfile.is_open())
{
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
int jctbMain::loadParameters(string fname) {
myDet->retrieveDetectorSetup(fname);
// string line;
// int i;
// ifstream myfile (fname.c_str());
// if (myfile.is_open())
// {
// while ( getline (myfile,line) )
// {
// }
// myfile.close();
// }
// else cout << "Unable to open file";
return 0;
}
int jctbMain::saveParameters(string fname) {
string line;
int i;
ofstream myfile (fname.c_str());
if (myfile.is_open())
{
myfile << dacs->getDacParameters();
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
int jctbMain::loadAlias(string fname) {
string line;
int i;
ifstream myfile (fname.c_str());
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
// cout << line ;
if (sscanf(line.c_str(),"BIT%d",&i)>0) {
//cout << "*******" << line<< endl;
sig->setSignalAlias(line);
// cout << line ;
} else if (sscanf(line.c_str(),"DAC%d",&i)>0) {
dacs->setDacAlias(line);
// cout << "+++++++++" << line<< endl;
} else if (sscanf(line.c_str(),"ADC%d",&i)>0) {
adcs->setAdcAlias(line);
// cout << "---------" << line<< endl;
} // else
// cout << "<<<<<<<" << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
int jctbMain::saveAlias(string fname) {
string line;
int i;
ofstream myfile (fname.c_str());
if (myfile.is_open())
{
//while ( getline (myfile,line) )
// {
// cout << line ;
//if (sscanf(line.c_str(),"BIT%d",&i)>0) {
//cout << "*******" << line<< endl;
myfile << sig->getSignalAlias();
// cout << line ;
// } else if (sscanf(line.c_str(),"DAC%d",&i)>0) {
myfile << dacs->getDacAlias();
// cout << "+++++++++" << line<< endl;
// } else if (sscanf(line.c_str(),"ADC%d",&i)>0) {
myfile << adcs->getAdcAlias();
// cout << "---------" << line<< endl;
// } // else
// cout << "<<<<<<<" << line << endl;
//}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
void jctbMain::tabSelected(Int_t i) {
// cout << "Selected tab " << i << endl;
// cout << "Current tab is " << mtab->GetCurrent() << endl;
switch (i) {
case 0: //dacs
dacs->update();
break;
case 1: //signals
sig->update();
break;
case 2: //adcs
adcs->update();
break;
case 3: //pattern
pat->update();
break;
case 4: //acq
acq->update();
break;
default:
;
}
}

View File

@ -1,94 +0,0 @@
#ifndef JCTBMAIN_H
#define JCTBMAIN_H
#include <TGFrame.h>
class TRootEmbeddedCanvas;
class TGButtonGroup;
class TGVerticalFrame;
class TGHorizontalFrame;
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TH2F;
class TGComboBox;
class TGCheckButton;
class THStack;
class TGraphErrors;
class TGTextButton;
class TGTab;
class TGMenuBar;
class TGPopupMenu;
class TGDockableFrame;
class TGLayoutHints;
class jctbDacs;
class jctbSignals;
class multiSlsDetector;
class jctbPattern;
class jctbAdcs;
class jctbAcquisition;
#include <string>
using namespace std;
class jctbMain : public TGMainFrame {
private:
multiSlsDetector *myDet;
TRootEmbeddedCanvas *fEcanvas;
TRootEmbeddedCanvas *fModulecanvas;
TGButtonGroup *br;
TGTab *mtab;
jctbDacs *dacs;
jctbSignals *sig;
jctbAdcs *adcs;
jctbPattern *pat;
jctbAcquisition *acq;
TGDockableFrame *fMenuDock;
TGMenuBar *fMenuBar;
TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
TGPopupMenu *fMenuNew1, *fMenuNew2;
TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
public:
jctbMain(const TGWindow *p, multiSlsDetector *det);
int loadAlias(string fname);
int saveAlias(string fname);
int loadParameters(string fname);
int saveParameters(string fname);
int loadConfiguration(string fname);
int saveConfiguration(string fname);
void tabSelected(Int_t);
void CloseWindow();
void HandleMenu(Int_t);
ClassDef(jctbMain,0)
};
#endif

View File

@ -1,532 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <THStack.h>
#include <TGTab.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "jctbPattern.h"
#include "multiSlsDetector.h"
using namespace std;
jctbLoop::jctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
TGHorizontalFrame *hframe=this;
char tit[100];
page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
MapWindow();
sprintf(tit, "Loop %d Repetitions: ", id);
TGLabel *label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eLoopNumber = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame( eLoopNumber,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eLoopNumber->MapWindow();
eLoopNumber->Resize(150,30);
TGTextEntry *e= eLoopNumber->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbLoop",this,"setNLoops()");
sprintf(tit, "Start Address: ");
label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eLoopStartAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 1024);
hframe->AddFrame( eLoopStartAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eLoopStartAddr->MapWindow();
eLoopStartAddr->Resize(150,30);
eLoopStartAddr->SetState(kFALSE);
label= new TGLabel(hframe, "Stop Address: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eLoopStopAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 1024);
hframe->AddFrame( eLoopStopAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eLoopStopAddr->MapWindow();
eLoopStopAddr->Resize(150,30);
eLoopStopAddr->SetState(kFALSE);
}
void jctbLoop::setNLoops() {
int start, stop, n;
start=-1;
stop=-1;
n=eLoopNumber->GetNumber();
myDet->setCTBPatLoops(id,start, stop,n);
}
void jctbLoop::update() {
int start, stop, n;
start=-1;
stop=-1;
n=-1;
myDet->setCTBPatLoops(id,start, stop,n);
eLoopStartAddr->SetHexNumber(start);
eLoopStopAddr->SetHexNumber(stop);
eLoopNumber->SetNumber(n);
}
jctbWait::jctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
char tit[100];
TGHorizontalFrame *hframe=this;
page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
MapWindow();
sprintf(tit, "Wait %d (run clk): ", id);
TGLabel *label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eWaitTime = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame( eWaitTime,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eWaitTime->MapWindow();
eWaitTime->Resize(150,30);
TGTextEntry *e= eWaitTime->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbWait",this,"setWaitTime()");
sprintf(tit, "Wait Address: ");
label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eWaitAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 1024);
hframe->AddFrame( eWaitAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eWaitAddr->MapWindow();
eWaitAddr->Resize(150,30);
eWaitAddr->SetState(kFALSE);
}
void jctbWait::setWaitTime() {
Long64_t t=eWaitTime->GetNumber();
t=myDet->setCTBPatWaitTime(id,t);
}
void jctbWait::update() {
int start, stop, n, addr;
Long64_t t=-1;
t=myDet->setCTBPatWaitTime(id,t);
addr=myDet->setCTBPatWaitAddr(id,-1);
eWaitAddr->SetHexNumber(addr);
eWaitTime->SetNumber(t);
}
jctbPattern::jctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
: TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
char tit[100];
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
sprintf(tit, "ADC Clock Frequency (MHz): ");
TGLabel *label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eAdcClkFreq = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 40);
hframe->AddFrame( eAdcClkFreq,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eAdcClkFreq->MapWindow();
eAdcClkFreq->Resize(150,30);
TGTextEntry *e= eAdcClkFreq->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbPattern",this,"setAdcFreq()");
label= new TGLabel(hframe, " Phase (0.15ns step): ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eAdcClkPhase = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 200);
hframe->AddFrame( eAdcClkPhase,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eAdcClkPhase->MapWindow();
eAdcClkPhase->Resize(150,30);
e= eAdcClkPhase->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbPattern",this,"setAdcPhase()");
hframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
sprintf(tit, "Run Clock Frequency (MHz): ");
label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eRunClkFreq = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 160);
hframe->AddFrame( eRunClkFreq,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eRunClkFreq->MapWindow();
eRunClkFreq->Resize(150,30);
e= eRunClkFreq->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbPattern",this,"setRunFreq()");
label= new TGLabel(hframe, " Phase (0.15ns step): ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eRunClkPhase = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 200);
hframe->AddFrame( eRunClkPhase,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eRunClkPhase->MapWindow();
eRunClkPhase->Resize(150,30);
e= eRunClkPhase->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbPattern",this,"setRunPhase()");
hframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
sprintf(tit, "Number of frames: ");
label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eFrames = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame( eFrames,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eFrames->MapWindow();
eFrames->Resize(150,30);
e= eFrames->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbPattern",this,"setFrames()");
label= new TGLabel(hframe, " Period (s): ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
ePeriod = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame( ePeriod,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
ePeriod->MapWindow();
ePeriod->Resize(150,30);
e= ePeriod->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","jctbPattern",this,"setPeriod()");
hframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
sprintf(tit, "Start Address: ");
label= new TGLabel(hframe, tit);
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eStartAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 1024);
hframe->AddFrame( eStartAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eStartAddr->MapWindow();
eStartAddr->Resize(150,30);
eStartAddr->SetState(kFALSE);
label= new TGLabel(hframe, "Stop Address: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eStopAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,
0, 1024);
hframe->AddFrame( eStopAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eStopAddr->MapWindow();
eStopAddr->Resize(150,30);
eStopAddr->SetState(kFALSE);
int idac=0;
for (idac=0; idac<NLOOPS; idac++) {
eLoop[idac]=new jctbLoop(this,idac,myDet);
}
for (idac=0; idac<NWAITS; idac++) {
eWait[idac]=new jctbWait(this,idac,myDet);
}
}
void jctbPattern::update() {
int start, stop, n, addr;
Long_t t;
eAdcClkFreq->SetNumber(myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,-1));
eRunClkFreq->SetNumber(myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,-1));
//ADC_PHASE
//PHASE_SHIFT
eFrames->SetNumber(myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
ePeriod->SetNumber(((Double_t)myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9);
start=-1;
stop=-1;
n=-1;
myDet->setCTBPatLoops(-1,start, stop,n);
eStartAddr->SetHexNumber(start);
eStopAddr->SetHexNumber(stop);
for (int iloop=0; iloop<NLOOPS; iloop++) {
eLoop[iloop]->update();
}
for (int iwait=0; iwait<NWAITS; iwait++) {
eWait[iwait]->update();
}
}
void jctbPattern::setFrames() {
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,eFrames->GetNumber());
}
void jctbPattern::setPeriod() {
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,eFrames->GetNumber()*1E9);
}
void jctbPattern::setAdcFreq() {
myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,eAdcClkFreq->GetNumber());
}
void jctbPattern::setRunFreq() {
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,eRunClkFreq->GetNumber());
}
void jctbPattern::setAdcPhase() {
myDet->setSpeed(slsDetectorDefs::ADC_PHASE,eAdcClkPhase->GetNumber());
}
void jctbPattern::setRunPhase() {
myDet->setSpeed(slsDetectorDefs::PHASE_SHIFT,eRunClkPhase->GetNumber());
}

View File

@ -1,124 +0,0 @@
#ifndef JCTBPATTERN_H
#define JCTBPATTERN_H
#include <TGFrame.h>
#define NLOOPS 3
#define NWAITS 3
#define NADCS 32
#define PATLEN 1024
class TRootEmbeddedCanvas;
class TGButtonGroup;
class TGVerticalFrame;
class TGHorizontalFrame;
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TH2F;
class TGComboBox;
class TGCheckButton;
class THStack;
class TGraphErrors;
class energyCalibration;
class TGTextButton;
class TGTab;
class multiSlsDetector;
#include <string>
using namespace std;
class jctbLoop : public TGHorizontalFrame {
private:
TGNumberEntry *eLoopStartAddr;
TGNumberEntry *eLoopStopAddr;
TGNumberEntry *eLoopNumber;
int id;
multiSlsDetector *myDet;
public:
jctbLoop(TGGroupFrame *page, int i,multiSlsDetector *det);
void setNLoops();
void update();
ClassDef(jctbLoop,0)
};
class jctbWait : public TGHorizontalFrame {
private:
TGNumberEntry *eWaitAddr;
TGNumberEntry *eWaitTime;
int id;
multiSlsDetector *myDet;
public:
jctbWait(TGGroupFrame *page, int i,multiSlsDetector *det);
void setWaitTime();
void update();
ClassDef(jctbWait,0)
};
class jctbPattern : public TGGroupFrame {
private:
TGNumberEntry *eAdcClkFreq;
TGNumberEntry *eRunClkFreq;
TGNumberEntry *eAdcClkPhase;
TGNumberEntry *eRunClkPhase;
TGNumberEntry *eStartAddr;
TGNumberEntry *eStopAddr;
TGNumberEntry *eFrames;
TGNumberEntry *ePeriod;
jctbLoop *eLoop[NLOOPS];
jctbWait *eWait[NWAITS];
char pat[PATLEN*8];
multiSlsDetector *myDet;
public:
jctbPattern(TGVerticalFrame *page, multiSlsDetector *det);
void update();
void setAdcFreq();
void setRunFreq();
void setAdcPhase();
void setRunPhase();
void setFrames();
void setPeriod();
ClassDef(jctbPattern,0)
};
#endif

View File

@ -1,186 +0,0 @@
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <TColor.h>
#include <TGColorSelect.h>
#include "jctbSignal.h"
#include "multiSlsDetector.h"
using namespace std;
jctbSignal::jctbSignal(TGFrame *page, int i, multiSlsDetector *det)
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
TGHorizontalFrame *hframe=this;
char tit[100];
sprintf(tit, "BIT%d ",id);
sLabel= new TGLabel(hframe, tit);
hframe->AddFrame( sLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sLabel->MapWindow();
sLabel->SetTextJustify(kTextLeft);
sOutput= new TGCheckButton(hframe, "Out");
hframe->AddFrame( sOutput,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sOutput->MapWindow();
sOutput->Connect("Toggled(Bool_t)","jctbSignal",this,"ToggledOutput(Bool_t)");
sClock= new TGCheckButton(hframe, "Clk");
hframe->AddFrame( sClock,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sClock->MapWindow();
sClock->Connect("Toggled(Bool_t)","jctbSignal",this,"ToggledClock(Bool_t)");
sPlot= new TGCheckButton(hframe, "Plot");
hframe->AddFrame( sPlot,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sPlot->MapWindow();
sPlot->Connect("Toggled(Bool_t)","jctbSignal",this,"ToggledPlot(Bool_t)");
fColorSel = new TGColorSelect(hframe, id+1, 0);
hframe->AddFrame(fColorSel, new TGLayoutHints(kLHintsTop |
kLHintsLeft, 2, 0, 2, 2));
fColorSel->SetColor(TColor::Number2Pixel(id+1));
ToggledOutput(kFALSE);
if (id==63) {
sOutput->SetOn(kTRUE);
sClock->SetOn(kFALSE);
sOutput->SetEnabled(kFALSE);
sClock->SetEnabled(kFALSE);
}
}
int jctbSignal::setSignalAlias(char *tit, int plot, int col) {
if (tit)
sLabel->SetText(tit);
if (plot>0) {
sPlot->SetOn(kTRUE,kTRUE);
} else if (plot==0)
sPlot->SetOn(kFALSE,kTRUE);
if (col>=0)
fColorSel->SetColor(col);//TColor::Number2Pixel(col+1));
fColorSel->SetEnabled(sPlot->IsOn());
return 0;
}
string jctbSignal::getSignalAlias() {
ostringstream oss;
oss << "BIT" << dec << id << " " << sLabel->GetText()->Data() << " " << sPlot->IsOn() << hex << " " << fColorSel->GetColor() << endl;
return oss.str();
}
int jctbSignal::setOutput(Long64_t r) {
// cout << hex << r << dec <<endl;
Long64_t mask=((Long64_t)1<<id);
if (r&mask)
sOutput->SetOn(kTRUE,kTRUE);
else
sOutput->SetOn(kFALSE,kTRUE);
return sOutput->IsOn();
}
int jctbSignal::setClock(Long64_t r) {
Long64_t mask=((Long64_t)1<<id);
// cout << hex << r << dec <<endl;
if (r&mask)
sClock->SetOn(kTRUE,kTRUE);
else
sClock->SetOn(kFALSE,kTRUE);
return sClock->IsOn();
}
int jctbSignal::isClock() { sClock->IsOn();}
int jctbSignal::isOutput() { sOutput->IsOn();}
int jctbSignal::isPlot() { sPlot->IsOn();}
void jctbSignal::ToggledOutput(Bool_t b) {
Long_t mask=b<<id;
ToggledSignalOutput(b<<id);
if (b) {
sClock->SetEnabled(kTRUE);
sPlot->SetEnabled(kTRUE);
if ( sPlot->IsOn())
fColorSel->SetEnabled(kTRUE);
else
fColorSel->SetEnabled(kFALSE);
} else {
sClock->SetEnabled(kFALSE);
sPlot->SetEnabled(kFALSE);
fColorSel->SetEnabled(kFALSE);
}
}
void jctbSignal::ToggledClock(Bool_t b){
Long_t mask=b<<id;
ToggledSignalClock(mask);
}
void jctbSignal::ToggledPlot(Bool_t b){
Long_t mask=b<<id;
ToggledSignalPlot(mask);
fColorSel->SetEnabled(b);
}
void jctbSignal::ToggledSignalOutput(Int_t b) {
Emit("ToggledSignalOutput(Int_t)", id);
}
void jctbSignal::ToggledSignalClock(Int_t b){
Emit("ToggledSignalClock(Int_t)", id);
}
void jctbSignal::ToggledSignalPlot(Int_t b){
Emit("ToggledSignalPlot(Int_t)", id);
}

View File

@ -1,71 +0,0 @@
#ifndef JCTBSIGNAL_H
#define JCTBSIGNAL_H
#include <TGFrame.h>
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
class TH1I;
class TGTextButton;
class TGColorSelect;
class multiSlsDetector;
#include <string>
using namespace std;
class jctbSignal : public TGHorizontalFrame {
// RQ_OBJECT("jctbSignal")
private:
TGLabel *sLabel;
TGCheckButton *sOutput;
TGCheckButton *sClock;
TGCheckButton *sPlot;
TGLabel *sValue;
TGNumberEntry *sEntry;
TGColorSelect *fColorSel;
multiSlsDetector *myDet;
Int_t id;
TH1I *hsig;
public:
jctbSignal(TGFrame *page, int i, multiSlsDetector *det);
int setSignalAlias(char *tit, int plot, int col);
string getSignalAlias();
TH1I *getPlot() {return hsig;};
int setOutput(Long64_t);
int setClock(Long64_t);
void ToggledOutput(Bool_t);
void ToggledClock(Bool_t);
void ToggledPlot(Bool_t);
int isClock();
int isOutput();
int isPlot();
void ToggledSignalOutput(Int_t); //*SIGNAL*
void ToggledSignalClock(Int_t); //*SIGNAL*
void ToggledSignalPlot(Int_t); //*SIGNAL*
ClassDef(jctbSignal,0)
};
#endif

View File

@ -1,257 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <THStack.h>
#include <TGTab.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "jctbSignals.h"
#include "jctbSignal.h"
#include "multiSlsDetector.h"
using namespace std;
#define DEFAULTFN "run_0.encal"
jctbSignals::jctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
cout << "window mapped " << endl;
TGHorizontalFrame *hframe;
char tit[100];
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hhframe->MapWindow();
TGVerticalFrame *vframe;
int idac=0;
for (idac=0; idac<NIOSIGNALS; idac++) {
if (idac%27==0) {
vframe=new TGVerticalFrame(hhframe, 400,800);
hhframe->AddFrame(vframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
vframe->MapWindow();
}
signals[idac]=new jctbSignal(vframe,idac,myDet);
signals[idac]->Connect(" ToggledSignalOutput(Int_t)","jctbSignals",this,"ToggledOutReg(Int_t)");
signals[idac]->Connect(" ToggledSignalClock(Int_t)","jctbSignals",this,"ToggledClockReg(Int_t)");
signals[idac]->Connect(" ToggledSignalPlot(Int_t)","jctbSignals",this,"ToggledPlot(Int_t)");
vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
signals[idac]->MapWindow();
}
idac=63;
signals[idac]=new jctbSignal(vframe,idac,myDet);
vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
signals[idac]->MapWindow();
sprintf(tit,"ADC Latch");
signals[idac]->setSignalAlias(tit,-1,-1);
signals[idac]->Connect(" ToggledSignalOutput(Int_t)","jctbSignals",this,"ToggledOutReg(Int_t)");
signals[idac]->Connect(" ToggledSignalClock(Int_t)","jctbSignals",this,"ToggledClockReg(Int_t)");
signals[idac]->Connect(" ToggledSignalPlot(Int_t)","jctbSignals",this,"ToggledPlot(Int_t)");
hframe=new TGHorizontalFrame(vframe, 800,50);
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
TGLabel *label= new TGLabel(hframe, "IO Control Register");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eIOCntrlRegister = new TGNumberEntry(hframe, 0, 16,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame(eIOCntrlRegister,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eIOCntrlRegister->MapWindow();
eIOCntrlRegister->Resize(150,30);
hframe=new TGHorizontalFrame(vframe, 800,50);
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
label= new TGLabel(hframe, "Clock Control Register");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eClkCntrlRegister = new TGNumberEntry(hframe, 0, 16,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame(eClkCntrlRegister,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eClkCntrlRegister->MapWindow();
eClkCntrlRegister->Resize(150,30);
eIOCntrlRegister->SetState(kFALSE);
eClkCntrlRegister->SetState(kFALSE);
}
int jctbSignals::setSignalAlias(string line) {
int is=-1, plot=0, col=-1;
char tit[100];
int narg=sscanf(line.c_str(),"BIT%d %s %d %d",&is,tit,&plot,&col);
if (narg<2)
return -1;
if (is>=0 && is<NIOSIGNALS) {
signals[is]->setSignalAlias(tit,plot,col);
}
return is;
}
string jctbSignals::getSignalAlias() {
ostringstream oss;
for (int is=0; is<NIOSIGNALS; is++)
oss << signals[is]->getSignalAlias() << endl;
return oss.str();
}
void jctbSignals::update() {
Long64_t oreg=myDet->setCTBWord(-1,-1);
Long64_t creg=myDet->setCTBWord(-2,-1);
char val[1000];
cout << hex << oreg << dec << endl;
cout << hex << creg << dec << endl;
sprintf(val,"%llX",oreg);
// eIOCntrlRegister->SetHexNumber(oreg);
eIOCntrlRegister->SetText(val);
sprintf(val,"%llX",creg);
// eClkCntrlRegister->SetHexNumber(creg);
eClkCntrlRegister->SetText(val);
for (int idac=0; idac<NIOSIGNALS; idac++) {
signals[idac]->setOutput(oreg);
signals[idac]->setClock(creg);
}
}
void jctbSignals::ToggledOutReg(Int_t mask) {
char val[1000];
Long64_t oreg=myDet->setCTBWord(-1,-1);
Long64_t m=((Long64_t)1)<<mask;
if (signals[mask]->isOutput())
oreg|=m;
else
oreg&=~m;
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
myDet->setCTBWord(-1,oreg);
oreg=myDet->setCTBWord(-1,-1);
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
sprintf(val,"%llX",oreg);
// eIOCntrlRegister->SetHexNumber(oreg);
eIOCntrlRegister->SetText(val);
// eIOCntrlRegister->SetNumber(oreg);
}
void jctbSignals::ToggledClockReg(Int_t mask){
char val[1000];
Long64_t oreg=myDet->setCTBWord(-2,-1);
Long64_t m=((Long64_t)1)<<mask;
if (signals[mask]->isClock())
oreg|=m;
else
oreg&=~m;
cout << hex << "clkreg " << oreg << endl;
myDet->setCTBWord(-2,oreg);
oreg=myDet->setCTBWord(-2,-1);
sprintf(val,"%llX",oreg);
// eIOCntrlRegister->SetHexNumber(oreg);
eClkCntrlRegister->SetText(val);
}
void jctbSignals::ToggledPlot(Int_t mask) {
if (signals[mask]->isPlot())
cout << "plot signal " << mask << endl;
else
cout << "unplot signal " << mask << endl;
}

View File

@ -1,44 +0,0 @@
#ifndef JCTBSIGNALS_H
#define JCTBSIGNALS_H
#include <TGFrame.h>
#define NSIGNALS 64
#define NIOSIGNALS 52
#define ADCLATCH 63
class TGNumberEntry;
class multiSlsDetector;
class jctbSignal;
#include <string>
using namespace std;
class jctbSignals : public TGGroupFrame {
private:
jctbSignal *signals[NSIGNALS];
TGNumberEntry *eIOCntrlRegister;
TGNumberEntry *eClkCntrlRegister;
multiSlsDetector *myDet;
public:
jctbSignals(TGVerticalFrame *page, multiSlsDetector *det);
int setSignalAlias(string line);
string getSignalAlias();
void update();
void ToggledOutReg(Int_t);
void ToggledClockReg(Int_t);
void ToggledPlot(Int_t);
ClassDef(jctbSignals,0)
};
#endif