Commit 048e5cd2 authored by rohe's avatar rohe
Browse files

slight changes

parent c83e49de
......@@ -117,4 +117,30 @@ void R4sImg::Save(const string &filename)
fclose(f);
}
void R4sImg::Add(R4sImg &tmp){
for (int pos=0; pos<IMG_WIDTH*IMG_HEIGHT; pos++)
{
data[pos] += tmp.Get(pos);
}
return;
}
void R4sImg::Substract(R4sImg &tmp){
for (int pos=0; pos<IMG_WIDTH*IMG_HEIGHT; pos++)
{
data[pos] -= tmp.Get(pos);
}
return;
}
void R4sImg::Divide(R4sImg &tmp, int denominator){
for (int pos=0; pos<IMG_WIDTH*IMG_HEIGHT; pos++)
{
data[pos] /= denominator;
}
return;
}
......@@ -5,14 +5,20 @@
class R4sImg
{
int *data;
int *dataSum; // sum of images
int nImgs = 1; // number of images averaged
std::vector<int> dataNEW;
public:
R4sImg() : data(0) {}
bool CreateRaw(const vector<uint16_t> &rawdata);
void Clear() { if (data) delete[] data; data = 0; dataNEW.clear();}
void Clear() { if (data) delete[] data; data = 0; }//dataNEW.clear();}
void Save(const string &filename);
void Print(unsigned int count);
int Get(int x, int y);
int Get(int pos) {return data[pos];}
void Add(R4sImg &tmp);
void Substract(R4sImg &tmp);
void Divide(R4sImg &tmp, int denominator);
std::vector<int> getData() {return dataNEW;}
};
\ No newline at end of file
......@@ -59,7 +59,7 @@ bool R4sLine::CreateRaw(const vector<uint16_t> &rawdata)
value -= 0x1000;
data[pos] = value;
dataNEW.push_back(value);
//dataNEW.push_back(value);
}
return true;
};
......
......@@ -5,14 +5,14 @@
class R4sLine
{
int *data;
std::vector<int> dataNEW;
//std::vector<int> dataNEW;
public:
R4sLine() : data(0) {}
bool CreateRaw(const vector<uint16_t> &rawdata);
void Clear() { if (data) delete[] data; data = 0; dataNEW.clear();}
void Clear() { if (data) delete[] data; data = 0; }//dataNEW.clear();}
void Save(const string &filename);
void Print(unsigned int count);
int Get(int x);
std::vector<int> getData() {return dataNEW;}
//std::vector<int> getData() {return dataNEW;}
};
......@@ -249,10 +249,10 @@ 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);
TFile *rootFile = new TFile("data/pixelAlive.root","recreate");
TH2D *pixelMap = new TH2D("pixelMap","pixel map",IMG_WIDTH,0,IMG_WIDTH,IMG_HEIGHT,0,IMG_HEIGHT);
TH1D *h = new TH1D("h","Distribution",120,-600,600);
//debugging
FILE *f = fopen("debug.txt", "wt");
......@@ -262,8 +262,9 @@ CMD_PROC(pixelAlive)
for (unsigned int i=0;i<data.size();i++)
{
fprintf(f,"DEBUG: Filling %d : %d/%d \n",i,i%IMG_WIDTH,i/IMG_WIDTH);
// fprintf(f,"DEBUG: Filling %d : %d/%d \n",i,i%IMG_WIDTH,i/IMG_WIDTH);
pixelMap->Fill(i%IMG_WIDTH,i/IMG_WIDTH,data[i]);
h->Fill(data[i]);
}
fclose(f);
......@@ -274,6 +275,7 @@ CMD_PROC(pixelAlive)
// h->Draw();
// app.Run();
pixelMap->Write();
h->Write();
rootFile->Close();
}
......
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