Bmnt.cxx File Reference

#include "Bmnt.h"
#include "bmnt/AcnetDevice.h"
#include <Validity/VldContext.h>
#include <RawData/RawRecord.h>
#include <RawData/RawBeamMonHeader.h>
#include <RawData/RawBeamMonBlock.h>
#include <RawData/RawDataBlock.h>
#include <RawData/RawBeamData.h>
#include <TFile.h>
#include <TTree.h>
#include <TSystem.h>
#include <cassert>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

Go to the source code of this file.

Classes

struct  BmntImp

Functions

static string acnet2branchname (string n)
void make_bmnt_one_per_dir (const char *indir, const char *outdir, bool skip_last)

Function Documentation

static string acnet2branchname ( string  n  )  [static]

Definition at line 38 of file Bmnt.cxx.

Referenced by BmntImp::Fill().

00039 {
00040     string out = "";
00041     out.push_back(tolower(n[0]));
00042     for (size_t ind=2; ind<8 && ind<n.size(); ++ind) { 
00043         if (n[ind] == '[') break;
00044         out.push_back(tolower(n[ind]));
00045     }
00046     out += ".";
00047     return out;
00048 }

void make_bmnt_one_per_dir ( const char *  indir,
const char *  outdir,
bool  skip_last 
)

Definition at line 253 of file Bmnt.cxx.

References files, gSystem(), infile, len, outfile, Bmnt::ProcessFiles(), and Bmnt::Write().

00254 {
00255     void *dir = gSystem->OpenDirectory(indir);
00256     if (!dir) {
00257         cerr << "No such directory: " << indir << endl;
00258         return;
00259     }
00260 
00261     vector<string> files;
00262     while (const char* file = gSystem->GetDirEntry(dir)) {
00263         string filename = file;
00264         if ( filename.length() > 5
00265              && filename[0] == 'B'
00266              && filename.find(".mbeam.root") == filename.length()-11 ) {
00267             files.push_back(file);
00268         }
00269     }
00270     std::sort(files.begin(),files.end());
00271     if (skip_last) files.pop_back();
00272     for (size_t ind = 0; ind < files.size(); ++ind) {
00273 
00274         string infile = indir;
00275         infile += "/";
00276         infile += files[ind];
00277 
00278         string outfile = outdir;
00279         size_t start = infile.rfind("/");
00280         size_t len = infile.find(".mbeam.root") - start;
00281         outfile += infile.substr(start,len);
00282         outfile += ".bmnt.root";
00283 
00284         if (!gSystem->AccessPathName(outfile.c_str(),kReadPermission)) {
00285             cerr << "File already exists: " << outfile << endl;
00286             return;
00287         }
00288 
00289         Bmnt* bd = new Bmnt(outfile.c_str());
00290         const char* file_array[] = { infile.c_str(), 0 };
00291         bd->ProcessFiles(file_array);
00292         bd->Write();
00293         delete bd;
00294     }
00295 }


Generated on 16 Jan 2018 for loon by  doxygen 1.6.1