10#include "UniDetectorParameter.h"
11#include "UniRawFile.h"
38 , isForwardMode(false)
39 , isRawRootInputFile(false)
40 , fApplyThreshold(kTRUE)
49 , fUseCalibFile(false)
56 LOG(debug) <<
"subname " << fSubName;
57 LOG(info) <<
"RunId " << fRunId <<
" got from " << (isRawRootInputFile ?
"RawRoot" :
"RawData") <<
" file";
58 fDigiFileName = (outfile ==
"") ? Form(
"bmn_run%d%s_digi.root", fRunId, fSubName.Data()) : outfile;
59 if (isRawRootInputFile)
60 fRootFileName = fRawFileName;
65 LOG(debug) <<
"~BmnRawDataDecoder()";
74 if (fRootFileName.Length() == 0) {
75 Int_t lastSlash = fDigiFileName.Last(
'/');
76 fDigiDirPath = (lastSlash == TString::kNPOS) ?
"" : TString(fDigiFileName(0, lastSlash + 1));
77 if (fRootDirPath.Length() == 0)
78 fRootDirPath = fDigiDirPath;
79 fRootFileName = Form(
"%sbmn_run%d%s_raw.root", fRootDirPath.Data(), fRunId, fSubName.Data());
81 if (fRootDirPath.Length()) {
82 bool dc = std::filesystem::create_directories(fRootDirPath.Data());
83 LOGF(info,
"Raw directory: %s was %s", fRootDirPath.Data(), dc ?
"created" :
"already present");
85 fRawSource =
new BmnRawSource(fRawFileName, fRootFileName, fMaxEvent, fPeriodId);
94 if (fRootFileName.Length() == 0) {
95 Int_t lastSlash = fDigiFileName.Last(
'/');
96 fDigiDirPath = (lastSlash == TString::kNPOS) ?
"" : TString(fDigiFileName(0, lastSlash + 1));
97 if (fRootDirPath.Length() == 0)
98 fRootDirPath = fDigiDirPath;
99 fRootFileName = Form(
"%sbmn_run%d%s_raw.root", fRootDirPath.Data(), fRunId, fSubName.Data());
101 fDecoder =
new BmnDecoder(fRootFileName, fDigiFileName, fMaxEvent, fPeriodId);
146 if (isRawRootInputFile) {
147 LOGF(info,
"Input is raw root file. Nothing to do!");
163 Int_t lastSlash = name.Last(
'/');
164 TString str(name(lastSlash + 1, name.Length() - lastSlash));
165 TPRegexp re_universal(
"[^0123456789]*(\\d+)(.*)\\.(\\w+)");
166 re_universal.Substitute(str,
"$1");
172 TPRegexp re(
".+\\.root");
173 return re.MatchB(name);
178 TPRegexp re(
".+\\.data");
179 return re.MatchB(name);
void SetRawTree(TTree *tree)
void SetBmnSetup(BmnSetup v)
BmnStatus DecodeDataToDigiIterate()
void SetForwardMode(bool v=true)
void SetDetectorSetup(std::map< DetectorId, bool > setup)
void SetDecoderConfigFileName(string FileName)
BmnStatus DecodeDataToDigi()
void SetRawTreeSpills(TTree *tree)
static double correctionSil
static Bool_t IsRawFile(TString name)
static double correctionGem
BmnStatus ConvertRawToRoot()
static double correctionCsc
BmnStatus DecodeDataToDigiIterate()
virtual ~BmnRawDataDecoder()
BmnStatus InitConverter()
BmnStatus ConvertRawToRootIterate(UInt_t *buf, UInt_t len)
BmnStatus DecodeDataToDigi()
static Bool_t IsRootFile(TString name)
BmnRawDataDecoder(TString file="", TString outfile="", ULong_t nEvents=0, ULong_t period=8)
static Int_t GetRunIdFromFile(TString name)
BmnStatus ConvertRawToRoot()
void SetDecoderConfigFileName(string FileName)
BmnStatus InitConverter(TString FileName)
TTree * GetRawTreeSpills()
BmnStatus ConvertRawToRootIterate(UInt_t *buf, UInt_t len)
void SetForwardMode(bool v=true)