8 #include "KVINDRARunSheetReader.h"
9 #include "KVINDRADBRun.h"
30 SetMakeTree(make_tree);
44 len_run =
size = data_rate = acq_rate = trait_rate = ctrl_rate =
45 rempli_dlt_pc = temps_mort = 0.;
46 run_num = buf_sav = eve_sav = eve_lus = buf_ctrl = eve_ctrl =
48 for (
int i = 0; i < 100; i++) fScalers[i] = 0;
63 filename.Form(fFileFormat.Data(), run);
68 return fFilePath.Data();
77 if (fTree)
delete fTree;
79 new TTree(
"RunInfoScalerTree",
80 "Data from INDRA runsheets. Created by KVINDRARunSheetReader.");
81 fTree->SetDirectory(
gROOT);
82 fTree->Branch(
"run", &run_num,
"run/I");
83 fTree->Branch(
"start", &istart,
"start/I");
84 fTree->Branch(
"end", &iend,
"end/I");
85 fTree->Branch(
"buf_sav", &buf_sav,
"buf_sav/I");
86 fTree->Branch(
"eve_sav", &eve_sav,
"eve_sav/I");
87 fTree->Branch(
"eve_lus", &eve_lus,
"eve_lus/I");
88 fTree->Branch(
"buf_ctrl", &buf_ctrl,
"buf_ctrl/I");
89 fTree->Branch(
"eve_ctrl", &eve_ctrl,
"eve_ctrl/I");
90 fTree->Branch(
"rempli_dlt_blocs", &rempli_dlt_blocs,
91 "rempli_dlt_blocs/I");
92 fTree->Branch(
"len_run", &len_run,
"len_run/D");
93 fTree->Branch(
"size", &
size,
"size/D");
94 fTree->Branch(
"data_rate", &data_rate,
"data_rate/D");
95 fTree->Branch(
"acq_rate", &acq_rate,
"acq_rate/D");
96 fTree->Branch(
"trait_rate", &trait_rate,
"trait_rate/D");
97 fTree->Branch(
"ctrl_rate", &ctrl_rate,
"ctrl_rate/D");
98 fTree->Branch(
"rempli_dlt_pc", &rempli_dlt_pc,
"rempli_dlt_pc/D");
99 fTree->Branch(
"temps_mort", &temps_mort,
"temps_mort/D");
118 "<KVINDRARunSheetReader::ReadRunSheet> : Reading runsheet for new run, Run "
124 gExpDB->
AddRun(indra_db_run);
128 ifstream read_file(GetRunSheetFileName(run));
129 if (!read_file.good()) {
130 cout <<
"Error opening file : " << fFilePath.Data() << endl;
138 line.ReadLine(read_file);
141 while (read_file.good() && !
line.Contains(
"Echelles")) {
143 if (
line.Contains(
"Run numero"))
145 if (
line.Contains(
"Debut")) {
146 start_run.SetGanacqDate(GetDateField(
line));
147 istart = start_run.Convert();
150 fTIME_START = start_run.Convert();
152 indra_db_run->
SetStartDate(start_run.AsGanacqDateString());
154 if (
line.Contains(
"Fin")) {
155 endrun.SetGanacqDate(GetDateField(
line));
156 iend = endrun.Convert();
157 indra_db_run->
SetEndDate(endrun.AsGanacqDateString());
159 if (
line.Contains(
"Length of run")) {
161 "Length of run: %lf seconds, Size : %lf MB ( %lf MB/sec)",
162 &len_run, &
size, &data_rate);
163 indra_db_run->
SetTime(len_run / 60.);
166 if (
line.Contains(
"Stat_eve")) {
167 dumstr = GetStringField(
line);
168 stat_eve = GetStringField(dumstr,
" ", 0);
170 if (
line.Contains(
"Buffers sauves")) {
171 dumstr = GetStringField(
line);
172 buf_sav = (
Int_t) GetNumberField(dumstr,
" ", 0);
173 eve_sav = (
Int_t) GetNumberField(
line,
":", 2);
174 indra_db_run->
SetScaler(
"Buffers", buf_sav);
177 if (
line.Contains(
"Evenements lus"))
179 if (
line.Contains(
"Buffers ctrl")) {
180 dumstr = GetStringField(
line);
181 buf_ctrl = (
Int_t) GetNumberField(dumstr,
" ", 0);
182 eve_ctrl = (
Int_t) GetNumberField(
line,
":", 2);
184 if (
line.Contains(
"Taux d'acquisition")) {
185 dumstr = GetStringField(
line);
186 acq_rate = GetNumberField(dumstr,
" ", 0);
188 if (
line.Contains(
"Taux de traitement")) {
189 dumstr = GetStringField(
line);
190 trait_rate = GetNumberField(dumstr,
" ", 0);
192 if (
line.Contains(
"Taux de controle")) {
193 dumstr = GetStringField(
line);
194 ctrl_rate = GetNumberField(dumstr,
" ", 0);
196 if (
line.Contains(
"Remplissage")) {
197 dumstr = GetStringField(
line);
198 rempli_dlt_pc = GetNumberField(dumstr,
" ", 0);
199 rempli_dlt_blocs = (
Int_t) GetNumberField(dumstr,
" ", 3);
203 line.ReadLine(read_file);
205 if (
line.Contains(
"Echelles")) {
207 line.ReadLine(read_file);
209 while (read_file.good() && !
line.Contains(
":"))
line.ReadLine(read_file);
211 while (read_file.good() &&
line.Contains(
":")) {
212 dumstr = GetStringField(
line,
":", 0);
217 line.ReadLine(read_file);
225 index = fTree->GetListOfBranches()->GetEntries();
226 br_sca = fTree->Branch(dumstr.
Data(), &fScalers[
index],
Form(
"%s/I", dumstr.
Data()));
230 index = fTree->GetListOfBranches()->IndexOf(br_sca);
233 fScalers[
index] = scaler;
242 indra_db_run->
SetScaler(
"Buffers", buf_ctrl);
243 indra_db_run->
SetSize(buf_ctrl * 16384. / 1024. / 1024.);
249 istart -= fTIME_START;
313 if (!strcmp(delim,
":")) {
314 for (
int i = 2; i < toks->
GetEntries(); i++) {
340 if (fMakeTree) CreateTree();
342 for (
int run =
first; run <= last; run++) {
348 n_lus += (
Int_t) ReadRunSheet(run);
351 if (fMakeTree) fTree->Print();
size_t size(const MatrixT &matrix)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
void SetEvents(ULong64_t evt_number)
void SetTime(Double_t time)
void SetStartDate(const KVString &date)
void SetEndDate(const KVString &d)
virtual void SetScaler(const Char_t *name, Int_t val)
Set value for the scaler with the given name for this run.
KVDBRun * GetDBRun(Int_t number) const
Database entry for each run of an INDRA experiment.
Double_t GetTempsMort() const
void SetTMpercent(Float_t tmp)
Read the run sheets produced by the standard INDRA acquisition control program.
TString GetDateField(TString &, const Char_t *delim=":")
void init_vars()
Set values of all runsheet/TTree variables to 0.
Double_t GetNumberField(TString &, const Char_t *delim=":", int index=1)
const Char_t * GetRunSheetFileName(Int_t run)
Int_t ReadAllRunSheets(Int_t first=1, Int_t last=9999)
Bool_t ReadRunSheet(Int_t run)
TString GetStringField(TString &, const Char_t *delim=":", int index=1)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
virtual TBranch * FindBranch(const char *name)
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
TSubString Strip(EStripType s=kTrailing, char c=' ') const
const char * Data() const
TString & Remove(EStripType s, char c)
TString & ReplaceAll(const char *s1, const char *s2)
virtual char * ConcatFileName(const char *dir, const char *name)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)