mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer
This commit is contained in:
commit
5b8e4f6c72
@ -38,7 +38,7 @@
|
||||
#include "Mythen3_01_jctbData.h"
|
||||
#include "Mythen3_02_jctbData.h"
|
||||
#include "adcSar2_jctbData.h"
|
||||
#include "moench04CtbReceiverData.h"
|
||||
#include "moench04CtbZmqData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
|
||||
@ -299,7 +299,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(eNumCount,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eNumCount->MapWindow();;
|
||||
eNumCount->SetNumber(64*3);
|
||||
eNumCount->SetNumber(128*3);
|
||||
e= eNumCount->TGNumberEntry::GetNumberEntry();
|
||||
eNumCount->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeNumberOfChannels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeNumberOfChannels()");
|
||||
@ -633,8 +633,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
// mgAdcs=new TMultiGraph();
|
||||
// bitStack=new THStack();
|
||||
bitStack=adcStack;
|
||||
bitStack=new THStack();
|
||||
// bitStack=adcStack;
|
||||
TH1F *hb;
|
||||
for (int i=0; i<NSIGNALS; i++) {
|
||||
sprintf(tit,"bit%d",i);
|
||||
@ -670,7 +670,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
photonFinder=NULL;
|
||||
h2DMap=NULL;
|
||||
h2DMapAn=NULL;
|
||||
h2DMapDig=NULL;
|
||||
//h2Scan=NULL;
|
||||
h1DMap=NULL;
|
||||
|
||||
@ -901,86 +902,46 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
uint16_t aval;
|
||||
i=0;
|
||||
for (ip=0; ip<nAnalogSamples; ip++) {
|
||||
for (ii=0; ii<nadc; ii++) {
|
||||
//for (ip=0; ip<adclist.size(); ip++) {
|
||||
|
||||
|
||||
char *d_data= data->cvalues+2*nadc*nAnalogSamples;
|
||||
char dval;
|
||||
|
||||
|
||||
if (dataStructure) {
|
||||
|
||||
|
||||
for (int x=0; x<nx; x++) {
|
||||
for (int y=0; y<ny; y++) {
|
||||
ped=0;
|
||||
aval=dataStructure->getValue(data->cvalues,x,y);
|
||||
|
||||
if (adclist.empty())
|
||||
ig=ii;
|
||||
else
|
||||
ig=adclist.at(ii);
|
||||
|
||||
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
||||
|
||||
// cout << "asample " << ip << " adc " << ig << " " << i << " " << aval << endl;
|
||||
|
||||
ped=0;
|
||||
|
||||
|
||||
|
||||
if (dataStructure) {
|
||||
dataStructure->getPixel(i,x,y);
|
||||
|
||||
|
||||
|
||||
if (cbGetPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
photonFinder->addToPedestal(aval,x,y);
|
||||
}
|
||||
}
|
||||
|
||||
if (plotFlag[ig]) {
|
||||
|
||||
if (cbSubtractPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
ped=photonFinder->getPedestal(x,y,cmSub);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//normal filling except when deserializer
|
||||
if (h2DMap)
|
||||
h2DMap->SetBinContent(x+1,y+1,aval-ped);
|
||||
if (h1DMap){
|
||||
h1DMap->SetBinContent(x+1,aval-ped);
|
||||
// cout << "plotting 1D " << endl;
|
||||
}
|
||||
// if (h2Scan) {
|
||||
// //cout << "plotting Scan " << endl;
|
||||
// h2Scan->SetBinContent((x+1)+y*nx,iScanStep+1,data->getChannel(i)-ped);
|
||||
// } else
|
||||
// cout << "No scan (analog)" << endl;
|
||||
if (cbSubtractPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
ped=photonFinder->getPedestal(x,y,cmSub);
|
||||
}
|
||||
}
|
||||
if (h2DMapAn)
|
||||
h2DMapAn->SetBinContent(x+1,y+1,aval-ped);
|
||||
|
||||
|
||||
|
||||
|
||||
if (h2DMapDig)
|
||||
h2DMapDig->SetBinContent(x+1,y+1,dataStructure->getGain(data->cvalues,x,y));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//if (enableFlag[ig]) {
|
||||
h=adcHisto[ig];
|
||||
h1=countsHisto[ig];
|
||||
//}
|
||||
|
||||
if (plotFlag[ig]) {
|
||||
// cout << data->getChannel(i) << endl;
|
||||
h->SetBinContent(ip+1,aval-ped);
|
||||
h1->Fill(aval-ped);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char *d_data= data->cvalues+2*nadc*nAnalogSamples;
|
||||
char dval;
|
||||
|
||||
|
||||
/**** Digital Samples ****/
|
||||
|
||||
|
||||
|
||||
} else
|
||||
if (deserializer) {
|
||||
cout << "deserializer"<< endl;
|
||||
if (dbitlist.empty())
|
||||
val=deserializer::deserializeAll(d_data,plotlist,dr,nx,soff);//dataStructure->getData(d_data);
|
||||
else
|
||||
@ -988,168 +949,210 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
|
||||
if (val) {
|
||||
// if (h2DMap) {
|
||||
// for (x=0; x<nx; x++) {
|
||||
// for (y=0; y<ny; y++) {
|
||||
// h2DMap->SetBinContent(x+1,y+1,val[y][x]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (h1DMap){
|
||||
for (x=0; x<nx; x++) {
|
||||
h1DMap->SetBinContent(x+1,val[x]);
|
||||
// cout << dec << x << " " << val[0][x] << endl;
|
||||
}
|
||||
}
|
||||
// if (h2Scan) {
|
||||
// for (x=0; x<nx; x++) {
|
||||
// for (y=0; y<ny; y++) {
|
||||
// //cout << "plotting Scan " << (x+1)+y*nx << " " << iScanStep+1 << " " << val[y][x] << endl;
|
||||
// h2Scan->SetBinContent((x+1)+y*nx,iScanStep+1,val[y][x]);
|
||||
// }
|
||||
// }
|
||||
// } else
|
||||
// cout << "No scan (digital)" << endl;
|
||||
|
||||
|
||||
delete [] val;
|
||||
} else
|
||||
cout << "get val did not succeed"<<endl;
|
||||
}
|
||||
} else {
|
||||
cout << "analog histo " << endl;
|
||||
for (ip=0; ip<nAnalogSamples; ip++) {
|
||||
for (ii=0; ii<nadc; ii++) {
|
||||
//for (ip=0; ip<adclist.size(); ip++) {
|
||||
if (adclist.empty())
|
||||
ig=ii;
|
||||
else
|
||||
ig=adclist.at(ii);
|
||||
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
||||
|
||||
if (plotFlag[ig]) {
|
||||
|
||||
//if (enableFlag[ig]) {
|
||||
h=adcHisto[ig];
|
||||
h1=countsHisto[ig];
|
||||
//}
|
||||
|
||||
// cout << data->getChannel(i) << endl;
|
||||
h->SetBinContent(ip+1,aval);
|
||||
h1->Fill(aval);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
cout << "bit histo"<< endl;
|
||||
|
||||
|
||||
|
||||
if (dbitlist.empty()) {
|
||||
for (ip=0; ip<nDigitalSamples; ip++) {
|
||||
for (ig=0; ig<8; ig++) {
|
||||
|
||||
dval=*(d_data+ip*8+ig);
|
||||
|
||||
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
|
||||
// cout << "dsample " << ip << " bit " << ib << endl;
|
||||
// cout << "Bit number " << ib << endl;
|
||||
if (bitPlotFlag[ib]) {
|
||||
hb=bitHisto[ib];
|
||||
// if (bitStack->GetHists()->Contains(hb)==0) cout << "ERROR!" << endl;
|
||||
//#define ADCSAR2
|
||||
// #ifdef ADCSAR2
|
||||
// if (ib==0) vv1=dval;
|
||||
// if (ib==16) vv2=dval;
|
||||
// cout << ib << " " << hex << vv << dec << endl;
|
||||
// #endif
|
||||
if (dbitlist.empty()) {
|
||||
for (ip=0; ip<nDigitalSamples; ip++) {
|
||||
for (ig=0; ig<8; ig++) {
|
||||
|
||||
dval=*(d_data+ip*8+ig);
|
||||
|
||||
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
|
||||
if (bitPlotFlag[ib]) {
|
||||
hb=bitHisto[ib];
|
||||
if (dval&(1<<(ib%8)))
|
||||
hb->SetBinContent(ip+1,1+bitOffset[ib]);
|
||||
else
|
||||
hb->SetBinContent(ip+1,bitOffset[ib]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #ifdef ADCSAR2
|
||||
// //this is a deserializer similar to MYTHEN!
|
||||
// hb=bitHisto[0];
|
||||
// int adcvalue=0;
|
||||
// // int startbit= ig;
|
||||
// for (int jj=0;jj<8;jj++){
|
||||
// adcvalue=adcvalue+ (((vv1>>(jj*2)) & 0x1)<<(jj));
|
||||
// }
|
||||
// for (int jj=0;jj<4;jj++){
|
||||
// adcvalue=adcvalue+ (((vv2>>(jj*2)) & 0x1)<<(jj+8));
|
||||
// }
|
||||
// hb->SetBinContent(ip+1, adcvalue);
|
||||
// printf(" %d 0x%x 0x%x adc=%d \n", i, vv1, vv2, adcvalue);
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ii=0;
|
||||
int iii=0;
|
||||
int nb=dbitlist.size();
|
||||
for (const auto &value : dbitlist) {
|
||||
ib=value;
|
||||
hb=bitHisto[ib];
|
||||
cout << dec <<endl << "Bit " << ib << " " << (nDigitalSamples-dBitOffset)/8 << endl;
|
||||
iii=0;
|
||||
for (ip=0; ip<(nDigitalSamples-dBitOffset)/8; ip++) {
|
||||
if (bitPlotFlag[ib]) {
|
||||
dval=*(d_data+ii*nDigitalSamples/8+ip);
|
||||
|
||||
for (int jj=0; jj<8; jj++) {
|
||||
if (dval&(1<<jj))
|
||||
hb->SetBinContent(iii,1+bitOffset[ib]);
|
||||
else
|
||||
hb->SetBinContent(iii,bitOffset[ib]);
|
||||
iii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
} else {
|
||||
ii=0;
|
||||
int iii=0;
|
||||
int nb=dbitlist.size();
|
||||
for (const auto &value : dbitlist) {
|
||||
ib=value;
|
||||
hb=bitHisto[ib];
|
||||
// cout << dec <<endl << "Bit " << ib << " " << (nDigitalSamples-dBitOffset)/8 << endl;
|
||||
iii=0;
|
||||
for (ip=0; ip<(nDigitalSamples-dBitOffset)/8; ip++) {
|
||||
if (bitPlotFlag[ib]) {
|
||||
dval=*(d_data+ii*nDigitalSamples/8+ip);
|
||||
|
||||
for (int jj=0; jj<8; jj++) {
|
||||
if (dval&(1<<jj))
|
||||
hb->SetBinContent(iii,1+bitOffset[ib]);
|
||||
else
|
||||
hb->SetBinContent(iii,bitOffset[ib]);
|
||||
iii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Draw();
|
||||
// iScanStep++;
|
||||
if (photonFinder)
|
||||
photonFinder->newFrame();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbAcquisition::Draw(){
|
||||
if (globalPlot) {
|
||||
// TThread::Lock();
|
||||
cout << "Draw" << endl;
|
||||
if (myCanvas && globalPlot!=0) {
|
||||
myCanvas->cd();
|
||||
myCanvas->Modified();
|
||||
myCanvas->Update();
|
||||
if (myCanvas) {
|
||||
if (adcPlot && dbitPlot) {
|
||||
|
||||
myCanvas->cd(1);
|
||||
// myCanvas->Modified();
|
||||
// myCanvas->Update();
|
||||
gPad->Modified();
|
||||
gPad->Update();
|
||||
|
||||
myCanvas->cd(2);
|
||||
// myCanvas->Modified();
|
||||
// myCanvas->Update();
|
||||
gPad->Modified();
|
||||
gPad->Update();
|
||||
|
||||
} else {
|
||||
|
||||
myCanvas->cd();
|
||||
myCanvas->Modified();
|
||||
myCanvas->Update();
|
||||
|
||||
}
|
||||
}
|
||||
// TThread::UnLock();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//here!!
|
||||
void ctbAcquisition::changePlot(){
|
||||
if (rbPlotOff->IsOn()) {
|
||||
globalPlot=0;
|
||||
adcPlot=0;
|
||||
dbitPlot=0;
|
||||
} else {
|
||||
globalPlot=0;
|
||||
adcPlot=0;
|
||||
dbitPlot=0;
|
||||
for (int ii=0; ii<NADCS; ii++)
|
||||
if (plotFlag[ii]==1) globalPlot=1;
|
||||
if (plotFlag[ii]==1) adcPlot=1;
|
||||
for (int ii=0; ii<NSIGNALS; ii++)
|
||||
if (bitPlotFlag[ii]==1) globalPlot=1;
|
||||
if (bitPlotFlag[ii]==1) dbitPlot=1;
|
||||
}
|
||||
|
||||
globalPlot=adcPlot || dbitPlot;
|
||||
|
||||
if (globalPlot!=0 && myCanvas) {
|
||||
if (rbWaveform->IsOn())
|
||||
if (adcStack)
|
||||
adcStack->Draw("NOSTACK");
|
||||
if (adcPlot && dbitPlot) {
|
||||
if (myCanvas->GetPad(1)==NULL || myCanvas->GetPad(2)==NULL) {
|
||||
myCanvas->Clear();
|
||||
myCanvas->Divide(1,2);
|
||||
} else
|
||||
cout << "Pad already there" << endl;
|
||||
myCanvas->cd(1);
|
||||
} else {
|
||||
myCanvas->Clear();
|
||||
// myCanvas->Divide(1,1);
|
||||
myCanvas->cd();
|
||||
}
|
||||
|
||||
if (adcPlot) {
|
||||
if (rbWaveform->IsOn())
|
||||
if (adcStack)
|
||||
adcStack->Draw("NOSTACK");
|
||||
else
|
||||
cout << "adcStack is NULL" << endl;
|
||||
else if (rbDistribution->IsOn())
|
||||
if (countsStack)
|
||||
countsStack->Draw("NOSTACK");
|
||||
else
|
||||
cout << "countsStack is NULL" << endl;
|
||||
else if (rb2D->IsOn()) {
|
||||
if (h2DMapAn)
|
||||
h2DMapAn->Draw("colz");
|
||||
else if (h1DMap)
|
||||
h1DMap->Draw();
|
||||
else
|
||||
cout << "h2DMap and h1DMap are NULL" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (dbitPlot) {
|
||||
if (adcPlot)
|
||||
myCanvas->cd(2);
|
||||
if (rb2D->IsOn()) {
|
||||
if (h2DMapDig)
|
||||
h2DMapDig->Draw("colz");
|
||||
} else if (bitStack)
|
||||
bitStack->Draw("NOSTACK");
|
||||
else
|
||||
cout << "adcStack is NULL" << endl;
|
||||
else if (rbDistribution->IsOn())
|
||||
if (countsStack)
|
||||
countsStack->Draw("NOSTACK");
|
||||
else
|
||||
cout << "countsStack is NULL" << endl;
|
||||
else if (rb2D->IsOn()) {
|
||||
if (h2DMap)
|
||||
h2DMap->Draw("colz");
|
||||
else if (h1DMap)
|
||||
h1DMap->Draw();
|
||||
else
|
||||
cout << "h2DMap and h1DMap are NULL" << endl;
|
||||
} // else if (rbScan->IsOn()) {
|
||||
cout << "bitStack is NULL" << endl;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// else if (rbScan->IsOn()) {
|
||||
// if (h2Scan)
|
||||
// h2Scan->Draw("colz");
|
||||
// else
|
||||
// cout << "h2Scan is NULL" << endl;
|
||||
// }
|
||||
}
|
||||
Draw();
|
||||
|
||||
Draw();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1158,28 +1161,30 @@ void ctbAcquisition::changePlot(){
|
||||
|
||||
void ctbAcquisition::changeDetector(){
|
||||
// cout << "change detector " << i << " old " << cbDetType->GetSelected() << endl;
|
||||
|
||||
if (dataStructure) delete dataStructure;
|
||||
if (commonMode) delete commonMode;
|
||||
if (photonFinder) delete photonFinder;
|
||||
if (h2DMap) delete h2DMap;
|
||||
|
||||
if (dataStructure) delete dataStructure;
|
||||
if (commonMode) delete commonMode;
|
||||
if (photonFinder) delete photonFinder;
|
||||
if (h2DMapAn) delete h2DMapAn;
|
||||
if (h2DMapDig) delete h2DMapDig;
|
||||
if (h1DMap) delete h1DMap;
|
||||
// if (h2Scan) delete h2Scan;
|
||||
h2DMap=NULL;
|
||||
h2DMapAn=NULL;
|
||||
h2DMapDig=NULL;
|
||||
h1DMap=NULL;
|
||||
// h2Scan=NULL;
|
||||
photonFinder=NULL;
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
TH2F *h2DMapOld=h2DMap;
|
||||
TH2F *h2DMapOld=h2DMapAn;
|
||||
// TH2F *h2ScanOld=h2Scan;
|
||||
TH1F *h1DMapOld=h1DMap;
|
||||
int dim=2;
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
commonModeSubtraction* cm=0;
|
||||
eNumCount->SetState(kFALSE);
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
commonModeSubtraction* cm=0;
|
||||
eNumCount->SetState(kFALSE);
|
||||
eDynRange->SetState(kFALSE);
|
||||
eSerOff->SetState(kFALSE);
|
||||
deserializer=0;
|
||||
@ -1187,12 +1192,12 @@ void ctbAcquisition::changeDetector(){
|
||||
switch (cbDetType->GetSelected()) {
|
||||
case DESERIALIZER:
|
||||
deserializer=1;
|
||||
// cout << "DESERIALIZER!" << endl;
|
||||
cout << "DESERIALIZER!" << endl;
|
||||
// dataStructure=new moench03T1CtbData();
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
dataStructure=new moench04CtbReceiverData();
|
||||
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
@ -1263,6 +1268,9 @@ void ctbAcquisition::changeDetector(){
|
||||
if (deserializer) {
|
||||
ny=1;
|
||||
nx=eNumCount->GetIntNumber();
|
||||
eNumCount->SetState(kTRUE);
|
||||
eDynRange->SetState(kTRUE);
|
||||
eSerOff->SetState(kTRUE);
|
||||
}
|
||||
// cout << "h size is " << nx << " " << ny << endl;
|
||||
int ymax=ny, xmax=nx;
|
||||
@ -1271,9 +1279,14 @@ void ctbAcquisition::changeDetector(){
|
||||
cout << "*** " << nx << " " << ny << endl;
|
||||
if (rb2D->IsOn()) {
|
||||
if (ny>1) {
|
||||
h2DMap=new TH2F("h2dmap","",nx,0,xmax,ny,0,ymax);
|
||||
h2DMap->SetStats(kFALSE);
|
||||
cout << "Created h2DMap"<< endl;
|
||||
h2DMapAn=new TH2F("h2dmapAn","",nx,0,xmax,ny,0,ymax);
|
||||
h2DMapAn->SetStats(kFALSE);
|
||||
cout << "Created h2DMapAn"<< endl;
|
||||
if (dbitPlot && adcPlot){
|
||||
h2DMapDig=new TH2F("h2dmapDig","",nx,0,xmax,ny,0,ymax);
|
||||
h2DMapDig->SetStats(kFALSE);
|
||||
cout << "Created h2DMapDig"<< endl;
|
||||
}
|
||||
} else {
|
||||
h1DMap=new TH1F("h1dmap","",nx,0,xmax);
|
||||
h1DMap->SetStats(kFALSE);
|
||||
@ -1598,8 +1611,10 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
for (int i=0; i<NSIGNALS; i++) {
|
||||
bitHisto[i]->Reset();
|
||||
}
|
||||
cout << "reset 2d" << endl;;
|
||||
if (h2DMap) h2DMap->Reset();
|
||||
cout << "reset 2d an" << endl;;
|
||||
if (h2DMapAn) h2DMapAn->Reset();
|
||||
cout << "reset 2d dig" << endl;;
|
||||
if (h2DMapDig) h2DMapDig->Reset();
|
||||
cout << "reset 1d" << endl;;
|
||||
if (h1DMap) h1DMap->Reset();
|
||||
cout << "done" << endl;;
|
||||
@ -1953,42 +1968,44 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeSerialOffset(){
|
||||
if (dataStructure) {
|
||||
// if (dataStructure) {
|
||||
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
cout << "settings offsets for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
// // cout << cbDetType->GetSelected()<< endl;
|
||||
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// // cout << "settings offsets for MYTHEN" << endl;
|
||||
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// // ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
|
||||
}
|
||||
}
|
||||
// // }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeDynamicRange(){
|
||||
if (dataStructure) {
|
||||
// if (dataStructure) {
|
||||
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
cout << "settings dynamic range for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
ms->setDynamicRange(eDynRange->GetIntNumber());
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings dynamic range for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setDynamicRange(eDynRange->GetIntNumber());
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
if (dataStructure) {
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
cout << "settings number of channels for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings number of channels for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
if (deserializer)
|
||||
changePlot();
|
||||
};
|
||||
|
||||
|
||||
@ -2023,9 +2040,9 @@ void ctbAcquisition::ChangeHistoLimitsPedSub(){
|
||||
if (cMinMaxPedSub->IsOn()) {
|
||||
adcStack->SetMaximum( eMaxPedSub->GetNumber());
|
||||
adcStack->SetMinimum( eMinPedSub->GetNumber());
|
||||
if (h2DMap) {
|
||||
h2DMap->SetMaximum( eMaxPedSub->GetNumber());
|
||||
h2DMap->SetMinimum( eMinPedSub->GetNumber());
|
||||
if (h2DMapAn) {
|
||||
h2DMapAn->SetMaximum( eMaxPedSub->GetNumber());
|
||||
h2DMapAn->SetMinimum( eMinPedSub->GetNumber());
|
||||
}
|
||||
if (h1DMap) {
|
||||
h1DMap->SetMaximum( eMaxPedSub->GetNumber());
|
||||
@ -2036,11 +2053,11 @@ void ctbAcquisition::ChangeHistoLimitsPedSub(){
|
||||
} else {
|
||||
if (adcStack->GetHistogram())
|
||||
adcStack->GetHistogram()->GetYaxis()->UnZoom();
|
||||
if (h2DMap) {
|
||||
h2DMap->GetZaxis()->UnZoom();
|
||||
if (h2DMapAn) {
|
||||
h2DMapAn->GetZaxis()->UnZoom();
|
||||
}
|
||||
if (h1DMap) {
|
||||
h1DMap->GetYaxis()->UnZoom();
|
||||
h1DMap->GetYaxis()->UnZoom();
|
||||
}
|
||||
if (countsStack->GetHistogram())
|
||||
countsStack->GetHistogram()->GetXaxis()->UnZoom();
|
||||
@ -2061,9 +2078,9 @@ void ctbAcquisition::ChangeHistoLimitsRaw(){
|
||||
if (cMinMaxRaw->IsOn()) {
|
||||
adcStack->SetMaximum( eMaxRaw->GetNumber());
|
||||
adcStack->SetMinimum( eMinRaw->GetNumber());
|
||||
if (h2DMap) {
|
||||
h2DMap->SetMaximum( eMaxRaw->GetNumber());
|
||||
h2DMap->SetMinimum( eMinRaw->GetNumber());
|
||||
if (h2DMapAn) {
|
||||
h2DMapAn->SetMaximum( eMaxRaw->GetNumber());
|
||||
h2DMapAn->SetMinimum( eMinRaw->GetNumber());
|
||||
}
|
||||
if (h1DMap) {
|
||||
h1DMap->SetMaximum( eMaxRaw->GetNumber());
|
||||
@ -2075,8 +2092,8 @@ void ctbAcquisition::ChangeHistoLimitsRaw(){
|
||||
|
||||
if (adcStack->GetHistogram())
|
||||
adcStack->GetHistogram()->GetYaxis()->UnZoom();
|
||||
if (h2DMap) {
|
||||
h2DMap->GetZaxis()->UnZoom();
|
||||
if (h2DMapAn) {
|
||||
h2DMapAn->GetZaxis()->UnZoom();
|
||||
}
|
||||
|
||||
if (h1DMap) {
|
||||
|
@ -20,8 +20,8 @@ class TTimer;
|
||||
class TCanvas;
|
||||
class TH2F;
|
||||
class TH1F;
|
||||
class TGLabel;
|
||||
class TGTextButton;
|
||||
class TGLabel;
|
||||
class TGTextButton;
|
||||
|
||||
class multiSlsDetector;
|
||||
class detectorData;
|
||||
@ -103,7 +103,8 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
|
||||
|
||||
TH2F *h2DMap; // for 2D detectors
|
||||
TH2F *h2DMapAn; // for 2D detectors
|
||||
TH2F *h2DMapDig; // for 2D detectors
|
||||
TH1F *h1DMap; //for 1D detectors
|
||||
|
||||
// TH2F *h2Scan; // for 2D detectors
|
||||
@ -148,6 +149,8 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
char patternCompiler[10000];
|
||||
|
||||
int globalPlot;
|
||||
int adcPlot;
|
||||
int dbitPlot;
|
||||
|
||||
int nAnalogSamples, nDigitalSamples;
|
||||
// int iScanStep;
|
||||
|
@ -126,7 +126,7 @@ void setwaittime(int iloop, uint64_t t) {
|
||||
void pw(){
|
||||
if (iaddr<MAXWORDS)
|
||||
PAT[iaddr]= pat;
|
||||
fprintf(fd,"patword %04x %016llx\n",iaddr, pat);
|
||||
fprintf(fd,"patword 0x%04x 0x%016llx\n",iaddr, pat);
|
||||
iaddr++;
|
||||
if (iaddr>=MAXWORDS) printf("ERROR: too many word in the pattern (%d instead of %d)!",iaddr, MAXWORDS);
|
||||
}
|
||||
@ -154,18 +154,18 @@ main(void) {
|
||||
fd=fopen(OUTFILE,"w");
|
||||
#include INFILE
|
||||
|
||||
fprintf(fd,"patioctrl %016llx\n",iopat);
|
||||
fprintf(fd,"patclkctrl %016llx\n",clkpat);
|
||||
fprintf(fd,"patlimits %04x %04x\n",start, stop);
|
||||
fprintf(fd,"patioctrl 0x%016llx\n",iopat);
|
||||
fprintf(fd,"patclkctrl 0x%016llx\n",clkpat);
|
||||
fprintf(fd,"patlimits 0x%04x 0x%04x\n",start, stop);
|
||||
|
||||
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
||||
fprintf(fd,"patloop%d %04x %04x\n",iloop, startloopaddr[iloop], stoploopaddr[iloop]);
|
||||
fprintf(fd,"patloop%d 0x%04x 0x%04x\n",iloop, startloopaddr[iloop], stoploopaddr[iloop]);
|
||||
if ( startloopaddr[iloop]<0 || stoploopaddr[iloop]<= startloopaddr[iloop]) nloop[iloop]=0;
|
||||
fprintf(fd,"patnloop%d %d\n",iloop, nloop[iloop]);
|
||||
}
|
||||
|
||||
for (iloop=0; iloop<MAXTIMERS; iloop++) {
|
||||
fprintf(fd,"patwait%d %04x\n",iloop, waitaddr[iloop]);
|
||||
fprintf(fd,"patwait%d 0x%04x\n",iloop, waitaddr[iloop]);
|
||||
if (waitaddr[iloop]<0) waittime[iloop]=0;
|
||||
fprintf(fd,"patwaittime%d %lld\n",iloop, waittime[iloop]);
|
||||
}
|
||||
|
276
slsDetectorCalibration/dataStructures/moench04CtbZmqData.h
Normal file
276
slsDetectorCalibration/dataStructures/moench04CtbZmqData.h
Normal file
@ -0,0 +1,276 @@
|
||||
#ifndef MOENCH04ZMQDATA_H
|
||||
#define MOENCH04ZMQDATA_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
int iframe;
|
||||
int nadc;
|
||||
int sc_width;
|
||||
int sc_height;
|
||||
const int aSamples;
|
||||
const int dSamples;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||
(160x160 pixels, 40 packets 1286 large etc.)
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
moench04CtbZmqData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) {
|
||||
|
||||
|
||||
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
|
||||
|
||||
int row, col;
|
||||
|
||||
int isample;
|
||||
int iadc;
|
||||
int ix, iy;
|
||||
|
||||
int npackets=40;
|
||||
int i;
|
||||
int adc4(0);
|
||||
|
||||
for (int is=0; is<aSamples; is++) {
|
||||
|
||||
for (iadc=0; iadc<nadc; iadc++) {
|
||||
i=is;
|
||||
// adc4=(int)iadc/4;
|
||||
if (i<sc_width*sc_height) {
|
||||
// for (int i=0; i<sc_width*sc_height; i++) {
|
||||
col=(adc_nr[iadc]%16)*sc_width+(i%sc_width);
|
||||
// if (adc4%2==0) {
|
||||
if (iadc<16) {
|
||||
row=199-i/sc_width;
|
||||
} else {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){ */
|
||||
/* xmap[ibyte]=-1; */
|
||||
/* ymap[ibyte]=-1; */
|
||||
/* } */
|
||||
/* int off=sizeof(sls_detector_header)/2; */
|
||||
|
||||
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
||||
|
||||
|
||||
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
||||
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
||||
/* i=ipacket*8208/2+ibyte; */
|
||||
/* isample=ii/nadc; */
|
||||
/* if (isample<nSamples) { */
|
||||
/* iadc=ii%nadc; */
|
||||
/* adc4 = (int)iadc/4; */
|
||||
/* ix=isample%sc_width; */
|
||||
/* iy=isample/sc_width; */
|
||||
/* if (adc4%2==0) { */
|
||||
/* xmap[i+off]=adc_nr[iadc]+ix; */
|
||||
/* ymap[i+off]=ny/2-1-iy; */
|
||||
/* } else { */
|
||||
/* xmap[i+off]=adc_nr[iadc]+ix; */
|
||||
/* ymap[i+off]=ny/2+iy; */
|
||||
/* } */
|
||||
/* } */
|
||||
/* ii++; */
|
||||
/* // } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
iframe=0;
|
||||
// cout << "data struct created" << endl;
|
||||
}
|
||||
|
||||
int getGain(char *data, int x, int y) {
|
||||
int aoff=aSamples*2*32;
|
||||
int irow;
|
||||
int isc=x/sc_width;
|
||||
int icol=x%sc_width;
|
||||
if (y<200) irow=sc_height-1-y;
|
||||
else {
|
||||
irow=y-sc_height;
|
||||
isc++;
|
||||
}
|
||||
int ibit[32]={-1,-1,-1,-1,-1,-1,1,3,5,7,-1,-1,-1,-1,-1,-1,62,60,58,56,54,52,50,48,63,61,59,57,55,53,51,49};
|
||||
int isample=irow*sc_width+icol;
|
||||
|
||||
uint64_t sample;
|
||||
char *ptr;
|
||||
if (isc<0 || isc>=32) return 0;
|
||||
if (ibit[isc]<0 || ibit[isc]>=64) return 0;
|
||||
if (dSamples>isample) {
|
||||
ptr=data+aoff+8*isample;
|
||||
sample=*((uint64_t*)ptr);
|
||||
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
|
||||
if (sample & (1<<ibit[isc]))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Returns the frame number for the given dataset. Purely virtual func.
|
||||
\param buff pointer to the dataset
|
||||
\returns frame number
|
||||
|
||||
*/
|
||||
|
||||
/* class jfrau_packet_header_t { */
|
||||
/* public: */
|
||||
/* unsigned char reserved[4]; */
|
||||
/* unsigned char packetNumber[1]; */
|
||||
/* unsigned char frameNumber[3]; */
|
||||
/* unsigned char bunchid[8]; */
|
||||
/* }; */
|
||||
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return iframe;};//((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
/**
|
||||
|
||||
Returns the packet number for the given dataset. purely virtual func
|
||||
\param buff pointer to the dataset
|
||||
\returns packet number number
|
||||
|
||||
|
||||
|
||||
*/
|
||||
//int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
/* /\** */
|
||||
|
||||
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||
/* \param data pointer to the memory to be analyzed */
|
||||
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||
/* \param dsize size of the memory slot to be analyzed */
|
||||
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||
|
||||
/* *\/ */
|
||||
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||
|
||||
|
||||
/* /\** */
|
||||
|
||||
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||
/* \param filebin input file stream (binary) */
|
||||
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||
|
||||
/* *\/ */
|
||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||
/* // int afifo_length=0; */
|
||||
/* uint16_t *afifo_cont; */
|
||||
/* int ib=0; */
|
||||
/* if (filebin.is_open()) { */
|
||||
/* afifo_cont=new uint16_t[dataSize/2]; */
|
||||
/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */
|
||||
/* ib+=2; */
|
||||
/* if (ib==dataSize) break; */
|
||||
/* } */
|
||||
/* if (ib>0) { */
|
||||
/* iframe++; */
|
||||
/* // cout << ib << "-" << endl; */
|
||||
/* return (char*)afifo_cont; */
|
||||
/* } else { */
|
||||
/* delete [] afifo_cont; */
|
||||
/* return NULL; */
|
||||
/* } */
|
||||
/* } */
|
||||
/* return NULL; */
|
||||
/* }; */
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
int ff=-1, np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||
int np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||
char *data=new char[dataSize];
|
||||
char *d=readNextFrame(filebin, ff, np, data);
|
||||
if (d==NULL) {delete [] data; data=NULL;}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
char *retval=0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
np=0;
|
||||
int pn;
|
||||
|
||||
// cout << dataSize << endl;
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, dataSize) ){
|
||||
ff=getFrameNumber(data);
|
||||
// np=getPacketNumber(data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||
\param data pointer to the memory to be analyzed
|
||||
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||
\param dsize size of the memory slot to be analyzed
|
||||
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||
|
||||
*/
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||
if (dsize<dataSize) ndata=dsize;
|
||||
else ndata=dataSize;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -261,6 +261,8 @@ class slsDetectorData {
|
||||
return d^m;
|
||||
};
|
||||
|
||||
virtual int getGain(char *data, int ix, int iy=0){return 0;};
|
||||
|
||||
/**
|
||||
|
||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||
|
Loading…
x
Reference in New Issue
Block a user