This is a short description only - for more details on class definitions and class methods follow the links in the text.
{
gROOT->Macro("LoadPolarLibs.C");
TPolControl * pc = new TPolControl("/dev/ttyS1");
pc->SerIO()->Setup(9600, 7, 0, 1);
pc->SerIO()->Open();
pc->SetSubdevs(0, 1, 2, 3, 4);
pc->ReadNameTable("polNames.dat");
pc->Print();
pc->PrintNameTable();
}
gROOT->Macro("LoadPolarLibs.C");
TPolControl * pc = new TPolControl("/dev/ttyS1");
pc->SerIO()->Setup(9600, 7, 0, 1); pc->SerIO()->Open();
pc->SetSubdevs(0, 1, 2, 3, 4);
pc->ReadNameTable("polNames.dat");
| relative |
pairs of numbers (subdev, channel), subdev as given by pc->SetSubdevs(), channel=0..31 for ADCs, =0..19 for DACs |
| absolute | addr is calculated by subdev*32 + channel |
| by name |
addr will be taken from name table, table entries are ":"-separated strings of the form name:subdevice:channel:type[:comment] Example of a name table file:
# This is a sample name table
ADC0:4:0:A
ADC1:4:1:A
ADC2:4:2:A
ADC3:4:3:A
ADC4:4:4:A
ADC5:4:5:A
DAC0:4:0:D
|
pc->Print(); pc->PrintNameTable();
Polarized Ion Source Control:
-----------------------------------------------------------------
Subdevices : 0 1 2 3 4
ADC Channels : 0:[0..31] 1:[32..63] 2:[64..95] 3:[96..127] 4:[128..159]
DAC Channels : 0:[0..19] 1:[32..51] 2:[64..83] 3:[96..115] 4:[128..147]
Wait states : 500 ms (AV), 500 ms (AR), 500 ms (SD)
RS232 Settings:
-----------------------------------------------------------------
Name : tty1
Port : /dev/ttyS1
State : open
Baud rate : 9600
Number of data bits : 7
Number of stop bits : 1
Parity : none
Terminator #1 : \000
#2 : \000
Handshake : none
Ignore CR : yes
Delay : 0 s
Prefix :
Postfix : \r
Bytes received : 0
Bytes transmitted : 0
Name table (7 entries read from file polNames.dat): ----------------------------------------------------------------------------------- Name Type AbsChn Subdev RelChn ................................................................................... ADC0 A 128 4 0 ADC1 A 129 4 1 ADC2 A 130 4 2 ADC3 A 131 4 3 ADC4 A 132 4 4 ADC5 A 133 4 5 DAC0 D 128 4 0
{
pc->SetDac(4, 0, 1.5);
pc->SetDac(128, 1.5);
pc->SetDac("DAC0", 1.5);
Int_t adcVal;
adcVal = pc->ReadAdc(4, 3);
adcVal = pc->ReadAdc(131);
adcVal = pc->ReadAdc("ADC3");
adcVal = pc->SetDac(4, 0, 1.5, 1);
adcVal = pc->SetDac(128, 1.5, 129);
adcVal = pc->SetDac("DAC0", 1.5, "ADC1");
}
pc->SetDac(4, 0, 1.5); pc->SetDac(128, 1.5); pc->SetDac("DAC0", 1.5);
adcVal = pc->ReadAdc(4, 3); adcVal = pc->ReadAdc(131); adcVal = pc->ReadAdc("ADC3");
adcVal = pc->SetDac(4, 0, 1.5, 1); adcVal = pc->SetDac(128, 1.5, 129); adcVal = pc->SetDac("DAC0", 1.5, "ADC1");
{
TH1F * histo;
histo = pc->Plot("SampleHist", 4, 0, 1, 0.0, 5.0, 0.1, "DAC0", "ADC1");
histo = pc->Plot("SampleHist", 128, 129, 0.0, 5.0, 0.1, "DAC0", "ADC1");
histo = pc->Plot("SampleHist", "DAC0", "ADC1", 0.0, 5.0, 0.1);
histo->Draw();
}
{
TNtuple * ntuple;
ntuple = pc->Monitor("test.root", "Monitor test", "ADC0:ADC1:ADC2:ADC3", 100, 1);
ntuple = pc->Monitor("test.root", "Monitor test", "128:129:130:131", 100, 1);
ntuple = pc->Monitor("test.root", "Monitor test", "4-0:4-1:4-2:4-3", 100, 1);
pc->PrintMonitorLayout();
}
Monitor layout (file test.root): ----------------------------------------------------------------------------------- Name Type AbsChn Subdev RelChn ................................................................................... ADC0 A 128 4 0 ADC1 A 129 4 1 ADC2 A 130 4 2 ADC3 A 131 4 3
{
TNtuple * ntuple;
ntuple = pc->Monitor("test.root");
TArrayF adcData;
UInt_t timeStamp;
for (Int_t i = 0; i < pc->GetNofEntries(); i++) {
Int_t n = pc->GetEntry(i, timeStamp, adcData);
for (Int_t j = 0; j < n; j++) {
cout << "ADC #" << j << " has value " << adcData[j] << endl;
}
}
pc->PrintRecords(0, 9);
}