7.0.3.rc: process the raw data files as a list (#848)

* Added file list option for moenchRawDataProcess
This commit is contained in:
anberga 2023-11-03 12:10:20 +01:00 committed by GitHub
parent b6ef3bc39e
commit 82edfa75d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 35 deletions

View File

@ -13,22 +13,7 @@ class etaInterpolationGlobal : public etaInterpolationBase {
virtual void prepareInterpolation(int &ok) { virtual void prepareInterpolation(int &ok) {
ok = 1; ok = 1;
#ifdef MYROOT1
if (hhx)
delete hhx;
if (hhy)
delete hhy;
hhx = new TH2D("hhx", "hhx", heta->GetNbinsX(),
heta->GetXaxis()->GetXmin(), heta->GetXaxis()->GetXmax(),
heta->GetNbinsY(), heta->GetYaxis()->GetXmin(),
heta->GetYaxis()->GetXmax());
hhy = new TH2D("hhy", "hhy", heta->GetNbinsX(),
heta->GetXaxis()->GetXmin(), heta->GetXaxis()->GetXmax(),
heta->GetNbinsY(), heta->GetYaxis()->GetXmin(),
heta->GetYaxis()->GetXmax());
#endif
///*Eta Distribution Rebinning*/// ///*Eta Distribution Rebinning*///
double bsize = 1. / nSubPixels; // precision double bsize = 1. / nSubPixels; // precision

View File

@ -304,18 +304,38 @@ int main(int argc, char *argv[]) {
int ifile = 0; int ifile = 0;
mt->setFrameMode(eFrame); mt->setFrameMode(eFrame);
int filelist=0;
ifstream flist;
flist.open (fformat, std::ifstream::in);
if (flist.is_open()) {
runmin=0;
runmax=0;
while (flist.getline(ffname,10000)){
cout << ffname << endl;
runmax++;
}
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) { for (int irun = runmin; irun <= runmax; irun++) {
cout << "DATA "; cout << "DATA ";
// sprintf(fn,fformat,irun); // sprintf(fn,fformat,irun);
sprintf(ffname, "%s/%s.raw", indir, fformat); if (flist.is_open()) {
sprintf(fname, (const char*)ffname, irun); flist.getline(ffname,10000);
sprintf(ffname, "%s/%s.tiff", outdir, fformat); cout << "file list " << ffname << endl;
sprintf(imgfname, (const char*)ffname, irun); } else {
sprintf(ffname, "%s/%s.clust", outdir, fformat); sprintf(ffname,(const char*)fformat,irun);
sprintf(cfname, (const char*)ffname, irun); cout << "loop " << ffname << endl;
}
cout << "ffname "<<ffname << endl;
sprintf(fname, "%s/%s.raw",indir,ffname);
sprintf(imgfname, "%s/%s.tiff",outdir,ffname);
sprintf(cfname, "%s/%s.clust",outdir,ffname);
cout << fname << " "; cout << fname << " ";
cout << imgfname << endl; cout << imgfname << " " << cfname << endl;
std::time(&end_time); std::time(&end_time);
cout << std::ctime(&end_time) << endl; cout << std::ctime(&end_time) << endl;
// cout << fname << " " << outfname << " " << imgfname << endl; // cout << fname << " " << outfname << " " << imgfname << endl;
@ -349,13 +369,13 @@ int main(int argc, char *argv[]) {
mt->popFree(buff); mt->popFree(buff);
ifr++; ifr++;
if (ifr % 100 == 0) if (ifr % 10000 == 0)
cout << ifr << " " << ff << endl; cout << ifr << " " << ff << endl;
if (nframes > 0) { if (nframes > 0) {
if (ifr % nframes == 0) { if (ifr % nframes == 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
ifile); sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile);
sprintf(imgfname, (const char*)ffname, irun);
while (mt->isBusy()) while (mt->isBusy())
; ;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
@ -376,11 +396,9 @@ int main(int argc, char *argv[]) {
} }
if (nframes >= 0) { if (nframes >= 0) {
if (nframes > 0) { if (nframes > 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile); sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile);
sprintf(imgfname, (const char*)ffname, irun);
} else { } else {
sprintf(ffname, "%s/%s.tiff", outdir, fformat); sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile);
sprintf(imgfname, (const char*)ffname, irun);
} }
cout << "Writing tiff to " << imgfname << " " << thr1 << endl; cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy()) while (mt->isBusy())
@ -399,11 +417,12 @@ int main(int argc, char *argv[]) {
cout << "Could not open " << fname << " for reading " << endl; cout << "Could not open " << fname << " for reading " << endl;
} }
if (nframes < 0) { if (nframes < 0) {
sprintf(ffname, "%s/%s.tiff", outdir, fformat); sprintf(imgfname, "%s/%s_tot.tiff",outdir,ffname);
strcpy(imgfname, ffname); cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
cout << "Writing tiff to " << imgfname << " " << thr1 << endl; mt->writeImage(imgfname, thr1);
mt->writeImage(imgfname, thr1); }
if (flist.is_open()) {
flist.close();
} }
return 0; return 0;
} }