24 #include "cetlib_except/coded_exception.h" 25 #include "cetlib_except/exception.h" 48 unsigned short software;
60 unsigned short samples;
73 size_t p1 = s1.find(
"R");
74 size_t p2 = s1.find(
"_E");
76 int run = atoi((s1.substr(p1+1,p2-p1-1)).c_str());
84 size_t p1 = s1.find(
"E");
85 size_t p2 = s1.find(
"_T");
87 int event = atoi((s1.substr(p1+1,p2-p1-1)).c_str());
100 return r1 == r2 ? e1 < e2
110 <<
"Vacuous directory name" <<
std::endl;
112 std::vector<std::string>
files;
115 if( (dp = opendir(dir.c_str())) == NULL ) {
117 <<
"Error opening directory " << dir <<
std::endl;
120 dirent * dirp = NULL;
121 while( (dirp = readdir(dp)) != NULL ) {
123 if(
filename.find(
"bin") != std::string::npos ) {
129 sort( files.begin(), files.end(),
compare );
134 struct EventFileSentry {
137 :
infile(filepath.c_str(),
std::ios_base::in |
std::ios_base::binary)
139 ~EventFileSentry() {
infile.close(); }
147 std::vector<raw::RawDigit>& digitList,
149 std::vector<raw::ExternalTrigger>& extTrig)
155 EventFileSentry efs(dir+
"/"+filename);
156 std::ifstream &
infile = efs.infile;
158 if( !infile.is_open() ) {
160 <<
"failed to open input file " << filename <<
std::endl;
164 unsigned int wiresPerPlane = 48;
165 unsigned int planes = 3;
166 int nwires = wiresPerPlane*planes;
173 infile.read((
char *) &h1,
sizeof h1);
175 time_t mytime = h1.time;
176 mytime = mytime << 32;
201 digitList.resize(wiresPerPlane*planes);
207 for(
int i = 0; i !=
nwires; ++i ) {
208 infile.read((
char *) &c1,
sizeof c1);
210 std::vector<short> adclist(c1.samples);
211 infile.read((
char*)&adclist[0],
sizeof(
short)*c1.samples);
217 for (
int ijk=0;ijk<c1.samples;++ijk) {
224 for (
int ijk=0;ijk<c1.samples;++ijk) {
225 int mysig=adclist[ijk]-400;
226 adclist[ijk]=400-mysig;
235 digitList[i].SetPedestal(400.);
238 digitList[239-i] =
raw::RawDigit(239-i, c1.samples, adclist);
239 digitList[239-i].SetPedestal(400.);
249 for(
int i = 0; i < 16; ++i ) {
250 unsigned int utrigtime = 0;
251 infile.read((
char *) &c1,
sizeof c1);
253 std::vector<short> adclist(c1.samples);
254 infile.read((
char*)&adclist[0],
sizeof(
short)*c1.samples);
257 while (j<c1.samples){
258 float test = 400.0-adclist[j];
259 if (test>10 && j>0) {
286 , nextfile_ ( inputfiles_.
begin() )
287 , filesdone_ ( inputfiles_.
end() )
288 , currentSubRunID_ ( )
325 std::unique_ptr<std::vector<raw::RawDigit> > rdcollb (
new std::vector<raw::RawDigit> );
326 std::unique_ptr<std::vector<raw::ExternalTrigger> > etcollb (
new std::vector<raw::ExternalTrigger> );
332 std::unique_ptr<raw::DAQHeader> daqcollb(
new raw::DAQHeader(daqHeader) );
349 <<
"Encountered run #" << rn
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Collection of charge vs time digitized from a single readout channel.
int compare(unsigned *r, sha1::digest_t const &d)
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
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.
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::unique_ptr< History > &&history) const
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
SubRunNumber_t subRun() const
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
IDNumber_t< Level::Run > RunNumber_t