Skip to content
Snippets Groups Projects
Commit 59de4df6 authored by Chao Peng's avatar Chao Peng
Browse files

adjust the branch data filling, now it does not need to know the data mode

parent 8fd890b7
No related branches found
No related tags found
No related merge requests found
...@@ -241,7 +241,6 @@ void waveform_analysis(const std::vector<uint32_t> &raw, BranchData &res) ...@@ -241,7 +241,6 @@ void waveform_analysis(const std::vector<uint32_t> &raw, BranchData &res)
res.nraw = len; res.nraw = len;
// sanity check // sanity check
if (len == 0) { if (len == 0) {
res.npul = 0;
return; return;
} }
...@@ -294,10 +293,8 @@ void waveform_analysis(const std::vector<uint32_t> &raw, BranchData &res) ...@@ -294,10 +293,8 @@ void waveform_analysis(const std::vector<uint32_t> &raw, BranchData &res)
// fill decoded FADC250 data into the container (branch data) // fill decoded FADC250 data into the container (branch data)
void fill_branch(const Fadc250Data &slot_data, const Module &mod, std::unordered_map<std::string, BranchData> &brdata, int mode) void fill_branch(const Fadc250Data &slot_data, const Module &mod, std::unordered_map<std::string, BranchData> &brdata)
{ {
// mode 3 only has integrals and timings
if (mode == 3) {
for (auto &event : slot_data.events) { for (auto &event : slot_data.events) {
for (auto &ch : mod.channels) { for (auto &ch : mod.channels) {
auto &channel = event.channels[ch.id]; auto &channel = event.channels[ch.id];
...@@ -307,22 +304,6 @@ void fill_branch(const Fadc250Data &slot_data, const Module &mod, std::unordered ...@@ -307,22 +304,6 @@ void fill_branch(const Fadc250Data &slot_data, const Module &mod, std::unordered
bd.integral[i] = channel.integral[i]; bd.integral[i] = channel.integral[i];
bd.time[i] = channel.time[i]; bd.time[i] = channel.time[i];
} }
}
}
return;
}
// mode 1 needs raw wave form analysis
if (mode != 1) {
std::cout << "Warning: unsupported data mode = " << mode << ", no data are stored." << std::endl;
return;
}
// fill raw data
for (auto &event : slot_data.events) {
for (auto &ch : mod.channels) {
auto &channel = event.channels[ch.id];
auto &bd = brdata[ch.name];
waveform_analysis(channel.raw, bd); waveform_analysis(channel.raw, bd);
} }
} }
...@@ -417,9 +398,8 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev, ...@@ -417,9 +398,8 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
br.second.nraw = 0; br.second.nraw = 0;
} }
int data_mode = -1;
// read data into event buffer // read data into event buffer
int data_mode = -1;
for (auto &mod : modules) { for (auto &mod : modules) {
int blvl = 1; int blvl = 1;
simpleGetRocBlockLevel(mod.crate, FADC_BANK, &blvl); simpleGetRocBlockLevel(mod.crate, FADC_BANK, &blvl);
...@@ -447,7 +427,7 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev, ...@@ -447,7 +427,7 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
} }
// fill branch data // fill branch data
fill_branch(slot_data, mod, brdata, data_mode); fill_branch(slot_data, mod, brdata);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment