2022-07-05 16:55:06 +08:00
|
|
|
#include "csvReader.h"
|
|
|
|
// #include "getADC.h"
|
2022-07-05 01:35:54 +08:00
|
|
|
#include <TFile.h>
|
|
|
|
#include <TH1F.h>
|
|
|
|
#include <TTree.h>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using std::string;
|
|
|
|
using std::to_string;
|
|
|
|
|
|
|
|
void readData(const char *fin, TH1F Left[5][8], TH1F Right[5][8]) {
|
|
|
|
// read file
|
|
|
|
TFile *fRun = new TFile(fin);
|
|
|
|
TTree *t = (TTree *)fRun->Get("Tree1");
|
|
|
|
|
|
|
|
// data numbers
|
|
|
|
Long64_t ntot = t->GetEntriesFast();
|
|
|
|
|
|
|
|
// five X-4 block
|
|
|
|
UInt_t dataArray[5][16];
|
|
|
|
|
|
|
|
// calibration coefficient
|
|
|
|
Float_t CalC[5][8];
|
|
|
|
Float_t Calk1[5][8];
|
|
|
|
Float_t Calk2[5][8];
|
|
|
|
|
|
|
|
// read adc data
|
|
|
|
t->SetBranchAddress("adc0ch0", &dataArray[0][0]);
|
|
|
|
t->SetBranchAddress("adc0ch1", &dataArray[0][1]);
|
|
|
|
t->SetBranchAddress("adc0ch2", &dataArray[0][2]);
|
|
|
|
t->SetBranchAddress("adc0ch3", &dataArray[0][3]);
|
|
|
|
t->SetBranchAddress("adc0ch4", &dataArray[0][4]);
|
|
|
|
t->SetBranchAddress("adc0ch5", &dataArray[0][5]);
|
|
|
|
t->SetBranchAddress("adc0ch6", &dataArray[0][6]);
|
|
|
|
t->SetBranchAddress("adc0ch7", &dataArray[0][7]);
|
|
|
|
t->SetBranchAddress("adc0ch8", &dataArray[0][8]);
|
|
|
|
t->SetBranchAddress("adc0ch9", &dataArray[0][9]);
|
|
|
|
t->SetBranchAddress("adc0ch10", &dataArray[0][10]);
|
|
|
|
t->SetBranchAddress("adc0ch11", &dataArray[0][11]);
|
|
|
|
t->SetBranchAddress("adc0ch12", &dataArray[0][12]);
|
|
|
|
t->SetBranchAddress("adc0ch13", &dataArray[0][13]);
|
|
|
|
t->SetBranchAddress("adc0ch14", &dataArray[0][14]);
|
|
|
|
t->SetBranchAddress("adc0ch15", &dataArray[0][15]);
|
|
|
|
|
|
|
|
t->SetBranchAddress("adc0ch16", &dataArray[1][0]);
|
|
|
|
t->SetBranchAddress("adc0ch17", &dataArray[1][1]);
|
|
|
|
t->SetBranchAddress("adc0ch18", &dataArray[1][2]);
|
|
|
|
t->SetBranchAddress("adc0ch19", &dataArray[1][3]);
|
|
|
|
t->SetBranchAddress("adc0ch20", &dataArray[1][4]);
|
|
|
|
t->SetBranchAddress("adc0ch21", &dataArray[1][5]);
|
|
|
|
t->SetBranchAddress("adc0ch22", &dataArray[1][6]);
|
|
|
|
t->SetBranchAddress("adc0ch23", &dataArray[1][7]);
|
|
|
|
t->SetBranchAddress("adc0ch24", &dataArray[1][8]);
|
|
|
|
t->SetBranchAddress("adc0ch25", &dataArray[1][9]);
|
|
|
|
t->SetBranchAddress("adc0ch26", &dataArray[1][10]);
|
|
|
|
t->SetBranchAddress("adc0ch27", &dataArray[1][11]);
|
|
|
|
t->SetBranchAddress("adc0ch28", &dataArray[1][12]);
|
|
|
|
t->SetBranchAddress("adc0ch29", &dataArray[1][13]);
|
|
|
|
t->SetBranchAddress("adc0ch30", &dataArray[1][14]);
|
|
|
|
t->SetBranchAddress("adc0ch31", &dataArray[1][15]);
|
|
|
|
|
|
|
|
t->SetBranchAddress("adc1ch0", &dataArray[2][0]);
|
|
|
|
t->SetBranchAddress("adc1ch1", &dataArray[2][1]);
|
|
|
|
t->SetBranchAddress("adc1ch2", &dataArray[2][2]);
|
|
|
|
t->SetBranchAddress("adc1ch3", &dataArray[2][3]);
|
|
|
|
t->SetBranchAddress("adc1ch4", &dataArray[2][4]);
|
|
|
|
t->SetBranchAddress("adc1ch5", &dataArray[2][5]);
|
|
|
|
t->SetBranchAddress("adc1ch6", &dataArray[2][6]);
|
|
|
|
t->SetBranchAddress("adc1ch7", &dataArray[2][7]);
|
|
|
|
t->SetBranchAddress("adc1ch8", &dataArray[2][8]);
|
|
|
|
t->SetBranchAddress("adc1ch9", &dataArray[2][9]);
|
|
|
|
t->SetBranchAddress("adc1ch10", &dataArray[2][10]);
|
|
|
|
t->SetBranchAddress("adc1ch11", &dataArray[2][11]);
|
|
|
|
t->SetBranchAddress("adc1ch12", &dataArray[2][12]);
|
|
|
|
t->SetBranchAddress("adc1ch13", &dataArray[2][13]);
|
|
|
|
t->SetBranchAddress("adc1ch14", &dataArray[2][14]);
|
|
|
|
t->SetBranchAddress("adc1ch15", &dataArray[2][15]);
|
|
|
|
|
|
|
|
t->SetBranchAddress("adc1ch16", &dataArray[3][0]);
|
|
|
|
t->SetBranchAddress("adc1ch17", &dataArray[3][1]);
|
|
|
|
t->SetBranchAddress("adc1ch18", &dataArray[3][2]);
|
|
|
|
t->SetBranchAddress("adc1ch19", &dataArray[3][3]);
|
|
|
|
t->SetBranchAddress("adc1ch20", &dataArray[3][4]);
|
|
|
|
t->SetBranchAddress("adc1ch21", &dataArray[3][5]);
|
|
|
|
t->SetBranchAddress("adc1ch22", &dataArray[3][6]);
|
|
|
|
t->SetBranchAddress("adc1ch23", &dataArray[3][7]);
|
|
|
|
t->SetBranchAddress("adc1ch24", &dataArray[3][8]);
|
|
|
|
t->SetBranchAddress("adc1ch25", &dataArray[3][9]);
|
|
|
|
t->SetBranchAddress("adc1ch26", &dataArray[3][10]);
|
|
|
|
t->SetBranchAddress("adc1ch27", &dataArray[3][11]);
|
|
|
|
t->SetBranchAddress("adc1ch28", &dataArray[3][12]);
|
|
|
|
t->SetBranchAddress("adc1ch29", &dataArray[3][13]);
|
|
|
|
t->SetBranchAddress("adc1ch30", &dataArray[3][14]);
|
|
|
|
t->SetBranchAddress("adc1ch31", &dataArray[3][15]);
|
|
|
|
|
|
|
|
t->SetBranchAddress("adc2ch0", &dataArray[4][0]);
|
|
|
|
t->SetBranchAddress("adc2ch1", &dataArray[4][1]);
|
|
|
|
t->SetBranchAddress("adc2ch2", &dataArray[4][2]);
|
|
|
|
t->SetBranchAddress("adc2ch3", &dataArray[4][3]);
|
|
|
|
t->SetBranchAddress("adc2ch4", &dataArray[4][4]);
|
|
|
|
t->SetBranchAddress("adc2ch5", &dataArray[4][5]);
|
|
|
|
t->SetBranchAddress("adc2ch6", &dataArray[4][6]);
|
|
|
|
t->SetBranchAddress("adc2ch7", &dataArray[4][7]);
|
|
|
|
t->SetBranchAddress("adc2ch8", &dataArray[4][8]);
|
|
|
|
t->SetBranchAddress("adc2ch9", &dataArray[4][9]);
|
|
|
|
t->SetBranchAddress("adc2ch10", &dataArray[4][10]);
|
|
|
|
t->SetBranchAddress("adc2ch11", &dataArray[4][11]);
|
|
|
|
t->SetBranchAddress("adc2ch12", &dataArray[4][12]);
|
|
|
|
t->SetBranchAddress("adc2ch13", &dataArray[4][13]);
|
|
|
|
t->SetBranchAddress("adc2ch14", &dataArray[4][14]);
|
|
|
|
t->SetBranchAddress("adc2ch15", &dataArray[4][15]);
|
|
|
|
|
|
|
|
for (int i = 0; i < ntot; i++) {
|
|
|
|
t->GetEntry(i);
|
|
|
|
for (int j = 0; j < 5; j++)
|
|
|
|
for (int k = 0; k < 8; k++) {
|
|
|
|
Left[j][k].Fill(dataArray[j][k]);
|
|
|
|
Right[j][k].Fill(dataArray[j][k + 8]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-04 23:52:05 +08:00
|
|
|
|
|
|
|
int main() {
|
2022-07-05 16:55:06 +08:00
|
|
|
// TH1F Left[5][8];
|
|
|
|
// TH1F Right[5][8];
|
|
|
|
|
|
|
|
// string L, R;
|
|
|
|
// for (int i = 0; i < 5; i++)
|
|
|
|
// for (int j = 0; j < 8; j++) {
|
|
|
|
// L = "Left" + to_string(i) + to_string(j);
|
|
|
|
// R = "Right" + to_string(i) + to_string(j);
|
|
|
|
// Left[i][j] = TH1F(L.c_str(), L.c_str(), CHANNEL_NUMBER, 0, CHANNEL_NUMBER);
|
|
|
|
// Right[i][j] = TH1F(R.c_str(), R.c_str(), CHANNEL_NUMBER, 0, CHANNEL_NUMBER);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// readData("F:/NuclearAstroPhy/Q3D-Calibration/2016Q3D/root/raw/201609Q3D1002.root", Left,
|
|
|
|
// Right); double x = getADC(&Left[0][0]); cout << x << endl;
|
|
|
|
|
|
|
|
csvReader cR("config.csv");
|
|
|
|
cR.readData();
|
2022-07-05 01:35:54 +08:00
|
|
|
|
2022-07-04 23:52:05 +08:00
|
|
|
return 0;
|
|
|
|
}
|