43 unsigned short format;
44 unsigned short software;
55 unsigned short samples;
65 int run(std::string s1)
67 size_t p1 = s1.find(
"R");
68 size_t p2 = s1.find(
"_E");
70 int run = atoi((s1.substr(p1 + 1, p2 - p1 - 1)).c_str());
75 int event(std::string s1)
77 size_t p1 = s1.find(
"E");
78 size_t p2 = s1.find(
"_T");
80 int event = atoi((s1.substr(p1 + 1, p2 - p1 - 1)).c_str());
85 bool compare(std::string s1, std::string s2)
92 return r1 == r2 ? e1 < e2 : r1 < r2;
96 std::vector<std::string> getsortedfiles(std::string
dir)
101 std::vector<std::string> files;
104 if ((dp = opendir(dir.c_str())) == NULL) {
106 <<
"Error opening directory " << dir << std::endl;
110 while ((dirp = readdir(dp)) != NULL) {
111 std::string filename(dirp->d_name);
112 if (filename.find(
"bin") != std::string::npos) { files.push_back(filename); }
116 sort(files.begin(), files.end(), compare);
121 struct EventFileSentry {
123 explicit EventFileSentry(std::string
const& filepath)
124 : infile(filepath.c_str(),
std::ios_base::
in |
std::ios_base::binary)
126 ~EventFileSentry() { infile.close(); }
128 std::ifstream infile;
132 void process_LAr_file(std::string dir,
133 std::string
const& filename,
134 std::vector<raw::RawDigit>& digitList,
141 EventFileSentry efs(dir +
"/" + filename);
142 std::ifstream& infile = efs.infile;
144 if (!infile.is_open()) {
146 <<
"failed to open input file " << filename << std::endl;
149 unsigned int wiresPerPlane = 48;
150 unsigned int planes = 3;
157 infile.read((
char*)&h1,
sizeof h1);
159 time_t mytime = h1.time;
160 mytime = mytime << 32;
185 digitList.resize(wiresPerPlane * planes);
187 for (
int i = 0; i != h1.nchan; ++i) {
188 infile.read((
char*)&c1,
sizeof c1);
190 std::vector<short> adclist(c1.samples);
191 infile.read((
char*)&adclist[0],
sizeof(
short) * c1.samples);
197 if (h1.run < 280 && h1.run > 192) {
198 if (i == 92) iw = 95;
199 if (i == 93) iw = 94;
200 if (i == 94) iw = 93;
201 if (i == 95) iw = 92;
208 digitList[i].SetPedestal(400.);
211 infile.read((
char*)&f1,
sizeof f1);
224 : principalMaker_(pm)
227 , nextfile_(inputfiles_.
begin())
228 , filesdone_(inputfiles_.
end())
263 std::unique_ptr<std::vector<raw::RawDigit>> rdcolsb(
new std::vector<raw::RawDigit>);
269 std::unique_ptr<raw::DAQHeader> daqcolsb(
new raw::DAQHeader(daqHeader));
274 if (firstEventInRun) {
283 <<
"Encountered run #" << rn <<
" while processing events from run #"
Collection of charge vs time digitized from a single readout channel.
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary subRunAux) const
EventPrincipal * makeEventPrincipal(EventAuxiliary eventAux) const
Definition of basic raw digits.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
RunPrincipal * makeRunPrincipal(RunAuxiliary runAux) const
std::enable_if_t<!detail::range_sets_supported(P::branch_type)> put_product_in_principal(std::unique_ptr< T > &&product, P &principal, std::string const &module_label, std::string const &instance_name={})
Conversion of binary data to root files.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
SubRunNumber_t subRun() const
cet::coded_exception< error, detail::translate > exception
Event finding and building.
IDNumber_t< Level::Run > RunNumber_t