19 #include <sys/types.h> 34 unsigned short format;
35 unsigned short software;
47 unsigned short samples;
58 int run( std::string s1 )
60 size_t p1 = s1.find(
"R");
61 size_t p2 = s1.find(
"_E");
63 int run = atoi((s1.substr(p1+1,p2-p1-1)).c_str());
69 int event( std::string s1 )
71 size_t p1 = s1.find(
"E");
72 size_t p2 = s1.find(
"_T");
74 int event = atoi((s1.substr(p1+1,p2-p1-1)).c_str());
80 bool compare( std::string s1, std::string s2 )
87 return r1 == r2 ? e1 < e2
93 std::vector<std::string> getsortedfiles( std::string
dir )
97 <<
"Vacuous directory name" << std::endl;
99 std::vector<std::string> files;
102 if( (dp = opendir(dir.c_str())) == NULL ) {
104 <<
"Error opening directory " << dir << std::endl;
107 dirent * dirp = NULL;
108 while( (dirp = readdir(dp)) != NULL ) {
109 std::string filename( dirp->d_name );
110 if( filename.find(
"bin") != std::string::npos ) {
111 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 = 240;
150 unsigned int planes = 2;
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);
196 digitList[i] =
raw::RawDigit((c1.ch-1), c1.samples, adclist);
199 digitList[i].SetPedestal(400.);
202 infile.read((
char *) &f1,
sizeof f1);
219 , nextfile_ ( inputfiles_.
begin() )
220 , filesdone_ ( inputfiles_.
end() )
221 , currentSubRunID_ ( )
257 std::unique_ptr<std::vector<raw::RawDigit> > rdcol (
new std::vector<raw::RawDigit> );
263 std::unique_ptr<raw::DAQHeader> daqcol(
new raw::DAQHeader(daqHeader) );
268 if (firstEventInRun){
269 std::unique_ptr<sumdata::RunData> rundata(
new sumdata::RunData(
"argoneut") );
279 <<
"Encountered run #" << rn
Collection of charge vs time digitized from a single readout channel.
std::enable_if_t< P::branch_type==InEvent||P::branch_type==InResults > put_product_in_principal(std::unique_ptr< T > &&product, P &principal, std::string const &module_label, std::string const &instance_name={})
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition of basic raw digits.
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Conversion of binary data to root files.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
SubRunNumber_t subRun() const
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::shared_ptr< History > &&history) const
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Event finding and building.
IDNumber_t< Level::Run > RunNumber_t