10 #include "art/Framework/Core/FileBlock.h"
11 #include "art/Framework/Core/ProductRegistryHelper.h"
12 #include "art/Framework/IO/Sources/SourceHelper.h"
13 #include "art/Framework/Principal/EventPrincipal.h"
14 #include "art/Framework/Principal/RunPrincipal.h"
15 #include "canvas/Persistency/Provenance/Timestamp.h"
26 #include "art/Framework/IO/Sources/put_product_in_principal.h"
27 #include "canvas/Utilities/Exception.h"
57 unsigned short samples;
68 int run( std::string s1 )
70 size_t p1 = s1.find(
"R");
71 size_t p2 = s1.find(
"_E");
73 int run = atoi((s1.substr(p1+1,p2-p1-1)).c_str());
79 int event( std::string s1 )
81 size_t p1 = s1.find(
"E");
82 size_t p2 = s1.find(
"_T");
84 int event = atoi((s1.substr(p1+1,p2-p1-1)).c_str());
90 bool compare( std::string s1, std::string s2 )
97 return r1 == r2 ? e1 < e2
103 std::vector<std::string> getsortedfiles( std::string
dir )
106 throw art::Exception( art::errors::Configuration )
107 <<
"Vacuous directory name" << std::endl;
109 std::vector<std::string> files;
112 if( (dp = opendir(dir.c_str())) == NULL ) {
113 throw art::Exception( art::errors::FileOpenError )
114 <<
"Error opening directory " << dir << std::endl;
117 dirent * dirp = NULL;
118 while( (dirp = readdir(dp)) != NULL ) {
119 std::string
filename( dirp->d_name );
120 if(
filename.find(
"bin") != std::string::npos ) {
126 sort( files.begin(), files.end(), compare );
131 struct EventFileSentry {
133 explicit EventFileSentry(std::string
const &filepath)
134 : infile(filepath.c_str(),
std::ios_base::
in |
std::ios_base::binary)
136 ~EventFileSentry() { infile.close(); }
138 std::ifstream infile;
142 void process_LAr_file(std::string dir,
144 std::vector<raw::RawDigit>& digitList,
151 EventFileSentry efs(dir+
"/"+filename);
152 std::ifstream &infile = efs.infile;
154 if( !infile.is_open() ) {
155 throw art::Exception( art::errors::FileReadError )
156 <<
"failed to open input file " << filename << std::endl;
159 unsigned int wiresPerPlane = 48;
167 infile.read((
char *) &h1,
sizeof h1);
169 time_t mytime = h1.time;
170 mytime = mytime << 32;
195 digitList.resize(wiresPerPlane*planes);
197 for(
int i = 0; i != h1.nchan; ++i ) {
198 infile.read((
char *) &c1,
sizeof c1);
200 std::vector<short> adclist(c1.samples);
201 infile.read((
char*)&adclist[0],
sizeof(
short)*c1.samples);
207 if (h1.run<280 && h1.run>192) {
218 digitList[i].SetPedestal(400.);
221 infile.read((
char *) &f1,
sizeof f1);
232 art::ProductRegistryHelper &helper,
233 art::SourceHelper
const &pm)
238 , nextfile_ ( inputfiles_.
begin() )
239 , filesdone_ ( inputfiles_.
end() )
240 , currentSubRunID_ ( )
243 helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>(
"daq");
263 fb =
new art::FileBlock(art::FileFormatVersion(1,
"LArRawInput 2011a"),
268 art::SubRunPrincipal*
const & ,
269 art::RunPrincipal* &outR,
270 art::SubRunPrincipal* &outSR,
271 art::EventPrincipal* &outE)
276 std::unique_ptr<std::vector<raw::RawDigit> > rdcolsb (
new std::vector<raw::RawDigit> );
282 std::unique_ptr<raw::DAQHeader> daqcolsb(
new raw::DAQHeader(daqHeader) );
284 art::RunNumber_t rn = daqHeader.
GetRun();
295 art::put_product_in_principal(std::move(rundatasb), *outR,
"daq");
298 throw cet::exception(
"InconsistentEventStream")
299 <<
"Encountered run #" << rn
310 art::put_product_in_principal(std::move(rdcolsb),
313 art::put_product_in_principal(std::move(daqcolsb),
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Collection of charge vs time digitized from a single readout channel.
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project production production checksum
BEGIN_PROLOG could also be dds filename
Definition of basic raw digits.
auto end(FixedBins< T, C > const &) noexcept
auto begin(FixedBins< T, C > const &) noexcept
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project software
physics associatedGroupsWithLeft p1