15 #include "art/Framework/IO/Sources/put_product_in_principal.h"
16 #include "art/Framework/Core/FileBlock.h"
17 #include "art/Framework/Core/ProductRegistryHelper.h"
18 #include "art/Framework/IO/Sources/SourceHelper.h"
19 #include "art/Framework/Principal/EventPrincipal.h"
20 #include "art/Framework/Principal/RunPrincipal.h"
21 #include "canvas/Persistency/Provenance/FileFormatVersion.h"
22 #include "canvas/Persistency/Provenance/Timestamp.h"
23 #include "canvas/Utilities/Exception.h"
24 #include "cetlib_except/coded_exception.h"
25 #include "cetlib_except/exception.h"
60 unsigned short samples;
71 int run( std::string s1 )
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());
82 int event( std::string s1 )
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());
93 bool compare( std::string s1, std::string s2 )
100 return r1 == r2 ? e1 < e2
106 std::vector<std::string> getsortedfiles( std::string
dir )
109 throw art::Exception( art::errors::Configuration )
110 <<
"Vacuous directory name" << std::endl;
112 std::vector<std::string> files;
115 if( (dp = opendir(dir.c_str())) == NULL ) {
116 throw art::Exception( art::errors::FileOpenError )
117 <<
"Error opening directory " << dir << std::endl;
120 dirent * dirp = NULL;
121 while( (dirp = readdir(dp)) != NULL ) {
122 std::string
filename( dirp->d_name );
123 if(
filename.find(
"bin") != std::string::npos ) {
129 sort( files.begin(), files.end(), compare );
134 struct EventFileSentry {
136 explicit EventFileSentry(std::string
const &filepath)
137 : infile(filepath.c_str(),
std::ios_base::
in |
std::ios_base::binary)
139 ~EventFileSentry() { infile.close(); }
141 std::ifstream infile;
145 void process_LAr_file(std::string dir,
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() ) {
159 throw art::Exception( art::errors::FileReadError )
160 <<
"failed to open input file " << filename << std::endl;
164 unsigned int wiresPerPlane = 48;
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) {
280 art::ProductRegistryHelper &helper,
281 art::SourceHelper
const &pm)
286 , nextfile_ ( inputfiles_.
begin() )
287 , filesdone_ ( inputfiles_.
end() )
288 , currentSubRunID_ ( )
291 helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>(
"daq");
292 helper.reconstitutes<std::vector<raw::ExternalTrigger>,art::InEvent>(
"daq");
312 fb =
new art::FileBlock(art::FileFormatVersion(1,
"LArRawInput 2011a"),
317 art::SubRunPrincipal*
const & ,
318 art::RunPrincipal* &outR,
319 art::SubRunPrincipal* &outSR,
320 art::EventPrincipal* &outE)
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) );
334 art::RunNumber_t rn = daqHeader.
GetRun();
345 art::put_product_in_principal(std::move(rundata), *outR,
"daq");
348 throw cet::exception(
"InconsistentEventStream")
349 <<
"Encountered run #" << rn
360 art::put_product_in_principal(std::move(etcollb),
363 art::put_product_in_principal(std::move(rdcollb),
366 art::put_product_in_principal(std::move(daqcollb),
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
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test
physics associatedGroupsWithLeft p1