63 if( !
IsOK() )
return -1;
65 const auto* codaevdata =
dynamic_cast<const CodaDecoder*
>(&evdata);
70 for(
const auto& bankloc :
banklocs ) {
72 bankloc->offset, bankloc->numwords);
74 for(
Int_t j = 0; j < bankloc->numwords; j++, k++ ) {
100 const char comment =
'#';
102 while( fgets(cbuf, LEN, fi) ) {
104 cout <<
"database line = " << cbuf << endl;
105 const vector<string> dbline = vsplit(cbuf);
106 if( dbline.size() <= 2 )
108 assert(!dbline.front().empty() && !isspace(dbline.front()[0]));
109 if( dbline.front()[0] == comment )
111 const string& svar = dbline[0];
112 Int_t iroc = atoi(dbline[1].c_str());
113 Int_t ibank = atoi(dbline[2].c_str());
114 Int_t ioff = 0, inum = 1;
115 if (dbline.size()>3) {
116 ioff = atoi(dbline[3].c_str());
117 if (dbline.size()>4) {
118 inum = atoi(dbline[4].c_str());
121 assert(!svar.empty());
122 if (
fDebug) cout <<
"svar " << svar <<
" len " << svar.length()
123 <<
" iroc " << iroc <<
" ibank " << ibank
124 <<
" offset " << ioff <<
" num " << inum << endl;
128 Int_t maxwords = 1, ibank = 0;
130 for(
const auto& bankloc :
banklocs) {
131 if (
fDebug) cout <<
"bankloc " << ibank++ <<
" " << bankloc->roc <<
" "
132 << bankloc->bank <<
" " << bankloc->offset <<
" "
133 << bankloc->numwords << endl;
134 if( bankloc->numwords > maxwords) maxwords = bankloc->numwords;
135 Nvars += bankloc->numwords;
141 const Int_t too_big = 1000000;
142 if (maxwords > too_big ||
Nvars > too_big) {
143 cerr <<
"BankData::ERROR: very huge number of words "
144 <<maxwords<<
" "<<
Nvars<<endl;
174 cerr <<
"BankData::ERROR: No gHaVars ?! Well, that's a problem !!"<<endl;
180 for(
const auto& bankloc :
banklocs ) {
181 string svarname = std::string(
fName.
Data()) +
"." + bankloc->svarname;
182 string cdesc =
"Bank Data " + bankloc->svarname;
183 if (bankloc->numwords == 1) {
184 if (
fDebug) cout <<
"numwords = 1, svarname = " << svarname << endl;
191 for (
Int_t j=0; j<bankloc->numwords; j++) {
194 if (
fDebug) cout <<
"numwords > 1, svarname = " << os.str() << endl;
Option_t Option_t TPoint TPoint const char mode
R__EXTERN class THaVarList * gHaVars
BankData(const char *name, const char *description)
virtual Int_t Process(const THaEvData &evdata)
std::vector< std::unique_ptr< BankLoc > > banklocs
virtual Int_t ReadDatabase(const TDatime &date)
virtual Int_t DefineVariables(EMode mode=kDefine)
BankLoc(std::string svar, Int_t iroc, Int_t ibank, Int_t ioff, Int_t inum)
virtual Int_t FillBankData(UInt_t *rdat, UInt_t roc, Int_t bank, UInt_t offset=0, UInt_t num=1) const
virtual FILE * OpenFile(const TDatime &date)
virtual Int_t RemoveName(const char *name)
THaVar * Define(const char *name, const char *descript, const Double_t &var, const Int_t *count=nullptr)
const char * Data() const