7#include "UniSearchCondition.h"
19 fBmnSetup ==
kSRCSETUP ?
"$VMCWORKDIR/database/uni_db/macros/parse_schemes/spill_run7/SRC_Data.txt"
20 :
"$VMCWORKDIR/database/uni_db/macros/parse_schemes/spill_run7/summary_corr_v2.txt",
22 ?
"$VMCWORKDIR/database/uni_db/macros/parse_schemes/spill_run7/spill_run7_src_full.xslt"
23 :
"$VMCWORKDIR/database/uni_db/macros/parse_schemes/spill_run7/spill_run7_bmn_full.xslt");
31 LOG(info) <<
"Reading MSC16 channel mapping file " <<
fMapFileName <<
"...";
34 fprintf(stderr,
"Error opening map-file (%s)!\n",
fMapFileName.Data());
40 UShort_t slot, bt, btnbusy, l0, tp, bc1, bc2, bc3, BC1H, BC1BP, BC1xBC2, BC1nBusy, IntTrig, SRCTrig, TrignBusy;
42 fMapFile >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy
43 >> dummy >> dummy >> dummy >> dummy;
45 while (
fMapFile >> hex >> ser >> dec >> slot >> bt >> btnbusy >> l0 >> tp >> bc1 >> bc2 >> bc3 >> BC1H >> BC1BP
46 >> BC1xBC2 >> BC1nBusy >> IntTrig >> SRCTrig >> TrignBusy)
65 fMap.push_back(record);
68 if (
fMap.size() == 0) {
69 fprintf(stderr,
"Map file is empty!\n");
79 Int_t log_shift_bmn = 6;
80 Int_t log_shift_src = -3;
83 map<TDatime, vector<Int_t>> temp_spill_map;
85 vector<structParseValue*> parse_values;
86 vector<structParseSchema> vecElements;
89 cout << endl <<
"Error: parser error (" << res_code <<
")" << endl;
93 if (parse_values.size() < 1) {
94 cout << endl <<
"Error: there are no lines to parse" << endl;
105 arrayConditions.
Add((
TObject*)searchCondition);
110 arrayConditions.
Add((
TObject*)searchCondition);
115 arrayConditions.
Add((
TObject*)searchCondition);
118 int sum_size = parse_values[0]->arrValues.size();
120 for (
size_t ind = 0; ind < parse_values.size(); ind++) {
123 for (
Int_t iValue = 0; iValue < sum_size; iValue++)
124 vals.push_back(boost::any_cast<Int_t>(st->
arrValues[iValue]));
129 vector<Long64_t> total_columns;
130 for (
int i_total = 0; i_total < sum_size; i_total++)
131 total_columns.push_back(0);
135 cout << endl <<
"Error: no experimental run was found " <<
fPeriodId <<
" : " <<
fRunId << endl;
140 if (dateEnd == NULL) {
141 cout <<
"Error: no end datetime in the database for this run" << endl;
151 fprintf(stderr,
"ELOG Error!\n");
154 fprintf(stderr,
"Run %d not found in ELOG!\n",
fRunId);
158 printf(
" - %s\n",
dtEnd.AsSQLString());
213 fprintf(stderr,
"Spill %u last event %u lost! Curent evId %u \n",
iSpill, dig->
GetLastEventId(), iEv);
224 for (
auto& mRec :
fMap) {
225 if (mRec.serial == serial) {
233 map<TDatime, vector<Int_t>>::iterator SpillMapIter =
spill_map.begin();
236 printf(
" spill %s\n", SpillMapIter->first.AsSQLString());
237 vector<Int_t>
v = SpillMapIter->second;
242 if (DAQ_Trigger - nPedEvBySpill != 0)
243 fBTAccepted += BT * (DAQ_Busy - nPedEvBySpill) / (DAQ_Trigger - nPedEvBySpill);
245 printf(
"BT %f DAQ_Busy %f DAQ_Trigger %f flux %f\n", BT, DAQ_Busy, DAQ_Trigger,
256 sh->
SetBC1(arr[mRec.BC1]);
257 sh->
SetBC2(arr[mRec.BC2]);
258 sh->
SetBC3(arr[mRec.BC3]);
259 sh->
SetBT(arr[mRec.BT]);
261 sh->
SetL0(arr[mRec.L0]);
262 sh->
SetProt(arr[mRec.TriggerProtection]);
287 printf(
"iSpill %4u last EvId %7u pedestals %d\n",
iSpill, dig->
GetLastEventId(), nPedEvBySpill);
290 "BC1 %7u, BC2 %7u, BC3 %4u, BeamTrigger %7u, L0 %7u, "
291 "TrigProtection %7u, BT&Busy %7u\n"
292 "\tBC1H %7u, BC1BP %7u, BC1xBC2 %4u, BC1nBusy %7u, IntTrig %7u, "
293 "SRCTrig %7u, TrignBusy %7u\n",
294 arr[mRec.BC1], arr[mRec.BC2], arr[mRec.BC3], arr[mRec.BT], arr[mRec.L0],
295 arr[mRec.TriggerProtection], arr[mRec.BTnBusy], arr[mRec.BC1H], arr[mRec.BC1BP],
296 arr[mRec.BC1xBC2], arr[mRec.BC1nBusy], arr[mRec.IntTrig], arr[mRec.SRCTrig],
297 arr[mRec.TrignBusy]);
300 "\tcand %7u, acc %7u, before %4u, after %6u, rjct %6u, all %7u, avail %7u\n\n",
BmnStatus
Define status code.
UInt_t GetLastEventId() const
std::array< IntType, MSC_N_COUNTERS > & GetValue()
unordered_map< UInt_t, vector< uint64_t > > fBoardSums
BmnStatus SumEvent7(TClonesArray *msc, BmnEventHeader *hdr, BmnSpillHeader *sh, UInt_t &nPedEvBySpill)
BmnStatus ParseTxtSpillLog(TString LogName, TString SchemeName)
BmnStatus SumEvent(TClonesArray *msc, BmnEventHeader *hdr, BmnSpillHeader *sh, UInt_t &nPedEvBySpill)
map< TDatime, vector< Int_t > > spill_map
void FillRunHeader(DigiRunHeader *rh)
void SetRawSpillTree(TTree *tree)
BmnStatus ReadChannelMap(TString mappingFile)
void SetDigSpillTree(TTree *tree)
Class BmnTrigInfo Trigger counters of the current spill from U40VE card.
static TObjArray * GetRecords(int period_number, int run_number, int findNeighbourRun=0)
get array of ElogRecord-s for a given or a neighbour run (the same period) from the database if findN...
virtual void SetOwner(Bool_t enable=kTRUE)
UInt_t Convert(Bool_t toGMT=kFALSE) const
Int_t GetEntriesFast() const
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
void Add(TObject *obj) override
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void Print(const Option_t *option="") const
int ParseTxt2Struct(TString txtName, TString schemaPath, vector< structParseValue * > &parse_values, vector< structParseSchema > &vecElements, int iVerbose=1)
UniRun.h Class for the table: run_.
static UniRun * GetRun(int period_number, int run_number)
get run from the database
TDatime * GetEndDatetime()
get end datetime of the current run
TDatime GetStartDatetime()
get start datetime of the current run
UShort_t BTnBusy
(BeamTrigger & !Busy)
UShort_t BT
BeamTrigger index.
UShort_t TrignBusy
Trigger * !Busy.
UShort_t TriggerProtection
UShort_t BC1BP
BC1 (before protection).
UShort_t BC1H
BC1 (high threshold).
vector< boost::any > arrValues