Commit 74e98049 authored by Stephan Wiederkehr's avatar Stephan Wiederkehr
Browse files

added pulse shape analysis

parent 5592dc65
......@@ -37,4 +37,12 @@ exists, but must be documented...
>`bin/r4stest LOG_FILE_NAME`
The `LOG_FILE_NAME` will overwrite the file if it exists.
\ No newline at end of file
The `LOG_FILE_NAME` will overwrite the file if it exists.
## DTB:
***
In order to make the system recognise the DTB and set the appropriate permissions, create a file in `/etc/udev/rules.d/60-pixel_DTB.rules which should contain:
>`SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="0666"`
where the attribute values can be checked using `lsusb -v`
\ No newline at end of file
......@@ -144,6 +144,10 @@ bool ReadImage(R4sImg &map, bool verbose=true)
return map.CreateRaw(data);
}
bool configure() {
//need to have a function configuring the chip from a file
}
CMD_PROC(getimg)
{
......@@ -184,12 +188,6 @@ CMD_PROC(seqcalscan)
////////// ANALYSIS
// #include "test.h"
// CMD_PROC(test)
// {
// test();
// }
//#include "pixelAlive.h"
#include "TROOT.h"
#include "TH1D.h"
......@@ -207,7 +205,6 @@ CMD_PROC(pixelAlive)
ReadImage(map);
map.Print(200);
TFile *rootFile = new TFile("pixelAlive.root","recreate");
// TH1D *h = new TH1D("h","title",10,0,10);
// h->Fill(1);
......@@ -266,7 +263,7 @@ CMD_PROC(pixelDist) {
}
printf("Done.\n");
//filling the data
//filling the data into the tree
printf("Writing the data into a TTree...");fflush(stdout);
for (int j=0;j<IMG_HEIGHT*IMG_WIDTH;j++)
{
......@@ -284,3 +281,58 @@ CMD_PROC(pixelDist) {
tPixDist->Write();
rootFile->Close();
}
//pulse shape analysis
CMD_PROC(pulseShape) {
int calX,calY;
PAR_INT(calX,0,255)
PAR_INT(calY,0,255)
TFile *rootFile = new TFile("pulseShape.root","recreate");
TTree *tPulseShape = new TTree("pulseShape","pulseShape");
int col(0),row(0),hold(0),value(0);
tPulseShape->Branch("col",&col,"col/I");
tPulseShape->Branch("row",&row,"row/I");
tPulseShape->Branch("hold",&hold,"hold/I");
tPulseShape->Branch("value",&value,"value/I");
std::vector< std::vector<int> > data;
R4sImg map;
const unsigned int hold_max = 255;
//get the data
printf("Setting cal for pixel x:%d y:%d\n",calX,calY);
tb.r4s_SetPixCal(calX, calY);
printf("Taking data...");fflush(stdout);
for (unsigned int i=0;i<hold_max;i++)
{
tb.r4s_SetHoldPos(i);
ReadImage(map,false);
std::vector<int> data_single = map.getData();
printf("Hold %d: data size: %d // should be %d \n",i+1,data_single.size(),IMG_HEIGHT*IMG_WIDTH);
data.push_back(data_single);
}
printf("Done.\n");
//filling the data into the tree
printf("Writing the data into a TTree...");fflush(stdout);
for (int j=0;j<IMG_HEIGHT*IMG_WIDTH;j++)
{
for (unsigned int k=0;k<data.size();k++)
{
col = j%IMG_WIDTH;
row = j/IMG_WIDTH;
hold = k;
value = data[k][j];
tPulseShape->Fill();
}
}
printf("Done.\n");
tPulseShape->Write();
rootFile->Close();
}
......@@ -22,5 +22,6 @@ CMD_REG(seqcalscan, "", "Load calibrate scan sequence")
//CMD_REG(test, "" , "print 'Hello World!'")
CMD_REG(pixelAlive, "" ,"performs a pixel alive test")
CMD_REG(pixelDist,"<iterations>","distribution of calibration pulses per pixel");
CMD_REG(pulseShape,"<x> <y>","analogue out as a function of the hold position");
//CMD_REG(gui, "", "Start graphical user interface");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment